Defines | |
| #define | tc_get_regs(id) ((void *) (TC##id##_BASE)) |
| Get a pointer to the TC registers. | |
Functions | |
| static uint8_t | tc_select_clock (uint8_t tc_id, uint32_t resolution) |
| Select clock for a specified TC and resolution. | |
| static uint32_t | tc_get_resolution (uint8_t tc_id, uint8_t clksel) |
| Get the resolution for a specified TC and clock selection. | |
|
| |
| static uint8_t | tc_get_sysclk_port (uint8_t tc_id) |
| Get the SYSCLK port for a specified tc_id. | |
| static uint8_t | tc_get_sysclk_id (uint8_t tc_id) |
| Get the SYSCLK ID for a specified tc_id. | |
| static void | tc_enable_pclk (uint8_t tc_id) |
| Enable the peripheral clock for a specified tc_id. | |
| static void | tc_disable_pclk (uint8_t tc_id) |
| Disable the peripheral clock for a specified tc_id. | |
| static bool | tc_pclk_is_enabled (uint8_t tc_id) |
| Return whether peripheral clock is enabled for a specified tc_id. | |
| static uint32_t | tc_get_pclk_hz (uint8_t tc_id) |
| Get the clock frequency for a specified tc_id. | |
Definitions for getting a TC's register base address at compile time, and clock selection and frequency at runtime.
| #define tc_get_regs | ( | id | ) | ((void *) (TC##id##_BASE)) |
Get a pointer to the TC registers.
| id | The ID of the TC module. This must be a constant value. The first ID is 0 and it refers to the first TC in the peripheral module address map. The other TCs that follow get increasing IDs 1, 2, 3 ... |
Definition at line 66 of file tc_xmega.h.
| static void tc_disable_pclk | ( | uint8_t | tc_id | ) | [inline, static] |
Disable the peripheral clock for a specified tc_id.
Definition at line 118 of file tc.h.
References sysclk_disable_module(), tc_get_sysclk_id(), and tc_get_sysclk_port().
Referenced by tc_timer_init(), tc_timer_set_alarm(), and tc_timer_stop().
| static void tc_enable_pclk | ( | uint8_t | tc_id | ) | [inline, static] |
Enable the peripheral clock for a specified tc_id.
Definition at line 109 of file tc.h.
References sysclk_enable_module(), tc_get_sysclk_id(), and tc_get_sysclk_port().
Referenced by tc_timer_init(), tc_timer_set_alarm(), and tc_timer_start().
Get the clock frequency for a specified tc_id.
All TCs in this chip are connected to CLKper, which is the same frequency as CLKcpu. tc_id is therefore only defined as a parameter for code consistency across devices.
Definition at line 142 of file tc.h.
Referenced by tc_get_resolution(), and tc_select_clock().
Get the resolution for a specified TC and clock selection.
This function returns the resolution which the specified clock selection and TC will result in. The resolution of a TC is synonymous with its clock frequency.
| tc_id | ID of TC to get resolution for. | |
| clksel | Clock selection, as prescaled CLKper. |
Definition at line 118 of file tc_xmega.h.
References TC_CLKSEL_DIV1, TC_CLKSEL_DIV1024, TC_CLKSEL_DIV2, TC_CLKSEL_DIV256, TC_CLKSEL_DIV4, TC_CLKSEL_DIV64, TC_CLKSEL_DIV8, TC_CLKSEL_OFF, tc_get_pclk_hz(), and unhandled_case.
Referenced by tc_timer_get_resolution().
Get the SYSCLK ID for a specified tc_id.
Definition at line 85 of file tc.h.
References SYSCLK_TC0, SYSCLK_TC1, and unhandled_case.
Referenced by tc_disable_pclk(), tc_enable_pclk(), and tc_pclk_is_enabled().
Get the SYSCLK port for a specified tc_id.
Definition at line 57 of file tc.h.
References SYSCLK_PORT_C, SYSCLK_PORT_D, SYSCLK_PORT_E, SYSCLK_PORT_F, and unhandled_case.
Referenced by tc_disable_pclk(), tc_enable_pclk(), and tc_pclk_is_enabled().
| static bool tc_pclk_is_enabled | ( | uint8_t | tc_id | ) | [inline, static] |
Return whether peripheral clock is enabled for a specified tc_id.
Definition at line 127 of file tc.h.
References sysclk_module_is_enabled(), tc_get_sysclk_id(), and tc_get_sysclk_port().
Referenced by tc_timer_get_time(), and tc_timer_set_alarm().
Select clock for a specified TC and resolution.
This function returns the clock selection, as prescaled CLKper, for a specified TC that gives a resolution at least as high as the one specified. The resolution of a TC is synonymous with its clock frequency.
| tc_id | ID of TC to get clock selection for. | |
| resolution | Desired resolution for the TC. |
Definition at line 84 of file tc_xmega.h.
References TC_CLKSEL_DIV1, TC_CLKSEL_DIV1024, TC_CLKSEL_DIV2, TC_CLKSEL_DIV256, TC_CLKSEL_DIV4, TC_CLKSEL_DIV64, TC_CLKSEL_DIV8, and tc_get_pclk_hz().
Referenced by tc_timer_init(), and tc_timer_set_resolution().
1.6.3