mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-06-24 00:21:05 +08:00
*** EFM32 branch ***
1. Upgrade Cortex driver library (CMSIS -> CMSIS & Device): version 2.3.2 -> 3.0.1 & 3.0.0 - Remove "bsp/efm32/Libraries/CMSIS/Lib/ARM", "bsp/efm32/Libraries/CMSIS/Lib/G++" and "bsp/efm32/Libraries/CMSIS/SVD" to save space 2. Upgrade EFM32 driver libraries (efm32lib -> emlib): version 2.3.2 -> 3.0.0 - Remove "bsp/efm32/Libraries/Device/EnergyMicro/EFM32LG" and "bsp/efm32/Libraries/Device/EnergyMicro/EFM32TG" to save space 3. Upgrade EFM32GG_DK3750 development kit driver library: version 1.2.2 -> 2.0.1 4. Upgrade EFM32_Gxxx_DK development kit driver library: version 1.7.3 -> 2.0.1 5. Add energy management unit driver and test code 6. Modify linker script and related code to compatible with new version of libraries 7. Change EFM32 branch version number to 1.0 8. Add photo frame demo application git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2122 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief EFM32GG_DK3750 board support package
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -26,14 +33,15 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************//**
|
||||
/**************************************************************************//**
|
||||
* @addtogroup BSP
|
||||
* @{
|
||||
******************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
#include "efm32.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "em_gpio.h"
|
||||
#include "em_cmu.h"
|
||||
#include "em_usart.h"
|
||||
#include "dvk.h"
|
||||
#include "dvk_bcregisters.h"
|
||||
|
||||
@@ -41,7 +49,7 @@
|
||||
DVK_Init_TypeDef dvkOperationMode;
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Initialize EMF32GG_DK3750 board support package functionality
|
||||
* @brief Initialize EFM32GG_DK3750 board support package functionality
|
||||
* @param[in] mode Initialize in EBI or SPI mode
|
||||
*****************************************************************************/
|
||||
void DVK_init(DVK_Init_TypeDef mode)
|
||||
@@ -158,7 +166,8 @@ uint16_t DVK_getLEDs(void)
|
||||
/**************************************************************************//**
|
||||
* @brief DK3750 Peripheral Access Control
|
||||
* Enable or disable access to on-board peripherals through switches
|
||||
* and SPI switch where applicable
|
||||
* and SPI switch where applicable. Turn off conflicting peripherals when
|
||||
* enabling another.
|
||||
* @param[in] perf
|
||||
* Which peripheral to configure
|
||||
* @param[in] enable
|
||||
@@ -202,6 +211,13 @@ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable)
|
||||
/* Enable Ethernet analog switches */
|
||||
perfControl |= (1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl |= (1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
|
||||
/* Disable Analog Diff Input - pins PD0 and PD1 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_ANALOG_DIFF_SHIFT);
|
||||
/* Disable Touch Inputs - pin PD3 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_TOUCH_SHIFT);
|
||||
/* Disable Analog SE Input - pin PD2 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_ANALOG_SE_SHIFT);
|
||||
break;
|
||||
|
||||
case DVK_I2S:
|
||||
@@ -213,6 +229,13 @@ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable)
|
||||
perfControl |= (1 << BC_PERICON_AUDIO_OUT_SEL_SHIFT);
|
||||
perfControl |= (1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
|
||||
/* Disable Analog Diff Input - pins PD0 and PD1 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_ANALOG_DIFF_SHIFT);
|
||||
/* Disable Touch Inputs - pin PD3 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_TOUCH_SHIFT);
|
||||
/* Disable Analog SE Input - pin PD2 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_ANALOG_SE_SHIFT);
|
||||
break;
|
||||
|
||||
case DVK_TRACE:
|
||||
@@ -221,6 +244,10 @@ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable)
|
||||
|
||||
case DVK_TOUCH:
|
||||
perfControl |= (1 << BC_PERICON_TOUCH_SHIFT);
|
||||
/* Disconnect SPI switch, pin PD3 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
DVK_spiControl(DVK_SPI_OFF);
|
||||
break;
|
||||
|
||||
case DVK_AUDIO_IN:
|
||||
@@ -234,10 +261,18 @@ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable)
|
||||
|
||||
case DVK_ANALOG_DIFF:
|
||||
perfControl |= (1 << BC_PERICON_ANALOG_DIFF_SHIFT);
|
||||
/* Disconnect SPI switch, pin PD0 and PD1 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
DVK_spiControl(DVK_SPI_OFF);
|
||||
break;
|
||||
|
||||
case DVK_ANALOG_SE:
|
||||
perfControl |= (1 << BC_PERICON_ANALOG_SE_SHIFT);
|
||||
/* Disconnect SPI switch, pin PD2 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
DVK_spiControl(DVK_SPI_OFF);
|
||||
break;
|
||||
|
||||
case DVK_MICROSD:
|
||||
@@ -249,6 +284,12 @@ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable)
|
||||
DVK_spiControl(DVK_SPI_Display);
|
||||
/* Enable SPI analog switch */
|
||||
perfControl |= (1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
/* Disable Analog Diff Input - pins D0 and D1 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_ANALOG_DIFF_SHIFT);
|
||||
/* Disable Touch Inputs - pin D3 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_TOUCH_SHIFT);
|
||||
/* Disable Analog SE Input - pin D2 is shared */
|
||||
perfControl &= ~(1 << BC_PERICON_ANALOG_SE_SHIFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -275,17 +316,19 @@ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable)
|
||||
break;
|
||||
|
||||
case DVK_ETH:
|
||||
/* Enable Ethernet analog switches */
|
||||
/* Disable SPI interface */
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
DVK_spiControl(DVK_SPI_OFF);
|
||||
break;
|
||||
|
||||
case DVK_I2S:
|
||||
/* Also make surea Audio out is connected for I2S operation */
|
||||
/* Disable SPI interface and audio out */
|
||||
perfControl &= ~(1 << BC_PERICON_AUDIO_OUT_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_AUDIO_OUT_SEL_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
DVK_spiControl(DVK_SPI_OFF);
|
||||
break;
|
||||
|
||||
case DVK_TRACE:
|
||||
@@ -318,8 +361,10 @@ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable)
|
||||
break;
|
||||
|
||||
case DVK_TFT:
|
||||
/* Disable SPI analog switch */
|
||||
/* Disable SPI interface */
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT);
|
||||
perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT);
|
||||
DVK_spiControl(DVK_SPI_OFF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -365,6 +410,11 @@ void DVK_spiControl(DVK_SpiControl_TypeDef device)
|
||||
case DVK_SPI_Display:
|
||||
DVK_writeRegister(&BC_REGISTER->SPI_DEMUX, BC_SPI_DEMUX_SLAVE_DISPLAY);
|
||||
break;
|
||||
|
||||
case DVK_SPI_OFF:
|
||||
USART_Reset(USART1);
|
||||
CMU_ClockEnable(cmuClock_USART1, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief EFM32GG_DK3750 board support package API
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -84,6 +91,7 @@ typedef enum
|
||||
DVK_SPI_Audio, /**< Configure switchable SPI interface to Audio I2S */
|
||||
DVK_SPI_Ethernet, /**< Configure switchable SPI interface to Ethernet */
|
||||
DVK_SPI_Display, /**< Configure switchable SPI interface to SSD2119 */
|
||||
DVK_SPI_OFF, /**< Disable SPI interface */
|
||||
} DVK_SpiControl_TypeDef;
|
||||
|
||||
|
||||
@@ -137,8 +145,8 @@ void DVK_clearInterruptFlags(uint16_t flags);
|
||||
bool DVK_EBI_init(void);
|
||||
void DVK_EBI_disable(void);
|
||||
void DVK_EBI_extendedAddressRange(bool enable);
|
||||
static __INLINE void DVK_EBI_writeRegister(volatile uint16_t *addr, uint16_t data);
|
||||
static __INLINE uint16_t DVK_EBI_readRegister(volatile uint16_t *addr);
|
||||
__STATIC_INLINE void DVK_EBI_writeRegister(volatile uint16_t *addr, uint16_t data);
|
||||
__STATIC_INLINE uint16_t DVK_EBI_readRegister(volatile uint16_t *addr);
|
||||
|
||||
/* SPI access */
|
||||
bool DVK_SPI_init(void);
|
||||
@@ -165,7 +173,7 @@ int DVK_BRD3600A_usbVBUSGetOCFlagState(void);
|
||||
* @param addr Address of board controller register
|
||||
* @param data Data to write into register
|
||||
*****************************************************************************/
|
||||
static __INLINE void DVK_EBI_writeRegister(volatile uint16_t *addr, uint16_t data)
|
||||
__STATIC_INLINE void DVK_EBI_writeRegister(volatile uint16_t *addr, uint16_t data)
|
||||
{
|
||||
*addr = data;
|
||||
}
|
||||
@@ -176,7 +184,7 @@ static __INLINE void DVK_EBI_writeRegister(volatile uint16_t *addr, uint16_t dat
|
||||
* @param addr Register to read from
|
||||
* @return Value of board controller register
|
||||
*****************************************************************************/
|
||||
static __INLINE uint16_t DVK_EBI_readRegister(volatile uint16_t *addr)
|
||||
__STATIC_INLINE uint16_t DVK_EBI_readRegister(volatile uint16_t *addr)
|
||||
{
|
||||
return *addr;
|
||||
}
|
||||
@@ -187,7 +195,7 @@ static __INLINE uint16_t DVK_EBI_readRegister(volatile uint16_t *addr)
|
||||
* @param addr Register to read
|
||||
* @return Value of board controller register
|
||||
*****************************************************************************/
|
||||
static __INLINE uint16_t DVK_readRegister(volatile uint16_t *addr)
|
||||
__STATIC_INLINE uint16_t DVK_readRegister(volatile uint16_t *addr)
|
||||
{
|
||||
if (dvkOperationMode == DVK_Init_EBI)
|
||||
{
|
||||
@@ -205,7 +213,7 @@ static __INLINE uint16_t DVK_readRegister(volatile uint16_t *addr)
|
||||
* @param addr Address to board control register
|
||||
* @param data Data to write into register
|
||||
*****************************************************************************/
|
||||
static __INLINE void DVK_writeRegister(volatile uint16_t *addr, uint16_t data)
|
||||
__STATIC_INLINE void DVK_writeRegister(volatile uint16_t *addr, uint16_t data)
|
||||
{
|
||||
if (dvkOperationMode == DVK_Init_EBI)
|
||||
{
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief Board Control register definitions
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -81,7 +88,7 @@ typedef struct
|
||||
__IO uint16_t ADC_STATUS; /**< 0x22 - AEM ADC SPI interface */
|
||||
__IO uint16_t ADC_READ; /**< 0x24 - AEM ADC SPI interface */
|
||||
|
||||
__IO uint16_t RESERVED2; /**< 0x26 - Reserved */
|
||||
__IO uint16_t CLKRST; /**< 0x26 - Clock and reset control */
|
||||
|
||||
__IO uint16_t HW_VERSION; /**< 0x28 - Hardware version */
|
||||
__IO uint16_t FW_BUILDNO; /**< 0x2A - Firmware build number */
|
||||
@@ -178,12 +185,14 @@ typedef struct
|
||||
#define BC_INTEN_DIP (1 << 1) /**< DIP Switch Interrupt enable */
|
||||
#define BC_INTEN_JOYSTICK (1 << 2) /**< Joystick Interrupt enable */
|
||||
#define BC_INTEN_AEM (1 << 3) /**< AEM Interrupt enable */
|
||||
#define BC_INTEN_ETH (1 << 4) /**< Ethernet Interrupt enable */
|
||||
|
||||
#define BC_INTFLAG_MASK (0x000f) /**< Interrupt flag mask */
|
||||
#define BC_INTFLAG_PB (1 << 0) /**< Push Button interrupt triggered */
|
||||
#define BC_INTFLAG_DIP (1 << 1) /**< DIP interrupt triggered */
|
||||
#define BC_INTFLAG_JOYSTICK (1 << 2) /**< Joystick interrupt triggered */
|
||||
#define BC_INTFLAG_AEM (1 << 3) /**< AEM interrupt triggered */
|
||||
#define BC_INTFLAG_AEM (1 << 3) /**< AEM Interrupt triggered */
|
||||
#define BC_INTFLAG_ETH (1 << 4) /**< Ethernet Interrupt triggered */
|
||||
|
||||
/* Peripheral control registers */
|
||||
#define BC_PERICON_RS232_SHUTDOWN_SHIFT 13 /**< RS232 enable MUX bit */
|
||||
@@ -211,6 +220,10 @@ typedef struct
|
||||
#define BC_ADC_STATUS_DONE (0) /**< ADC Status Done */
|
||||
#define BC_ADC_STATUS_BUSY (1) /**< ADC Status Busy */
|
||||
|
||||
/* Clock and Reset Control */
|
||||
#define BC_CLKRST_FLASH_SHIFT (1 << 1) /**< Flash Reset Control */
|
||||
#define BC_CLKRST_ETH_SHIFT (1 << 2) /**< Ethernet Reset Control */
|
||||
|
||||
/* Hardware version information */
|
||||
#define BC_HW_VERSION_PCB_MASK (0x07f0) /**< PCB Version mask */
|
||||
#define BC_HW_VERSION_PCB_SHIFT (4) /**< PCB Version shift */
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief EFM32GG_DK3750 board support package BRD3600A API implementation
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -32,9 +39,9 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "efm32.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_ebi.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "em_gpio.h"
|
||||
#include "em_ebi.h"
|
||||
#include "em_cmu.h"
|
||||
#include "dvk.h"
|
||||
#include "dvk_bcregisters.h"
|
||||
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief EFM32GG_DK3750 board support package EBI API implementation
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -32,9 +39,9 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "efm32.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_ebi.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "em_gpio.h"
|
||||
#include "em_ebi.h"
|
||||
#include "em_cmu.h"
|
||||
#include "dvk.h"
|
||||
#include "dvk_bcregisters.h"
|
||||
|
||||
@@ -147,7 +154,7 @@ bool DVK_EBI_init(void)
|
||||
ebiConfig.mode = ebiModeD16A16ALE;;
|
||||
ebiConfig.alePolarity = ebiActiveHigh;
|
||||
/* keep blEnable */
|
||||
/* ebiConfig.blEnable = false; - common setting needs to be true for PSRAM */
|
||||
ebiConfig.blEnable = false;
|
||||
ebiConfig.addrHalfALE = true;
|
||||
ebiConfig.readPrefetch = false;
|
||||
ebiConfig.noIdle = true;
|
||||
@@ -206,8 +213,9 @@ bool DVK_EBI_init(void)
|
||||
ebiConfig.csLines = EBI_CS3;
|
||||
ebiConfig.mode = ebiModeD16A16ALE;;
|
||||
ebiConfig.alePolarity = ebiActiveHigh;
|
||||
|
||||
/* keep blEnable */
|
||||
/* ebiConfig.blEnable = false; */
|
||||
ebiConfig.blEnable = true;
|
||||
ebiConfig.addrHalfALE = true;
|
||||
ebiConfig.readPrefetch = false;
|
||||
ebiConfig.noIdle = true;
|
||||
@@ -217,12 +225,12 @@ bool DVK_EBI_init(void)
|
||||
ebiConfig.addrSetupCycles = 0;
|
||||
|
||||
/* Read cycle times */
|
||||
ebiConfig.readStrobeCycles = 7;
|
||||
ebiConfig.readStrobeCycles = 5;
|
||||
ebiConfig.readHoldCycles = 0;
|
||||
ebiConfig.readSetupCycles = 0;
|
||||
|
||||
/* Write cycle times */
|
||||
ebiConfig.writeStrobeCycles = 2;
|
||||
ebiConfig.writeStrobeCycles = 5;
|
||||
ebiConfig.writeHoldCycles = 0;
|
||||
ebiConfig.writeSetupCycles = 0;
|
||||
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief EFM32GG_DK3750 board support package SPI API implementation
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -32,9 +39,9 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "efm32.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_usart.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "em_gpio.h"
|
||||
#include "em_usart.h"
|
||||
#include "em_cmu.h"
|
||||
#include "dvk.h"
|
||||
#include "dvk_bcregisters.h"
|
||||
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief API for enabling SWO or ETM trace on DK3750 board
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -30,10 +37,11 @@
|
||||
* @addtogroup BSP
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "efm32.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "em_gpio.h"
|
||||
#include "em_cmu.h"
|
||||
#include "trace.h"
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Configure EFM32GG990F1024 for DK3750 ETM trace output
|
||||
@@ -66,7 +74,9 @@ void TRACE_ETMSetup(void)
|
||||
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Configure EFM32GG990F1024 for DK3750 SWO trace output
|
||||
* @brief Configure trace output for energyAware Profiler
|
||||
* @note Kit needs to be initialized with SPI-mode;
|
||||
* @verbatim DVK_init(DVK_Init_SPI); @endverbatim
|
||||
*****************************************************************************/
|
||||
void TRACE_SWOSetup(void)
|
||||
{
|
||||
@@ -95,7 +105,6 @@ void TRACE_SWOSetup(void)
|
||||
while(!(CMU->STATUS & CMU_STATUS_AUXHFRCORDY));
|
||||
|
||||
/* Enable trace in core debug */
|
||||
CoreDebug->DHCSR |= 1;
|
||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||
|
||||
/* Enable PC and IRQ sampling output */
|
||||
@@ -112,4 +121,27 @@ void TRACE_SWOSetup(void)
|
||||
ITM->TCR = 0x10009;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Profiler configuration for EFM32GG990F11024/EFM32GG-DK3750
|
||||
* @return true if energyAware Profiler/SWO is enabled, false if not
|
||||
* @note If first word of the user page is zero, this will not
|
||||
* enable SWO profiler output
|
||||
*****************************************************************************/
|
||||
bool TRACE_ProfilerSetup(void)
|
||||
{
|
||||
volatile uint32_t *userData = (uint32_t *) USER_PAGE;
|
||||
|
||||
/* Check magic "trace" word in user page */
|
||||
if(*userData == 0x00000000UL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_SWOSetup();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/** @} (end group BSP) */
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
/**************************************************************************//**
|
||||
* @file
|
||||
* @brief API for enabling SWO or ETM trace on DK3750 board
|
||||
* @brief SWO Trace API (for eAProfiler)
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.2
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -32,8 +39,9 @@
|
||||
* @addtogroup BSP
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "em_msc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -41,6 +49,57 @@ extern "C" {
|
||||
|
||||
void TRACE_ETMSetup(void);
|
||||
void TRACE_SWOSetup(void);
|
||||
bool TRACE_ProfilerSetup(void);
|
||||
|
||||
#define USER_PAGE 0x0FE00000UL
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Set or clear word in user page which enables or disables SWO
|
||||
* for TRACE_ProfilerSetup. If TRACE_ProfilerEnable(false) has been run,
|
||||
* no example project will enable SWO trace.
|
||||
* @param[in] enable
|
||||
* @note Add "em_msc.c" to build to use this function.
|
||||
*****************************************************************************/
|
||||
__STATIC_INLINE void TRACE_ProfilerEnable(bool enable)
|
||||
{
|
||||
uint32_t data;
|
||||
volatile uint32_t *userpage = (uint32_t *) USER_PAGE;
|
||||
|
||||
/* Check that configuration needs to change */
|
||||
data = *userpage;
|
||||
if(enable)
|
||||
{
|
||||
if(data == 0xFFFFFFFF)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(data == 0x00000000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize MSC */
|
||||
MSC_Init();
|
||||
|
||||
/* Write enble or disable trigger word into flash */
|
||||
if(enable)
|
||||
{
|
||||
data = 0xFFFFFFFF;
|
||||
MSC_ErasePage((uint32_t *)USER_PAGE);
|
||||
MSC_WriteWord((uint32_t *)USER_PAGE, (void *) &data, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = 0x00000000;
|
||||
MSC_ErasePage((uint32_t *)USER_PAGE);
|
||||
MSC_WriteWord((uint32_t *)USER_PAGE, (void *) &data, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief DVK board support package, initialization
|
||||
* @author Energy Micro AS
|
||||
* @version 1.7.3
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief DVK Board Support, master header file
|
||||
* @author Energy Micro AS
|
||||
* @version 1.7.3
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief Board Control register definitions
|
||||
* @author Energy Micro AS
|
||||
* @version 1.7.3
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief DVK Peripheral Board Control API implementation
|
||||
* @author Energy Micro AS
|
||||
* @version 1.7.3
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
* @file
|
||||
* @brief DVK Peripheral Board Control, prototypes and definitions
|
||||
* @author Energy Micro AS
|
||||
* @version 1.7.3
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
|
||||
@@ -4,16 +4,23 @@
|
||||
* This implementation works for devices w/o LCD display on the
|
||||
* MCU module, specifically the EFM32_G2xx_DK development board
|
||||
* @author Energy Micro AS
|
||||
* @version 1.7.3
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -28,9 +35,9 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include "efm32.h"
|
||||
#include "efm32_ebi.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "em_ebi.h"
|
||||
#include "em_cmu.h"
|
||||
#include "em_gpio.h"
|
||||
#include "dvk.h"
|
||||
#include "dvk_bcregisters.h"
|
||||
|
||||
|
||||
@@ -4,16 +4,23 @@
|
||||
* This implementation use the USART2 SPI interface to control board
|
||||
* control registers. It works
|
||||
* @author Energy Micro AS
|
||||
* @version 1.7.3
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
|
||||
******************************************************************************
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* This source code is the property of Energy Micro AS. The source and compiled
|
||||
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
@@ -35,9 +42,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "efm32.h"
|
||||
#include "efm32_usart.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "em_usart.h"
|
||||
#include "em_gpio.h"
|
||||
#include "em_cmu.h"
|
||||
#include "dvk.h"
|
||||
#include "dvk_bcregisters.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/**************************************************************************//**
|
||||
* @file
|
||||
* @brief SWO Trace API (for eAProfiler)
|
||||
* @author Energy Micro AS
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
* Software "AS IS", with no express or implied warranties of any kind,
|
||||
* including, but not limited to, any implied warranties of merchantability
|
||||
* or fitness for any particular purpose or warranties against infringement
|
||||
* of any proprietary rights of a third party.
|
||||
*
|
||||
* Energy Micro AS will not be liable for any consequential, incidental, or
|
||||
* special damages, or any other relief, or for any claim by any third party,
|
||||
* arising from your use of this Software.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <stdbool.h>
|
||||
#include "efm32.h"
|
||||
#include "trace.h"
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup BSP
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Configure trace output for energyAware Profiler
|
||||
*****************************************************************************/
|
||||
void TRACE_SWOSetup(void)
|
||||
{
|
||||
uint32_t *dwt_ctrl = (uint32_t *) 0xE0001000;
|
||||
uint32_t *tpiu_prescaler = (uint32_t *) 0xE0040010;
|
||||
uint32_t *tpiu_protocol = (uint32_t *) 0xE00400F0;
|
||||
|
||||
/* Enable GPIO clock */
|
||||
CMU->HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO;
|
||||
|
||||
/* Enable Serial wire output pin */
|
||||
GPIO->ROUTE |= GPIO_ROUTE_SWOPEN;
|
||||
|
||||
/* Set location 1 */
|
||||
GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | GPIO_ROUTE_SWLOCATION_LOC1;
|
||||
|
||||
/* Enable output on pin */
|
||||
GPIO->P[2].MODEH &= ~(_GPIO_P_MODEH_MODE15_MASK);
|
||||
GPIO->P[2].MODEH |= GPIO_P_MODEH_MODE15_PUSHPULL;
|
||||
|
||||
/* Enable debug clock AUXHFRCO */
|
||||
CMU->OSCENCMD = CMU_OSCENCMD_AUXHFRCOEN;
|
||||
|
||||
/* Wait until clock is ready */
|
||||
while(!(CMU->STATUS & CMU_STATUS_AUXHFRCORDY));
|
||||
|
||||
/* Enable trace in core debug */
|
||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||
|
||||
/* Enable PC and IRQ sampling output */
|
||||
*dwt_ctrl = 0x400113FF;
|
||||
|
||||
/* Set TPIU prescaler to 16. */
|
||||
*tpiu_prescaler = 0xf;
|
||||
|
||||
/* Set protocol to NRZ */
|
||||
*tpiu_protocol = 2;
|
||||
|
||||
/* Unlock ITM and output data */
|
||||
ITM->LAR = 0xC5ACCE55;
|
||||
ITM->TCR = 0x10009;
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Profiler configuration
|
||||
* @return true if energyAware Profiler/SWO is enabled, false if not
|
||||
* @note If first word of the user page is zero, this will not
|
||||
* enable SWO profiler output, see trace.h
|
||||
*****************************************************************************/
|
||||
bool TRACE_ProfilerSetup(void)
|
||||
{
|
||||
volatile uint32_t *userData = (uint32_t *) USER_PAGE;
|
||||
|
||||
/* Check magic "trace" word in user page */
|
||||
if(*userData == 0x00000000UL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_SWOSetup();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/** @} (end group BSP) */
|
||||
@@ -0,0 +1,109 @@
|
||||
/**************************************************************************//**
|
||||
* @file
|
||||
* @brief SWO Trace API (for eAProfiler)
|
||||
* @author Energy Micro AS
|
||||
* @version 2.0.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
* 4. The source and compiled code may only be used on Energy Micro "EFM32"
|
||||
* microcontrollers and "EFR4" radios.
|
||||
*
|
||||
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
||||
* obligation to support this Software. Energy Micro AS is providing the
|
||||
* Software "AS IS", with no express or implied warranties of any kind,
|
||||
* including, but not limited to, any implied warranties of merchantability
|
||||
* or fitness for any particular purpose or warranties against infringement
|
||||
* of any proprietary rights of a third party.
|
||||
*
|
||||
* Energy Micro AS will not be liable for any consequential, incidental, or
|
||||
* special damages, or any other relief, or for any claim by any third party,
|
||||
* arising from your use of this Software.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __TRACE_H
|
||||
#define __TRACE_H
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup BSP
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "em_msc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void TRACE_SWOSetup(void);
|
||||
bool TRACE_ProfilerSetup(void);
|
||||
|
||||
#define USER_PAGE 0x0FE00000UL
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Set or clear word in user page which enables or disables SWO
|
||||
* in TRACE_ProfilerSetup. If TRACE_ProfilerEnable(false) has been run,
|
||||
* no example project will enable SWO trace.
|
||||
* @param[in] enable
|
||||
* @note Add "em_msc.c" to build to use this function.
|
||||
*****************************************************************************/
|
||||
__STATIC_INLINE void TRACE_ProfilerEnable(bool enable)
|
||||
{
|
||||
uint32_t data;
|
||||
volatile uint32_t *userpage = (uint32_t *) USER_PAGE;
|
||||
|
||||
/* Check that configuration needs to change */
|
||||
data = *userpage;
|
||||
if(enable)
|
||||
{
|
||||
if(data == 0xFFFFFFFF)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(data == 0x00000000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize MSC */
|
||||
MSC_Init();
|
||||
|
||||
/* Write enble or disable trigger word into flash */
|
||||
if(enable)
|
||||
{
|
||||
data = 0xFFFFFFFF;
|
||||
MSC_ErasePage((uint32_t *)USER_PAGE);
|
||||
MSC_WriteWord((uint32_t *)USER_PAGE, (void *) &data, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = 0x00000000;
|
||||
MSC_ErasePage((uint32_t *)USER_PAGE);
|
||||
MSC_WriteWord((uint32_t *)USER_PAGE, (void *) &data, 4);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} (end group BSP) */
|
||||
|
||||
#endif
|
||||
+116
-113
@@ -1,9 +1,9 @@
|
||||
/***************************************************************************//**
|
||||
* @file efm32_rom_gg.ld
|
||||
* @brief Linker script for EFM32 giant gecko with GNU ld
|
||||
* COPYRIGHT (C) 2011, RT-Thread Development Team
|
||||
* @brief Linker script for EFM32 giant gecko
|
||||
* COPYRIGHT (C) 2012, RT-Thread Development Team
|
||||
* @author onelife
|
||||
* @version 0.4 beta
|
||||
* @version 1.0
|
||||
*******************************************************************************
|
||||
* @section License
|
||||
* The license and distribution terms for this file may be found in the file
|
||||
@@ -11,49 +11,71 @@
|
||||
*******************************************************************************
|
||||
* @section Change Logs
|
||||
* Date Author Notes
|
||||
* 2011-12-08 onelife Initial creation for EFM3 giant gecko
|
||||
* support
|
||||
* 2011-12-08 onelife Initial creation for EFM3 giant gecko support
|
||||
* 2012-05-15 onelife Modified to compatible with CMSIS v3
|
||||
******************************************************************************/
|
||||
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||
ENTRY(__cs3_reset)
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lcs3 -lcs3unhosted)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
CODE (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
|
||||
DATA (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 131072
|
||||
}
|
||||
_system_stack_size = 0x200;
|
||||
|
||||
/* These force the linker to search for particular symbols from
|
||||
* the start of the link process and thus ensure the user's
|
||||
* overrides are picked up
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
*/
|
||||
|
||||
EXTERN(__cs3_reset __cs3_reset_efm32)
|
||||
EXTERN(__cs3_start_asm _start)
|
||||
|
||||
PROVIDE(__cs3_reset = __cs3_reset_efm32);
|
||||
PROVIDE(__cs3_start_asm = _start);
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.cs3.interrupt_vector)) /* Startup code */
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.cs3.reset)
|
||||
*(.cs3.init)
|
||||
*(.text) /* remaining code */
|
||||
*(.text.*) /* remaining code */
|
||||
*(.rodata) /* read-only data (constants) */
|
||||
*(.rodata*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.gnu.linkonce.t*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(4);
|
||||
@@ -64,106 +86,87 @@ SECTIONS
|
||||
__vsymtab_start = .;
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
. = ALIGN(4);
|
||||
} > FLASH = 0
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
} > CODE = 0
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
/* .ARM.exidx is sorted, so has to go in its own output section. */
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_sidata = .;
|
||||
} > CODE
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* .data section which is used for initialized data */
|
||||
.data : AT (_sidata)
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_sdata = . ;
|
||||
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
*(.ram)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .data secion */
|
||||
_edata = . ;
|
||||
} >DATA
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
.stack :
|
||||
{
|
||||
. = . + _system_stack_size;
|
||||
. = ALIGN(4);
|
||||
__cs3_stack = .;
|
||||
} >DATA
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .;
|
||||
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
. = ALIGN(4);
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_ebss = . ;
|
||||
.heap :
|
||||
{
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
_end = __end__;
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
*(.bss.init)
|
||||
} > DATA
|
||||
__bss_end = .;
|
||||
_end = .;
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy :
|
||||
{
|
||||
*(.stack)
|
||||
} > RAM
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* DWARF debug sections.
|
||||
* Symbols in the DWARF debugging sections are relative to
|
||||
* the beginning of the section so we begin them at 0.
|
||||
*/
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* DWARF 2.1 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
|
||||
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
|
||||
.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) }
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
/**************************************************************************//**
|
||||
* @file core_cm3.c
|
||||
* @brief CMSIS Cortex-M3 Core Peripheral Access Layer Source File
|
||||
* @version V2.00
|
||||
* @date 13. September 2010
|
||||
*
|
||||
* @note
|
||||
* Copyright (C) 2009-2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* @par
|
||||
* ARM Limited (ARM) is supplying this software for use with Cortex-M
|
||||
* processor based microcontrollers. This file can be freely distributed
|
||||
* within development tools that are supporting such ARM based processors.
|
||||
*
|
||||
* @par
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
||||
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
||||
* ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
||||
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* define compiler specific symbols */
|
||||
#if defined ( __CC_ARM )
|
||||
#define __ASM __asm /*!< asm keyword for ARM Compiler */
|
||||
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
|
||||
|
||||
#elif defined ( __ICCARM__ )
|
||||
#define __ASM __asm /*!< asm keyword for IAR Compiler */
|
||||
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only avaiable in High optimization mode! */
|
||||
|
||||
#elif defined ( __GNUC__ )
|
||||
#define __ASM __asm /*!< asm keyword for GNU Compiler */
|
||||
#define __INLINE inline /*!< inline keyword for GNU Compiler */
|
||||
|
||||
#elif defined ( __TASKING__ )
|
||||
#define __ASM __asm /*!< asm keyword for TASKING Compiler */
|
||||
#define __INLINE inline /*!< inline keyword for TASKING Compiler */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* ########################## Core Instruction Access ######################### */
|
||||
|
||||
#if defined ( __CC_ARM ) /*------------------ RealView Compiler ----------------*/
|
||||
|
||||
/** \brief Reverse byte order (16 bit)
|
||||
|
||||
This function reverses the byte order in two unsigned short values.
|
||||
|
||||
\param [in] value Value to reverse
|
||||
\return Reversed value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400677)
|
||||
__ASM uint32_t __REV16(uint32_t value)
|
||||
{
|
||||
rev16 r0, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Reverse byte order in signed short value
|
||||
|
||||
This function reverses the byte order in a signed short value with sign extension to integer.
|
||||
|
||||
\param [in] value Value to reverse
|
||||
\return Reversed value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400677)
|
||||
__ASM int32_t __REVSH(int32_t value)
|
||||
{
|
||||
revsh r0, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Remove the exclusive lock
|
||||
|
||||
This function removes the exclusive lock which is created by LDREX.
|
||||
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM void __CLREX(void)
|
||||
{
|
||||
clrex
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
#elif (defined (__ICCARM__)) /*---------------- ICC Compiler ---------------------*/
|
||||
/* obsolete */
|
||||
#elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
|
||||
/* obsolete */
|
||||
#elif (defined (__TASKING__)) /*--------------- TASKING Compiler -----------------*/
|
||||
/* obsolete */
|
||||
#endif
|
||||
|
||||
|
||||
/* ########################### Core Function Access ########################### */
|
||||
|
||||
#if defined ( __CC_ARM ) /*------------------ RealView Compiler ----------------*/
|
||||
|
||||
/** \brief Get Control Register
|
||||
|
||||
This function returns the content of the Control Register.
|
||||
|
||||
\return Control Register value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_CONTROL(void)
|
||||
{
|
||||
mrs r0, control
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Set Control Register
|
||||
|
||||
This function writes the given value to the Control Register.
|
||||
|
||||
\param [in] control Control Register value to set
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM void __set_CONTROL(uint32_t control)
|
||||
{
|
||||
msr control, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Get ISPR Register
|
||||
|
||||
This function returns the content of the ISPR Register.
|
||||
|
||||
\return ISPR Register value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_IPSR(void)
|
||||
{
|
||||
mrs r0, ipsr
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Get APSR Register
|
||||
|
||||
This function returns the content of the APSR Register.
|
||||
|
||||
\return APSR Register value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_APSR(void)
|
||||
{
|
||||
mrs r0, apsr
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Get xPSR Register
|
||||
|
||||
This function returns the content of the xPSR Register.
|
||||
|
||||
\return xPSR Register value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_xPSR(void)
|
||||
{
|
||||
mrs r0, xpsr
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Get Process Stack Pointer
|
||||
|
||||
This function returns the current value of the Process Stack Pointer (PSP).
|
||||
|
||||
\return PSP Register value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_PSP(void)
|
||||
{
|
||||
mrs r0, psp
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Set Process Stack Pointer
|
||||
|
||||
This function assigns the given value to the Process Stack Pointer (PSP).
|
||||
|
||||
\param [in] topOfProcStack Process Stack Pointer value to set
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM void __set_PSP(uint32_t topOfProcStack)
|
||||
{
|
||||
msr psp, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Get Main Stack Pointer
|
||||
|
||||
This function returns the current value of the Main Stack Pointer (MSP).
|
||||
|
||||
\return MSP Register value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_MSP(void)
|
||||
{
|
||||
mrs r0, msp
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Set Main Stack Pointer
|
||||
|
||||
This function assigns the given value to the Main Stack Pointer (MSP).
|
||||
|
||||
\param [in] topOfMainStack Main Stack Pointer value to set
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM void __set_MSP(uint32_t mainStackPointer)
|
||||
{
|
||||
msr msp, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Get Base Priority
|
||||
|
||||
This function returns the current value of the Base Priority register.
|
||||
|
||||
\return Base Priority register value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_BASEPRI(void)
|
||||
{
|
||||
mrs r0, basepri
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Set Base Priority
|
||||
|
||||
This function assigns the given value to the Base Priority register.
|
||||
|
||||
\param [in] basePri Base Priority value to set
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM void __set_BASEPRI(uint32_t basePri)
|
||||
{
|
||||
msr basepri, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
/** \brief Get Priority Mask
|
||||
|
||||
This function returns the current state of the priority mask bit from the Priority Mask Register.
|
||||
|
||||
\return Priority Mask value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_PRIMASK(void)
|
||||
{
|
||||
mrs r0, primask
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Set Priority Mask
|
||||
|
||||
This function assigns the given value to the Priority Mask Register.
|
||||
|
||||
\param [in] priMask Priority Mask
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM void __set_PRIMASK(uint32_t priMask)
|
||||
{
|
||||
msr primask, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Get Fault Mask
|
||||
|
||||
This function returns the current value of the Fault Mask Register.
|
||||
|
||||
\return Fault Mask value
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM uint32_t __get_FAULTMASK(void)
|
||||
{
|
||||
mrs r0, faultmask
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
/** \brief Set the Fault Mask
|
||||
|
||||
This function assigns the given value to the Fault Mask Register.
|
||||
|
||||
\param [in] faultMask Fault Mask value value to set
|
||||
*/
|
||||
#if (__ARMCC_VERSION < 400000)
|
||||
__ASM void __set_FAULTMASK(uint32_t faultMask)
|
||||
{
|
||||
msr faultmask, r0
|
||||
bx lr
|
||||
}
|
||||
#endif /* __ARMCC_VERSION */
|
||||
|
||||
|
||||
|
||||
#elif (defined (__ICCARM__)) /*---------------- ICC Compiler ---------------------*/
|
||||
/* obsolete */
|
||||
#elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
|
||||
/* obsolete */
|
||||
#elif (defined (__TASKING__)) /*--------------- TASKING Compiler -----------------*/
|
||||
/* obsolete */
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user