Kevin Kadooka / mbed-dev

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Wed Jan 04 16:58:05 2017 +0000
Revision:
154:37f96f9d4de2
This updates the lib to the mbed lib v133

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 154:37f96f9d4de2 1 /*
<> 154:37f96f9d4de2 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
<> 154:37f96f9d4de2 3 * All rights reserved.
<> 154:37f96f9d4de2 4 *
<> 154:37f96f9d4de2 5 * Redistribution and use in source and binary forms, with or without modification,
<> 154:37f96f9d4de2 6 * are permitted provided that the following conditions are met:
<> 154:37f96f9d4de2 7 *
<> 154:37f96f9d4de2 8 * o Redistributions of source code must retain the above copyright notice, this list
<> 154:37f96f9d4de2 9 * of conditions and the following disclaimer.
<> 154:37f96f9d4de2 10 *
<> 154:37f96f9d4de2 11 * o Redistributions in binary form must reproduce the above copyright notice, this
<> 154:37f96f9d4de2 12 * list of conditions and the following disclaimer in the documentation and/or
<> 154:37f96f9d4de2 13 * other materials provided with the distribution.
<> 154:37f96f9d4de2 14 *
<> 154:37f96f9d4de2 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
<> 154:37f96f9d4de2 16 * contributors may be used to endorse or promote products derived from this
<> 154:37f96f9d4de2 17 * software without specific prior written permission.
<> 154:37f96f9d4de2 18 *
<> 154:37f96f9d4de2 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<> 154:37f96f9d4de2 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
<> 154:37f96f9d4de2 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 154:37f96f9d4de2 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
<> 154:37f96f9d4de2 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
<> 154:37f96f9d4de2 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
<> 154:37f96f9d4de2 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
<> 154:37f96f9d4de2 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<> 154:37f96f9d4de2 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
<> 154:37f96f9d4de2 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 154:37f96f9d4de2 29 */
<> 154:37f96f9d4de2 30
<> 154:37f96f9d4de2 31 #ifndef _FSL_SIM_H_
<> 154:37f96f9d4de2 32 #define _FSL_SIM_H_
<> 154:37f96f9d4de2 33
<> 154:37f96f9d4de2 34 #include "fsl_common.h"
<> 154:37f96f9d4de2 35
<> 154:37f96f9d4de2 36 /*! @addtogroup sim */
<> 154:37f96f9d4de2 37 /*! @{*/
<> 154:37f96f9d4de2 38
<> 154:37f96f9d4de2 39
<> 154:37f96f9d4de2 40 /*******************************************************************************
<> 154:37f96f9d4de2 41 * Definitions
<> 154:37f96f9d4de2 42 *******************************************************************************/
<> 154:37f96f9d4de2 43
<> 154:37f96f9d4de2 44 /*! @name Driver version */
<> 154:37f96f9d4de2 45 /*@{*/
<> 154:37f96f9d4de2 46 #define FSL_SIM_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Driver version 2.0.0 */
<> 154:37f96f9d4de2 47 /*@}*/
<> 154:37f96f9d4de2 48
<> 154:37f96f9d4de2 49 #if (defined(FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) && FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR)
<> 154:37f96f9d4de2 50 /*!@brief USB voltage regulator enable setting. */
<> 154:37f96f9d4de2 51 enum _sim_usb_volt_reg_enable_mode
<> 154:37f96f9d4de2 52 {
<> 154:37f96f9d4de2 53 kSIM_UsbVoltRegEnable = SIM_SOPT1_USBREGEN_MASK, /*!< Enable voltage regulator. */
<> 154:37f96f9d4de2 54 kSIM_UsbVoltRegEnableInLowPower = SIM_SOPT1_USBVSTBY_MASK, /*!< Enable voltage regulator in VLPR/VLPW modes. */
<> 154:37f96f9d4de2 55 kSIM_UsbVoltRegEnableInStop = SIM_SOPT1_USBSSTBY_MASK, /*!< Enable voltage regulator in STOP/VLPS/LLS/VLLS modes. */
<> 154:37f96f9d4de2 56 kSIM_UsbVoltRegEnableInAllModes = SIM_SOPT1_USBREGEN_MASK | SIM_SOPT1_USBSSTBY_MASK |
<> 154:37f96f9d4de2 57 SIM_SOPT1_USBVSTBY_MASK /*!< Enable voltage regulator in all power modes. */
<> 154:37f96f9d4de2 58 };
<> 154:37f96f9d4de2 59 #endif /* (defined(FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) && FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) */
<> 154:37f96f9d4de2 60
<> 154:37f96f9d4de2 61 /*!@brief Unique ID. */
<> 154:37f96f9d4de2 62 typedef struct _sim_uid
<> 154:37f96f9d4de2 63 {
<> 154:37f96f9d4de2 64 #if defined(SIM_UIDH)
<> 154:37f96f9d4de2 65 uint32_t H; /*!< UIDH. */
<> 154:37f96f9d4de2 66 #endif
<> 154:37f96f9d4de2 67 uint32_t MH; /*!< UIDMH. */
<> 154:37f96f9d4de2 68 uint32_t ML; /*!< UIDML. */
<> 154:37f96f9d4de2 69 uint32_t L; /*!< UIDL. */
<> 154:37f96f9d4de2 70 } sim_uid_t;
<> 154:37f96f9d4de2 71
<> 154:37f96f9d4de2 72 /*!@brief Flash enable mode. */
<> 154:37f96f9d4de2 73 enum _sim_flash_mode
<> 154:37f96f9d4de2 74 {
<> 154:37f96f9d4de2 75 kSIM_FlashDisableInWait = SIM_FCFG1_FLASHDOZE_MASK, /*!< Disable flash in wait mode. */
<> 154:37f96f9d4de2 76 kSIM_FlashDisable = SIM_FCFG1_FLASHDIS_MASK /*!< Disable flash in normal mode. */
<> 154:37f96f9d4de2 77 };
<> 154:37f96f9d4de2 78
<> 154:37f96f9d4de2 79 /*******************************************************************************
<> 154:37f96f9d4de2 80 * API
<> 154:37f96f9d4de2 81 ******************************************************************************/
<> 154:37f96f9d4de2 82
<> 154:37f96f9d4de2 83 #if defined(__cplusplus)
<> 154:37f96f9d4de2 84 extern "C" {
<> 154:37f96f9d4de2 85 #endif /* __cplusplus*/
<> 154:37f96f9d4de2 86
<> 154:37f96f9d4de2 87 #if (defined(FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) && FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR)
<> 154:37f96f9d4de2 88 /*!
<> 154:37f96f9d4de2 89 * @brief Sets the USB voltage regulator setting.
<> 154:37f96f9d4de2 90 *
<> 154:37f96f9d4de2 91 * This function configures whether the USB voltage regulator is enabled in
<> 154:37f96f9d4de2 92 * normal RUN mode, STOP/VLPS/LLS/VLLS modes, and VLPR/VLPW modes. The configurations
<> 154:37f96f9d4de2 93 * are passed in as mask value of \ref _sim_usb_volt_reg_enable_mode. For example, to enable
<> 154:37f96f9d4de2 94 * USB voltage regulator in RUN/VLPR/VLPW modes and disable in STOP/VLPS/LLS/VLLS mode,
<> 154:37f96f9d4de2 95 * use:
<> 154:37f96f9d4de2 96 *
<> 154:37f96f9d4de2 97 * SIM_SetUsbVoltRegulatorEnableMode(kSIM_UsbVoltRegEnable | kSIM_UsbVoltRegEnableInLowPower);
<> 154:37f96f9d4de2 98 *
<> 154:37f96f9d4de2 99 * @param mask USB voltage regulator enable setting.
<> 154:37f96f9d4de2 100 */
<> 154:37f96f9d4de2 101 void SIM_SetUsbVoltRegulatorEnableMode(uint32_t mask);
<> 154:37f96f9d4de2 102 #endif /* FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR */
<> 154:37f96f9d4de2 103
<> 154:37f96f9d4de2 104 /*!
<> 154:37f96f9d4de2 105 * @brief Gets the unique identification register value.
<> 154:37f96f9d4de2 106 *
<> 154:37f96f9d4de2 107 * @param uid Pointer to the structure to save the UID value.
<> 154:37f96f9d4de2 108 */
<> 154:37f96f9d4de2 109 void SIM_GetUniqueId(sim_uid_t *uid);
<> 154:37f96f9d4de2 110
<> 154:37f96f9d4de2 111 /*!
<> 154:37f96f9d4de2 112 * @brief Sets the flash enable mode.
<> 154:37f96f9d4de2 113 *
<> 154:37f96f9d4de2 114 * @param mode The mode to set; see \ref _sim_flash_mode for mode details.
<> 154:37f96f9d4de2 115 */
<> 154:37f96f9d4de2 116 static inline void SIM_SetFlashMode(uint8_t mode)
<> 154:37f96f9d4de2 117 {
<> 154:37f96f9d4de2 118 SIM->FCFG1 = mode;
<> 154:37f96f9d4de2 119 }
<> 154:37f96f9d4de2 120
<> 154:37f96f9d4de2 121 #if defined(__cplusplus)
<> 154:37f96f9d4de2 122 }
<> 154:37f96f9d4de2 123 #endif /* __cplusplus*/
<> 154:37f96f9d4de2 124
<> 154:37f96f9d4de2 125 /*! @}*/
<> 154:37f96f9d4de2 126
<> 154:37f96f9d4de2 127 #endif /* _FSL_SIM_H_ */