ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Committer:
group-onsemi
Date:
Wed Jan 25 20:34:15 2017 +0000
Revision:
0:098463de4c5d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-onsemi 0:098463de4c5d 1 /*
group-onsemi 0:098463de4c5d 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
group-onsemi 0:098463de4c5d 3 * All rights reserved.
group-onsemi 0:098463de4c5d 4 *
group-onsemi 0:098463de4c5d 5 * Redistribution and use in source and binary forms, with or without modification,
group-onsemi 0:098463de4c5d 6 * are permitted provided that the following conditions are met:
group-onsemi 0:098463de4c5d 7 *
group-onsemi 0:098463de4c5d 8 * o Redistributions of source code must retain the above copyright notice, this list
group-onsemi 0:098463de4c5d 9 * of conditions and the following disclaimer.
group-onsemi 0:098463de4c5d 10 *
group-onsemi 0:098463de4c5d 11 * o Redistributions in binary form must reproduce the above copyright notice, this
group-onsemi 0:098463de4c5d 12 * list of conditions and the following disclaimer in the documentation and/or
group-onsemi 0:098463de4c5d 13 * other materials provided with the distribution.
group-onsemi 0:098463de4c5d 14 *
group-onsemi 0:098463de4c5d 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
group-onsemi 0:098463de4c5d 16 * contributors may be used to endorse or promote products derived from this
group-onsemi 0:098463de4c5d 17 * software without specific prior written permission.
group-onsemi 0:098463de4c5d 18 *
group-onsemi 0:098463de4c5d 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
group-onsemi 0:098463de4c5d 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
group-onsemi 0:098463de4c5d 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
group-onsemi 0:098463de4c5d 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
group-onsemi 0:098463de4c5d 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
group-onsemi 0:098463de4c5d 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
group-onsemi 0:098463de4c5d 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
group-onsemi 0:098463de4c5d 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
group-onsemi 0:098463de4c5d 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
group-onsemi 0:098463de4c5d 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
group-onsemi 0:098463de4c5d 29 */
group-onsemi 0:098463de4c5d 30
group-onsemi 0:098463de4c5d 31 #include "fsl_rcm.h"
group-onsemi 0:098463de4c5d 32
group-onsemi 0:098463de4c5d 33 void RCM_ConfigureResetPinFilter(RCM_Type *base, const rcm_reset_pin_filter_config_t *config)
group-onsemi 0:098463de4c5d 34 {
group-onsemi 0:098463de4c5d 35 #if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
group-onsemi 0:098463de4c5d 36 uint32_t reg;
group-onsemi 0:098463de4c5d 37
group-onsemi 0:098463de4c5d 38 reg = (((uint32_t)config->enableFilterInStop << RCM_RPC_RSTFLTSS_SHIFT) | (uint32_t)config->filterInRunWait);
group-onsemi 0:098463de4c5d 39 if (config->filterInRunWait == kRCM_FilterBusClock)
group-onsemi 0:098463de4c5d 40 {
group-onsemi 0:098463de4c5d 41 reg |= ((uint32_t)config->busClockFilterCount << RCM_RPC_RSTFLTSEL_SHIFT);
group-onsemi 0:098463de4c5d 42 }
group-onsemi 0:098463de4c5d 43 base->RPC = reg;
group-onsemi 0:098463de4c5d 44 #else
group-onsemi 0:098463de4c5d 45 base->RPFC = ((uint8_t)(config->enableFilterInStop << RCM_RPFC_RSTFLTSS_SHIFT) | (uint8_t)config->filterInRunWait);
group-onsemi 0:098463de4c5d 46 if (config->filterInRunWait == kRCM_FilterBusClock)
group-onsemi 0:098463de4c5d 47 {
group-onsemi 0:098463de4c5d 48 base->RPFW = config->busClockFilterCount;
group-onsemi 0:098463de4c5d 49 }
group-onsemi 0:098463de4c5d 50 #endif /* FSL_FEATURE_RCM_REG_WIDTH */
group-onsemi 0:098463de4c5d 51 }
group-onsemi 0:098463de4c5d 52
group-onsemi 0:098463de4c5d 53 #if (defined(FSL_FEATURE_RCM_HAS_BOOTROM) && FSL_FEATURE_RCM_HAS_BOOTROM)
group-onsemi 0:098463de4c5d 54 void RCM_SetForceBootRomSource(RCM_Type *base, rcm_boot_rom_config_t config)
group-onsemi 0:098463de4c5d 55 {
group-onsemi 0:098463de4c5d 56 uint32_t reg;
group-onsemi 0:098463de4c5d 57
group-onsemi 0:098463de4c5d 58 reg = base->FM;
group-onsemi 0:098463de4c5d 59 reg &= ~RCM_FM_FORCEROM_MASK;
group-onsemi 0:098463de4c5d 60 reg |= ((uint32_t)config << RCM_FM_FORCEROM_SHIFT);
group-onsemi 0:098463de4c5d 61 base->FM = reg;
group-onsemi 0:098463de4c5d 62 }
group-onsemi 0:098463de4c5d 63 #endif /* #if FSL_FEATURE_RCM_HAS_BOOTROM */