Find the best PBA/MCK divisor.
uint32_t tc_find_mck_divisor( uint32_t ul_freq, uint32_t ul_mck, uint32_t * p_uldiv, uint32_t * ul_tcclks, uint32_t ul_boardmck)
(ul_pbaclk / (2* DIV * 65536)) <= freq <= (ul_pbaclk / (2* DIV))
with DIV being the lowest possible value, to maximize timing adjust resolution.(MCK / (DIV * 65536)) <= freq <= (MCK / DIV)
with DIV being the lowest possible value, to maximize timing adjust resolution.Data direction | Parameter name | Description |
---|---|---|
[in] |
ul_freq |
Desired timer frequency |
[in] |
ul_mck |
PBA clock frequency |
[out] |
p_uldiv |
Divisor value |
[out] |
p_ultcclks |
TCCLKS field value for divisor |
[in] |
ul_boardmck |
Board clock frequency (set to 0 for SAM4L devices) |
The divisor found status.
Return value | Description |
---|---|
0 |
No suitable divisor was found |
1 |
A divisor was found |