|
Enabling and disabling synchronous clocks | |
|
| |
| static void | sysclk_enable_module (uint16_t id) |
| Enable a module clock derived from the system clock. | |
| static void | sysclk_disable_module (uint16_t id) |
| Disable a module clock derived from the system clock. | |
System Clock Initialization | |
|
| |
| static void | sysclk_init (void) |
| Initialize the synchronous clock system. | |
Maskable module clock IDs | |
|
| |
| #define | SYSCLK_ADC 0x0001 |
| A/D Converter. | |
| #define | SYSCLK_SPI 0x0004 |
| SPI controller. | |
| #define | SYSCLK_TC1 0x0008 |
| Timer/Counter 1. | |
| #define | SYSCLK_TC0 0x0020 |
| Timer/Counter 0. | |
| #define | SYSCLK_TC2 0x0040 |
| Timer/Counter 2. | |
| #define | SYSCLK_TWI 0x0080 |
| TWI controller. | |
| #define | SYSCLK_USART1 0x0101 |
| USART 1 replicated due to chip naming convention */. | |
| #define | SYSCLK_USART0 SYSCLK_USART1 |
| #define | SYSCLK_TC3 0x0108 |
| Timer/counter 3. | |
| #define | SYSCLK_USB 0x0180 |
| USB controller. | |
The sysclk API covers the system clock and all clocks derived from it. The system clock is a chip-internal clock on which all synchronous clocks, i.e. CPU and bus/peripheral clocks, are based. The system clock is typically generated from one of a variety of sources, which may include crystal and RC oscillators as well as PLLs. The clocks derived from the system clock are sometimes also known as synchronous clocks, since they always run synchronously with respect to each other, as opposed to generic clocks which may run from different oscillators or PLLs.
The sysclk API is partially chip- or platform-specific. While all platforms provide mostly the same functionality, there are some variations around how different bus types are handled.
| #define SYSCLK_SPI 0x0004 |
SPI controller.
Definition at line 51 of file sysclk.h.
Referenced by spi_priv_disable(), and spi_priv_enable().
| #define SYSCLK_USART1 0x0101 |
| #define SYSCLK_USB 0x0180 |
USB controller.
Definition at line 60 of file sysclk.h.
Referenced by at90usb_init(), sysclk_disable_module(), and sysclk_enable_module().
| static void sysclk_disable_module | ( | uint16_t | id | ) | [inline, static] |
Disable a module clock derived from the system clock.
| id | The ID of the module clock to be disabled (e.g. SYSCLK_USART1 to disable the second USART.) |
Definition at line 99 of file sysclk.h.
References assert, cpu_irq_restore(), cpu_irq_save(), and SYSCLK_USB.
Referenced by spi_priv_disable().
| static void sysclk_enable_module | ( | uint16_t | id | ) | [inline, static] |
Enable a module clock derived from the system clock.
| id | The ID of the module clock to be enabled (e.g. SYSCLK_USART1 to enable the second USART.) |
Definition at line 77 of file sysclk.h.
References assert, cpu_irq_restore(), cpu_irq_save(), and SYSCLK_USB.
Referenced by at90usb_init(), and spi_priv_enable().
| void sysclk_init | ( | void | ) | [inline, static] |
Initialize the synchronous clock system.
This function will mask all synchronous clocks except for any clocks which are essential for normal operation (for example internal memory clocks). Peripheral clocks must be re-enabled before use by the peripheral driver.
Definition at line 118 of file sysclk.h.
Referenced by main().
1.6.3