Introduction.
This module handles clock generation, configuration and distribution through a concept of ClockController.
|
|
#define | CC_DEFAULT_CLOCK 0 |
| | Identifier of a default system clock (usually main clock of the CPU)
|
| |
| #define | CC_Init(cc) (cc)->Init(cc) |
| |
| #define | CC_Deinit(cc) (cc)->Deinit(cc) |
| |
| #define | CC_SetClockSource(cc, clk, clk_src, freq) (cc)->SetClockSource((cc), (clk), (clk_src), (freq)) |
| |
| #define | CC_GetClockSource(cc, clk) (cc)->GetClockSource((cc), (clk)) |
| |
| #define | CC_GetClockSourceFreq(cc, clk) (cc)->GetClockSourceFreq((cc), (clk)) |
| |
| #define | CC_SetClockFreq(cc, clk, freq) (cc)->SetClockFreq((cc), (clk), (freq)) |
| |
| #define | CC_GetClockFreq(cc, clk) (cc)->GetClockFrequency((cc), (clk)) |
| |
| #define CC_Init |
( |
|
cc | ) |
(cc)->Init(cc) |
Initializes the clock controller.
- Parameters
-
| cc | handle of the clock controller |
| #define CC_Deinit |
( |
|
cc | ) |
(cc)->Deinit(cc) |
Deinitializes the clock controller.
- Parameters
-
| cc | handle of the clock controller |
| #define CC_SetClockSource |
( |
|
cc, |
|
|
|
clk, |
|
|
|
clk_src, |
|
|
|
freq |
|
) |
| (cc)->SetClockSource((cc), (clk), (clk_src), (freq)) |
Sets a clock source for a given clock
- Parameters
-
| cc | handle of the clock controller |
| clk | clock (CORE_DEFAULT_CLOCK for default clock) |
| clk_src | clock source |
| freq | frequency of the clock source (in ex. XTAL frequency) or 0 if default frequency should be used |
- Returns
- HALRESULT_OK if the operation was successful, HALRESULT_ERROR otherwise
| #define CC_GetClockSource |
( |
|
cc, |
|
|
|
clk |
|
) |
| (cc)->GetClockSource((cc), (clk)) |
Gets the clock source that is currently used for a given clock
- Parameters
-
| cc | handle of the clock controller |
| clk | clock (CORE_DEFAULT_CLOCK for default clock) |
- Returns
- currently used clock source number
| #define CC_GetClockSourceFreq |
( |
|
cc, |
|
|
|
clk |
|
) |
| (cc)->GetClockSourceFreq((cc), (clk)) |
Gets the frequency of the clock source, that is currently used for a given clock
- Parameters
-
| cc | handle of the clock controller |
| clk | clock (CORE_DEFAULT_CLOCK for default clock) |
- Returns
- clock source frequency (0 means that the clock is not enabled or not available)
| #define CC_SetClockFreq |
( |
|
cc, |
|
|
|
clk, |
|
|
|
freq |
|
) |
| (cc)->SetClockFreq((cc), (clk), (freq)) |
Sets frequency of a given clock
- Parameters
-
| cc | handle of the clock controller |
| clk | clock to set (CORE_DEFAULT_CLOCK for default clock) |
| freq | frequency that we want to set (depending on the port capabilities, value of 0 may switch off the clock) |
- Returns
- HALRESULT_OK if the operation was successful, HALRESULT_ERROR otherwise
| #define CC_GetClockFreq |
( |
|
cc, |
|
|
|
clk |
|
) |
| (cc)->GetClockFrequency((cc), (clk)) |
Gets frequency of a given clock
- Parameters
-
| cc | handle of the clock controller |
| clk | clock (CORE_DEFAULT_CLOCK for default clock) |
- Returns
- frequency of the clock (0 means that the clock is not enabled or not available)