/* Configure TC for timer, waveform generation, or capture.  */
void tc_init(Tc *p_tc, uint32_t ul_channel, uint32_t ul_mode)
/* Configure TC for timer, waveform generation, or capture.  */
void tc_init(Tc *p_tc, uint32_t ul_channel, uint32_t ul_mode)
{
	TcChannel *tc_channel;
	Assert(p_tc);
	Assert(ul_channel <
			(sizeof(p_tc->TC_CHANNEL) / sizeof(p_tc->TC_CHANNEL[0])));
	tc_channel = p_tc->TC_CHANNEL + ul_channel;
	tc_channel->TC_CCR = TC_CCR_CLKDIS;
	tc_channel->TC_IDR = 0xFFFFFFFF;
	tc_channel->TC_SR;
	tc_channel->TC_CMR = ul_mode;
}