/* Sets count value for the given TCC module. 
Sets the timer count value of an initialized TCC module. The specified TCC module can remain running or stopped. */
enum status_code tcc_set_count_value(const struct tcc_module *const module_inst, const uint32_t count)
/* Sets count value for the given TCC module. 
Sets the timer count value of an initialized TCC module. The specified TCC module can remain running or stopped. */
enum status_code tcc_set_count_value(const struct tcc_module *const module_inst, const uint32_t count)
{
	Assert(module_inst);
	Assert(module_inst->hw);
	Tcc *const tcc_module = module_inst->hw;
	uint8_t module_index = _tcc_get_inst_index(tcc_module);
	uint32_t max_count = _tcc_maxs[module_index];
	if (count > max_count) {
		return STATUS_ERR_INVALID_ARG;
	}
	while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_COUNT) {
	}
	tcc_module->COUNT.reg = (count);
	return STATUS_OK;
}