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 #include <stdbool.h>
25 
26 /*
27  * Include the cpu specific clock API header files.
28  */
29 #if (defined(S32K144_SERIES))
30  /* S32K144 Clock System Level API header file */
31  #include "../src/clock/S32K144/clock_S32K144.h"
32 #elif (defined(S32V234_SERIES))
33  /* S32V234 Clock System Level API header file */
34  #include "../src/clock/S32V234/clock_S32V234.h"
35 #else
36  #error "No valid CPU defined!"
37 #endif
38 
39 
54 /*******************************************************************************
55  * Definitions
56  ******************************************************************************/
57 
58 /*******************************************************************************
59  * API
60  ******************************************************************************/
61 
66 typedef struct
67 {
68 #if (defined(S32K144_SERIES))
73 #else
74  bool dummy; /* this dummy variable is put here to avoid compiler warnings - to be removed */
75 #endif
77 
82 typedef enum
83 {
88 
93 typedef enum
94 {
99 
104 typedef enum
105 {
109 
114 typedef struct
115 {
120 
125  void* callbackData);
126 
131 typedef struct
132 {
135  void* callbackData;
137 
142 typedef struct
143 {
145  uint8_t clockConfigNum;
146  uint8_t curConfigIndex;
148  uint8_t callbackNum;
151 
152 #if defined(__cplusplus)
153 extern "C" {
154 #endif /* __cplusplus*/
155 
174 status_t CLOCK_SYS_Init(clock_manager_user_config_t const **clockConfigsPtr,
175  uint8_t configsNumber,
177  uint8_t callbacksNumber);
178 
198 status_t CLOCK_SYS_UpdateConfiguration(uint8_t targetConfigIndex,
199  clock_manager_policy_t policy);
200 
217 
224 
236 
237 
258  uint32_t *frequency);
259 
260 /* @} */
261 
262 
263 #if defined(__cplusplus)
264 }
265 #endif /* __cplusplus*/
266 
269 #endif /* CLOCK_MANAGER_H */
270 /*******************************************************************************
271  * EOF
272  ******************************************************************************/
273 
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.
Definition: scg_hal.h:378
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...
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:31
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
sim_clock_config_t simConfig
Definition: clock_manager.h:70
clock_manager_callback_type_t callbackType
clock_names_t
Clock names.
clock_manager_notify_t
The clock notification type. Implements clock_manager_notify_t_Class.
Definition: clock_manager.h:82
PMC configure structure.
Definition: pmc_hal.h:70
clock_manager_notify_t notifyType
clock_manager_callback_type_t
The callback type, indicates what kinds of notification this callback handles. Implements clock_manag...
Definition: clock_manager.h:93
Clock configuration structure. Implements clock_manager_user_config_t_Class.
Definition: clock_manager.h:66
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.
Definition: pcc_hal.h:176