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:
Kojto
Date:
Tue Feb 02 14:43:35 2016 +0000
Revision:
113:f141b2784e32
Parent:
98:8ab26030e058
Child:
128:9bcdf88f62b0
Release 113 of the mbed library

Changes:
- new targets - Silabs Perl Gecko, TY51822
- Silabs - emlib update to 4.1.0, various bugfixes as result
- STM B96B_F446VE - add async serial support
- Freescale KLXX - rtc lock fix
- LPC11U68 and LPC1549 - pwm bugfixes - duty cycle

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 98:8ab26030e058 1 /***************************************************************************//**
Kojto 98:8ab26030e058 2 * @file em_rmu.h
Kojto 98:8ab26030e058 3 * @brief Reset Management Unit (RMU) peripheral API
Kojto 113:f141b2784e32 4 * @version 4.2.1
Kojto 98:8ab26030e058 5 *******************************************************************************
Kojto 98:8ab26030e058 6 * @section License
Kojto 113:f141b2784e32 7 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
Kojto 98:8ab26030e058 8 *******************************************************************************
Kojto 98:8ab26030e058 9 *
Kojto 98:8ab26030e058 10 * Permission is granted to anyone to use this software for any purpose,
Kojto 98:8ab26030e058 11 * including commercial applications, and to alter it and redistribute it
Kojto 98:8ab26030e058 12 * freely, subject to the following restrictions:
Kojto 98:8ab26030e058 13 *
Kojto 98:8ab26030e058 14 * 1. The origin of this software must not be misrepresented; you must not
Kojto 98:8ab26030e058 15 * claim that you wrote the original software.
Kojto 98:8ab26030e058 16 * 2. Altered source versions must be plainly marked as such, and must not be
Kojto 98:8ab26030e058 17 * misrepresented as being the original software.
Kojto 98:8ab26030e058 18 * 3. This notice may not be removed or altered from any source distribution.
Kojto 98:8ab26030e058 19 *
Kojto 98:8ab26030e058 20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
Kojto 98:8ab26030e058 21 * obligation to support this Software. Silicon Labs is providing the
Kojto 98:8ab26030e058 22 * Software "AS IS", with no express or implied warranties of any kind,
Kojto 98:8ab26030e058 23 * including, but not limited to, any implied warranties of merchantability
Kojto 98:8ab26030e058 24 * or fitness for any particular purpose or warranties against infringement
Kojto 98:8ab26030e058 25 * of any proprietary rights of a third party.
Kojto 98:8ab26030e058 26 *
Kojto 98:8ab26030e058 27 * Silicon Labs will not be liable for any consequential, incidental, or
Kojto 98:8ab26030e058 28 * special damages, or any other relief, or for any claim by any third party,
Kojto 98:8ab26030e058 29 * arising from your use of this Software.
Kojto 98:8ab26030e058 30 *
Kojto 98:8ab26030e058 31 ******************************************************************************/
Kojto 98:8ab26030e058 32
Kojto 113:f141b2784e32 33 #ifndef __SILICON_LABS_EM_RMU_H__
Kojto 113:f141b2784e32 34 #define __SILICON_LABS_EM_RMU_H__
Kojto 98:8ab26030e058 35
Kojto 98:8ab26030e058 36 #include "em_device.h"
Kojto 98:8ab26030e058 37 #if defined(RMU_COUNT) && (RMU_COUNT > 0)
Kojto 113:f141b2784e32 38 #include "em_assert.h"
Kojto 98:8ab26030e058 39
Kojto 98:8ab26030e058 40 #include <stdbool.h>
Kojto 98:8ab26030e058 41
Kojto 98:8ab26030e058 42 #ifdef __cplusplus
Kojto 98:8ab26030e058 43 extern "C" {
Kojto 98:8ab26030e058 44 #endif
Kojto 98:8ab26030e058 45
Kojto 98:8ab26030e058 46 /***************************************************************************//**
Kojto 98:8ab26030e058 47 * @addtogroup EM_Library
Kojto 98:8ab26030e058 48 * @{
Kojto 98:8ab26030e058 49 ******************************************************************************/
Kojto 98:8ab26030e058 50
Kojto 98:8ab26030e058 51 /***************************************************************************//**
Kojto 98:8ab26030e058 52 * @addtogroup RMU
Kojto 98:8ab26030e058 53 * @{
Kojto 98:8ab26030e058 54 ******************************************************************************/
Kojto 98:8ab26030e058 55
Kojto 98:8ab26030e058 56 /*******************************************************************************
Kojto 98:8ab26030e058 57 ******************************** ENUMS ************************************
Kojto 98:8ab26030e058 58 ******************************************************************************/
Kojto 98:8ab26030e058 59
Kojto 113:f141b2784e32 60 /** RMU reset modes */
Kojto 113:f141b2784e32 61 typedef enum
Kojto 113:f141b2784e32 62 {
Kojto 113:f141b2784e32 63 #if defined(_RMU_CTRL_PINRMODE_MASK)
Kojto 113:f141b2784e32 64 rmuResetModeDisabled = _RMU_CTRL_PINRMODE_DISABLED,
Kojto 113:f141b2784e32 65 rmuResetModeLimited = _RMU_CTRL_PINRMODE_LIMITED,
Kojto 113:f141b2784e32 66 rmuResetModeExtended = _RMU_CTRL_PINRMODE_EXTENDED,
Kojto 113:f141b2784e32 67 rmuResetModeFull = _RMU_CTRL_PINRMODE_FULL,
Kojto 113:f141b2784e32 68 #else
Kojto 113:f141b2784e32 69 rmuResetModeClear = 0,
Kojto 113:f141b2784e32 70 rmuResetModeSet = 1,
Kojto 113:f141b2784e32 71 #endif
Kojto 113:f141b2784e32 72 } RMU_ResetMode_TypeDef;
Kojto 113:f141b2784e32 73
Kojto 98:8ab26030e058 74 /** RMU controlled peripheral reset control and reset source control */
Kojto 98:8ab26030e058 75 typedef enum
Kojto 98:8ab26030e058 76 {
Kojto 113:f141b2784e32 77 #if defined(RMU_CTRL_BURSTEN)
Kojto 113:f141b2784e32 78 rmuResetBU = _RMU_CTRL_BURSTEN_MASK, /**< Reset control over Backup Power domain select */
Kojto 113:f141b2784e32 79 #endif
Kojto 113:f141b2784e32 80 #if defined(RMU_CTRL_LOCKUPRDIS)
Kojto 113:f141b2784e32 81 rmuResetLockUp = _RMU_CTRL_LOCKUPRDIS_MASK, /**< Cortex lockup reset select */
Kojto 113:f141b2784e32 82 #elif defined(_RMU_CTRL_LOCKUPRMODE_MASK)
Kojto 113:f141b2784e32 83 rmuResetLockUp = _RMU_CTRL_LOCKUPRMODE_MASK, /**< Cortex lockup reset select */
Kojto 98:8ab26030e058 84 #endif
Kojto 113:f141b2784e32 85 #if defined(_RMU_CTRL_WDOGRMODE_MASK)
Kojto 113:f141b2784e32 86 rmuResetWdog = _RMU_CTRL_WDOGRMODE_MASK, /**< WDOG reset select */
Kojto 113:f141b2784e32 87 #endif
Kojto 113:f141b2784e32 88 #if defined(_RMU_CTRL_LOCKUPRMODE_MASK)
Kojto 113:f141b2784e32 89 rmuResetCoreLockup = _RMU_CTRL_LOCKUPRMODE_MASK, /**< Cortex lockup reset select */
Kojto 113:f141b2784e32 90 #endif
Kojto 113:f141b2784e32 91 #if defined(_RMU_CTRL_SYSRMODE_MASK)
Kojto 113:f141b2784e32 92 rmuResetSys = _RMU_CTRL_SYSRMODE_MASK, /**< SYSRESET select */
Kojto 113:f141b2784e32 93 #endif
Kojto 113:f141b2784e32 94 #if defined(_RMU_CTRL_PINRMODE_MASK)
Kojto 113:f141b2784e32 95 rmuResetPin = _RMU_CTRL_PINRMODE_MASK, /**< Pin reset select */
Kojto 113:f141b2784e32 96 #endif
Kojto 98:8ab26030e058 97 } RMU_Reset_TypeDef;
Kojto 98:8ab26030e058 98
Kojto 98:8ab26030e058 99 /*******************************************************************************
Kojto 98:8ab26030e058 100 ***************************** PROTOTYPES **********************************
Kojto 98:8ab26030e058 101 ******************************************************************************/
Kojto 98:8ab26030e058 102
Kojto 98:8ab26030e058 103 /** RMU_LockupResetDisable kept for backwards compatibility */
Kojto 98:8ab26030e058 104 #define RMU_LockupResetDisable(A) RMU_ResetControl(rmuResetLockUp, A)
Kojto 98:8ab26030e058 105
Kojto 113:f141b2784e32 106 void RMU_ResetControl(RMU_Reset_TypeDef reset, RMU_ResetMode_TypeDef mode);
Kojto 98:8ab26030e058 107 void RMU_ResetCauseClear(void);
Kojto 98:8ab26030e058 108 uint32_t RMU_ResetCauseGet(void);
Kojto 98:8ab26030e058 109
Kojto 113:f141b2784e32 110 #if defined(_RMU_CTRL_RESETSTATE_MASK)
Kojto 113:f141b2784e32 111 /***************************************************************************//**
Kojto 113:f141b2784e32 112 * @brief
Kojto 113:f141b2784e32 113 * Set user reset state. This state is reset only by a Power-on-reset and a
Kojto 113:f141b2784e32 114 * pin reset.
Kojto 113:f141b2784e32 115 *
Kojto 113:f141b2784e32 116 * @param[in] userState User state to set
Kojto 113:f141b2784e32 117 ******************************************************************************/
Kojto 113:f141b2784e32 118 __STATIC_INLINE void RMU_UserResetStateSet(uint32_t userState)
Kojto 113:f141b2784e32 119 {
Kojto 113:f141b2784e32 120 EFM_ASSERT(!(userState
Kojto 113:f141b2784e32 121 & ~(_RMU_CTRL_RESETSTATE_MASK >> _RMU_CTRL_RESETSTATE_SHIFT)));
Kojto 113:f141b2784e32 122 RMU->CTRL = (RMU->CTRL & ~_RMU_CTRL_RESETSTATE_MASK)
Kojto 113:f141b2784e32 123 | (userState << _RMU_CTRL_RESETSTATE_SHIFT);
Kojto 113:f141b2784e32 124 }
Kojto 113:f141b2784e32 125
Kojto 113:f141b2784e32 126 /***************************************************************************//**
Kojto 113:f141b2784e32 127 * @brief
Kojto 113:f141b2784e32 128 * Get user reset state. This state is reset only by a Power-on-reset and a
Kojto 113:f141b2784e32 129 * pin reset.
Kojto 113:f141b2784e32 130 *
Kojto 113:f141b2784e32 131 * @return
Kojto 113:f141b2784e32 132 * Reset surviving user state
Kojto 113:f141b2784e32 133 ******************************************************************************/
Kojto 113:f141b2784e32 134 __STATIC_INLINE uint32_t RMU_UserResetStateGet(void)
Kojto 113:f141b2784e32 135 {
Kojto 113:f141b2784e32 136 uint32_t userState = (RMU->CTRL & _RMU_CTRL_RESETSTATE_MASK)
Kojto 113:f141b2784e32 137 >> _RMU_CTRL_RESETSTATE_SHIFT;
Kojto 113:f141b2784e32 138 return userState;
Kojto 113:f141b2784e32 139 }
Kojto 113:f141b2784e32 140 #endif
Kojto 113:f141b2784e32 141
Kojto 98:8ab26030e058 142 /** @} (end addtogroup RMU) */
Kojto 98:8ab26030e058 143 /** @} (end addtogroup EM_Library) */
Kojto 98:8ab26030e058 144
Kojto 98:8ab26030e058 145 #ifdef __cplusplus
Kojto 98:8ab26030e058 146 }
Kojto 98:8ab26030e058 147 #endif
Kojto 98:8ab26030e058 148
Kojto 98:8ab26030e058 149 #endif /* defined(RMU_COUNT) && (RMU_COUNT > 0) */
Kojto 113:f141b2784e32 150 #endif /* __SILICON_LABS_EM_RMU_H__ */