Add Kinesis watchdog, ramfuncs, idle loop, start of clock configuration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3875 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
6c5c797edd
commit
b8b77ba579
@ -4596,6 +4596,10 @@ build
|
||||
<code>CONFIG_BOOT_COPYTORAM</code>: Some configurations boot in FLASH
|
||||
but copy themselves entirely into RAM for better performance.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_BOOT_RAMFUNCS</code>: Other configurations may copy just
|
||||
some functions into RAM, either for better performance or for errata workarounds.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_STACK_POINTER</code>: The initial stack pointer
|
||||
</li>
|
||||
|
@ -147,7 +147,35 @@ extern uint32_t _sdata; /* Start of .data */
|
||||
extern uint32_t _edata; /* End+1 of .data */
|
||||
extern uint32_t _sbss; /* Start of .bss */
|
||||
extern uint32_t _ebss; /* End+1 of .bss */
|
||||
#endif
|
||||
|
||||
/* Sometimes, functions must be executed from RAM. In this case, the following
|
||||
* macro may be used (with GCC!) to specify a function that will execute from
|
||||
* RAM. For example,
|
||||
*
|
||||
* int __ramfunc__ foo (void);
|
||||
* int __ramfunc__ foo (void) { return bar; }
|
||||
*
|
||||
* will create a function named foo that will execute from RAM.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_BOOT_RAMFUNCS
|
||||
|
||||
# define __ramfunc__ __attribute__ ((section(".ramfunc")))
|
||||
|
||||
/* Functions decleared in the .ramfunc section will be packaged together
|
||||
* by the linker script and stored in FLASH. During boot-up, the start
|
||||
* logic must include logic to copy the RAM functions from their storage
|
||||
* location in FLASH to their correct destination in SRAM. The following
|
||||
* following linker-defined values provide the information to copy the
|
||||
* functions from flash to RAM.
|
||||
*/
|
||||
|
||||
extern const uint32_t _framfuncs; /* Copy source address in FLASH */
|
||||
extern uint32_t _sramfuncs; /* Copy destination start address in RAM */
|
||||
extern uint32_t _eramfuncs; /* Copy destination start address in RAM */
|
||||
|
||||
#endif /* CONFIG_BOOT_RAMFUNCS */
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
|
@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# arch/arm/src/kinetis/Make.defs
|
||||
#
|
||||
# Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -57,10 +57,10 @@ endif
|
||||
# Required Kinetis files
|
||||
|
||||
CHIP_ASRCS =
|
||||
#CHIP_CSRCS = kinetis_allocateheap.c kinetis_can.c kinetis_clockconfig.c \
|
||||
# kinetis_clrpend.c kinetis_gpio.c kinetis_idle.c kinetis_lowputc.c \
|
||||
#CHIP_CSRCS = kinetis_allocateheap.c kinetis_can.c kinetis_gpio.c kinetis_lowputc.c \
|
||||
# kinetis_serial.c kinetis_spi.c kinetis_ssp.c kinetis_timerisr.c
|
||||
CHIP_CSRCS = kinetis_irq.c kinetis_start.c
|
||||
CHIP_CSRCS = kinetis_clrpend.c kinetis_idle.c kinetis_irq.c kinetis_mcg.c kinetis_start.c \
|
||||
kinetis_wdog.c
|
||||
|
||||
# Configuration-dependent Kinetis files
|
||||
|
||||
|
104
arch/arm/src/kinetis/kinetis_clrpend.c
Executable file
104
arch/arm/src/kinetis/kinetis_clrpend.c
Executable file
@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/kinetis/kinetis_clrpend.c
|
||||
* arch/arm/src/chip/kinetis_clrpend.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "nvic.h"
|
||||
#include "up_arch.h"
|
||||
#include "kinetis_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kinetis_clrpend
|
||||
*
|
||||
* Description:
|
||||
* Clear a pending interrupt at the NVIC. This does not seem to be required
|
||||
* for most interrupts. Don't know why...
|
||||
*
|
||||
* I keep it in a separate file so that it will not increase the footprint
|
||||
* on Kinetis platforms that do not need this function.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void kinetis_clrpend(int irq)
|
||||
{
|
||||
/* Check for external interrupt */
|
||||
|
||||
if (irq >= KINETIS_IRQ_EXTINT)
|
||||
{
|
||||
if (irq < (KINETIS_IRQ_EXTINT+32))
|
||||
{
|
||||
putreg32(1 << (irq - KINETIS_IRQ_EXTINT), NVIC_IRQ0_31_CLRPEND);
|
||||
}
|
||||
else if (irq < (KINETIS_IRQ_EXTINT+64))
|
||||
{
|
||||
putreg32(1 << (irq - KINETIS_IRQ_EXTINT - 32), NVIC_IRQ32_63_CLRPEND);
|
||||
}
|
||||
else if (irq < (KINETIS_IRQ_EXTINT+96))
|
||||
{
|
||||
putreg32(1 << (irq - KINETIS_IRQ_EXTINT - 64), NVIC_IRQ64_95_CLRPEND);
|
||||
}
|
||||
else if (irq < NR_IRQS)
|
||||
{
|
||||
putreg32(1 << (irq - KINETIS_IRQ_EXTINT - 96), NVIC_IRQ96_127_CLRPEND);
|
||||
}
|
||||
}
|
||||
}
|
104
arch/arm/src/kinetis/kinetis_idle.c
Executable file
104
arch/arm/src/kinetis/kinetis_idle.c
Executable file
@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/kinetis/kinetis_idle.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Does the board support an IDLE LED to indicate that the board is in the
|
||||
* IDLE state?
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_LEDS) && defined(LED_IDLE)
|
||||
# define BEGIN_IDLE() up_ledon(LED_IDLE)
|
||||
# define END_IDLE() up_ledoff(LED_IDLE)
|
||||
#else
|
||||
# define BEGIN_IDLE()
|
||||
# define END_IDLE()
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_idle
|
||||
*
|
||||
* Description:
|
||||
* up_idle() is the logic that will be executed when their is no other
|
||||
* ready-to-run task. This is processor idle time and will continue until
|
||||
* some interrupt occurs to cause a context switch from the idle task.
|
||||
*
|
||||
* Processing in this state may be processor-specific. e.g., this is where
|
||||
* power management operations might be performed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_idle(void)
|
||||
{
|
||||
#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
|
||||
/* If the system is idle and there are no timer interrupts, then process
|
||||
* "fake" timer interrupts. Hopefully, something will wake up.
|
||||
*/
|
||||
|
||||
sched_process_timer();
|
||||
#else
|
||||
|
||||
/* Sleep until an interrupt occurs to save power */
|
||||
|
||||
BEGIN_IDLE();
|
||||
asm("WFI");
|
||||
END_IDLE();
|
||||
#endif
|
||||
}
|
||||
|
@ -290,9 +290,9 @@ extern "C" {
|
||||
* Name: kinetis_clockconfig
|
||||
*
|
||||
* Description:
|
||||
* Called to initialize the KINETIS. This does whatever setup is needed to put the
|
||||
* MCU in a usable state. This includes the initialization of clocking using the
|
||||
* settings in board.h.
|
||||
* Called to initialize the Kinetis chip. This does whatever setup is needed to
|
||||
* put the MCU in a usable state. This includes the initialization of clocking
|
||||
* using the settings in board.h.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
@ -310,6 +310,16 @@ EXTERN void kinetis_clockconfig(void);
|
||||
|
||||
EXTERN void kinetis_lowsetup(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_wddisable
|
||||
*
|
||||
* Description:
|
||||
* Disable the watchdog timer
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void kinetis_wddisable(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_gpioirqinitialize
|
||||
*
|
||||
|
139
arch/arm/src/kinetis/kinetis_mcg.c
Normal file
139
arch/arm/src/kinetis/kinetis_mcg.c
Normal file
@ -0,0 +1,139 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/kinetis/kinetis_mcg.c
|
||||
* arch/arm/src/chip/kinetis_mcg.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
||||
#include "kinetis_internal.h"
|
||||
#include "kinetis_mcg.h"
|
||||
#include "kinetis_sim.h"
|
||||
#include "kinetis_fmc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_BOOT_RAMFUNCS
|
||||
# error "CONFIG_BOOT_RAMFUNCS must be defined for this logic"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void __ramfunc__
|
||||
kinesis_setdividers(uint32_t div1, uint32_t div2, uint32_t div3, uint32_t div4);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kinesis_setdividers
|
||||
*
|
||||
* Description:
|
||||
* "This routine must be placed in RAM. It is a workaround for errata e2448.
|
||||
* Flash prefetch must be disabled when the flash clock divider is changed.
|
||||
* This cannot be performed while executing out of flash. There must be a
|
||||
* short delay after the clock dividers are changed before prefetch can be
|
||||
* re-enabled."
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void __ramfunc__
|
||||
kinesis_setdividers(uint32_t div1, uint32_t div2, uint32_t div3, uint32_t div4)
|
||||
{
|
||||
uint32_t regval;
|
||||
int i;
|
||||
|
||||
/* Save the current value of the Flash Access Protection Register */
|
||||
|
||||
regval = getreg32(KINETIS_FMC_PFAPR);
|
||||
|
||||
/* Set M0PFD through M7PFD to 1 to disable prefetch */
|
||||
|
||||
putreg32(FMC_PFAPR_M7PFD | FMC_PFAPR_M6PFD | FMC_PFAPR_M5PFD |
|
||||
FMC_PFAPR_M4PFD | FMC_PFAPR_M3PFD | FMC_PFAPR_M2PFD |
|
||||
FMC_PFAPR_M1PFD | FMC_PFAPR_M0PFD,
|
||||
KINETIS_FMC_PFAPR);
|
||||
|
||||
/* Set clock dividers to desired value */
|
||||
|
||||
putreg32(SIM_CLKDIV1_OUTDIV1(div1) | SIM_CLKDIV1_OUTDIV2(div2) |
|
||||
SIM_CLKDIV1_OUTDIV3(div3) | SIM_CLKDIV1_OUTDIV4(div4),
|
||||
KINETIS_SIM_CLKDIV1);
|
||||
|
||||
/* Wait for dividers to change */
|
||||
|
||||
for (i = 0 ; i < div4 ; i++);
|
||||
|
||||
/* Re-store saved value of FMC_PFAPR */
|
||||
|
||||
putreg32(regval, KINETIS_FMC_PFAPR);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_clockconfig
|
||||
*
|
||||
* Description:
|
||||
* Called to initialize the Kinetis chip. This does whatever setup is needed to
|
||||
* put the MCU in a usable state. This includes the initialization of clocking
|
||||
* using the settings in board.h.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void kinetis_clockconfig(void)
|
||||
{
|
||||
#warning "Missing logic"
|
||||
}
|
||||
|
@ -207,14 +207,14 @@
|
||||
/* Bits 0-23: Reserved */
|
||||
#define SIM_SOPT6_RSTFLTSEL_SHIFT (24) /* Bits 24-28: Reset pin filter select */
|
||||
#define SIM_SOPT6_RSTFLTSEL_MASK (31 << SIM_SOPT6_RSTFLTSEL_SHIFT)
|
||||
# SIM_SOPT6_RSTFLTSEL(n) (((n)-1) << SIM_SOPT6_RSTFLTSEL_SHIFT) /* Bux clock filter count n, n=1..32 */
|
||||
# define SIM_SOPT6_RSTFLTSEL(n) (((n)-1) << SIM_SOPT6_RSTFLTSEL_SHIFT) /* Bux clock filter count n, n=1..32 */
|
||||
#define SIM_SOPT6_RSTFLTEN_SHIFT (29) /* Bits 29-31: Reset pin filter enable */
|
||||
#define SIM_SOPT6_RSTFLTEN_MASK (7 << SIM_SOPT6_RSTFLTEN_SHIFT)
|
||||
#define SIM_SOPT6_RSTFLTEN_DISABLED (0 << SIM_SOPT6_RSTFLTEN_SHIFT) /* All filtering disabled */
|
||||
# define SIM_SOPT6_RSTFLTEN_ BUSCLK1 (1 << SIM_SOPT6_RSTFLTEN_SHIFT) /* Bus clock filter enabled (normal); LPO clock filter enabled (stop) */
|
||||
# define SIM_SOPT6_RSTFLTEN_ LPO1 (2 << SIM_SOPT6_RSTFLTEN_SHIFT) /* LPO clock filter enabled */
|
||||
# define SIM_SOPT6_RSTFLTEN_ BUSCLK2 (3 << SIM_SOPT6_RSTFLTEN_SHIFT) /* Bus clock filter enabled (normal); All filtering disabled (stop) */
|
||||
# define SIM_SOPT6_RSTFLTEN_ LPO2 (4 << SIM_SOPT6_RSTFLTEN_SHIFT) /* PO clock filter enabled (normal); All filtering disabled (stop) */
|
||||
# define SIM_SOPT6_RSTFLTEN_BUSCLK1 (1 << SIM_SOPT6_RSTFLTEN_SHIFT) /* Bus clock filter enabled (normal); LPO clock filter enabled (stop) */
|
||||
# define SIM_SOPT6_RSTFLTEN_LPO1 (2 << SIM_SOPT6_RSTFLTEN_SHIFT) /* LPO clock filter enabled */
|
||||
# define SIM_SOPT6_RSTFLTEN_BUSCLK2 (3 << SIM_SOPT6_RSTFLTEN_SHIFT) /* Bus clock filter enabled (normal); All filtering disabled (stop) */
|
||||
# define SIM_SOPT6_RSTFLTEN_LPO2 (4 << SIM_SOPT6_RSTFLTEN_SHIFT) /* PO clock filter enabled (normal); All filtering disabled (stop) */
|
||||
|
||||
/* System Options Register 7 */
|
||||
|
||||
@ -385,80 +385,80 @@
|
||||
/* Bits 0-15: Reserved */
|
||||
#define SIM_CLKDIV1_OUTDIV4_SHIFT (16) /* Bits 16-19: Clock 4 output divider value */
|
||||
#define SIM_CLKDIV1_OUTDIV4_MASK (15 << SIM_CLKDIV1_OUTDIV4_SHIFT)
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV(n) (((n)-1) << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV1 (0 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV2 (1 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV3 (2 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV4 (3 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV5 (4 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV6 (5 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV7 (6 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV8 (7 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV9 (8 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV10 (9 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV11 (10 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV12 (11 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV13 (12 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV14 (13 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV15 (14 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_DIV16 (15 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 16 */
|
||||
# define SIM_CLKDIV1_OUTDIV4(n) (((n)-1) << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_1 (0 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_2 (1 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_3 (2 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_4 (3 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_5 (4 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_6 (5 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_7 (6 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_8 (7 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_9 (8 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_10 (9 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_11 (10 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_12 (11 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_13 (12 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_14 (13 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_15 (14 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV4_16 (15 << SIM_CLKDIV1_OUTDIV4_SHIFT) /* Divide by 16 */
|
||||
#define SIM_CLKDIV1_OUTDIV3_SHIFT (20) /* Bits 20-23: Clock 3 output divider value */
|
||||
#define SIM_CLKDIV1_OUTDIV3_MASK (15 << SIM_CLKDIV1_OUTDIV3_SHIFT)
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV(n) (((n)-1) << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV1 (0 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV2 (1 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV3 (2 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV4 (3 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV5 (4 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV6 (5 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV7 (6 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV8 (7 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV9 (8 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV10 (9 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV11 (10 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV12 (11 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV13 (12 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV14 (13 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV15 (14 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_DIV16 (15 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 16 */
|
||||
# define SIM_CLKDIV1_OUTDIV3(n) (((n)-1) << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_1 (0 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_2 (1 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_3 (2 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_4 (3 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_5 (4 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_6 (5 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_7 (6 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_8 (7 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_9 (8 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_10 (9 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_11 (10 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_12 (11 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_13 (12 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_14 (13 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_15 (14 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV3_16 (15 << SIM_CLKDIV1_OUTDIV3_SHIFT) /* Divide by 16 */
|
||||
#define SIM_CLKDIV1_OUTDIV2_SHIFT (24) /* Bits 24-27: Clock 2 output divider value */
|
||||
#define SIM_CLKDIV1_OUTDIV2_MASK (15 << SIM_CLKDIV1_OUTDIV2_SHIFT)
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV(n) (((n)-1) << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV1 (0 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV2 (1 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV3 (2 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV4 (3 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV5 (4 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV6 (5 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV7 (6 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV8 (7 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV9 (8 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV10 (9 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV11 (10 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV12 (11 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV13 (12 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV14 (13 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV15 (14 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_DIV16 (15 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 16 */
|
||||
# define SIM_CLKDIV1_OUTDIV2(n) (((n)-1) << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_1 (0 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_2 (1 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_3 (2 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_4 (3 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_5 (4 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_6 (5 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_7 (6 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_8 (7 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_9 (8 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_10 (9 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_11 (10 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_12 (11 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_13 (12 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_14 (13 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_15 (14 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV2_16 (15 << SIM_CLKDIV1_OUTDIV2_SHIFT) /* Divide by 16 */
|
||||
#define SIM_CLKDIV1_OUTDIV1_SHIFT (28) /* Bits 28-31: Clock 1 output divider value */
|
||||
#define SIM_CLKDIV1_OUTDIV1_MASK (15 << SIM_CLKDIV1_OUTDIV1_SHIFT)
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV(n) (((n)-1) << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV1 (0 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV2 (1 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV3 (2 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV4 (3 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV5 (4 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV6 (5 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV7 (6 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV8 (7 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV9 (8 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV10 (9 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV11 (10 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV12 (11 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV13 (12 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV14 (13 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV15 (14 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_DIV16 (15 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 16 */
|
||||
# define SIM_CLKDIV1_OUTDIV1(n) (((n)-1) << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by n, n=1..16 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_1 (0 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 1 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_2 (1 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 2 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_3 (2 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 3 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_4 (3 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 4 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_5 (4 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 5 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_6 (5 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 6 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_7 (6 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 7 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_8 (7 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 8 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_9 (8 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 9 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_10 (9 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 10 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_11 (10 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 11 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_12 (11 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 12 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_13 (12 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 13 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_14 (13 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 14 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_15 (14 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 15 */
|
||||
# define SIM_CLKDIV1_OUTDIV1_16 (15 << SIM_CLKDIV1_OUTDIV1_SHIFT) /* Divide by 16 */
|
||||
|
||||
/* System Clock Divider Register 2 */
|
||||
|
||||
|
@ -99,6 +99,10 @@ void __start(void)
|
||||
const uint32_t *src;
|
||||
uint32_t *dest;
|
||||
|
||||
/* Disable the watchdog timer */
|
||||
|
||||
kinetis_wddisable();
|
||||
|
||||
/* Configure the uart so that we can get debug output as soon as possible */
|
||||
|
||||
kinetis_clockconfig();
|
||||
@ -127,22 +131,41 @@ void __start(void)
|
||||
}
|
||||
showprogress('C');
|
||||
|
||||
/* Copy any necessary code sections from FLASH to RAM. The correct
|
||||
* destination in SRAM is geive by _sramfuncs and _eramfuncs. The
|
||||
* temporary location is in flash after the data initalization code
|
||||
* at _framfuncs
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_BOOT_RAMFUNCS
|
||||
for (src = &_framfuncs, dest = &_sramfuncs; dest < &_eramfuncs; )
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
#endif
|
||||
showprogress('E');
|
||||
|
||||
|
||||
/* Perform early serial initialization */
|
||||
|
||||
#ifdef CONFIG_USE_EARLYSERIALINIT
|
||||
up_earlyserialinit();
|
||||
#endif
|
||||
showprogress('D');
|
||||
showprogress('F');
|
||||
|
||||
/* Initialize onboard resources */
|
||||
|
||||
kinetis_boardinitialize();
|
||||
showprogress('E');
|
||||
showprogress('G');
|
||||
showprogress('\r');
|
||||
showprogress('\n');
|
||||
|
||||
/* Show reset status */
|
||||
|
||||
dbg("Reset status: %02x:%02x\n", getreg8(KINETIS_SMC_SRSH), getreg8(KINETIS_SMC_SRSL));
|
||||
|
||||
/* Then start NuttX */
|
||||
|
||||
showprogress('\r');
|
||||
showprogress('\n');
|
||||
os_start();
|
||||
|
||||
/* Shouldn't get here */
|
||||
|
117
arch/arm/src/kinetis/kinetis_wdog.c
Normal file
117
arch/arm/src/kinetis/kinetis_wdog.c
Normal file
@ -0,0 +1,117 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/kinetis/kinetis_wdog.c
|
||||
* arch/arm/src/chip/kinetis_wdog.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "kinetis_internal.h"
|
||||
#include "kinetis_wdog.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kinetis_wdunlock
|
||||
*
|
||||
* Description:
|
||||
* Watchdog timer unlock routine. Writing 0xc520 followed by 0xd928 will
|
||||
* unlock the write once registers in the WDOG so they are writable
|
||||
* within the WCT period.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void kinetis_wdunlock(void)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* This sequence must execute within 20 clock cycles. Disable interrupts
|
||||
* to assure that the following steps are atomic.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
|
||||
/* Write 0xC520 followed by 0xD928 to the unlock register */
|
||||
|
||||
putreg16(0xc520, KINETIS_WDOG_UNLOCK);
|
||||
putreg16(0xd928, KINETIS_WDOG_UNLOCK);
|
||||
irqrestore(flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kinetis_wddisable
|
||||
*
|
||||
* Description:
|
||||
* Disable the watchdog timer
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void kinetis_wddisable(void)
|
||||
{
|
||||
uint16_t regval;
|
||||
|
||||
/* Unlock the watchdog so that we can write to registers */
|
||||
|
||||
kinetis_wdunlock();
|
||||
|
||||
/* Clear the WDOGEN bit to disable the watchdog */
|
||||
|
||||
regval = getreg16(KINETIS_WDOG_STCTRLH);
|
||||
regval &= ~WDOG_STCTRLH_WDOGEN;
|
||||
putreg16(regval, KINETIS_WDOG_STCTRLH);
|
||||
}
|
@ -1052,6 +1052,8 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
operation from FLASH but must copy initialized .data sections to RAM.
|
||||
CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
|
||||
but copy themselves entirely into RAM for better performance.
|
||||
CONFIG_BOOT_RAMFUNCS - Other configurations may copy just some functions
|
||||
into RAM, either for better performance or for errata workarounds.
|
||||
CONFIG_STACK_POINTER - The initial stack pointer
|
||||
CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
|
||||
This is the thread that (1) performs the inital boot of the system up
|
||||
|
@ -822,6 +822,8 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
|
||||
# (should also be =n for the KwikStik-K40 which always runs from flash)
|
||||
# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
|
||||
# but copy themselves entirely into RAM for better performance.
|
||||
# CONFIG_BOOT_RAMFUNCS - Other configurations may copy just some functions
|
||||
# into RAM, either for better performance or for errata workarounds.
|
||||
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
|
||||
# all stack operations outside of the nuttx model.
|
||||
# CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
|
||||
@ -839,6 +841,7 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
|
||||
#
|
||||
CONFIG_BOOT_RUNFROMFLASH=n
|
||||
CONFIG_BOOT_COPYTORAM=n
|
||||
CONFIG_BOOT_RAMFUNCS=y
|
||||
CONFIG_CUSTOM_STACK=n
|
||||
CONFIG_STACK_POINTER=
|
||||
CONFIG_IDLETHREAD_STACKSIZE=1024
|
||||
|
@ -66,8 +66,6 @@ SECTIONS
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
@ -76,6 +74,16 @@ SECTIONS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
_eronly = LOADADDR(.data);
|
||||
|
||||
.ramfunc ALIGN(4): {
|
||||
_sramfunc_begin = . ;
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfunc_end = . ;
|
||||
} > sram AT > flash
|
||||
|
||||
_framfunc = LOADADDR(.ramfunc);
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >sram
|
||||
|
Loading…
Reference in New Issue
Block a user