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:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

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