clock_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
18 
19 #if !defined(CLOCK_MANAGER_H)
20 #define CLOCK_MANAGER_H
21 
22 #include "device_registers.h"
23 #include "status.h"
24 
25 /*
26  * Include the cpu specific clock API header files.
27  */
28 #if (defined(S32K14x_SERIES) || defined(S32K11x_SERIES))
29  /* S32K144 Clock System Level API header file */
30  #include "../src/clock/S32K1xx/clock_S32K1xx.h"
31 #elif (defined(S32MTV_SERIES))
32  /* S32MTV Clock System Level API header file */
33  #include "../src/clock/S32Mxx/clock_S32Mxx.h"
34 #elif (defined(S32V234_SERIES))
35  /* S32V234 Clock System Level API header file */
36  #include "../src/clock/S32V234/clock_S32V234.h"
37 #elif (defined(MPC5777C_SERIES))
38  /* MPC5777C Clock System Level API header file */
39  #include "../src/clock/MPC57xx/clock_MPC57xx.h"
40 #elif (defined(MPC574x_SERIES))
41  /* MPC574x Clock System Level API header file */
42  #include "../src/clock/MPC57xx/clock_MPC57xx.h"
43 #elif (defined(S32S247_SERIES))
44  /* S32S247 Clock System Level API header file */
45  #include "../src/clock/S32Sxx/clock_S32Sxx.h"
46 #elif (defined(SJA1110_SERIES))
47  /* SJA1110 Clock System Level API header file */
48  #include "../src/clock/SJA11xx/clock_SJA11xx.h"
49 #else
50  #error "No valid CPU defined!"
51 #endif
52 
53 
73 /*******************************************************************************
74  * Definitions
75  ******************************************************************************/
76 
81 typedef enum
82 {
87 
92 typedef enum
93 {
98 
103 typedef enum
104 {
108 
113 typedef struct
114 {
119 
124  void* callbackData);
125 
130 typedef struct
131 {
134  void* callbackData;
136 
141 typedef struct
142 {
144  uint8_t clockConfigNum;
145  uint8_t curConfigIndex;
147  uint8_t callbackNum;
150 
151 #if defined(__cplusplus)
152 extern "C" {
153 #endif /* __cplusplus*/
154 
155 /*******************************************************************************
156  * API
157  ******************************************************************************/
158 
177 status_t CLOCK_SYS_Init(clock_manager_user_config_t const **clockConfigsPtr,
178  uint8_t configsNumber,
180  uint8_t callbacksNumber);
181 
202 status_t CLOCK_SYS_UpdateConfiguration(uint8_t targetConfigIndex,
203  clock_manager_policy_t policy);
204 
221 
228 
240 
241 
262  uint32_t *frequency);
263 
267 #if defined(__cplusplus)
268 }
269 #endif /* __cplusplus*/
270 
273 #endif /* CLOCK_MANAGER_H */
274 /*******************************************************************************
275  * EOF
276  ******************************************************************************/
277 
Clock manager state structure. Implements clock_manager_state_t_Class.
status_t CLOCK_SYS_UpdateConfiguration(uint8_t targetConfigIndex, clock_manager_policy_t policy)
Set system clock configuration according to pre-defined structure.
Definition: clock_manager.c:90
clock_manager_callback_user_config_t ** callbackConfig
clock_manager_user_config_t const ** configTable
clock_manager_policy_t policy
clock_manager_policy_t
Clock transition policy. Implements clock_manager_policy_t_Class.
Structure for callback function and its parameter. Implements clock_manager_callback_user_config_t_Cl...
status_t CLOCK_SYS_SetConfiguration(clock_manager_user_config_t const *config)
Set system clock configuration.
clock_manager_callback_t callback
status_t CLOCK_SYS_GetFreq(clock_names_t clockName, uint32_t *frequency)
Gets the clock frequency for a specific clock name.
uint8_t CLOCK_SYS_GetCurrentConfiguration(void)
Get current system clock configuration.
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
status_t CLOCK_SYS_Init(clock_manager_user_config_t const **clockConfigsPtr, uint8_t configsNumber, clock_manager_callback_user_config_t **callbacksPtr, uint8_t callbacksNumber)
Install pre-defined clock configurations.
Definition: clock_manager.c:57
clock_manager_callback_type_t callbackType
clock_manager_notify_t
The clock notification type. Implements clock_manager_notify_t_Class.
Definition: clock_manager.h:81
clock_manager_notify_t notifyType
clock_names_t
Clock names.
clock_manager_callback_type_t
The callback type, indicates what kinds of notification this callback handles. Implements clock_manag...
Definition: clock_manager.h:92
Clock configuration structure. Implements clock_manager_user_config_t_Class.
Clock notification structure passed to clock callback function. Implements clock_notify_struct_t_Clas...
clock_manager_callback_user_config_t * CLOCK_SYS_GetErrorCallback(void)
Get the callback which returns error in last clock switch.
status_t(* clock_manager_callback_t)(clock_notify_struct_t *notify, void *callbackData)
Type of clock callback functions.