mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
*** EFM32 branch ***
Add missing folder git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1842 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
3c3b3697ad
commit
43ece86f11
8 files changed
+1846
No files matched your search
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
@@ -0,0 +1,107 @@
|
||||
/**************************************************************************//**
|
||||
* @file
|
||||
* @brief EFM32GG_DK3750 board support package BRD3600A API implementation
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 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.
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup BSP
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
#include "efm32.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_ebi.h"
|
||||
#include "efm32_cmu.h"
|
||||
#include "dvk.h"
|
||||
#include "dvk_bcregisters.h"
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Configure BRD3600A on-board peripherals.
|
||||
*****************************************************************************/
|
||||
void DVK_BRD3600A_init(void)
|
||||
{
|
||||
/* Enable CMU GPIO clocks */
|
||||
CMU_ClockEnable(cmuClock_GPIO, true);
|
||||
|
||||
/* USB status LED - configure PE1 as push pull */
|
||||
GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, 0);
|
||||
|
||||
/* USB overcurrent status - configure PE2 as push pull */
|
||||
GPIO_PinModeSet(gpioPortE, 2, gpioModeInput, 0);
|
||||
|
||||
/* USB VBUS switch - configure PF5 as push pull - Default OFF */
|
||||
GPIO_PinModeSet(gpioPortF, 5, gpioModePushPull, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Disable EFM32GG_DK3750 EBI board support package functionality
|
||||
*****************************************************************************/
|
||||
void DVK_BRD3600A_deInit(void)
|
||||
{
|
||||
/* Disable PE1 */
|
||||
GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, 0);
|
||||
|
||||
/* Disable CMU GPIO clocks */
|
||||
CMU_ClockEnable(cmuClock_GPIO, false);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Set state of USB status LED
|
||||
* @param[in] enable Set to true to light LED, false to dim it
|
||||
*****************************************************************************/
|
||||
void DVK_BRD3600A_usbStatusLEDEnable(int enable)
|
||||
{
|
||||
GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, enable);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Enable VBUS switch
|
||||
* @param[in] enable Set to true to enable switch
|
||||
*****************************************************************************/
|
||||
void DVK_BRD3600A_usbVBUSSwitchEnable(int enable)
|
||||
{
|
||||
GPIO_PinModeSet(gpioPortF, 5, gpioModePushPull, enable);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Get state of VBUS switch overcurrent flag
|
||||
*****************************************************************************/
|
||||
int DVK_BRD3600A_usbVBUSGetOCFlagState(void)
|
||||
{
|
||||
return ~GPIO_PinInGet(gpioPortE, 2);
|
||||
}
|
||||
|
||||
/** @} (end group BSP) */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,115 @@
|
||||
/**************************************************************************//**
|
||||
* @file
|
||||
* @brief API for enabling SWO or ETM trace on DK3750 board
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 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.
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************//**
|
||||
* @addtogroup BSP
|
||||
* @{
|
||||
******************************************************************************/
|
||||
|
||||
#include "efm32.h"
|
||||
#include "efm32_gpio.h"
|
||||
#include "efm32_cmu.h"
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Configure EFM32GG990F1024 for DK3750 ETM trace output
|
||||
* @note You need to configure ETM trace on on kit config menu as well!
|
||||
*****************************************************************************/
|
||||
void TRACE_ETMSetup(void)
|
||||
{
|
||||
/* Enable peripheral clocks */
|
||||
CMU->HFCORECLKEN0 |= CMU_HFCORECLKEN0_LE;
|
||||
CMU->HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO;
|
||||
CMU->OSCENCMD = CMU_OSCENCMD_AUXHFRCOEN;
|
||||
|
||||
/* Wait until AUXHFRCO clock is ready */
|
||||
while (!(CMU->STATUS & CMU_STATUS_AUXHFRCORDY)) ;
|
||||
|
||||
/* Enable Port D, pins 3,4,5,6 for ETM Trace Data output */
|
||||
GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE3_MASK) | GPIO_P_MODEL_MODE3_PUSHPULL;
|
||||
GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE4_MASK) | GPIO_P_MODEL_MODE4_PUSHPULL;
|
||||
GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE5_MASK) | GPIO_P_MODEL_MODE5_PUSHPULL;
|
||||
GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE6_MASK) | GPIO_P_MODEL_MODE6_PUSHPULL;
|
||||
|
||||
/* Enable Port D, pin 7 for DBG_TCLK */
|
||||
GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE7_MASK) | GPIO_P_MODEL_MODE7_PUSHPULL;
|
||||
|
||||
/* Configure trace output for alternate location */
|
||||
GPIO->ROUTE = GPIO->ROUTE | GPIO_ROUTE_TCLKPEN | GPIO_ROUTE_TD0PEN | GPIO_ROUTE_TD1PEN
|
||||
| GPIO_ROUTE_TD2PEN | GPIO_ROUTE_TD3PEN
|
||||
| GPIO_ROUTE_ETMLOCATION_LOC0;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************//**
|
||||
* @brief Configure EFM32GG990F1024 for DK3750 SWO trace output
|
||||
*****************************************************************************/
|
||||
void TRACE_SWOSetup(void)
|
||||
{
|
||||
/* Debug logic registers */
|
||||
volatile uint32_t *dwt_ctrl = (uint32_t *) 0xE0001000;
|
||||
volatile uint32_t *tpiu_prescaler = (uint32_t *) 0xE0040010;
|
||||
volatile 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 0 */
|
||||
GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | GPIO_ROUTE_SWLOCATION_LOC0;
|
||||
|
||||
/* Enable output on pin - GPIO Port F, Pin 2 */
|
||||
GPIO->P[5].MODEL &= ~(_GPIO_P_MODEL_MODE2_MASK);
|
||||
GPIO->P[5].MODEL |= GPIO_P_MODEL_MODE2_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->DHCSR |= 1;
|
||||
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;
|
||||
}
|
||||
|
||||
/** @} (end group BSP) */
|
||||
@@ -0,0 +1,51 @@
|
||||
/**************************************************************************//**
|
||||
* @file
|
||||
* @brief API for enabling SWO or ETM trace on DK3750 board
|
||||
* @author Energy Micro AS
|
||||
* @version 1.2.1
|
||||
******************************************************************************
|
||||
* @section License
|
||||
* <b>(C) Copyright 2011 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.
|
||||
*
|
||||
* This copyright notice may not be removed from the source code nor changed.
|
||||
*
|
||||
* 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>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void TRACE_ETMSetup(void);
|
||||
void TRACE_SWOSetup(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} (end group BSP) */
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user