added prescaler for 16 bit pwm in LPC1347 target

Fork of mbed-dev by mbed official

Committer:
JojoS
Date:
Sat Sep 10 15:32:04 2016 +0000
Revision:
147:ba84b7dc41a7
Parent:
144:ef7eb2e8f9f7
added prescaler for 16 bit timers (solution as in LPC11xx), default prescaler 31 for max 28 ms period time

Who changed what in which revision?

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