The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_MAX32625PICO/TARGET_Maxim/TARGET_MAX32625/mxc/mxc_sys.h@169:a7c7b631e539
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anna Bridge 169:a7c7b631e539 1 /*******************************************************************************
Anna Bridge 169:a7c7b631e539 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
Anna Bridge 169:a7c7b631e539 3 *
Anna Bridge 169:a7c7b631e539 4 * Permission is hereby granted, free of charge, to any person obtaining a
Anna Bridge 169:a7c7b631e539 5 * copy of this software and associated documentation files (the "Software"),
Anna Bridge 169:a7c7b631e539 6 * to deal in the Software without restriction, including without limitation
Anna Bridge 169:a7c7b631e539 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Anna Bridge 169:a7c7b631e539 8 * and/or sell copies of the Software, and to permit persons to whom the
Anna Bridge 169:a7c7b631e539 9 * Software is furnished to do so, subject to the following conditions:
Anna Bridge 169:a7c7b631e539 10 *
Anna Bridge 169:a7c7b631e539 11 * The above copyright notice and this permission notice shall be included
Anna Bridge 169:a7c7b631e539 12 * in all copies or substantial portions of the Software.
Anna Bridge 169:a7c7b631e539 13 *
Anna Bridge 169:a7c7b631e539 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Anna Bridge 169:a7c7b631e539 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Anna Bridge 169:a7c7b631e539 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Anna Bridge 169:a7c7b631e539 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Anna Bridge 169:a7c7b631e539 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Anna Bridge 169:a7c7b631e539 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Anna Bridge 169:a7c7b631e539 20 * OTHER DEALINGS IN THE SOFTWARE.
Anna Bridge 169:a7c7b631e539 21 *
Anna Bridge 169:a7c7b631e539 22 * Except as contained in this notice, the name of Maxim Integrated
Anna Bridge 169:a7c7b631e539 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Anna Bridge 169:a7c7b631e539 24 * Products, Inc. Branding Policy.
Anna Bridge 169:a7c7b631e539 25 *
Anna Bridge 169:a7c7b631e539 26 * The mere transfer of this software does not imply any licenses
Anna Bridge 169:a7c7b631e539 27 * of trade secrets, proprietary technology, copyrights, patents,
Anna Bridge 169:a7c7b631e539 28 * trademarks, maskwork rights, or any other form of intellectual
Anna Bridge 169:a7c7b631e539 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
Anna Bridge 169:a7c7b631e539 30 * ownership rights.
Anna Bridge 169:a7c7b631e539 31 *
Anna Bridge 169:a7c7b631e539 32 * $Date: 2016-05-18 16:40:40 -0500 (Wed, 18 May 2016) $
Anna Bridge 169:a7c7b631e539 33 * $Revision: 22910 $
Anna Bridge 169:a7c7b631e539 34 *
Anna Bridge 169:a7c7b631e539 35 ******************************************************************************/
Anna Bridge 169:a7c7b631e539 36
Anna Bridge 169:a7c7b631e539 37 /**
Anna Bridge 169:a7c7b631e539 38 * @file mxc_sys.h
Anna Bridge 169:a7c7b631e539 39 * @brief System level header file.
Anna Bridge 169:a7c7b631e539 40 */
Anna Bridge 169:a7c7b631e539 41
Anna Bridge 169:a7c7b631e539 42 #ifndef _MXC_SYS_H_
Anna Bridge 169:a7c7b631e539 43 #define _MXC_SYS_H_
Anna Bridge 169:a7c7b631e539 44
Anna Bridge 169:a7c7b631e539 45 #include "mxc_config.h"
Anna Bridge 169:a7c7b631e539 46 #include "clkman.h"
Anna Bridge 169:a7c7b631e539 47 #include "ioman.h"
Anna Bridge 169:a7c7b631e539 48 #include "gpio.h"
Anna Bridge 169:a7c7b631e539 49 #include "i2cm_regs.h"
Anna Bridge 169:a7c7b631e539 50 #include "i2cs_regs.h"
Anna Bridge 169:a7c7b631e539 51 #include "tmr_regs.h"
Anna Bridge 169:a7c7b631e539 52 #include "pt_regs.h"
Anna Bridge 169:a7c7b631e539 53 #include "wdt_regs.h"
Anna Bridge 169:a7c7b631e539 54 #include "owm_regs.h"
Anna Bridge 169:a7c7b631e539 55 #include "spis_regs.h"
Anna Bridge 169:a7c7b631e539 56
Anna Bridge 169:a7c7b631e539 57 #ifdef __cplusplus
Anna Bridge 169:a7c7b631e539 58 extern "C" {
Anna Bridge 169:a7c7b631e539 59 #endif
Anna Bridge 169:a7c7b631e539 60
Anna Bridge 169:a7c7b631e539 61 /***** Definitions *****/
Anna Bridge 169:a7c7b631e539 62
Anna Bridge 169:a7c7b631e539 63 /** @brief System Configuration Object */
Anna Bridge 169:a7c7b631e539 64 typedef struct {
Anna Bridge 169:a7c7b631e539 65 clkman_scale_t clk_scale; /** desired clock scale value for the peripheral */
Anna Bridge 169:a7c7b631e539 66 ioman_cfg_t io_cfg; /** IOMAN configuration object */
Anna Bridge 169:a7c7b631e539 67 } sys_cfg_t;
Anna Bridge 169:a7c7b631e539 68
Anna Bridge 169:a7c7b631e539 69 /** @brief Watchdog System Configuration Object */
Anna Bridge 169:a7c7b631e539 70 typedef struct {
Anna Bridge 169:a7c7b631e539 71 clkman_wdt_clk_select_t clk; /** select the clock source for the watchdog */
Anna Bridge 169:a7c7b631e539 72 clkman_scale_t clk_scale; /** desired clock scale value for the peripheral */
Anna Bridge 169:a7c7b631e539 73 /** clk_scale is only applied if the system clock is used as the clk */
Anna Bridge 169:a7c7b631e539 74 } sys_cfg_wdt_t;
Anna Bridge 169:a7c7b631e539 75
Anna Bridge 169:a7c7b631e539 76 /** @brief UART System Configuration Object */
Anna Bridge 169:a7c7b631e539 77 typedef sys_cfg_t sys_cfg_uart_t;
Anna Bridge 169:a7c7b631e539 78
Anna Bridge 169:a7c7b631e539 79 /** @brief I2CM System Configuration Object */
Anna Bridge 169:a7c7b631e539 80 typedef sys_cfg_t sys_cfg_i2cm_t;
Anna Bridge 169:a7c7b631e539 81
Anna Bridge 169:a7c7b631e539 82 /** @brief I2CS System Configuration Object */
Anna Bridge 169:a7c7b631e539 83 typedef sys_cfg_t sys_cfg_i2cs_t;
Anna Bridge 169:a7c7b631e539 84
Anna Bridge 169:a7c7b631e539 85 /** @brief SPIM System Configuration Object */
Anna Bridge 169:a7c7b631e539 86 typedef sys_cfg_t sys_cfg_spim_t;
Anna Bridge 169:a7c7b631e539 87
Anna Bridge 169:a7c7b631e539 88 /** @brief SPIX System Configuration Object */
Anna Bridge 169:a7c7b631e539 89 typedef sys_cfg_t sys_cfg_spix_t;
Anna Bridge 169:a7c7b631e539 90
Anna Bridge 169:a7c7b631e539 91 /** @brief SPIS System Configuration Object */
Anna Bridge 169:a7c7b631e539 92 typedef sys_cfg_t sys_cfg_spis_t;
Anna Bridge 169:a7c7b631e539 93
Anna Bridge 169:a7c7b631e539 94 /** @brief OWM System Configuration Object */
Anna Bridge 169:a7c7b631e539 95 typedef sys_cfg_t sys_cfg_owm_t;
Anna Bridge 169:a7c7b631e539 96
Anna Bridge 169:a7c7b631e539 97 /** @brief Timer System Configuration Object */
Anna Bridge 169:a7c7b631e539 98 typedef gpio_cfg_t sys_cfg_tmr_t;
Anna Bridge 169:a7c7b631e539 99
Anna Bridge 169:a7c7b631e539 100 /** @brief Pulse Train System Configuration Object */
Anna Bridge 169:a7c7b631e539 101 typedef gpio_cfg_t sys_cfg_pt_t;
Anna Bridge 169:a7c7b631e539 102 typedef clkman_scale_t sys_pt_clk_scale;
Anna Bridge 169:a7c7b631e539 103
Anna Bridge 169:a7c7b631e539 104 /***** Include Files *****/
Anna Bridge 169:a7c7b631e539 105 /* These includes require the above types to be defined first */
Anna Bridge 169:a7c7b631e539 106 #include "uart.h"
Anna Bridge 169:a7c7b631e539 107 #include "spim.h"
Anna Bridge 169:a7c7b631e539 108
Anna Bridge 169:a7c7b631e539 109 /***** Function Prototypes *****/
Anna Bridge 169:a7c7b631e539 110
Anna Bridge 169:a7c7b631e539 111 /**
Anna Bridge 169:a7c7b631e539 112 * @brief Get the frequency of a clock scaler
Anna Bridge 169:a7c7b631e539 113 * @param clk_scale value of clk_scale field from clk_ctrl register
Anna Bridge 169:a7c7b631e539 114 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 115 */
Anna Bridge 169:a7c7b631e539 116 uint32_t SYS_GetFreq(uint32_t clk_scale);
Anna Bridge 169:a7c7b631e539 117
Anna Bridge 169:a7c7b631e539 118 /**
Anna Bridge 169:a7c7b631e539 119 * @brief Get the frequency of the CPU
Anna Bridge 169:a7c7b631e539 120 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 121 */
Anna Bridge 169:a7c7b631e539 122 uint32_t SYS_CPU_GetFreq(void);
Anna Bridge 169:a7c7b631e539 123
Anna Bridge 169:a7c7b631e539 124 /**
Anna Bridge 169:a7c7b631e539 125 * @brief System level initialization for ADC module.
Anna Bridge 169:a7c7b631e539 126 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 127 */
Anna Bridge 169:a7c7b631e539 128 int SYS_ADC_Init(void);
Anna Bridge 169:a7c7b631e539 129
Anna Bridge 169:a7c7b631e539 130 /**
Anna Bridge 169:a7c7b631e539 131 * @brief System level initialization for AES module.
Anna Bridge 169:a7c7b631e539 132 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 133 */
Anna Bridge 169:a7c7b631e539 134 int SYS_AES_Init(void);
Anna Bridge 169:a7c7b631e539 135
Anna Bridge 169:a7c7b631e539 136 /**
Anna Bridge 169:a7c7b631e539 137 * @brief System level initialization for GPIO module.
Anna Bridge 169:a7c7b631e539 138 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 139 */
Anna Bridge 169:a7c7b631e539 140 int SYS_GPIO_Init(void);
Anna Bridge 169:a7c7b631e539 141
Anna Bridge 169:a7c7b631e539 142 /**
Anna Bridge 169:a7c7b631e539 143 * @brief System level initialization for UART module.
Anna Bridge 169:a7c7b631e539 144 * @param uart Pointer to UART module registers
Anna Bridge 169:a7c7b631e539 145 * @param uart_cfg UART configuration object
Anna Bridge 169:a7c7b631e539 146 * @param sys_cfg System configuration object
Anna Bridge 169:a7c7b631e539 147 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 148 */
Anna Bridge 169:a7c7b631e539 149 int SYS_UART_Init(mxc_uart_regs_t *uart, const uart_cfg_t *uart_cfg, const sys_cfg_uart_t *sys_cfg);
Anna Bridge 169:a7c7b631e539 150
Anna Bridge 169:a7c7b631e539 151 /**
Anna Bridge 169:a7c7b631e539 152 * @brief System level shutdown for UART module
Anna Bridge 169:a7c7b631e539 153 * @param uart Pointer to UART module registers
Anna Bridge 169:a7c7b631e539 154 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 155 */
Anna Bridge 169:a7c7b631e539 156 int SYS_UART_Shutdown(mxc_uart_regs_t *uart);
Anna Bridge 169:a7c7b631e539 157
Anna Bridge 169:a7c7b631e539 158 /**
Anna Bridge 169:a7c7b631e539 159 * @brief Get the frequency of the UART module source clock
Anna Bridge 169:a7c7b631e539 160 * @param uart Pointer to UART module registers
Anna Bridge 169:a7c7b631e539 161 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 162 */
Anna Bridge 169:a7c7b631e539 163 uint32_t SYS_UART_GetFreq(mxc_uart_regs_t *uart);
Anna Bridge 169:a7c7b631e539 164
Anna Bridge 169:a7c7b631e539 165 /**
Anna Bridge 169:a7c7b631e539 166 * @brief System level initialization for I2CM module.
Anna Bridge 169:a7c7b631e539 167 * @param i2cm Pointer to I2CM module registers
Anna Bridge 169:a7c7b631e539 168 * @param cfg System configuration object
Anna Bridge 169:a7c7b631e539 169 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 170 */
Anna Bridge 169:a7c7b631e539 171 int SYS_I2CM_Init(mxc_i2cm_regs_t *i2cm, const sys_cfg_i2cm_t *cfg);
Anna Bridge 169:a7c7b631e539 172
Anna Bridge 169:a7c7b631e539 173 /**
Anna Bridge 169:a7c7b631e539 174 * @brief System level shutdown for I2CM module
Anna Bridge 169:a7c7b631e539 175 * @param i2cm Pointer to I2CM module registers
Anna Bridge 169:a7c7b631e539 176 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 177 */
Anna Bridge 169:a7c7b631e539 178 int SYS_I2CM_Shutdown(mxc_i2cm_regs_t *i2cm);
Anna Bridge 169:a7c7b631e539 179
Anna Bridge 169:a7c7b631e539 180 /**
Anna Bridge 169:a7c7b631e539 181 * @brief Get the frequency of the I2CM module source clock
Anna Bridge 169:a7c7b631e539 182 * @param i2cm Pointer to I2CM module registers
Anna Bridge 169:a7c7b631e539 183 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 184 */
Anna Bridge 169:a7c7b631e539 185 uint32_t SYS_I2CM_GetFreq(mxc_i2cm_regs_t *i2cm);
Anna Bridge 169:a7c7b631e539 186
Anna Bridge 169:a7c7b631e539 187 /**
Anna Bridge 169:a7c7b631e539 188 * @brief System level initialization for I2CS module.
Anna Bridge 169:a7c7b631e539 189 * @param i2cs Pointer to I2CS module registers
Anna Bridge 169:a7c7b631e539 190 * @param cfg System configuration object
Anna Bridge 169:a7c7b631e539 191 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 192 */
Anna Bridge 169:a7c7b631e539 193 int SYS_I2CS_Init(mxc_i2cs_regs_t *i2cs, const sys_cfg_i2cs_t *cfg);
Anna Bridge 169:a7c7b631e539 194
Anna Bridge 169:a7c7b631e539 195 /**
Anna Bridge 169:a7c7b631e539 196 * @brief System level shutdown for I2CS module
Anna Bridge 169:a7c7b631e539 197 * @param i2cs Pointer to I2CS module registers
Anna Bridge 169:a7c7b631e539 198 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 199 */
Anna Bridge 169:a7c7b631e539 200 int SYS_I2CS_Shutdown(mxc_i2cs_regs_t *i2cs);
Anna Bridge 169:a7c7b631e539 201
Anna Bridge 169:a7c7b631e539 202 /**
Anna Bridge 169:a7c7b631e539 203 * @brief Get the frequency of the I2CS module source clock
Anna Bridge 169:a7c7b631e539 204 * @param i2cs Pointer to I2CS module registers
Anna Bridge 169:a7c7b631e539 205 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 206 */
Anna Bridge 169:a7c7b631e539 207 uint32_t SYS_I2CS_GetFreq(mxc_i2cs_regs_t *i2cs);
Anna Bridge 169:a7c7b631e539 208
Anna Bridge 169:a7c7b631e539 209 /**
Anna Bridge 169:a7c7b631e539 210 * @brief System level initialization for SPIM module.
Anna Bridge 169:a7c7b631e539 211 * @param spim Pointer to SPIM module registers
Anna Bridge 169:a7c7b631e539 212 * @param spim_cfg SPIM configuration object
Anna Bridge 169:a7c7b631e539 213 * @param sys_cfg System configuration object
Anna Bridge 169:a7c7b631e539 214 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 215 */
Anna Bridge 169:a7c7b631e539 216 int SYS_SPIM_Init(mxc_spim_regs_t *spim, const spim_cfg_t *spim_cfg, const sys_cfg_spim_t *sys_cfg);
Anna Bridge 169:a7c7b631e539 217
Anna Bridge 169:a7c7b631e539 218 /**
Anna Bridge 169:a7c7b631e539 219 * @brief System level shutdown for SPIM module
Anna Bridge 169:a7c7b631e539 220 * @param spim Pointer to SPIM module registers
Anna Bridge 169:a7c7b631e539 221 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 222 */
Anna Bridge 169:a7c7b631e539 223 int SYS_SPIM_Shutdown(mxc_spim_regs_t *spim);
Anna Bridge 169:a7c7b631e539 224
Anna Bridge 169:a7c7b631e539 225 /**
Anna Bridge 169:a7c7b631e539 226 * @brief Get the frequency of the SPIM module source clock
Anna Bridge 169:a7c7b631e539 227 * @param spim Pointer to SPIM module registers
Anna Bridge 169:a7c7b631e539 228 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 229 */
Anna Bridge 169:a7c7b631e539 230 uint32_t SYS_SPIM_GetFreq(mxc_spim_regs_t *spim);
Anna Bridge 169:a7c7b631e539 231
Anna Bridge 169:a7c7b631e539 232 /**
Anna Bridge 169:a7c7b631e539 233 * @brief System level initialization for SPIX module.
Anna Bridge 169:a7c7b631e539 234 * @param sys_cfg System configuration object
Anna Bridge 169:a7c7b631e539 235 * @param baud Baud rate for clock divider configuration
Anna Bridge 169:a7c7b631e539 236 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 237 */
Anna Bridge 169:a7c7b631e539 238 int SYS_SPIX_Init(const sys_cfg_spix_t *sys_cfg, uint32_t baud);
Anna Bridge 169:a7c7b631e539 239
Anna Bridge 169:a7c7b631e539 240 /**
Anna Bridge 169:a7c7b631e539 241 * @brief System level shutdown for SPIX module
Anna Bridge 169:a7c7b631e539 242 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 243 */
Anna Bridge 169:a7c7b631e539 244 int SYS_SPIX_Shutdown(void);
Anna Bridge 169:a7c7b631e539 245
Anna Bridge 169:a7c7b631e539 246 /**
Anna Bridge 169:a7c7b631e539 247 * @brief Get the frequency of the SPIX module source clock
Anna Bridge 169:a7c7b631e539 248 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 249 */
Anna Bridge 169:a7c7b631e539 250 uint32_t SYS_SPIX_GetFreq(void);
Anna Bridge 169:a7c7b631e539 251
Anna Bridge 169:a7c7b631e539 252 /**
Anna Bridge 169:a7c7b631e539 253 * @brief System level initialization for SPIS module.
Anna Bridge 169:a7c7b631e539 254 * @param sys_cfg System configuration object.
Anna Bridge 169:a7c7b631e539 255 * @returns E_NO_ERROR if everything is successful.
Anna Bridge 169:a7c7b631e539 256 */
Anna Bridge 169:a7c7b631e539 257 int SYS_SPIS_Init(const sys_cfg_spix_t *sys_cfg);
Anna Bridge 169:a7c7b631e539 258
Anna Bridge 169:a7c7b631e539 259 /**
Anna Bridge 169:a7c7b631e539 260 * @brief System level shutdown for SPIS module
Anna Bridge 169:a7c7b631e539 261 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 262 */
Anna Bridge 169:a7c7b631e539 263 int SYS_SPIS_Shutdown(mxc_spis_regs_t *spis);
Anna Bridge 169:a7c7b631e539 264
Anna Bridge 169:a7c7b631e539 265 /**
Anna Bridge 169:a7c7b631e539 266 * @brief Get the frequency of the SPIS module source clock
Anna Bridge 169:a7c7b631e539 267 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 268 */
Anna Bridge 169:a7c7b631e539 269 uint32_t SYS_SPIS_GetFreq(mxc_spis_regs_t *spis);
Anna Bridge 169:a7c7b631e539 270
Anna Bridge 169:a7c7b631e539 271 /**
Anna Bridge 169:a7c7b631e539 272 * @brief System level initialization for OWM module.
Anna Bridge 169:a7c7b631e539 273 * @param owm Pointer to OWM module registers
Anna Bridge 169:a7c7b631e539 274 * @param owm_cfg OWM configuration object
Anna Bridge 169:a7c7b631e539 275 * @param sys_cfg System configuration object
Anna Bridge 169:a7c7b631e539 276 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 277 */
Anna Bridge 169:a7c7b631e539 278 int SYS_OWM_Init(mxc_owm_regs_t *owm, const sys_cfg_owm_t *sys_cfg);
Anna Bridge 169:a7c7b631e539 279
Anna Bridge 169:a7c7b631e539 280 /**
Anna Bridge 169:a7c7b631e539 281 * @brief System level shutdown for OWM module
Anna Bridge 169:a7c7b631e539 282 * @param owm Pointer to OWM module registers
Anna Bridge 169:a7c7b631e539 283 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 284 */
Anna Bridge 169:a7c7b631e539 285 int SYS_OWM_Shutdown(mxc_owm_regs_t *owm);
Anna Bridge 169:a7c7b631e539 286
Anna Bridge 169:a7c7b631e539 287 /**
Anna Bridge 169:a7c7b631e539 288 * @brief Get the frequency of the OWM module source clock
Anna Bridge 169:a7c7b631e539 289 * @param owm Pointer to OWM module registers
Anna Bridge 169:a7c7b631e539 290 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 291 */
Anna Bridge 169:a7c7b631e539 292 uint32_t SYS_OWM_GetFreq(mxc_owm_regs_t *owm);
Anna Bridge 169:a7c7b631e539 293
Anna Bridge 169:a7c7b631e539 294 /**
Anna Bridge 169:a7c7b631e539 295 * @brief System level initialization for TMR module.
Anna Bridge 169:a7c7b631e539 296 * @param tmr Pointer to TMR module registers
Anna Bridge 169:a7c7b631e539 297 * @param cfg System configuration object
Anna Bridge 169:a7c7b631e539 298 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 299 */
Anna Bridge 169:a7c7b631e539 300 int SYS_TMR_Init(mxc_tmr_regs_t *tmr, const sys_cfg_tmr_t *cfg);
Anna Bridge 169:a7c7b631e539 301
Anna Bridge 169:a7c7b631e539 302 /**
Anna Bridge 169:a7c7b631e539 303 * @brief Get the frequency of the TMR module source clock
Anna Bridge 169:a7c7b631e539 304 * @param spim Pointer to TMR module registers
Anna Bridge 169:a7c7b631e539 305 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 306 */
Anna Bridge 169:a7c7b631e539 307 uint32_t SYS_TMR_GetFreq(mxc_tmr_regs_t *tmr);
Anna Bridge 169:a7c7b631e539 308
Anna Bridge 169:a7c7b631e539 309 /**
Anna Bridge 169:a7c7b631e539 310 * @brief Get the frequency of the Pulse Train module source clock
Anna Bridge 169:a7c7b631e539 311 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 312 */
Anna Bridge 169:a7c7b631e539 313 uint32_t SYS_PT_GetFreq(void);
Anna Bridge 169:a7c7b631e539 314
Anna Bridge 169:a7c7b631e539 315 /**
Anna Bridge 169:a7c7b631e539 316 * @brief Initialize the global pulse train clock scale
Anna Bridge 169:a7c7b631e539 317 * @param clk_scale scale the system clock for the PT clock
Anna Bridge 169:a7c7b631e539 318 */
Anna Bridge 169:a7c7b631e539 319 void SYS_PT_Init(sys_pt_clk_scale clk_scale);
Anna Bridge 169:a7c7b631e539 320
Anna Bridge 169:a7c7b631e539 321 /**
Anna Bridge 169:a7c7b631e539 322 * @brief System level initialization for Pulse Train module.
Anna Bridge 169:a7c7b631e539 323 * @param pt Pointer to PT module registers
Anna Bridge 169:a7c7b631e539 324 * @param cfg System configuration object
Anna Bridge 169:a7c7b631e539 325 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 326 */
Anna Bridge 169:a7c7b631e539 327 int SYS_PT_Config(mxc_pt_regs_t *pt, const sys_cfg_pt_t *cfg);
Anna Bridge 169:a7c7b631e539 328
Anna Bridge 169:a7c7b631e539 329 /**
Anna Bridge 169:a7c7b631e539 330 * @brief System level initialization for USB device.
Anna Bridge 169:a7c7b631e539 331 * @param enable 1 to enable the peripheral, 0 to disable.
Anna Bridge 169:a7c7b631e539 332 */
Anna Bridge 169:a7c7b631e539 333 void SYS_USB_Enable(uint8_t enable);
Anna Bridge 169:a7c7b631e539 334
Anna Bridge 169:a7c7b631e539 335 /**
Anna Bridge 169:a7c7b631e539 336 * @brief System Tick Configuration Helper
Anna Bridge 169:a7c7b631e539 337 *
Anna Bridge 169:a7c7b631e539 338 * The function enables selection of the external clock source for the
Anna Bridge 169:a7c7b631e539 339 * System Tick Timer. It initializes the System Timer and its interrupt,
Anna Bridge 169:a7c7b631e539 340 * and starts the System Tick Timer. Counter is in free running mode to generate
Anna Bridge 169:a7c7b631e539 341 * periodic interrupts.
Anna Bridge 169:a7c7b631e539 342
Anna Bridge 169:a7c7b631e539 343 * @param ticks Number of ticks between two interrupts.
Anna Bridge 169:a7c7b631e539 344 * @param clk_src Selects between default SystemClock or External Clock.
Anna Bridge 169:a7c7b631e539 345 * - 0 Use external clock source
Anna Bridge 169:a7c7b631e539 346 * - 1 SystemClock
Anna Bridge 169:a7c7b631e539 347 * @return E_NO_ERROR Function succeeded.
Anna Bridge 169:a7c7b631e539 348 * @return E_INVALID Invalid reload value requested.
Anna Bridge 169:a7c7b631e539 349 *
Anna Bridge 169:a7c7b631e539 350 * @see CLKMAN_SetRTOSMode(uint8_t enable) if using the external clock source to drive the System Tick Timer
Anna Bridge 169:a7c7b631e539 351 *
Anna Bridge 169:a7c7b631e539 352 */
Anna Bridge 169:a7c7b631e539 353 int SYS_SysTick_Config(uint32_t ticks, int clk_src);
Anna Bridge 169:a7c7b631e539 354
Anna Bridge 169:a7c7b631e539 355 /**
Anna Bridge 169:a7c7b631e539 356 * @brief Disable System Tick timer
Anna Bridge 169:a7c7b631e539 357 *
Anna Bridge 169:a7c7b631e539 358 *
Anna Bridge 169:a7c7b631e539 359 */
Anna Bridge 169:a7c7b631e539 360 __STATIC_INLINE void SYS_SysTick_Disable(void)
Anna Bridge 169:a7c7b631e539 361 {
Anna Bridge 169:a7c7b631e539 362 SysTick->CTRL = 0;
Anna Bridge 169:a7c7b631e539 363 }
Anna Bridge 169:a7c7b631e539 364
Anna Bridge 169:a7c7b631e539 365 /**
Anna Bridge 169:a7c7b631e539 366 * @brief Delay a requested number of SysTick Timer Ticks.
Anna Bridge 169:a7c7b631e539 367 * @param ticks Number of System Ticks to delay.
Anna Bridge 169:a7c7b631e539 368 * @note This delay function is based on the clock used for the SysTick timer
Anna Bridge 169:a7c7b631e539 369 * if the SysTick timer is enabled. If the SysTick timer is
Anna Bridge 169:a7c7b631e539 370 * not enabled, the current SysTick registers are saved and the
Anna Bridge 169:a7c7b631e539 371 * timer will use the SystemClock as the source for the delay.
Anna Bridge 169:a7c7b631e539 372 * The delay is measured in clock ticks and is not based on the
Anna Bridge 169:a7c7b631e539 373 * SysTick interval.
Anna Bridge 169:a7c7b631e539 374 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 375 */
Anna Bridge 169:a7c7b631e539 376 int SYS_SysTick_Delay(uint32_t ticks);
Anna Bridge 169:a7c7b631e539 377
Anna Bridge 169:a7c7b631e539 378 /**
Anna Bridge 169:a7c7b631e539 379 * @brief Get the frequency of the SysTick Timer
Anna Bridge 169:a7c7b631e539 380 * @returns frequency in Hz
Anna Bridge 169:a7c7b631e539 381 */
Anna Bridge 169:a7c7b631e539 382 uint32_t SYS_SysTick_GetFreq(void);
Anna Bridge 169:a7c7b631e539 383
Anna Bridge 169:a7c7b631e539 384 /**
Anna Bridge 169:a7c7b631e539 385 * @brief Delay a requested number of microseconds.
Anna Bridge 169:a7c7b631e539 386 * @param us Number of microseconds to delay.
Anna Bridge 169:a7c7b631e539 387 * @note Calls SYS_SysTick_Delay.
Anna Bridge 169:a7c7b631e539 388 */
Anna Bridge 169:a7c7b631e539 389 __STATIC_INLINE void SYS_SysTick_DelayUs(uint32_t us)
Anna Bridge 169:a7c7b631e539 390 {
Anna Bridge 169:a7c7b631e539 391 SYS_SysTick_Delay((uint32_t)(((uint64_t)SYS_SysTick_GetFreq() * us) / 1000000));
Anna Bridge 169:a7c7b631e539 392 }
Anna Bridge 169:a7c7b631e539 393
Anna Bridge 169:a7c7b631e539 394 /**
Anna Bridge 169:a7c7b631e539 395 * @brief System level initialization for RTC module.
Anna Bridge 169:a7c7b631e539 396 * @returns E_NO_ERROR if everything is successful
Anna Bridge 169:a7c7b631e539 397 */
Anna Bridge 169:a7c7b631e539 398 int SYS_RTC_Init(void);
Anna Bridge 169:a7c7b631e539 399
Anna Bridge 169:a7c7b631e539 400 /**
Anna Bridge 169:a7c7b631e539 401 * @brief Select VDDIO for the specified GPIO pin.
Anna Bridge 169:a7c7b631e539 402 */
Anna Bridge 169:a7c7b631e539 403 void SYS_IOMAN_UseVDDIO(const gpio_cfg_t *cfg);
Anna Bridge 169:a7c7b631e539 404
Anna Bridge 169:a7c7b631e539 405 /**
Anna Bridge 169:a7c7b631e539 406 * @brief Select VDDIOH for the specified GPIO pin.
Anna Bridge 169:a7c7b631e539 407 */
Anna Bridge 169:a7c7b631e539 408 void SYS_IOMAN_UseVDDIOH(const gpio_cfg_t *cfg);
Anna Bridge 169:a7c7b631e539 409
Anna Bridge 169:a7c7b631e539 410 /**
Anna Bridge 169:a7c7b631e539 411 * @brief System level initialization for Watchdog module.
Anna Bridge 169:a7c7b631e539 412 * @param wdt Pointer to Watchdog module registers
Anna Bridge 169:a7c7b631e539 413 * @param cfg Watchdog System configuration object
Anna Bridge 169:a7c7b631e539 414 */
Anna Bridge 169:a7c7b631e539 415 void SYS_WDT_Init(mxc_wdt_regs_t *wdt, const sys_cfg_wdt_t *cfg);
Anna Bridge 169:a7c7b631e539 416
Anna Bridge 169:a7c7b631e539 417 /**
Anna Bridge 169:a7c7b631e539 418 * @brief System level initialization for PRNG module.
Anna Bridge 169:a7c7b631e539 419 * Enable crypto clock and set divisors to 1 if disabled
Anna Bridge 169:a7c7b631e539 420 */
Anna Bridge 169:a7c7b631e539 421 void SYS_PRNG_Init(void);
Anna Bridge 169:a7c7b631e539 422
Anna Bridge 169:a7c7b631e539 423 /**
Anna Bridge 169:a7c7b631e539 424 * @brief System level initialization for MAA module.
Anna Bridge 169:a7c7b631e539 425 * Enable crypto clock and set divisors to 1 if disabled
Anna Bridge 169:a7c7b631e539 426 */
Anna Bridge 169:a7c7b631e539 427 void SYS_MAA_Init(void);
Anna Bridge 169:a7c7b631e539 428
Anna Bridge 169:a7c7b631e539 429 /*
Anna Bridge 169:a7c7b631e539 430 * @brief Gets the size of the SRAM
Anna Bridge 169:a7c7b631e539 431 * @returns size of SRAM in bytes
Anna Bridge 169:a7c7b631e539 432 */
Anna Bridge 169:a7c7b631e539 433 uint32_t SYS_SRAM_GetSize(void);
Anna Bridge 169:a7c7b631e539 434
Anna Bridge 169:a7c7b631e539 435 /*
Anna Bridge 169:a7c7b631e539 436 * @brief Gets the size of the Flash
Anna Bridge 169:a7c7b631e539 437 * @returns size of Flash in bytes
Anna Bridge 169:a7c7b631e539 438 */
Anna Bridge 169:a7c7b631e539 439 uint32_t SYS_FLASH_GetSize(void);
Anna Bridge 169:a7c7b631e539 440
Anna Bridge 169:a7c7b631e539 441 #ifdef __cplusplus
Anna Bridge 169:a7c7b631e539 442 }
Anna Bridge 169:a7c7b631e539 443 #endif
Anna Bridge 169:a7c7b631e539 444
Anna Bridge 169:a7c7b631e539 445 #endif /* _MXC_SYS_H_*/