S32 SDK
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))
29  /* S32K144 Clock System Level API header file */
30  #include "../src/clock/S32K1xx/clock_S32K1xx.h"
31 #elif (defined(S32V234_SERIES))
32  /* S32V234 Clock System Level API header file */
33  #include "../src/clock/S32V234/clock_S32V234.h"
34 #elif (defined(MPC574x_SERIES))
35  /* MPC5748G Clock System Level API header file */
36  #include "../src/clock/MPC57xx/clock_MPC57xx.h"
37 #else
38  #error "No valid CPU defined!"
39 #endif
40 
41 
61 /*******************************************************************************
62  * Definitions
63  ******************************************************************************/
64 
65 /*******************************************************************************
66  * API
67  ******************************************************************************/
68 
73 typedef struct
74 {
75 #if (defined(S32K14x_SERIES))
76  scg_config_t scgConfig;
77  sim_clock_config_t simConfig;
78  pcc_config_t pccConfig;
79  pmc_config_t pmcConfig;
80 #elif (defined(S32V234_SERIES))
81  cgm_config_t cgmConfig;
82 #else
83  mc_me_config_t mcmeConfig;
84  cgm_config_t cgmConfig;
85  cgmcs_config_t cgmcsConfig;
86 #endif
88 
93 typedef enum
94 {
99 
104 typedef enum
105 {
110 
115 typedef enum
116 {
120 
125 typedef struct
126 {
131 
136  void* callbackData);
137 
142 typedef struct
143 {
146  void* callbackData;
148 
153 typedef struct
154 {
156  uint8_t clockConfigNum;
157  uint8_t curConfigIndex;
159  uint8_t callbackNum;
162 
163 #if defined(__cplusplus)
164 extern "C" {
165 #endif /* __cplusplus*/
166 
185 status_t CLOCK_SYS_Init(clock_manager_user_config_t const **clockConfigsPtr,
186  uint8_t configsNumber,
188  uint8_t callbacksNumber);
189 
209 status_t CLOCK_SYS_UpdateConfiguration(uint8_t targetConfigIndex,
210  clock_manager_policy_t policy);
211 
228 
235 
247 
248 
269  uint32_t *frequency);
270 
271 /* @} */
272 
273 
274 #if defined(__cplusplus)
275 }
276 #endif /* __cplusplus*/
277 
280 #endif /* CLOCK_MANAGER_H */
281 /*******************************************************************************
282  * EOF
283  ******************************************************************************/
284 
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
SCG configure structure. Implements scg_config_t_Class.
clock_manager_policy_t policy
SIM configure structure. Implements sim_clock_config_t_Class.
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...
clock_names_t
Clock names.
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:93
PMC configure structure.
clock_manager_notify_t notifyType
clock_manager_callback_type_t
The callback type, indicates what kinds of notification this callback handles. Implements clock_manag...
Clock configuration structure. Implements clock_manager_user_config_t_Class.
Definition: clock_manager.h:73
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.
PCC configuration. Implements pcc_config_t_Class.