diff --git a/bsp/efm32/EFM32GG_DK3750/SConscript b/bsp/efm32/EFM32GG_DK3750/SConscript
new file mode 100644
index 0000000000..9a5db65b6c
--- /dev/null
+++ b/bsp/efm32/EFM32GG_DK3750/SConscript
@@ -0,0 +1,11 @@
+import rtconfig
+from building import *
+
+if rtconfig.EFM32_BOARD == 'EFM32GG_DK3750':
+ src = Glob('*.c')
+ CPPPATH = [GetCurrentDir()]
+
+ group = DefineGroup('EFM32GG_DK3750', src, depend = [''], CPPPATH = CPPPATH)
+ Return('group')
+else:
+ Return('')
\ No newline at end of file
diff --git a/bsp/efm32/EFM32GG_DK3750/dvk.c b/bsp/efm32/EFM32GG_DK3750/dvk.c
index edd564f543..32fd20cef2 100644
--- a/bsp/efm32/EFM32GG_DK3750/dvk.c
+++ b/bsp/efm32/EFM32GG_DK3750/dvk.c
@@ -2,7 +2,7 @@
* @file
* @brief EFM32GG_DK3750 board support package
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/EFM32GG_DK3750/dvk.h b/bsp/efm32/EFM32GG_DK3750/dvk.h
index 4a82c659a8..a9dad28b5a 100644
--- a/bsp/efm32/EFM32GG_DK3750/dvk.h
+++ b/bsp/efm32/EFM32GG_DK3750/dvk.h
@@ -2,7 +2,7 @@
* @file
* @brief EFM32GG_DK3750 board support package API
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/EFM32GG_DK3750/dvk_bcregisters.h b/bsp/efm32/EFM32GG_DK3750/dvk_bcregisters.h
index e5394f3dab..6002105d02 100644
--- a/bsp/efm32/EFM32GG_DK3750/dvk_bcregisters.h
+++ b/bsp/efm32/EFM32GG_DK3750/dvk_bcregisters.h
@@ -2,7 +2,7 @@
* @file
* @brief Board Control register definitions
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/EFM32GG_DK3750/dvk_brd3600.c b/bsp/efm32/EFM32GG_DK3750/dvk_brd3600.c
index ceb64dd5b2..e239776381 100644
--- a/bsp/efm32/EFM32GG_DK3750/dvk_brd3600.c
+++ b/bsp/efm32/EFM32GG_DK3750/dvk_brd3600.c
@@ -2,7 +2,7 @@
* @file
* @brief EFM32GG_DK3750 board support package BRD3600A API implementation
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/EFM32GG_DK3750/dvk_ebi.c b/bsp/efm32/EFM32GG_DK3750/dvk_ebi.c
index fca23ad9f4..0325c29e48 100644
--- a/bsp/efm32/EFM32GG_DK3750/dvk_ebi.c
+++ b/bsp/efm32/EFM32GG_DK3750/dvk_ebi.c
@@ -2,7 +2,7 @@
* @file
* @brief EFM32GG_DK3750 board support package EBI API implementation
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/EFM32GG_DK3750/dvk_spi.c b/bsp/efm32/EFM32GG_DK3750/dvk_spi.c
index 8d697a371a..ad54cdbc7d 100644
--- a/bsp/efm32/EFM32GG_DK3750/dvk_spi.c
+++ b/bsp/efm32/EFM32GG_DK3750/dvk_spi.c
@@ -2,7 +2,7 @@
* @file
* @brief EFM32GG_DK3750 board support package SPI API implementation
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
@@ -74,12 +74,11 @@ static void SPI_BC_Init(void)
GPIO_PinModeSet(PORT_SPI_CS, PIN_SPI_CS, gpioModePushPull, 1);
/* Configure to use SPI master with manual CS */
- /* For now, configure SPI for worst case 32MHz clock in order to work for all */
+ /* For now, configure SPI for worst case 48MHz clock in order to work for all */
/* configurations. */
bcinit.refFreq = 48000000;
bcinit.baudrate = 7000000;
- USART_Reset(USART_USED);
/* Initialize USART */
USART_InitSync(USART_USED, &bcinit);
@@ -93,6 +92,7 @@ static void SPI_BC_Init(void)
*****************************************************************************/
static void SPI_BC_Disable(void)
{
+ /* Restore and disable USART */
USART_Reset(USART_USED);
GPIO_PinModeSet(PORT_SPI_TX, PIN_SPI_TX, gpioModeDisabled, 0);
@@ -155,12 +155,11 @@ static void SPI_BC_Write(uint8_t addr, uint16_t data)
/**************************************************************************//**
* @brief Performs SPI read from FPGA register
* @param addr Address of register
- * @param data Dummy data
* @return 16-bit value of board controller register
*****************************************************************************/
-static uint16_t SPI_BC_Read(uint8_t addr, uint16_t data)
+static uint16_t SPI_BC_Read(uint8_t addr)
{
- return SPI_BC_Access(addr, 1, data);
+ return SPI_BC_Access(addr, 1, 0);
}
@@ -182,7 +181,6 @@ bool DVK_SPI_init(void)
SPI_BC_Init();
/* Read "board control Magic" register to verify SPI is up and running */
/* if not FPGA is configured to be in EBI mode */
-
bcMagic = DVK_SPI_readRegister(&BC_REGISTER->MAGIC);
if (bcMagic != BC_MAGIC_VALUE)
{
@@ -219,9 +217,10 @@ uint16_t DVK_SPI_readRegister(volatile uint16_t *addr)
SPI_BC_Write(0x01, 0xFF & ((uint32_t) addr >> 16)); /*MSBs of address*/
SPI_BC_Write(0x02, (0x0C000000 & (uint32_t) addr) >> 26); /*Chip select*/
}
- /* Read twice */
- data = SPI_BC_Read(0x03, 0);
- data = SPI_BC_Read(0x03, 0);
+ /* Read twice; when register address has changed we need two SPI transfer
+ * to clock out valid data through board controller FIFOs */
+ data = SPI_BC_Read(0x03);
+ data = SPI_BC_Read(0x03);
lastAddr = addr;
return data;
}
diff --git a/bsp/efm32/EFM32GG_DK3750/trace.c b/bsp/efm32/EFM32GG_DK3750/trace.c
index caeb026d0d..341911c752 100644
--- a/bsp/efm32/EFM32GG_DK3750/trace.c
+++ b/bsp/efm32/EFM32GG_DK3750/trace.c
@@ -2,7 +2,7 @@
* @file
* @brief API for enabling SWO or ETM trace on DK3750 board
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/EFM32GG_DK3750/trace.h b/bsp/efm32/EFM32GG_DK3750/trace.h
index 340480900a..3583c1b727 100644
--- a/bsp/efm32/EFM32GG_DK3750/trace.h
+++ b/bsp/efm32/EFM32GG_DK3750/trace.h
@@ -2,7 +2,7 @@
* @file
* @brief API for enabling SWO or ETM trace on DK3750 board
* @author Energy Micro AS
- * @version 1.2.1
+ * @version 1.2.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/EFM32_Gxxx_DK/SConscript b/bsp/efm32/EFM32_Gxxx_DK/SConscript
new file mode 100644
index 0000000000..d5528ab5e7
--- /dev/null
+++ b/bsp/efm32/EFM32_Gxxx_DK/SConscript
@@ -0,0 +1,11 @@
+import rtconfig
+from building import *
+
+if rtconfig.EFM32_BOARD == 'EFM32_GXXX_DK':
+ src = Glob('*.c')
+ CPPPATH = [GetCurrentDir()]
+
+ group = DefineGroup('EFM32_GXXX_DK', src, depend = [''], CPPPATH = CPPPATH)
+ Return('group')
+else:
+ Return('')
\ No newline at end of file
diff --git a/bsp/efm32/EFM32_Gxxx_DK/dvk.c b/bsp/efm32/EFM32_Gxxx_DK/dvk.c
index 710087d99d..3ceab93742 100644
--- a/bsp/efm32/EFM32_Gxxx_DK/dvk.c
+++ b/bsp/efm32/EFM32_Gxxx_DK/dvk.c
@@ -2,7 +2,7 @@
* @file
* @brief DVK board support package, initialization
* @author Energy Micro AS
- * @version 1.7.2
+ * @version 1.7.3
******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -29,6 +29,11 @@
#include "efm32.h"
#include "dvk.h"
+/***************************************************************************//**
+ * @addtogroup BSP
+ * @{
+ ******************************************************************************/
+
/**************************************************************************//**
* @brief Initializes DVK, configures board control access
*****************************************************************************/
@@ -67,3 +72,5 @@ void DVK_disable(void)
DVK_SPI_disable();
#endif
}
+
+/** @} (end group BSP) */
diff --git a/bsp/efm32/EFM32_Gxxx_DK/dvk.h b/bsp/efm32/EFM32_Gxxx_DK/dvk.h
index 4e3a330fd0..304ac5b072 100644
--- a/bsp/efm32/EFM32_Gxxx_DK/dvk.h
+++ b/bsp/efm32/EFM32_Gxxx_DK/dvk.h
@@ -2,7 +2,7 @@
* @file
* @brief DVK Board Support, master header file
* @author Energy Micro AS
- * @version 1.7.2
+ * @version 1.7.3
******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -29,6 +29,11 @@
#ifndef __DVK_H
#define __DVK_H
+/***************************************************************************//**
+ * @addtogroup BSP
+ * @{
+ ******************************************************************************/
+
#include
#include
#include "dvk_boardcontrol.h"
@@ -131,5 +136,6 @@ void DVK_disable(void);
}
#endif
+/** @} (end group BSP) */
#endif
diff --git a/bsp/efm32/EFM32_Gxxx_DK/dvk_bcregisters.h b/bsp/efm32/EFM32_Gxxx_DK/dvk_bcregisters.h
index ca1b311ade..710b5738b4 100644
--- a/bsp/efm32/EFM32_Gxxx_DK/dvk_bcregisters.h
+++ b/bsp/efm32/EFM32_Gxxx_DK/dvk_bcregisters.h
@@ -2,7 +2,7 @@
* @file
* @brief Board Control register definitions
* @author Energy Micro AS
- * @version 1.7.2
+ * @version 1.7.3
******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -29,6 +29,11 @@
#ifndef __DVK_BCREGISTERS_H
#define __DVK_BCREGISTERS_H
+/***************************************************************************//**
+ * @addtogroup BSP
+ * @{
+ ******************************************************************************/
+
#include
/**************************************************************************//**
@@ -172,3 +177,5 @@
#define BC_INTFLAG_AEM (1 << 3) /**< AEM interrupt triggered */
#endif
+
+/** @} (end group BSP) */
diff --git a/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.c b/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.c
index cdbc74f556..315c7f3ce8 100644
--- a/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.c
+++ b/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.c
@@ -2,7 +2,7 @@
* @file
* @brief DVK Peripheral Board Control API implementation
* @author Energy Micro AS
- * @version 1.7.2
+ * @version 1.7.3
******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -26,6 +26,11 @@
*
*****************************************************************************/
+/***************************************************************************//**
+ * @addtogroup BSP
+ * @{
+ ******************************************************************************/
+
#include "efm32.h"
#include "dvk.h"
#include "dvk_boardcontrol.h"
@@ -246,3 +251,5 @@ uint16_t DVK_getInterruptFlags(void)
{
return DVK_readRegister(BC_INTFLAG);
}
+
+/** @} (end group BSP) */
diff --git a/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.h b/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.h
index d414b21851..d3818ba573 100644
--- a/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.h
+++ b/bsp/efm32/EFM32_Gxxx_DK/dvk_boardcontrol.h
@@ -2,7 +2,7 @@
* @file
* @brief DVK Peripheral Board Control, prototypes and definitions
* @author Energy Micro AS
- * @version 1.7.2
+ * @version 1.7.3
******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -29,6 +29,11 @@
#ifndef __DVK_BOARDCONTROL_H
#define __DVK_BOARDCONTROL_H
+/***************************************************************************//**
+ * @addtogroup BSP
+ * @{
+ ******************************************************************************/
+
#include
#include "dvk_bcregisters.h"
@@ -78,4 +83,7 @@ void DVK_disableInterrupt(uint16_t flags);
uint16_t DVK_getInterruptFlags(void);
void DVK_clearInterruptFlags(uint16_t flags);
+/** @} (end group BSP) */
+
#endif
+
diff --git a/bsp/efm32/EFM32_Gxxx_DK/dvk_ebi.c b/bsp/efm32/EFM32_Gxxx_DK/dvk_ebi.c
index a48b800e93..0dfbd9b121 100644
--- a/bsp/efm32/EFM32_Gxxx_DK/dvk_ebi.c
+++ b/bsp/efm32/EFM32_Gxxx_DK/dvk_ebi.c
@@ -4,7 +4,7 @@
* 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.2
+ * @version 1.7.3
******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -34,6 +34,11 @@
#include "dvk.h"
#include "dvk_bcregisters.h"
+/***************************************************************************//**
+ * @addtogroup BSP
+ * @{
+ ******************************************************************************/
+
#if defined(EBI_PRESENT)
/**************************************************************************//**
* @brief Configure EBI (external bus interface) for Board Control register
@@ -242,3 +247,5 @@ uint16_t DVK_EBI_readRegister(volatile uint16_t *addr)
return *addr;
}
#endif
+
+/** @} (end group BSP) */
diff --git a/bsp/efm32/EFM32_Gxxx_DK/dvk_spi.c b/bsp/efm32/EFM32_Gxxx_DK/dvk_spi.c
index 7af4c89923..63daf56d7f 100644
--- a/bsp/efm32/EFM32_Gxxx_DK/dvk_spi.c
+++ b/bsp/efm32/EFM32_Gxxx_DK/dvk_spi.c
@@ -4,7 +4,7 @@
* This implementation use the USART2 SPI interface to control board
* control registers. It works
* @author Energy Micro AS
- * @version 1.7.2
+ * @version 1.7.3
******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -27,6 +27,12 @@
* arising from your use of this Software.
*
*****************************************************************************/
+
+/***************************************************************************//**
+ * @addtogroup BSP
+ * @{
+ ******************************************************************************/
+
#include
#include "efm32.h"
#include "efm32_usart.h"
@@ -252,3 +258,5 @@ void DVK_SPI_writeRegister(volatile uint16_t *addr, uint16_t data)
spiWrite(0x03, data); /*Data*/
lastAddr = addr;
}
+
+/** @} (end group BSP) */
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32.h
index b30932656e..503eeeb711 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32.h
@@ -9,7 +9,7 @@
* Add "#include "efm32.h" to your source files
* @endverbatim
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f16.h
index 89e9221bd7..035c415fd0 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G200F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f32.h
index 1385722a2b..25e199a287 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G200F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f64.h
index 89e6c391f1..dac5dfd50f 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g200f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G200F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g210f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g210f128.h
index 4db39cca13..540624e7d6 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g210f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g210f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G210F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f128.h
index d87d56cb77..565817eeac 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G222F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f32.h
index 73af882687..02fa5a68ba 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G222F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f64.h
index 23ad73f03d..c8e17be6c2 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g222f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G222F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f128.h
index 88d966764f..e23dc7cbc1 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G230F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f32.h
index 42ef63dcb9..4c5744d5d7 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G230F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f64.h
index 28ddf4a6b8..df592734f2 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g230f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G230F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f128.h
index 00f60897e9..925cdb4182 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G232F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f32.h
index 3491fcaff4..e746fe2d1d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G232F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f64.h
index 2597d080ed..241a57bcd9 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g232f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G232F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f128.h
index 7758e1c590..5c02e51917 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G280F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f32.h
index 96dbfaa01b..b60c04bd77 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G280F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f64.h
index 97d031308d..f948e7b1f8 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g280f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G280F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f128.h
index 3007a0ff8f..dd986a962c 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G290F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f32.h
index 4e84f53ccf..6a49d326d6 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G290F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f64.h
index 470ff898a1..e5d28a5676 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g290f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G290F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f128.h
index d8ca27420e..f7075b3126 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G840F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f32.h
index 9ef1f168ae..144c13a6c3 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G840F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f64.h
index 0972f9dc03..cc5d0dcff9 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g840f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G840F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f128.h
index 437ae55d57..13121c9b46 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G842F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f32.h
index 822a7c9a2f..a23f9d99de 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G842F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f64.h
index 1efe9485ff..2b15481015 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g842f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G842F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f128.h
index 0ef6555370..39ffb24cec 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G880F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f32.h
index 0553c8f8a6..00570c1d52 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G880F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f64.h
index 9efe2fc5f9..1a28d311c3 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g880f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G880F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f128.h
index 2077e21eb5..66a590966e 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G890F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f32.h
index 059afb0338..8eeb46e567 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G890F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f64.h
index 7335a144c7..2d396a6c87 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32g890f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32G890F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f1024.h
index b0fc447199..2ae0cbc841 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG230F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f512.h
index 2064665cb8..fcf4d08a7d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg230f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG230F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f1024.h
index e72600a59c..f3d66eb369 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG232F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f512.h
index c3f280bc8c..6de62f8f00 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg232f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG232F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f1024.h
index ee150de61e..833483047c 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG280F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f512.h
index c07fec41ef..737e37b4fc 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg280f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG280F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f1024.h
index ba333c71ba..9a43b1be0a 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG290F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f512.h
index 2a92e9262c..cf4b319e96 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg290f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG290F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f1024.h
index 1576b00ff9..280660e622 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG295F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f512.h
index 620e1c61d5..0bdc87a8b3 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg295f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG295F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f1024.h
index 6e85bd1b0c..2a9ca3db94 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG330F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f512.h
index b862155f06..dc697be2d4 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg330f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG330F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f1024.h
index b66b2fae87..c83c5c8fc1 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG332F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f512.h
index 2fdd4528a3..3fe6ef8f71 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg332f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG332F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f1024.h
index 36e7137cea..a4728e6968 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG380F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f512.h
index a6e7e7d597..d12d70cf73 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg380f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG380F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f1024.h
index 429ddfc066..986a8a8b3e 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG390F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f512.h
index d8d4169c52..8da32b693d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg390f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG390F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f1024.h
index dc8691737f..a69a42e4d7 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG395F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f512.h
index dcdb024388..ed057e5246 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg395f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG395F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f1024.h
index ace839a26c..a27e18ff23 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG840F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f512.h
index fae4608ed6..fd0ab441c8 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg840f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG840F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f1024.h
index 2d871a81e8..35958c47bd 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG842F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f512.h
index cccc5b7e48..c5a04a2dbe 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg842f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG842F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f1024.h
index 8480a15de9..56522ae31d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG880F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f512.h
index 6c9f89a8a3..6d8169b44e 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg880f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG880F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f1024.h
index dac4e2dfaf..6aa386e9f2 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG890F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f512.h
index 05d161c9a9..6794e70ac0 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg890f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG890F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f1024.h
index 504c81aa33..388e05415c 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG895F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f512.h
index f42a389139..73fd6d4833 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg895f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG895F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f1024.h
index 30b95373f9..48a0d275d9 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG940F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f512.h
index d0c5aa1412..dc2e3e7216 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg940f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG940F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f1024.h
index 3b82453f97..c3a50d1608 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG942F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f512.h
index 7b514f4547..8a20a44e42 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg942f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG942F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f1024.h
index 7165f4237e..0ee695c805 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG980F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f512.h
index c54d13f9b4..e4ed8f43f9 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg980f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG980F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f1024.h
index eb8a3196c5..10b8f19edf 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG990F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f512.h
index ba2de4ba7f..debe85ed53 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg990f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG990F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f1024.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f1024.h
index 4d17471184..a3faa6ca9d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f1024.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f1024.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG995F1024
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f512.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f512.h
index c79d532cec..7109a8364a 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f512.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32gg995f512.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32GG995F512
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f128.h
index 36f9cdf3c1..cde95558ba 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG230F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f256.h
index 29ec564861..504158705b 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG230F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f64.h
index 071e8c6aab..d86bdafe41 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg230f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG230F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f128.h
index 96837ee985..e9a8458d9f 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG232F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f256.h
index d47a0686f3..b6bf3235b7 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG232F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f64.h
index cd353d0609..788f1b0363 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg232f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG232F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f128.h
index 1055522946..444a40d46a 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG280F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f256.h
index 9af4024e8d..141f25e0d3 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG280F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f64.h
index 7540e0b2cc..d33b4f7674 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg280f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG280F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f128.h
index 29c58e8154..446df316e5 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG290F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f256.h
index c2e9912f6c..b2fd7b3d70 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG290F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f64.h
index b9cd00d9e6..8b451923dc 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg290f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG290F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f128.h
index 4daf0ec310..57e3238420 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG295F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f256.h
index e5bce196a4..39767d2fda 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG295F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f64.h
index fc281d5774..1c08bb1365 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg295f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG295F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f128.h
index cc16709e35..28faee45be 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG330F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f256.h
index 1f660a8b54..de38db6bad 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG330F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f64.h
index fd2b94edf8..7decf89f31 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg330f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG330F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f128.h
index 5b751a73bc..ccc79214db 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG332F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f256.h
index 08c8ed1dad..c7f313f2bb 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG332F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f64.h
index 71f5824677..60387fc5f1 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg332f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG332F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f128.h
index 7a0c856e80..ed3e75e7ca 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG380F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f256.h
index 2827ec5874..6a64568a23 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG380F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f64.h
index f4f41eeecc..c0e87e91dd 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg380f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG380F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f128.h
index c6cdf368eb..79e3ae63e8 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG390F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f256.h
index 7f91a9476e..d010edadbf 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG390F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f64.h
index c0d7616472..d23d3dc1f6 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg390f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG390F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f128.h
index d033ba3d94..e1108b0ea5 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG395F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f256.h
index 73110a41aa..dd0ce189dd 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG395F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f64.h
index 93fae5cbf1..d856580640 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg395f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG395F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f128.h
index 5a7fb3b5fe..665e7a11f8 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG840F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f256.h
index 6d2f24ee24..b845b9dad0 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG840F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f64.h
index 8ce4279d14..34e8e02563 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg840f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG840F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f128.h
index c3832faaad..ab784b128b 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG842F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f256.h
index 175419cef6..663cc27a2d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG842F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f64.h
index dbd114ceeb..414a5c67df 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg842f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG842F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f128.h
index e9d5714452..448e63e3c1 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG880F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f256.h
index ec8800a1ae..22984df312 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG880F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f64.h
index aed2dd7e32..49938f9854 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg880f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG880F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f128.h
index 3ae79ec68f..42517f1423 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG890F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f256.h
index 62707292a7..b4f9e3174c 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG890F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f64.h
index b636263aef..922d59228d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg890f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG890F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f128.h
index 39b3bc2f88..e20db252ee 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG895F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f256.h
index 3a8d0df658..db1fef3cf4 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG895F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f64.h
index 3a712f825b..0fafa5f8ca 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg895f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG895F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f128.h
index 0ffef455b6..1c8d9c6458 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG940F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f256.h
index 063eaca883..bcb82a9e8d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG940F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f64.h
index 1935ed808b..63f5331e98 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg940f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG940F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f128.h
index bbd0d59484..45f4211ac2 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG942F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f256.h
index 75899e7eca..8f501ccdbc 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG942F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f64.h
index 91d2e8887c..ab0937a0c1 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg942f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG942F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f128.h
index b00ed7ba6a..b7cbf631b4 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG980F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f256.h
index a003477716..cda5edbb1b 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG980F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f64.h
index 1fb5ee125e..2bbcb58d61 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg980f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG980F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f128.h
index 824c0edba7..52ebc957a9 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG990F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f256.h
index 549b76ccc2..e423afd661 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG990F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f64.h
index 09641505ee..a7aac7d3c8 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg990f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG990F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f128.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f128.h
index 1fcc7abe7c..30894be9ac 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f128.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f128.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG995F128
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f256.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f256.h
index 13a7d3a7f9..31ad7b0922 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f256.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f256.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG995F256
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f64.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f64.h
index 673d9268bf..89cf55298f 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f64.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32lg995f64.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32LG995F64
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f16.h
index 771b9a0bf8..2df81913ba 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG108F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f32.h
index c8525842fb..3aa236aeec 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG108F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f4.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f4.h
index da53f72762..03437c9b3e 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f4.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f4.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG108F4
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f8.h
index c65f1ea552..3ace74fa74 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg108f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG108F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f16.h
index ffea56c651..28aeb5bb2e 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG110F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f32.h
index 733e5451c1..dde826da20 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG110F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f4.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f4.h
index ebb92a62d4..54e2e7273c 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f4.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f4.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG110F4
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f8.h
index 2e74f497e1..980e97f581 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg110f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG110F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f16.h
index eeb65422de..3eb2699b7b 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG210F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f32.h
index eff2ff1128..23caa0897a 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG210F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f8.h
index fe6aaa10be..516338e8a1 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg210f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG210F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f16.h
index 0e3f366517..040cb0ca40 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG222F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f32.h
index b5dee1e90d..e61c58334c 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG222F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f8.h
index 50698728e2..a503752245 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg222f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG222F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f16.h
index c27074d158..18ccc4d299 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG230F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f32.h
index f35425123d..f10aa7ff5d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG230F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f8.h
index 8f25b1c048..ace34d380e 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg230f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG230F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f16.h
index 0aa060e272..bc419cbf6f 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG232F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f32.h
index c4acf7a19e..b7b0d2b431 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG232F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f8.h
index 4fb3810413..01e3fe2399 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg232f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG232F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f16.h
index 203aaedddf..0cde72ae44 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG822F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f32.h
index 9d57687322..1a8cd15967 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG822F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f8.h
index 71c79333ec..51cf6a138f 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg822f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG822F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f16.h
index ae94f1f062..80d17bd7ba 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG840F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f32.h
index bb149dbd3b..b6bced8f8c 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG840F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f8.h
index 35e106d157..c8fd778d48 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg840f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG840F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f16.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f16.h
index 5eeded516c..9296d895ed 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f16.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f16.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG842F16
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f32.h
index 403a4c28e7..58d61f7c3b 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f32.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG842F32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f8.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f8.h
index 25950b1937..42f1cfb9b7 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f8.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/efm32tg842f8.h
@@ -3,7 +3,7 @@
* @brief CMSIS Cortex-M3 Peripheral Access Layer Header File
* for EFM EFM32TG842F8
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32.s
index c4fbc0f376..4bf7116767 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32.s
@@ -2,7 +2,7 @@
; * @file: startup_efm32.s
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
; * for the Energy Micro EFM32 device series
-; * @version 2.3.0
+; * @version 2.3.2
; * @date: January 2011
; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
; *
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32gg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32gg.s
index 0cf033dbd1..8943e3a582 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32gg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32gg.s
@@ -2,7 +2,7 @@
; * @file: startup_efm32.s
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
; * for the Energy Micro EFM32 device series
-; * @version 2.3.0
+; * @version 2.3.2
; * @date: January 2011
; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
; *
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32lg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32lg.s
index 0cf033dbd1..8943e3a582 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32lg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32lg.s
@@ -2,7 +2,7 @@
; * @file: startup_efm32.s
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
; * for the Energy Micro EFM32 device series
-; * @version 2.3.0
+; * @version 2.3.2
; * @date: January 2011
; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
; *
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32tg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32tg.s
index f136c879bf..bd39351080 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32tg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/arm/startup_efm32tg.s
@@ -2,7 +2,7 @@
; * @file: startup_efm32.s
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
; * for the Energy Micro EFM32 device series
-; * @version 2.3.0
+; * @version 2.3.2
; * @date: January 2011
; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
; *
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32.s
index fbf0b35c36..22660a5e54 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32.s
@@ -16,7 +16,7 @@
* they apply.
*
* Energy Micro release version
- * @version 2.3.0
+ * @version 2.3.2
*/
.section ".cs3.interrupt_vector", "ax"
.globl __cs3_interrupt_vector_efm32g
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32gg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32gg.s
index 181362d050..fa5fce5923 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32gg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32gg.s
@@ -1,4 +1,4 @@
-/* Vector table for efm32g
+/* Vector table for efm32gg/lg
*
* Version: Sourcery G++ 4.4-180
* Support: https://support.codesourcery.com/GNUToolchain/
@@ -16,7 +16,7 @@
* they apply.
*
* Energy Micro release version
- * @version 2.3.0
+ * @version 2.3.2
*/
.section ".cs3.interrupt_vector", "ax"
.globl __cs3_interrupt_vector_efm32g
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32lg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32lg.s
index 181362d050..fa5fce5923 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32lg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32lg.s
@@ -1,4 +1,4 @@
-/* Vector table for efm32g
+/* Vector table for efm32gg/lg
*
* Version: Sourcery G++ 4.4-180
* Support: https://support.codesourcery.com/GNUToolchain/
@@ -16,7 +16,7 @@
* they apply.
*
* Energy Micro release version
- * @version 2.3.0
+ * @version 2.3.2
*/
.section ".cs3.interrupt_vector", "ax"
.globl __cs3_interrupt_vector_efm32g
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32tg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32tg.s
index 3b0613552f..621e59c8e8 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32tg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32tg.s
@@ -1,4 +1,4 @@
-/* Vector table for efm32g
+/* Vector table for efm32tg
*
* Version: Sourcery G++ 4.4-180
* Support: https://support.codesourcery.com/GNUToolchain/
@@ -16,7 +16,7 @@
* they apply.
*
* Energy Micro release version
- * @version 2.3.0
+ * @version 2.3.2
*/
.section ".cs3.interrupt_vector", "ax"
.globl __cs3_interrupt_vector_efm32g
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.c b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.c
index fd5906dc63..8883748eaa 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.c
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.c
@@ -2,7 +2,7 @@
* @file
* @brief CMSIS Compatible EFM32 startup file in C for IAR EWARM
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
@@ -238,7 +238,8 @@ __weak void AES_IRQHandler(void)
}
-/* With IAR, the CSTACK size is defined via project options settings */
+/* With IAR, the CSTACK is defined via project options settings */
+#pragma data_alignment=256
#pragma location = ".intvec"
const void * const __vector_table[]= {
&CSTACK$$Limit,
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.s
index 93c7d887c6..1c7c0aaeb1 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32.s
@@ -1,8 +1,8 @@
;/*************************************************************************//**
-; * @file: startup_efm32.s
+; * @file:
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
; * for the Energy Micro 'EFM32G' Device Series
-; * @version 2.3.0
+; * @version 2.3.2
; * @date: January 2011
; *----------------------------------------------------------------------------
; *
@@ -43,7 +43,7 @@
;; Forward declaration of sections.
SECTION CSTACK:DATA:NOROOT(3)
- SECTION .intvec:CODE:NOROOT(2)
+ SECTION .intvec:CODE:NOROOT(8)
EXTERN __iar_program_start
EXTERN SystemInit
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.c b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.c
index af1e72be37..21c1b86ac0 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.c
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.c
@@ -2,7 +2,7 @@
* @file
* @brief CMSIS Compatible EFM32 startup file in Cfor IAR EWARM
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
@@ -284,6 +284,7 @@ __weak void EMU_IRQHandler(void)
/* With IAR, the CSTACK is defined via project options settings */
+#pragma data_alignment=256
#pragma location = ".intvec"
const void * const __vector_table[]= {
&CSTACK$$Limit,
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.s
index d37c48fb9e..efc16589b0 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32gg.s
@@ -1,8 +1,8 @@
;/*************************************************************************//**
-; * @file: startup_efm32.s
+; * @file:
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
-; * for the Energy Micro 'EFM32G' Device Series
-; * @version 2.3.0
+; * for the Energy Micro 'EFM32LG/GG' Device Series
+; * @version 2.3.2
; * @date: January 2011
; *----------------------------------------------------------------------------
; *
@@ -43,7 +43,7 @@
;; Forward declaration of sections.
SECTION CSTACK:DATA:NOROOT(3)
- SECTION .intvec:CODE:NOROOT(2)
+ SECTION .intvec:CODE:NOROOT(8)
EXTERN __iar_program_start
EXTERN SystemInit
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.c b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.c
index af1e72be37..21c1b86ac0 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.c
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.c
@@ -2,7 +2,7 @@
* @file
* @brief CMSIS Compatible EFM32 startup file in Cfor IAR EWARM
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
@@ -284,6 +284,7 @@ __weak void EMU_IRQHandler(void)
/* With IAR, the CSTACK is defined via project options settings */
+#pragma data_alignment=256
#pragma location = ".intvec"
const void * const __vector_table[]= {
&CSTACK$$Limit,
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.s
index d37c48fb9e..efc16589b0 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32lg.s
@@ -1,8 +1,8 @@
;/*************************************************************************//**
-; * @file: startup_efm32.s
+; * @file:
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
-; * for the Energy Micro 'EFM32G' Device Series
-; * @version 2.3.0
+; * for the Energy Micro 'EFM32LG/GG' Device Series
+; * @version 2.3.2
; * @date: January 2011
; *----------------------------------------------------------------------------
; *
@@ -43,7 +43,7 @@
;; Forward declaration of sections.
SECTION CSTACK:DATA:NOROOT(3)
- SECTION .intvec:CODE:NOROOT(2)
+ SECTION .intvec:CODE:NOROOT(8)
EXTERN __iar_program_start
EXTERN SystemInit
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.c b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.c
index c5cb606b01..29036e3c0b 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.c
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.c
@@ -1,8 +1,8 @@
/**************************************************************************//**
* @file
- * @brief CMSIS Compatible EFM32 startup file in Cfor IAR EWARM
+ * @brief CMSIS Compatible EFM32 startup file in C for IAR EWARM
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
@@ -204,6 +204,7 @@ __weak void AES_IRQHandler(void)
/* With IAR, the CSTACK is defined via project options settings */
+#pragma data_alignment=256
#pragma location = ".intvec"
const void * const __vector_table[]= {
&CSTACK$$Limit,
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.s b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.s
index caaf4aa7b5..fde21ee360 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.s
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/iar/startup_efm32tg.s
@@ -1,8 +1,8 @@
;/*************************************************************************//**
-; * @file: startup_efm32.s
+; * @file:
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
-; * for the Energy Micro 'EFM32G' Device Series
-; * @version 2.3.0
+; * for the Energy Micro 'EFM32TG' Device Series
+; * @version 2.3.2
; * @date: January 2011
; *----------------------------------------------------------------------------
; *
@@ -43,7 +43,7 @@
;; Forward declaration of sections.
SECTION CSTACK:DATA:NOROOT(3)
- SECTION .intvec:CODE:NOROOT(2)
+ SECTION .intvec:CODE:NOROOT(8)
EXTERN __iar_program_start
EXTERN SystemInit
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.c b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.c
index 84dabbdf15..03f8f79cbd 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.c
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.c
@@ -2,7 +2,7 @@
* @file
* @brief CMSIS Cortex-M3 Peripheral Access Layer for EFM32 devices.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.h b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.h
index a711ea6761..dc4177bf0d 100644
--- a/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.h
+++ b/bsp/efm32/Libraries/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.h
@@ -2,7 +2,7 @@
* @file
* @brief CMSIS Cortex-M3 Peripheral Access Layer for EFM32 devices.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/SConscript b/bsp/efm32/Libraries/SConscript
index fc8ae147e9..eaaf53f498 100644
--- a/bsp/efm32/Libraries/SConscript
+++ b/bsp/efm32/Libraries/SConscript
@@ -43,19 +43,21 @@ startup_scripts['Gecko'] = 'startup_efm32.s'
startup_scripts['Giant Gecko'] = 'startup_efm32gg.s'
# linker scripts for each EFM32 family
-#linker_scripts = {}
-#linker_scripts['TinyGecko'] = 'efm32tg.ld'
-#linker_scripts['Gecko'] = 'efm32g.ld'
-#linker_scripts['Giant Gecko'] = 'efm32gg.ld'
+linker_scripts = {}
+linker_scripts['TinyGecko'] = 'efm32tg.ld'
+linker_scripts['Gecko'] = 'efm32g.ld'
+linker_scripts['Giant Gecko'] = 'efm32gg.ld'
-# add startup script
-src = src + ['CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/' + startup_scripts[rtconfig.EFM32_FAMILY]]
+startup_scripts[rtconfig.EFM32_FAMILY] = 'CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/' + startup_scripts[rtconfig.EFM32_FAMILY]
+linker_scripts[rtconfig.EFM32_FAMILY] = cwd + '/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/' + linker_scripts[rtconfig.EFM32_FAMILY]
+src = src + [startup_scripts[rtconfig.EFM32_FAMILY]]
path = [cwd + '/efm32lib/inc',
cwd + '/CMSIS/CM3/CoreSupport',
cwd + '/CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32']
CPPDEFINES = [rtconfig.EFM32_TYPE]
+#group = DefineGroup('EFM32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES, LINKFLAGS = linker_scripts[rtconfig.EFM32_FAMILY])
group = DefineGroup('EFM32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
Return('group')
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_acmp.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_acmp.h
index 9e10699aaa..e31cedb8bb 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_acmp.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_acmp.h
@@ -2,7 +2,7 @@
* @file
* @brief Analog Comparator (ACMP) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_adc.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_adc.h
index 63ff796278..f8b3db716f 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_adc.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_adc.h
@@ -2,7 +2,7 @@
* @file
* @brief Analog to Digital Converter (ADC) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_aes.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_aes.h
index 6293753c78..dc3a6e0d18 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_aes.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_aes.h
@@ -3,7 +3,7 @@
* @brief Advanced encryption standard (AES) accelerator peripheral API for
* EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_assert.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_assert.h
index 0a38da1462..f9b53f0ab2 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_assert.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_assert.h
@@ -2,7 +2,7 @@
* @file
* @brief EFM32 peripheral API "assert" implementation.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*
* @details
* By default, EFM32 library assert usage is not included in order to reduce
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_bitband.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_bitband.h
index 52c7e7a54c..686b5410e0 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_bitband.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_bitband.h
@@ -2,7 +2,7 @@
* @file
* @brief Bitband Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_chip.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_chip.h
index 1cd01e4331..edeed18b74 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_chip.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_chip.h
@@ -2,7 +2,7 @@
* @file
* @brief Chip Initialization API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_cmu.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_cmu.h
index 8aad895874..8348ba0bd6 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_cmu.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_cmu.h
@@ -2,7 +2,7 @@
* @file
* @brief Clock management unit (CMU) API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_common.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_common.h
index 3f29719506..527cc927e6 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_common.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_common.h
@@ -2,7 +2,7 @@
* @file
* @brief EFM32 general purpose utilities.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_dac.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_dac.h
index 5f152b9afb..2febcd4cfa 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_dac.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_dac.h
@@ -2,7 +2,7 @@
* @file
* @brief Digital to Analog Converter (DAC) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_dbg.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_dbg.h
index c3c88d2da5..f51a3ca709 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_dbg.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_dbg.h
@@ -2,7 +2,7 @@
* @file
* @brief Debug (DBG) API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_dma.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_dma.h
index ff97629ff8..68eea861eb 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_dma.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_dma.h
@@ -2,7 +2,7 @@
* @file
* @brief Direct memory access (DMA) API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -265,7 +265,6 @@ typedef struct
#endif
-
/** Configuration structure for alternate scatter-gather descriptor. */
typedef struct
{
@@ -330,8 +329,22 @@ typedef struct
/**
* Pointer to the controlblock in memory holding descriptors (channel
* control data structures). This memory must be properly aligned
- * according to requirements. Please refer to the reference manual,
- * DMA chapter for details.
+ * according to requirements.
+ *
+ * Alignment requirements are
+ * a) 5 bits base requirement, bits [4:0]
+ * b) Add the number of bits needed to represent the wanted number
+ * of channels
+ * c) Align structure with this number of bits set to zero
+ *
+ * Examples: 4 channels, 5 + 2 (channels 0 to 3) = 7 bits
+ * 7 bit alignment, 64 byte address alignment
+ * 8 channels, 5 + 3 (channels 0 to 7) = 8 bits
+ * 8 bit alignment, 256 byte address alignment
+ * 12 channels, 5 + 4 (channels 0 to 11) = 9 bits
+ * 9 bit alignment, 512 byte address alignment
+ *
+ * Please refer to the reference manual, DMA chapter for more details.
*
* It is possible to provide a smaller memory block, only covering
* those channels actually used, if not all available channels are used.
@@ -379,6 +392,7 @@ void DMA_CfgDescr(unsigned int channel,
#if defined(_EFM32_GIANT_FAMILY)
void DMA_CfgLoop(unsigned int channel, DMA_CfgLoop_TypeDef *cfg);
void DMA_CfgRect(unsigned int channel, DMA_CfgRect_TypeDef *cfg);
+
/***************************************************************************//**
* @brief
* Clear Loop configuration for channel
@@ -395,7 +409,7 @@ static __INLINE void DMA_ResetLoop(unsigned int channel)
DMA->LOOP0 = _DMA_LOOP0_RESETVALUE;
break;
case 1:
- DMA->LOOP0 = _DMA_LOOP1_RESETVALUE;
+ DMA->LOOP1 = _DMA_LOOP1_RESETVALUE;
break;
default:
break;
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_ebi.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_ebi.h
index 3aa8680dec..35a02da8ce 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_ebi.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_ebi.h
@@ -2,7 +2,7 @@
* @file
* @brief External Bus Iterface (EBI) peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -68,15 +68,15 @@ extern "C" {
******************************* DEFINES ***********************************
******************************************************************************/
-#define EBI_BANK0 (1 << 1) /**< EBI address bank 0 */
-#define EBI_BANK1 (1 << 2) /**< EBI address bank 1 */
-#define EBI_BANK2 (1 << 3) /**< EBI address bank 2 */
-#define EBI_BANK3 (1 << 4) /**< EBI address bank 3 */
+#define EBI_BANK0 (uint32_t)(1 << 1) /**< EBI address bank 0 */
+#define EBI_BANK1 (uint32_t)(1 << 2) /**< EBI address bank 1 */
+#define EBI_BANK2 (uint32_t)(1 << 3) /**< EBI address bank 2 */
+#define EBI_BANK3 (uint32_t)(1 << 4) /**< EBI address bank 3 */
-#define EBI_CS0 (1 << 1) /**< EBI chip select line 0 */
-#define EBI_CS1 (1 << 2) /**< EBI chip select line 1 */
-#define EBI_CS2 (1 << 3) /**< EBI chip select line 2 */
-#define EBI_CS3 (1 << 4) /**< EBI chip select line 3 */
+#define EBI_CS0 (uint32_t)(1 << 1) /**< EBI chip select line 0 */
+#define EBI_CS1 (uint32_t)(1 << 2) /**< EBI chip select line 1 */
+#define EBI_CS2 (uint32_t)(1 << 3) /**< EBI chip select line 2 */
+#define EBI_CS3 (uint32_t)(1 << 4) /**< EBI chip select line 3 */
/*******************************************************************************
******************************** ENUMS ************************************
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_emu.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_emu.h
index 1e1d9bc598..1084c0b482 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_emu.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_emu.h
@@ -2,7 +2,7 @@
* @file
* @brief Energy management unit (EMU) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -46,6 +46,155 @@ extern "C" {
* @{
******************************************************************************/
+/*******************************************************************************
+ ******************************** ENUMS ************************************
+ ******************************************************************************/
+
+#if defined(_EFM32_GIANT_FAMILY)
+/** EM4 duty oscillator */
+typedef enum
+{
+ /** Select ULFRCO as duty oscillator in EM4 */
+ emuEM4Osc_ULFRCO = EMU_EM4CONF_OSC_ULFRCO,
+ /** Select LFXO as duty oscillator in EM4 */
+ emuEM4Osc_LFXO = EMU_EM4CONF_OSC_LFXO,
+ /** Select LFRCO as duty oscillator in EM4 */
+ emuEM4Osc_LFRCO = EMU_EM4CONF_OSC_LFRCO
+} EMU_EM4Osc_TypeDef;
+
+/** Backup Power Voltage Probe types */
+typedef enum
+{
+ /** Disable voltage probe */
+ emuProbe_Disable = EMU_BUCTRL_PROBE_DISABLE,
+ /** Connect probe to VDD_DREG */
+ emuProbe_VDDDReg = EMU_BUCTRL_PROBE_VDDDREG,
+ /** Connect probe to BU_IN */
+ emuProbe_BUIN = EMU_BUCTRL_PROBE_BUIN,
+ /** Connect probe to BU_OUT */
+ emuProbe_BUOUT = EMU_BUCTRL_PROBE_BUOUT
+} EMU_Probe_TypeDef;
+
+/** Backup Power Domain resistor selection */
+typedef enum
+{
+ /** Main power and backup power connected with RES0 series resistance */
+ emuRes_Res0 = EMU_PWRCONF_PWRRES_RES0,
+ /** Main power and backup power connected with RES1 series resistance */
+ emuRes_Res1 = EMU_PWRCONF_PWRRES_RES1,
+ /** Main power and backup power connected with RES2 series resistance */
+ emuRes_Res2 = EMU_PWRCONF_PWRRES_RES2,
+ /** Main power and backup power connected with RES3 series resistance */
+ emuRes_Res3 = EMU_PWRCONF_PWRRES_RES3,
+} EMU_Resistor_TypeDef;
+
+/** Backup Power Domain power connection */
+typedef enum
+{
+ /** No connection between main and backup power */
+ emuPower_None = EMU_BUINACT_PWRCON_NONE,
+ /** Main power and backup power connected through diode,
+ allowing current from backup to main only */
+ emuPower_BUMain = EMU_BUINACT_PWRCON_BUMAIN,
+ /** Main power and backup power connected through diode,
+ allowing current from main to backup only */
+ emuPower_MainBU = EMU_BUINACT_PWRCON_MAINBU,
+ /** Main power and backup power connected without diode */
+ emuPower_NoDiode = EMU_BUINACT_PWRCON_NODIODE,
+} EMU_Power_TypeDef;
+#endif
+
+/*******************************************************************************
+ ******************************* STRUCTS ***********************************
+ ******************************************************************************/
+
+#if defined(_EFM32_GIANT_FAMILY)
+/** Energy Mode 4 initialization structure */
+typedef struct
+{
+ /** Lock configuration of regulator, BOD and oscillator */
+ bool lockConfig;
+ /** EM4 duty oscillator */
+ EMU_EM4Osc_TypeDef osc;
+ /** Wake up on EM4 BURTC interrupt */
+ bool buRtcWakeup;
+ /** Enable EM4 voltage regulator */
+ bool vreg;
+} EMU_EM4Init_TypeDef;
+
+/** Default initialization of EM4 configuration */
+#define EMU_EM4INIT_DEFAULT \
+ { false, /* Dont't lock configuration after it's been set */ \
+ emuEM4Osc_ULFRCO, /* Use default ULFRCO oscillator */ \
+ true, /* Wake up on EM4 BURTC interrupt */ \
+ true, /* Enable VREG */ \
+ }
+
+/** Backup Power Domain Initialization structure */
+typedef struct
+{
+ /* Backup Power Domain power configuration */
+
+ /** Voltage probe select, selects ADC voltage */
+ EMU_Probe_TypeDef probe;
+ /** Enable BOD calibration mode */
+ bool bodCal;
+ /** Enable BU_STAT status pin for active BU mode */
+ bool statusPinEnable;
+
+ /* Backup Power Domain connection configuration */
+ /** Power domain resistor */
+ EMU_Resistor_TypeDef resistor;
+ /** BU_VOUT strong enable */
+ bool voutStrong;
+ /** BU_VOUT medium enable */
+ bool voutMed;
+ /** BU_VOUT weak enable */
+ bool voutWeak;
+
+ /* Backup Power Domain inactive configuration */
+ /** Power connection, when not in Backup Mode */
+ EMU_Power_TypeDef inactivePower;
+ /** Threshold range for backup BOD sensing on VDD_DREG, when not in Backup Mode */
+ uint32_t inactiveThresRange;
+ /** Threshold for backup BOD sesning on VDD_DREG, when not in Backup Mode */
+ uint32_t inactiveThreshold;
+
+ /* Backup Power Domain active configuration */
+ /** Power connection, when in Backup Mode */
+ EMU_Power_TypeDef activePower;
+ /** Threshold range for backup BOD sensing when in Backup Mode */
+ uint32_t activeThresRange;
+ /** Threshold for backup BOD sesning on VDD_DREG, when in Backup Mode */
+ uint32_t activeThreshold;
+
+ /** Enable backup power domain, and release reset, enable BU_VIN pin */
+ bool enable;
+} EMU_BUPDInit_TypeDef;
+
+/** Default */
+#define EMU_BUPDINIT_DEFAULT \
+ { emuProbe_Disable, /* Do not enable voltage probe */ \
+ false, /* Disable BOD calibration mode */ \
+ false, /* Disable BU_STAT pin for backup mode indication */ \
+ \
+ emuRes_Res0, /* RES0 series resistance between main and backup power */ \
+ false, /* Don't enable strong switch */ \
+ false, /* Don't enable medium switch */ \
+ false, /* Don't enable weak switch */ \
+ \
+ emuPower_None, /* No connection between main and backup power (inactive mode) */ \
+ 0, /* Default threshold range for backup BOD sense (inactive mode) */ \
+ 0, /* Default threshold for backup BOD snese (inactive mode) */ \
+ \
+ emuPower_None, /* No connection between main and backup power (active mode) */ \
+ 0, /* Default threshold range for backup BOD sense (active mode) */ \
+ 0, /* Default threshold for backup BOD snese (active mode) */ \
+ \
+ true /* Enable BUPD enter on BOD, enable BU_VIN pin, release BU reset */ \
+ }
+#endif
+
/*******************************************************************************
***************************** PROTOTYPES **********************************
******************************************************************************/
@@ -67,9 +216,21 @@ void EMU_EnterEM3(bool restore);
void EMU_EnterEM4(void);
void EMU_MemPwrDown(uint32_t blocks);
void EMU_UpdateOscConfig(void);
+#if defined(_EFM32_GIANT_FAMILY)
+void EMU_EM4Init(EMU_EM4Init_TypeDef *em4init);
+void EMU_BUPDInit(EMU_BUPDInit_TypeDef *budpdInit);
-static __INLINE void EMU_EM2Block(void);
-static __INLINE void EMU_EM2UnBlock(void);
+/***************************************************************************//**
+ * @brief
+ * Disable BU_VIN support
+ * @param[in] enable
+ * If true, enables BU_VIN input pin support, if false disables it
+ ******************************************************************************/
+static __INLINE void EMU_BUPinEnable(bool enable)
+{
+ BITBAND_Peripheral(&(EMU->ROUTE), _EMU_ROUTE_BUVINPEN_SHIFT, enable);
+}
+#endif
/***************************************************************************//**
* @brief
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_gpio.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_gpio.h
index 916de5a110..5723077262 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_gpio.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_gpio.h
@@ -2,7 +2,7 @@
* @file
* @brief General Purpose IO (GPIO) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_i2c.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_i2c.h
index ca0c6da726..406c18b57e 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_i2c.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_i2c.h
@@ -2,7 +2,7 @@
* @file
* @brief Inter-intergrated circuit (I2C) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_int.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_int.h
index 7c2d222efa..5b4861749d 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_int.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_int.h
@@ -2,7 +2,7 @@
* @file
* @brief Interrupt enable/disable unit API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_lcd.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_lcd.h
index b62c64ae07..76b51952da 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_lcd.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_lcd.h
@@ -2,7 +2,7 @@
* @file
* @brief Liquid Crystal Display (LCD) peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_lesense.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_lesense.h
index a0539e11f2..f23f9c99aa 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_lesense.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_lesense.h
@@ -2,7 +2,7 @@
* @file
* @brief Low Energy Sensor (LESENSE) peripheral API for EFM32 TG/GG devices.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_letimer.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_letimer.h
index 328eb090ab..cebfff4867 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_letimer.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_letimer.h
@@ -2,7 +2,7 @@
* @file
* @brief Low Energy Timer (LETIMER) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_leuart.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_leuart.h
index 9a07e19b53..188745b721 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_leuart.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_leuart.h
@@ -3,7 +3,7 @@
* @brief Low Energy Universal Asynchronous Receiver/Transmitter (LEUART)
* peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_mpu.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_mpu.h
index 760d38c9cd..3b3480b9e2 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_mpu.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_mpu.h
@@ -2,7 +2,7 @@
* @file
* @brief Memory protection unit (MPU) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_msc.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_msc.h
index 4d63cf166e..6213188008 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_msc.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_msc.h
@@ -2,7 +2,7 @@
* @file
* @brief Flash controller module (MSC) peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -39,7 +39,6 @@ extern "C" {
#include "efm32_bitband.h"
-
/***************************************************************************//**
* @addtogroup EFM32_Library
* @{
@@ -82,6 +81,16 @@ typedef enum
} msc_Return_TypeDef;
+#if defined (_EFM32_GIANT_FAMILY)
+/** Strategy for prioritized bus access */
+typedef enum {
+ mscBusStrategyCPU = MSC_READCTRL_BUSSTRATEGY_CPU, /**< Prioritize CPU bus accesses */
+ mscBusStrategyDMA = MSC_READCTRL_BUSSTRATEGY_DMA, /**< Prioritize DMA bus accesses */
+ mscBusStrategyDMAEM2 = MSC_READCTRL_BUSSTRATEGY_DMAEM2, /**< Prioritize DMAEM2 for bus accesses */
+ mscBusStrategyNone = MSC_READCTRL_BUSSTRATEGY_NONE /**< No unit has bus priority */
+} mscBusStrategy_Typedef;
+#endif
+
/*******************************************************************************
************************* PROTOTYPES **************************************
******************************************************************************/
@@ -301,23 +310,50 @@ static __INLINE void MSC_EnableAutoCacheFlush(bool enable)
}
#endif
+
+#if defined(_EFM32_GIANT_FAMILY)
+/***************************************************************************//**
+ * @brief
+ * Configure which unit should get priority on system bus.
+ * @param[in] mode
+ * Unit to prioritize bus accesses for.
+ ******************************************************************************/
+static __INLINE void MSC_BusStrategy(mscBusStrategy_Typedef mode)
+{
+ MSC->READCTRL = (MSC->READCTRL & ~(_MSC_READCTRL_BUSSTRATEGY_MASK))|mode;
+}
+#endif
+
#ifdef __CC_ARM /* MDK-ARM compiler */
msc_Return_TypeDef MSC_WriteWord(uint32_t *address, void const *data, int numBytes);
msc_Return_TypeDef MSC_ErasePage(uint32_t *startAddress);
+#if defined (_EFM32_GIANT_FAMILY)
+msc_Return_TypeDef MSC_MassErase(void);
+#endif
#endif /* __CC_ARM */
#ifdef __ICCARM__ /* IAR compiler */
__ramfunc msc_Return_TypeDef MSC_WriteWord(uint32_t *address, void const *data, int numBytes);
__ramfunc msc_Return_TypeDef MSC_ErasePage(uint32_t *startAddress);
+#if defined (_EFM32_GIANT_FAMILY)
+__ramfunc msc_Return_TypeDef MSC_MassErase(void);
+#endif
#endif /* __ICCARM__ */
#ifdef __GNUC__ /* GCC based compilers */
#ifdef __CROSSWORKS_ARM /* Rowley Crossworks */
msc_Return_TypeDef MSC_WriteWord(uint32_t *address, void const *data, int numBytes) __attribute__ ((section(".fast")));
msc_Return_TypeDef MSC_ErasePage(uint32_t *startAddress) __attribute__ ((section(".fast")));
+#if defined (_EFM32_GIANT_FAMILY)
+msc_Return_TypeDef MSC_MassErase(void) __attribute__ ((section(".fast")));
+#endif
#else /* Sourcery G++ */
msc_Return_TypeDef MSC_WriteWord(uint32_t *address, void const *data, int numBytes) __attribute__ ((section(".ram")));
msc_Return_TypeDef MSC_ErasePage(uint32_t *startAddress) __attribute__ ((section(".ram")));
+#if defined (_EFM32_GIANT_FAMILY)
+msc_Return_TypeDef MSC_MassErase(void) __attribute__ ((section(".ram")));
+#endif
+
#endif /* __GNUC__ */
#endif /* __CROSSWORKS_ARM */
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_opamp.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_opamp.h
index a7a7850803..fd13995da8 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_opamp.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_opamp.h
@@ -2,7 +2,7 @@
* @file
* @brief Operational Amplifier (OPAMP) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_pcnt.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_pcnt.h
index 87329508e3..c4f4490167 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_pcnt.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_pcnt.h
@@ -2,7 +2,7 @@
* @file
* @brief Pulse Counter (PCNT) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_prs.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_prs.h
index b784fa1a04..16101773b8 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_prs.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_prs.h
@@ -2,7 +2,7 @@
* @file
* @brief Peripheral Reflex System (PRS) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_rmu.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_rmu.h
index ad80d65fc1..4adf6956e3 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_rmu.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_rmu.h
@@ -2,7 +2,7 @@
* @file
* @brief Reset Management Unit (RMU) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_rtc.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_rtc.h
index 1c82245d2f..7aa6724cbf 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_rtc.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_rtc.h
@@ -2,7 +2,7 @@
* @file
* @brief Real Time Counter (RTC) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_system.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_system.h
index e1442c6990..ba0871ecd0 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_system.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_system.h
@@ -2,7 +2,7 @@
* @file
* @brief System API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_timer.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_timer.h
index 13471e04ae..ec0dbeba4b 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_timer.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_timer.h
@@ -2,7 +2,7 @@
* @file
* @brief Timer/counter (TIMER) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_usart.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_usart.h
index 8dc8f886c4..7945a62d97 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_usart.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_usart.h
@@ -3,7 +3,7 @@
* @brief Universal synchronous/asynchronous receiver/transmitter (USART/UART)
* peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_vcmp.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_vcmp.h
index 8fed4a3e42..79fa662dba 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_vcmp.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_vcmp.h
@@ -2,7 +2,7 @@
* @file
* @brief Voltage Comparator (VCMP) peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/inc/efm32_wdog.h b/bsp/efm32/Libraries/efm32lib/inc/efm32_wdog.h
index 281aeaf0db..a03db33af6 100644
--- a/bsp/efm32/Libraries/efm32lib/inc/efm32_wdog.h
+++ b/bsp/efm32/Libraries/efm32lib/inc/efm32_wdog.h
@@ -2,7 +2,7 @@
* @file
* @brief Watchdog (WDOG) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_acmp.c b/bsp/efm32/Libraries/efm32lib/src/efm32_acmp.c
index 7716495da3..02be609620 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_acmp.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_acmp.c
@@ -3,7 +3,7 @@
* @brief Analog Comparator (ACMP) peripheral module library implementation
* for EFM32 devices.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_adc.c b/bsp/efm32/Libraries/efm32lib/src/efm32_adc.c
index ff8028ce51..e191293caa 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_adc.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_adc.c
@@ -2,7 +2,7 @@
* @file
* @brief Analog to Digital Converter (ADC) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_aes.c b/bsp/efm32/Libraries/efm32lib/src/efm32_aes.c
index b5e1accfc8..9f285bced5 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_aes.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_aes.c
@@ -3,7 +3,7 @@
* @brief Advanced Encryption Standard (AES) accelerator peripheral API
* for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_assert.c b/bsp/efm32/Libraries/efm32lib/src/efm32_assert.c
index a29c3e67f0..c7ab68ee94 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_assert.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_assert.c
@@ -2,7 +2,7 @@
* @file
* @brief Assert API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_cmu.c b/bsp/efm32/Libraries/efm32lib/src/efm32_cmu.c
index 3a37c676eb..e5cd5c1496 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_cmu.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_cmu.c
@@ -2,7 +2,7 @@
* @file
* @brief Clock management unit (CMU) Peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
@@ -356,8 +356,9 @@ static uint32_t CMU_LFClkGet(unsigned int lfClkBranch)
case _CMU_LFCLKSEL_LFA_HFCORECLKLEDIV2:
#if defined (_EFM32_GIANT_FAMILY)
- /* Giant Gecko can use a /4 divider (and must >32MHz) */
- if((CMU->HFCORECLKDIV & _CMU_HFCORECLKDIV_HFCORECLKLEDIV_MASK) == CMU_HFCORECLKDIV_HFCORECLKLEDIV_DIV4)
+ /* Giant Gecko can use a /4 divider (and must if >32MHz) or HFLE is set */
+ if(((CMU->HFCORECLKDIV & _CMU_HFCORECLKDIV_HFCORECLKLEDIV_MASK) == CMU_HFCORECLKDIV_HFCORECLKLEDIV_DIV4)||
+ (CMU->CTRL & CMU_CTRL_HFLE))
{
ret = SystemCoreClockGet() / 4;
}
@@ -1359,10 +1360,11 @@ void CMU_ClockSelectSet(CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
select = CMU_CMD_HFCLKSEL_HFXO;
osc = cmuOsc_HFXO;
#if defined(_EFM32_GIANT_FAMILY)
- /* Adjust HFXO buffer current for high frequencies */
+ /* Adjust HFXO buffer current for high frequencies, enable HFLE for */
+ /* frequencies above 32MHz */
if(SystemHFXOClockGet() > 32000000)
{
- CMU->CTRL = (CMU->CTRL | _CMU_CTRL_HFXOBUFCUR_MASK);
+ CMU->CTRL |= (_CMU_CTRL_HFXOBUFCUR_MASK|CMU_CTRL_HFLE);
}
#endif
break;
@@ -1449,7 +1451,7 @@ void CMU_ClockSelectSet(CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
if(freq > CMU_MAX_FREQ_1WS)
{
/* Enable CMU HFLE */
- CMU->CTRL |= CMU_CTRL_HFLE;
+ BITBAND_Peripheral(&(CMU->CTRL), _CMU_CTRL_HFLE_SHIFT, 1);
/* Enable DIV4 factor for peripheral clock */
CMU->HFCORECLKDIV = (CMU->HFCORECLKDIV & ~(_CMU_HFCORECLKDIV_HFCORECLKLEDIV_MASK))|
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_dac.c b/bsp/efm32/Libraries/efm32lib/src/efm32_dac.c
index 0698d5d998..7a9c436584 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_dac.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_dac.c
@@ -2,7 +2,7 @@
* @file
* @brief Digital to Analog Coversion (DAC) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_dbg.c b/bsp/efm32/Libraries/efm32lib/src/efm32_dbg.c
index 3bee9c0d46..6db7a6f5f9 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_dbg.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_dbg.c
@@ -2,7 +2,7 @@
* @file
* @brief Debug (DBG) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_dma.c b/bsp/efm32/Libraries/efm32lib/src/efm32_dma.c
index f572157f52..595c799dd9 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_dma.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_dma.c
@@ -2,7 +2,7 @@
* @file
* @brief Direct memory access (DMA) module peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_ebi.c b/bsp/efm32/Libraries/efm32lib/src/efm32_ebi.c
index 2a0f16d826..c60c72b509 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_ebi.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_ebi.c
@@ -2,7 +2,7 @@
* @file
* @brief External Bus Interface (EBI) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_emu.c b/bsp/efm32/Libraries/efm32lib/src/efm32_emu.c
index 53647b94f3..e8b9a141b1 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_emu.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_emu.c
@@ -2,7 +2,7 @@
* @file
* @brief Energy Management Unit (EMU) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -46,13 +46,13 @@
#if (CMU_STATUS_AUXHFRCOENS != CMU_OSCENCMD_AUXHFRCOEN)
#error Conflict in AUXHFRCOENS and AUXHFRCOEN bitpositions
#endif
-#if (CMU_STATUS_HFXCOENS != CMU_OSCENCMD_HFXCOEN)
+#if (CMU_STATUS_HFXOENS != CMU_OSCENCMD_HFXOEN)
#error Conflict in HFXOENS and HFXOEN bitpositions
#endif
#if (CMU_STATUS_LFRCOENS != CMU_OSCENCMD_LFRCOEN)
#error Conflict in LFRCOENS and LFRCOEN bitpositions
#endif
-#if (CMU_STATUS_LFXCOENS != CMU_OSCENCMD_LFXCOEN)
+#if (CMU_STATUS_LFXOENS != CMU_OSCENCMD_LFXOEN)
#error Conflict in LFXOENS and LFXOEN bitpositions
#endif
@@ -380,5 +380,120 @@ void EMU_UpdateOscConfig(void)
}
+#if defined(_EFM32_GIANT_FAMILY)
+/***************************************************************************//**
+ * @brief
+ * Update EMU module with Energy Mode 4 configuration
+ *
+ * @param[in] em4init
+ * Energy Mode 4 configuration structure
+ ******************************************************************************/
+void EMU_EM4Init(EMU_EM4Init_TypeDef *em4init)
+{
+ uint32_t em4conf = EMU->EM4CONF;
+
+ /* Clear fields that will be reconfigured */
+ em4conf &= ~(
+ _EMU_EM4CONF_LOCKCONF_MASK|
+ _EMU_EM4CONF_OSC_MASK|
+ _EMU_EM4CONF_BURTCWU_MASK|
+ _EMU_EM4CONF_VREGEN_MASK);
+
+ /* Configure new settings */
+ em4conf |= (
+ (em4init->lockConfig << _EMU_EM4CONF_LOCKCONF_SHIFT)|
+ (em4init->osc)|
+ (em4init->buRtcWakeup << _EMU_EM4CONF_BURTCWU_SHIFT)|
+ (em4init->vreg << _EMU_EM4CONF_VREGEN_SHIFT));
+
+ /* Apply configuration. Note that lock can be set after this stage. */
+ EMU->EM4CONF = em4conf;
+}
+
+
+/***************************************************************************//**
+ * @brief
+ * Configure BackUp Power Domain settings
+ *
+ * @note
+ * stig note to self: Touches RMU->CTRL BUPD?
+ *
+ * @param[in] bupdInit
+ * Backup power domain initialization structure
+ ******************************************************************************/
+void EMU_BUPDInit(EMU_BUPDInit_TypeDef *bupdInit)
+{
+ uint32_t reg;
+
+ EFM_ASSERT(bupdInit->inactiveThresRange < 4);
+ EFM_ASSERT(bupdInit->inactiveThreshold < 4);
+ EFM_ASSERT(bupdInit->activeThresRange < 4);
+ EFM_ASSERT(bupdInit->activeThreshold < 4);
+
+ /* Set power connection configuration */
+ reg = EMU->PWRCONF & ~(
+ _EMU_PWRCONF_PWRRES_MASK|
+ _EMU_PWRCONF_VOUTSTRONG_MASK|
+ _EMU_PWRCONF_VOUTMED_MASK|
+ _EMU_PWRCONF_VOUTWEAK_MASK);
+
+ reg |= (bupdInit->resistor|
+ (bupdInit->voutStrong << _EMU_PWRCONF_VOUTSTRONG_SHIFT)|
+ (bupdInit->voutMed << _EMU_PWRCONF_VOUTMED_SHIFT)|
+ (bupdInit->voutWeak << _EMU_PWRCONF_VOUTWEAK_SHIFT));
+
+ EMU->PWRCONF = reg;
+
+ /* Set backup domain inactive mode configuration */
+ reg = EMU->BUINACT & ~(
+ _EMU_BUINACT_PWRCON_MASK|
+ _EMU_BUINACT_BUENRANGE_MASK|
+ _EMU_BUINACT_BUENTHRES_MASK);
+
+ reg |= (bupdInit->inactivePower|
+ (bupdInit->inactiveThresRange << _EMU_BUINACT_BUENRANGE_SHIFT)|
+ (bupdInit->inactiveThreshold << _EMU_BUINACT_BUENTHRES_SHIFT));
+
+ EMU->BUINACT = reg;
+
+ /* Set backup domain active mode configuration */
+ reg = EMU->BUACT & ~(
+ _EMU_BUACT_PWRCON_MASK|
+ _EMU_BUACT_BUEXRANGE_MASK|
+ _EMU_BUACT_BUEXTHRES_MASK);
+
+ reg |= (bupdInit->activePower|
+ (bupdInit->activeThresRange << _EMU_BUACT_BUEXRANGE_SHIFT)|
+ (bupdInit->activeThreshold << _EMU_BUACT_BUEXTHRES_SHIFT));
+
+ EMU->BUACT = reg;
+
+ /* Set power control configuration */
+ reg = EMU->BUCTRL & ~(
+ _EMU_BUCTRL_PROBE_MASK|
+ _EMU_BUCTRL_BODCAL_MASK|
+ _EMU_BUCTRL_STATEN_MASK|
+ _EMU_BUCTRL_EN_MASK);
+
+ /* Note use of ->enable to both enable BUPD, use BU_VIN pin input and
+ release reset */
+ reg |= (bupdInit->probe|
+ (bupdInit->bodCal << _EMU_BUCTRL_BODCAL_SHIFT)|
+ (bupdInit->statusPinEnable << _EMU_BUCTRL_STATEN_SHIFT)|
+ (bupdInit->enable << _EMU_BUCTRL_EN_SHIFT));
+
+ /* Enable configuration */
+ EMU->BUCTRL = reg;
+
+ /* If enable is true, enable BU_VIN input power pin, if not disable it */
+ EMU_BUPinEnable(bupdInit->enable);
+
+ /* If enable is true, release BU reset, if not keep reset asserted */
+ BITBAND_Peripheral(&(RMU->CTRL), _RMU_CTRL_BURSTEN_SHIFT, !bupdInit->enable);
+}
+
+#endif
+
+
/** @} (end addtogroup EMU) */
/** @} (end addtogroup EFM32_Library) */
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_gpio.c b/bsp/efm32/Libraries/efm32lib/src/efm32_gpio.c
index 104ebc0ab2..0d188c5b26 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_gpio.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_gpio.c
@@ -3,7 +3,7 @@
* @brief General Purpose IO (GPIO) peripheral API for EFM32
* devices.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_i2c.c b/bsp/efm32/Libraries/efm32lib/src/efm32_i2c.c
index 6315c85bac..d25690e296 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_i2c.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_i2c.c
@@ -2,7 +2,7 @@
* @file
* @brief Inter-integrated Circuit (I2C) Peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_int.c b/bsp/efm32/Libraries/efm32lib/src/efm32_int.c
index 6f08b211b8..41c7dac885 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_int.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_int.c
@@ -2,7 +2,7 @@
* @file
* @brief Interrupt enable/disable unit API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_lcd.c b/bsp/efm32/Libraries/efm32lib/src/efm32_lcd.c
index 85ec1b36cf..c2e4a5111f 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_lcd.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_lcd.c
@@ -2,7 +2,7 @@
* @file
* @brief Liquid Crystal Display (LCD) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_lesense.c b/bsp/efm32/Libraries/efm32lib/src/efm32_lesense.c
index 950f7cf520..c144fe00f0 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_lesense.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_lesense.c
@@ -2,7 +2,7 @@
* @file
* @brief Low Energy Sensor (LESENSE) Peripheral API for EFM32 TG/GG devices.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_letimer.c b/bsp/efm32/Libraries/efm32lib/src/efm32_letimer.c
index 3dbdbc3d50..a6340a5c33 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_letimer.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_letimer.c
@@ -2,7 +2,7 @@
* @file
* @brief Low Energy Timer (LETIMER) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_leuart.c b/bsp/efm32/Libraries/efm32lib/src/efm32_leuart.c
index 55d92a8e31..1001cbc1c5 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_leuart.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_leuart.c
@@ -3,7 +3,7 @@
* @brief Low Energy Universal Asynchronous Receiver/Transmitter (LEUART)
* peripheral module peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_mpu.c b/bsp/efm32/Libraries/efm32lib/src/efm32_mpu.c
index 6aa1cb2319..3c338e98e1 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_mpu.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_mpu.c
@@ -2,7 +2,7 @@
* @file
* @brief Memory Protection Unit (MPU) Peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_msc.c b/bsp/efm32/Libraries/efm32lib/src/efm32_msc.c
index d4c101ecf7..1f14b9fb52 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_msc.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_msc.c
@@ -2,7 +2,7 @@
* @file
* @brief Flash controller (MSC) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -26,6 +26,9 @@
*
******************************************************************************/
#include "efm32_msc.h"
+#if defined (_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
+#include "efm32_cmu.h"
+#endif
#include "efm32_assert.h"
/***************************************************************************//**
@@ -46,15 +49,51 @@
/***************************************************************************//**
* @brief
* Enables the flash controller for writing.
+ * @note
+ * IMPORTANT: This function must be called before flash operations when
+ * AUXHFRCO clock has been changed from default 14MHz band.
******************************************************************************/
void MSC_Init(void)
{
+#if defined (_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
+ uint32_t freq, cycles;
+#endif
/* Enable writing to the MSC */
MSC->WRITECTRL |= MSC_WRITECTRL_WREN;
/* Unlock the MSC */
MSC->LOCK = MSC_UNLOCK_CODE;
/* Disable writing to the MSC */
MSC->WRITECTRL &= ~MSC_WRITECTRL_WREN;
+
+#if defined (_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
+ /* Configure MSC->TIMEBASE according to selected frequency */
+ freq = CMU_ClockFreqGet(cmuClock_AUX);
+
+ if( freq > 7000000)
+ {
+ /* Calculate number of clock cycles for 1us as base period */
+ freq = (freq * 11) / 10;
+ cycles = (freq / 1000000) + 1;
+
+ /* Configure clock cycles for flash timing */
+ MSC->TIMEBASE = (MSC->TIMEBASE & ~(_MSC_TIMEBASE_BASE_MASK|
+ _MSC_TIMEBASE_PERIOD_MASK))|
+ MSC_TIMEBASE_PERIOD_1US|
+ (cycles << _MSC_TIMEBASE_BASE_SHIFT);
+ }
+ else
+ {
+ /* Calculate number of clock cycles for 5us as base period */
+ freq = (freq * 5 * 11) / 10;
+ cycles = (freq / 1000000) + 1;
+
+ /* Configure clock cycles for flash timing */
+ MSC->TIMEBASE = (MSC->TIMEBASE & ~(_MSC_TIMEBASE_BASE_MASK|
+ _MSC_TIMEBASE_PERIOD_MASK))|
+ MSC_TIMEBASE_PERIOD_5US|
+ (cycles << _MSC_TIMEBASE_BASE_SHIFT);
+ }
+#endif
}
/***************************************************************************//**
@@ -96,6 +135,13 @@ void MSC_Deinit(void)
#ifdef __CC_ARM /* MDK-ARM compiler */
#pragma arm section code="ram_code"
#endif /* __CC_ARM */
+#if defined( __ICCARM__ )
+/* Suppress warnings originating from use of EFM_ASSERT(): */
+/* "Call to a non __ramfunc function from within a __ramfunc function" */
+/* "Possible rom access from within a __ramfunc function" */
+#pragma diag_suppress=Ta022
+#pragma diag_suppress=Ta023
+#endif
msc_Return_TypeDef MSC_ErasePage(uint32_t *startAddress)
{
int timeOut = MSC_PROGRAM_TIMEOUT;
@@ -146,6 +192,10 @@ msc_Return_TypeDef MSC_ErasePage(uint32_t *startAddress)
MSC->WRITECTRL &= ~MSC_WRITECTRL_WREN;
return mscReturnOk;
}
+#if defined( __ICCARM__ )
+#pragma diag_default=Ta022
+#pragma diag_default=Ta023
+#endif
/***************************************************************************//**
* @brief
@@ -178,6 +228,13 @@ msc_Return_TypeDef MSC_ErasePage(uint32_t *startAddress)
#ifdef __CC_ARM /* MDK-ARM compiler */
#pragma arm section code="ram_code"
#endif /* __CC_ARM */
+#if defined( __ICCARM__ )
+/* Suppress warnings originating from use of EFM_ASSERT(): */
+/* "Call to a non __ramfunc function from within a __ramfunc function" */
+/* "Possible rom access from within a __ramfunc function" */
+#pragma diag_suppress=Ta022
+#pragma diag_suppress=Ta023
+#endif
msc_Return_TypeDef MSC_WriteWord(uint32_t *address, void const *data, int numBytes)
{
int timeOut;
@@ -219,7 +276,7 @@ msc_Return_TypeDef MSC_WriteWord(uint32_t *address, void const *data, int numByt
}
/* Wait for the MSC to be ready for a new data word */
- /* Due to the timing of this function, the MSC should allready by ready */
+ /* Due to the timing of this function, the MSC should already by ready */
timeOut = MSC_PROGRAM_TIMEOUT;
while (((MSC->STATUS & MSC_STATUS_WDATAREADY) == 0) && (timeOut != 0))
{
@@ -259,6 +316,54 @@ msc_Return_TypeDef MSC_WriteWord(uint32_t *address, void const *data, int numByt
MSC->WRITECTRL &= ~MSC_WRITECTRL_WREN;
return mscReturnOk;
}
+#if defined( __ICCARM__ )
+#pragma diag_default=Ta022
+#pragma diag_default=Ta023
+#endif
+
+
+#if defined(_EFM32_GIANT_FAMILY)
+/***************************************************************************//**
+ * @brief
+ * Erase entire flash in one operation
+ * @note
+ * This command will erase the entire contents of the device.
+ * Use with care, both a debug session and all contents of the flash will be
+ * lost. The lock bit, MLW will prevent this operation from executing and
+ * might prevent successful mass erase.
+ ******************************************************************************/
+#ifdef __CC_ARM /* MDK-ARM compiler */
+#pragma arm section code="ram_code"
+#endif /* __CC_ARM */
+msc_Return_TypeDef MSC_MassErase(void)
+{
+ /* Enable writing to the MSC */
+ MSC->WRITECTRL |= MSC_WRITECTRL_WREN;
+
+ /* Unlock device mass erase */
+ MSC->MASSLOCK = MSC_MASSLOCK_LOCKKEY_UNLOCK;
+
+ /* Erase first 512K block */
+ MSC->WRITECMD = MSC_WRITECMD_ERASEMAIN0;
+
+ /* Waiting for erase to complete */
+ while ((MSC->STATUS & MSC_STATUS_BUSY)){}
+
+#if FLASH_SIZE >= (512*1024)
+ /* Erase second 512K block */
+ MSC->WRITECMD = MSC_WRITECMD_ERASEMAIN1;
+
+ /* Waiting for erase to complete */
+ while ((MSC->STATUS & MSC_STATUS_BUSY)){}
+#endif
+
+ /* Restore mass erase lock */
+ MSC->MASSLOCK = MSC_MASSLOCK_LOCKKEY_LOCK;
+
+ /* This will only successfully return if calling function is also in SRAM */
+ return mscReturnOk;
+}
+#endif
/** @} (end addtogroup MSC) */
/** @} (end addtogroup EFM32_Library) */
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_opamp.c b/bsp/efm32/Libraries/efm32lib/src/efm32_opamp.c
index e812bc8692..72e5c079d5 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_opamp.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_opamp.c
@@ -2,7 +2,7 @@
* @file
* @brief Operational Amplifier (OPAMP) peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
******************************************************************************
* @section License
* (C) Copyright 2011 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_pcnt.c b/bsp/efm32/Libraries/efm32lib/src/efm32_pcnt.c
index b3eb1beeea..7d2b299ef9 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_pcnt.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_pcnt.c
@@ -2,7 +2,7 @@
* @file
* @brief Pulse Counter (PCNT) peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_prs.c b/bsp/efm32/Libraries/efm32lib/src/efm32_prs.c
index 7877e40833..fc76901f56 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_prs.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_prs.c
@@ -2,7 +2,7 @@
* @file
* @brief Peripheral Reflex System (PRS) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_rmu.c b/bsp/efm32/Libraries/efm32lib/src/efm32_rmu.c
index db4d852fbc..7cec30d23a 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_rmu.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_rmu.c
@@ -3,7 +3,7 @@
* @brief Reset Management Unit (RMU) peripheral module peripheral API
* for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -114,6 +114,33 @@ uint32_t RMU_ResetCauseGet(void)
/* Inspect and decode bits. The decoding must be done in correct order, */
/* since some reset causes may trigger other reset causes due to internal */
/* design. We are only interested in the main cause. */
+#if defined(_EFM32_TINY_FAMILY) || defined(_EFM32_GIANT_FAMILY)
+ /* Clear "stray" bits if EM4 bit is set, they will always be active */
+ if (ret & RMU_RSTCAUSE_EM4RST)
+ {
+ ret &= ~(RMU_RSTCAUSE_BODREGRST|
+ RMU_RSTCAUSE_BODUNREGRST|
+ RMU_RSTCAUSE_LOCKUPRST|
+ RMU_RSTCAUSE_SYSREQRST);
+ }
+ if (ret == RMU_RSTCAUSE_BODAVDD0)
+ {
+ ret = RMU_RSTCAUSE_BODAVDD0;
+ }
+ else if (ret == RMU_RSTCAUSE_BODAVDD1)
+ {
+ ret = RMU_RSTCAUSE_BODAVDD1;
+ }
+ else if (ret == (RMU_RSTCAUSE_EM4WURST|RMU_RSTCAUSE_EM4RST))
+ {
+ ret &= (RMU_RSTCAUSE_EM4WURST|RMU_RSTCAUSE_EM4RST);
+ }
+ else if (ret & (RMU_RSTCAUSE_EM4RST|RMU_RSTCAUSE_EXTRST))
+ {
+ ret &= (RMU_RSTCAUSE_EM4RST|RMU_RSTCAUSE_EXTRST);
+ }
+ else
+#endif
if (ret & RMU_RSTCAUSE_PORST)
{
ret = RMU_RSTCAUSE_PORST;
@@ -132,11 +159,14 @@ uint32_t RMU_ResetCauseGet(void)
ret &= RMU_RSTCAUSE_EXTRST | RMU_RSTCAUSE_WDOGRST;
}
/* Both lockup and system reset may occur at the same time */
- else
+ else if (ret & (RMU_RSTCAUSE_LOCKUPRST | RMU_RSTCAUSE_SYSREQRST))
{
ret &= RMU_RSTCAUSE_LOCKUPRST | RMU_RSTCAUSE_SYSREQRST;
}
-
+ else
+ {
+ ret = 0;
+ }
return ret;
}
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_rtc.c b/bsp/efm32/Libraries/efm32lib/src/efm32_rtc.c
index 5ce2cbb678..05ef697b43 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_rtc.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_rtc.c
@@ -2,7 +2,7 @@
* @file
* @brief Real Time Counter (RTC) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_system.c b/bsp/efm32/Libraries/efm32lib/src/efm32_system.c
index 4c7bee1d3e..b79bde662b 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_system.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_system.c
@@ -2,7 +2,7 @@
* @file
* @brief System Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_timer.c b/bsp/efm32/Libraries/efm32lib/src/efm32_timer.c
index 4a253c15cb..a1ace6f2c6 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_timer.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_timer.c
@@ -2,7 +2,7 @@
* @file
* @brief Timer/counter (TIMER) Peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_usart.c b/bsp/efm32/Libraries/efm32lib/src/efm32_usart.c
index 9a9cb0e2c9..bd7f5caff0 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_usart.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_usart.c
@@ -3,7 +3,7 @@
* @brief Universal synchronous/asynchronous receiver/transmitter (USART/UART)
* peripheral module peripheral API for EFM32.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
@@ -186,7 +186,7 @@ void USART_BaudrateAsyncSet(USART_TypeDef *usart,
}
/* Calculate and set CLKDIV with fractional bits */
- clkdiv = 4 * refFreq;
+ clkdiv = 4 * refFreq + (oversample * baudrate) / 2;
clkdiv /= (oversample * baudrate);
clkdiv -= 4;
clkdiv *= 64;
@@ -451,7 +451,7 @@ void USART_BaudrateSyncSet(USART_TypeDef *usart, uint32_t refFreq, uint32_t baud
/* up (and thus reducing baudrate, not increasing baudrate above */
/* specified value). */
clkdiv += 0xc0;
- clkdiv &= ~0xff;
+ clkdiv &= 0xffffff00;
clkdiv &= _USART_CLKDIV_DIV_MASK;
usart->CLKDIV = clkdiv;
}
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_vcmp.c b/bsp/efm32/Libraries/efm32lib/src/efm32_vcmp.c
index 5828297b0a..8371d0adb1 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_vcmp.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_vcmp.c
@@ -2,7 +2,7 @@
* @file
* @brief Voltage Comparator (VCMP) peripheral API for EFM32
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/Libraries/efm32lib/src/efm32_wdog.c b/bsp/efm32/Libraries/efm32lib/src/efm32_wdog.c
index 69ada9b963..365cf58f97 100644
--- a/bsp/efm32/Libraries/efm32lib/src/efm32_wdog.c
+++ b/bsp/efm32/Libraries/efm32lib/src/efm32_wdog.c
@@ -3,7 +3,7 @@
* @brief Watchdog (WDOG) peripheral API for EFM32
* devices.
* @author Energy Micro AS
- * @version 2.3.0
+ * @version 2.3.2
*******************************************************************************
* @section License
* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
diff --git a/bsp/efm32/SConscript b/bsp/efm32/SConscript
index 8f36f940e8..764e7bcec2 100644
--- a/bsp/efm32/SConscript
+++ b/bsp/efm32/SConscript
@@ -2,27 +2,17 @@ import rtconfig
Import('RTT_ROOT')
from building import *
-if rtconfig.EFM32_BOARD == 'EFM32_GXXX_DK':
- src_kit = Glob('EFM32_Gxxx_DK/*.c')
- CPPPATH = [RTT_ROOT + '/bsp/efm32/EFM32_Gxxx_DK']
-elif rtconfig.EFM32_BOARD == 'EFM32GG_DK3750':
- src_kit = Glob('EFM32GG_DK3750/*.c')
- CPPPATH = [RTT_ROOT + '/bsp/efm32/EFM32GG_DK3750']
-else:
- src_kit = []
- CPPPATH = []
-
src_bsp = ['application.c', 'startup.c', 'board.c']
if rtconfig.PLATFORM == 'gcc':
src_bsp.append('start_gcc.S')
src_drv1 = ['drv_dma.c', 'drv_rtc.c', 'drv_adc.c', 'drv_acmp.c', 'drv_usart.c', 'drv_leuart.c', 'drv_iic.c', 'drv_timer.c']
src_drv2 = ['drv_sdcard.c', 'drv_ethernet.c']
-src_dev = ['dev_misc.c', 'dev_led.c', 'dev_accel.c', 'dev_sflash.c']
+src_dev = ['dev_misc.c', 'dev_led.c', 'dev_accel.c', 'dev_sflash.c', 'dev_lcd.c']
src_hdl = ['hdl_interrupt.c']
src_app = ['httpd.c']
-src = src_kit + src_bsp + src_drv1 + src_drv2 + src_dev + src_hdl + src_app
-CPPPATH.append(RTT_ROOT + '/bsp/efm32')
+src = src_bsp + src_drv1 + src_drv2 + src_dev + src_hdl + src_app
+CPPPATH = [RTT_ROOT + '/bsp/efm32']
CPPDEFINES = [rtconfig.EFM32_BOARD, rtconfig.EFM32_TYPE]
group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
diff --git a/bsp/efm32/SConstruct b/bsp/efm32/SConstruct
index 4ff332568b..2774838d19 100644
--- a/bsp/efm32/SConstruct
+++ b/bsp/efm32/SConstruct
@@ -22,7 +22,10 @@ Export('rtconfig')
objs = PrepareBuilding(env, RTT_ROOT)
# EFM32 library building script
-objs = objs + SConscript(RTT_ROOT + '/bsp/efm32/Libraries/SConscript', variant_dir='build/bsp/Libraries', duplicate=0)
+objs = objs + SConscript(RTT_ROOT + '/bsp/efm32/EFM32_Gxxx_DK/SConscript', variant_dir='build/EFM32_Gxxx_DK', duplicate=0)
+objs = objs + SConscript(RTT_ROOT + '/bsp/efm32/EFM32GG_DK3750/SConscript', variant_dir='build/EFM32GG_DK3750', duplicate=0)
+objs = objs + SConscript(RTT_ROOT + '/bsp/efm32/graphics/SConscript', variant_dir='build/graphics', duplicate=0)
+objs = objs + SConscript(RTT_ROOT + '/bsp/efm32/Libraries/SConscript', variant_dir='build/Libraries', duplicate=0)
# build program
env.Program(TARGET, objs)
diff --git a/bsp/efm32/application.c b/bsp/efm32/application.c
index f0e84ad9b3..c0a76b22ff 100644
--- a/bsp/efm32/application.c
+++ b/bsp/efm32/application.c
@@ -1,8 +1,8 @@
/***************************************************************************//**
- * @file application.c
- * @brief application tasks
- * COPYRIGHT (C) 2011, RT-Thread Development Team
- * @author Bernard, onelife
+ * @file application.c
+ * @brief application tasks
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author Bernard, onelife
* @version 0.4 beta
*******************************************************************************
* @section License
@@ -10,14 +10,15 @@
* LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
*******************************************************************************
* @section Change Logs
- * Date Author Notes
- * 2009-01-05 Bernard first version
- * 2010-12-29 onelife Modify for EFM32
- * 2011-05-06 onelife Add SPI Flash DEMO
- * 2011-07-15 onelife Add accelerometer DEMO
- * 2011-07-27 onelife Modify Ethernet DEMO
- * 2011-08-23 onelife Modify Ethernet DEMO according to the changes of
+ * Date Author Notes
+ * 2009-01-05 Bernard first version
+ * 2010-12-29 onelife Modify for EFM32
+ * 2011-05-06 onelife Add SPI Flash DEMO
+ * 2011-07-15 onelife Add accelerometer DEMO
+ * 2011-07-27 onelife Modify Ethernet DEMO
+ * 2011-08-23 onelife Modify Ethernet DEMO according to the changes of
* lwIP API in reversion 1668
+ * 2011-12-20 onelife Add LCD DEMO
******************************************************************************/
/***************************************************************************//**
@@ -50,225 +51,688 @@
#if defined(EFM32_USING_ETHERNET)
#include "drv_ethernet.h"
#endif
+#if defined(EFM32_USING_LCD)
+#include "dev_lcd.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#endif
+
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
-volatile rt_uint32_t rt_system_status = 0;
+volatile rt_uint32_t rt_system_status = 0;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
+static rt_uint8_t index = 0 ;
+static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
+{
+ if (event->type == RTGUI_EVENT_PAINT)
+ {
+ struct rtgui_dc* dc;
+ struct rtgui_rect rect;
+
+ dc = rtgui_dc_begin_drawing(widget);
+ if (dc == RT_NULL)
+ return RT_FALSE;
+ rtgui_widget_get_rect(widget, &rect);
+
+ rtgui_dc_fill_rect(dc, &rect);
+ rect.x2 -= 1; rect.y2 -= 1;
+ rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
+ rtgui_dc_draw_vline(dc, rect.x1, rect.y1, rect.y2);
+
+ rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y2);
+ rtgui_dc_draw_vline(dc, rect.x2, rect.y1, rect.y2 + 1);
+
+ /* shrink border */
+ rtgui_rect_inflate(&rect, -1);
+
+ /* draw text */
+ rtgui_widget_get_rect(widget, &rect);
+ rect.y1 += 25;
+ rtgui_dc_draw_text(dc, " EFM3 EFM32GG_DK3750 Kit", &rect);
+ rect.y1 += 10;
+ rtgui_dc_draw_text(dc, " RT-Thread & RTGUI", &rect);
+ rect.y1 += 10;
+ rtgui_dc_draw_text(dc, " ÖÐÎÄÒ²ÐÐ!", &rect);
+
+ rtgui_dc_end_drawing(dc);
+
+ return RT_FALSE;
+ }
+ else if (event->type == RTGUI_EVENT_KBD)
+ {
+ struct rtgui_dc* dc;
+ struct rtgui_rect rect;
+ struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
+ if (ekbd->type == RTGUI_KEYDOWN)
+ {
+ char key_str[16];
+ switch (ekbd->key)
+ {
+ case RTGUIK_LEFT:
+ rt_sprintf(key_str, "%s", "L");
+ break;
+ case RTGUIK_RIGHT:
+ rt_sprintf(key_str, "%s", "R");
+ break;
+ case RTGUIK_DOWN:
+ rt_sprintf(key_str, "%s", "D");
+ break;
+ case RTGUIK_UP:
+ rt_sprintf(key_str, "%s", "U");
+ break;
+ default:
+ rt_sprintf(key_str, "%s", "S");
+ break;
+ }
+ dc = rtgui_dc_begin_drawing(widget);
+ if (dc == RT_NULL)
+ return RT_FALSE;
+ rect.x1 = 118;
+ rect.y1 = 1;
+ rect.x2 = 127;
+ rect.y2 = 10;
+ rtgui_dc_fill_rect(dc, &rect);
+ rtgui_dc_draw_text(dc, key_str, &rect);
+ rtgui_dc_end_drawing(dc);
+ }
+ else if (ekbd->type == RTGUI_KEYUP)
+ {
+ dc = rtgui_dc_begin_drawing(widget);
+ if (dc == RT_NULL)
+ return RT_FALSE;
+ rect.x1 = 118;
+ rect.y1 = 1;
+ rect.x2 = 127;
+ rect.y2 = 10;
+ rtgui_dc_fill_rect(dc, &rect);
+ //rtgui_dc_draw_text(dc, key_str, &rect);
+ rtgui_dc_end_drawing(dc);
+ }
+ }
+ else if (event->type == RTGUI_EVENT_COMMAND)
+ {
+ char str[16];
+ struct rtgui_dc* dc;
+ struct rtgui_rect rect;
+ struct rtgui_event_command* ecmd;
+ rt_uint8_t major,minor;
+ dc = rtgui_dc_begin_drawing(widget);
+ if (dc == RT_NULL)
+ return RT_FALSE;
+
+ ecmd = (struct rtgui_event_command*)event;
+ switch (ecmd->command_id)
+ {
+ default:
+ rect.x1 = 1;
+ rect.y1 = 1;
+ rect.x2 = 117;
+ rect.y2 = 10;
+ rtgui_dc_fill_rect(dc, &rect);
+ rt_sprintf(str, "ADC = %d mv", 123);
+ rtgui_dc_draw_text(dc, str, &rect);
+ break;
+ /* case ADC_UPDATE:
+ rect.x1 = 1;
+ rect.y1 = 1;
+ rect.x2 = 117;
+ rect.y2 = 10;
+ rtgui_dc_fill_rect(dc, &rect);
+ rt_sprintf(str, "ADC = %d mv", adc_value);
+ rtgui_dc_draw_text(dc, str, &rect);
+ break;
+ case CPU_UPDATE:
+ cpu_usage_get(&major, &minor);
+ rect.x1 = 1;
+ rect.y1 = 12;
+ rect.x2 = 127;
+ rect.y2 = 22;
+ rtgui_dc_fill_rect(dc, &rect);
+ rt_sprintf(str, "CPU : %d.%d%", major, minor);
+ rtgui_dc_draw_text(dc, str, &rect);
+
+ rect.y1 = 23;
+ rect.y2 = 63;
+ index++;
+ if (index == 127)
+ {
+ index = 1;
+ rtgui_dc_fill_rect(dc, &rect);
+ }
+ if (major>40)
+ rtgui_dc_draw_vline(dc, index, rect.y1, rect.y2);
+ else
+ rtgui_dc_draw_vline(dc, index, rect.y2-major, rect.y2);
+ break;
+*/ }
+ rtgui_dc_end_drawing(dc);
+ }
+
+ return rtgui_view_event_handler(widget, event);
+}
+
+static void wb_info(void* parameter)
+{
+ rt_mq_t mq;
+ rtgui_view_t *view;
+ rtgui_workbench_t *workbench;
+
+ /* Create message queue for self */
+ mq = rt_mq_create("mq_wb1", 256, 4, RT_IPC_FLAG_FIFO);
+ if(mq == RT_NULL)
+ {
+ rt_kprintf("Create mq failed!\n");
+ return;
+ }
+ rtgui_thread_register(rt_thread_self(), mq);
+
+ /* Create workbench */
+ workbench = rtgui_workbench_create("info", "wb_1");
+ if(workbench == RT_NULL)
+ {
+ rt_kprintf("Create wb failed!\n");
+ return;
+ }
+ /* Create a view */
+ view = rtgui_view_create("view_1");
+ if(view == RT_NULL)
+ {
+ rt_kprintf("Create view failed!\n");
+ return;
+ }
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = red;
+ RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(view)) = white;
+// rtgui_widget_set_event_handler(RTGUI_WIDGET(view), view_event_handler);
+
+ /* Create a lable */
+ rtgui_label_t *label = rtgui_label_create("R-Thread & RTGUI");
+ if(label == RT_NULL)
+ {
+ rt_kprintf("Create lable failed!\n");
+ return;
+ }
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = red;
+ RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = white;
+
+ /* Set lable position */
+ rtgui_rect_t rect;
+ rect.x1 = 10; rect.y1 = 2;
+ rect.x2 = 230; rect.y2 = 22;
+ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
+ rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
+
+ /* Add view to workbench */
+ rtgui_workbench_add_view(workbench, view);
+
+ /* this view can be focused */
+// RTGUI_WIDGET(view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
+ /* set widget focus */
+// rtgui_widget_focus(RTGUI_WIDGET(view));
+
+ /* Show view */
+ rtgui_view_show(view, RT_FALSE);
+
+ /* Workbench loop */
+ rtgui_workbench_event_loop(workbench);
+
+ /* Prepare for exit */
+ rtgui_thread_deregister(rt_thread_self());
+ rt_mq_delete(mq);
+}
+
+
+static void wb_main(void* parameter)
+{
+ rt_mq_t mq;
+ rtgui_view_t *view;
+ rtgui_workbench_t *workbench;
+
+ /* Create message queue for self */
+ mq = rt_mq_create("mq_wb2", 256, 4, RT_IPC_FLAG_FIFO);
+ if(mq == RT_NULL)
+ {
+ rt_kprintf("Create mq failed!\n");
+ return;
+ }
+ rtgui_thread_register(rt_thread_self(), mq);
+
+ /* Create workbench */
+ workbench = rtgui_workbench_create("main", "wb_2");
+ if(workbench == RT_NULL)
+ {
+ rt_kprintf("Create wb failed!\n");
+ return;
+ }
+ /* Create a view */
+ view = rtgui_view_create("view_2");
+ if(view == RT_NULL)
+ {
+ rt_kprintf("Create view failed!\n");
+ return;
+ }
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white;
+ RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(view)) = red;
+// rtgui_widget_set_event_handler(RTGUI_WIDGET(view), view_event_handler);
+
+ /* Create a lable */
+ rtgui_label_t* label = rtgui_label_create("EFM32GG_DK3750 Kit");
+ if(label == RT_NULL)
+ {
+ rt_kprintf("Create lable failed!\n");
+ return;
+ }
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
+ RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = red;
+
+ /* Set lable position */
+ rtgui_rect_t rect;
+ rect.x1 = 10; rect.y1 = 50;
+ rect.x2 = 230; rect.y2 = 70;
+ rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
+ rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label));
+
+ /* Add view to workbench */
+ rtgui_workbench_add_view(workbench, view);
+
+ /* this view can be focused */
+// RTGUI_WIDGET(view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
+ /* set widget focus */
+// rtgui_widget_focus(RTGUI_WIDGET(view));
+
+ /* Show view */
+ rtgui_view_show(view, RT_FALSE);
+
+ /* Workbench loop */
+ rtgui_workbench_event_loop(workbench);
+
+ /* Prepare for exit */
+ rtgui_thread_deregister(rt_thread_self());
+ rt_mq_delete(mq);
+}
+
+static void win_hello(void* parameter)
+{
+ rt_mq_t mq;
+ struct rtgui_view* view;
+ rtgui_win_t *win;
+
+ /* Create message queue for self */
+ mq = rt_mq_create("mq_win", 256, 4, RT_IPC_FLAG_FIFO);
+ if(mq == RT_NULL)
+ {
+ rt_kprintf("Create mq failed!\n");
+ return;
+ }
+ rtgui_thread_register(rt_thread_self(), mq);
+
+ /* Window position */
+ rtgui_rect_t rect;
+ rect.x1 = 50; rect.y1 = 50;
+ rect.x2 = 180; rect.y2 = 180;
+
+ /* Create window */
+ win = rtgui_win_create(RT_NULL, "Hello", &rect, RTGUI_WIN_STYLE_DEFAULT);
+ if(win == RT_NULL)
+ {
+ rt_kprintf("Create win failed!\n");
+ return;
+ }
+
+ /* Create a box */
+ rtgui_box_t *box = rtgui_box_create(RTGUI_VERTICAL, RT_NULL);
+ if(box == RT_NULL)
+ {
+ rt_kprintf("Create box failed!\n");
+ return;
+ }
+ rtgui_win_set_box(win, box);
+
+ rtgui_label_t *label = rtgui_label_create("¹þÂÞ,íïÅÖ!");
+ if(label == RT_NULL)
+ {
+ rt_kprintf("Create lable failed!\n");
+ return;
+ }
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(label)) = white;
+ RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(label)) = black;
+ RTGUI_WIDGET(label)->align = RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL;
+ rtgui_widget_set_miniwidth(RTGUI_WIDGET(label),130);
+ rtgui_box_append(box, RTGUI_WIDGET(label));
+
+ /* Auto layout */
+ rtgui_box_layout(box);
+
+ /* Show window */
+ rtgui_win_show(win, RT_FALSE);
+
+ /* Window loop */
+ rtgui_win_event_loop(win);
+
+ /* Prepare for exit */
+ rtgui_thread_deregister(rt_thread_self());
+ rt_mq_delete(mq);
+}
+
void rt_demo_thread_entry(void* parameter)
{
#if 0 //defined(EFM32_USING_ACCEL)
- struct efm32_accel_result_t result;
+{
+ struct efm32_accel_result_t result;
- rt_kprintf(">>> waiting\n");
- rt_thread_sleep(6000);
- rt_kprintf(">>> start\n");
- while(1)
- {
- efm_accel_get_data(&result);
- rt_kprintf("Accel x: %x\n", result.x);
- rt_kprintf("Accel y: %x\n", result.y);
- rt_kprintf("Accel z: %x\n\n", result.z);
- rt_thread_sleep(200);
- }
+ rt_kprintf(">>> waiting\n");
+ rt_thread_sleep(6000);
+ rt_kprintf(">>> start\n");
+ while(1)
+ {
+ efm_accel_get_data(&result);
+ rt_kprintf("Accel x: %x\n", result.x);
+ rt_kprintf("Accel y: %x\n", result.y);
+ rt_kprintf("Accel z: %x\n\n", result.z);
+ rt_thread_sleep(200);
+ }
+}
#endif
#if defined(RT_USING_DFS)
- /* Filesystem Initialization */
- dfs_init();
+{
+ rt_kprintf("File system DEMO start...\n");
+ /* Filesystem Initialization */
+ dfs_init();
#if defined(RT_USING_DFS_ELMFAT)
- /* init the elm chan FatFs filesystam*/
- elm_init();
+ /* init the elm chan FatFs filesystam*/
+ elm_init();
#if defined(EFM32_USING_SPISD)
- /* mount sd card fat partition 1 as root directory */
- if (dfs_mount(SPISD_DEVICE_NAME, "/", "elm", 0, 0) == 0)
- {
- rt_kprintf("FatFs init OK\n");
- }
- else
- {
- rt_kprintf("FatFs init failed!\n");
- }
+ /* mount sd card fat partition 1 as root directory */
+ if (dfs_mount(SPISD_DEVICE_NAME, "/", "elm", 0, 0) == 0)
+ {
+ rt_kprintf("FatFs init OK\n");
+ }
+ else
+ {
+ rt_kprintf("FatFs init failed!\n");
+ }
#endif
#endif
+ rt_kprintf("File system DEMO end.\n");
+}
#endif
#ifdef EFM32_USING_SFLASH
{
- rt_uint8_t i;
- rt_uint8_t test[] = "123456789ABCDEF";
- rt_uint8_t buf[30], buf2[30];
+ rt_kprintf("SPI Flash DEMO start...\n");
- efm_spiFlash_cmd(sflash_inst_rdid_l, EFM32_NO_DATA, buf, sizeof(buf));
- rt_kprintf("Manuf ID: %x\n", buf[0]);
- rt_kprintf("Memory type: %x\n", buf[1]);
- rt_kprintf("Memory capacity: %x\n", buf[2]);
- rt_kprintf("CFD length: %x\n", buf[3]);
- rt_kprintf("CFD: %x%x%x...%x%x\n", buf[4], buf[5], buf[6], buf[18], buf[19]);
+ rt_uint8_t i;
+ rt_uint8_t test[] = "123456789ABCDEF";
+ rt_uint8_t buf[30], buf2[30];
- efm_spiFlash_cmd(sflash_inst_wren, EFM32_NO_DATA, EFM32_NO_POINTER, EFM32_NO_DATA);
- do
- {
- efm_spiFlash_cmd(sflash_inst_rdsr, EFM32_NO_DATA, buf2, sizeof(buf2));
- rt_kprintf("Status: %x\n", buf2[0]);
- } while (buf2[0] == 0xFF);
- rt_kprintf("Status: %x\n", buf2[0]);
+ efm_spiFlash_cmd(sflash_inst_rdid_l, EFM32_NO_DATA, buf, sizeof(buf));
+ rt_kprintf("Manuf ID: %x\n", buf[0]);
+ rt_kprintf("Memory type: %x\n", buf[1]);
+ rt_kprintf("Memory capacity: %x\n", buf[2]);
+ rt_kprintf("CFD length: %x\n", buf[3]);
+ rt_kprintf("CFD: %x%x%x...%x%x\n", buf[4], buf[5], buf[6], buf[18], buf[19]);
- //efm_spiFash_cmd(sflash_inst_pp, 0x000003F8, test, sizeof(test) - 1);
+ efm_spiFlash_cmd(sflash_inst_wren, EFM32_NO_DATA, EFM32_NO_POINTER, EFM32_NO_DATA);
+ do
+ {
+ efm_spiFlash_cmd(sflash_inst_rdsr, EFM32_NO_DATA, buf2, sizeof(buf2));
+ rt_kprintf("Status: %x\n", buf2[0]);
+ } while (buf2[0] == 0xFF);
+ rt_kprintf("Status: %x\n", buf2[0]);
- efm_spiFlash_cmd(sflash_inst_rdsr, EFM32_NO_DATA, buf2, sizeof(buf2));
- rt_kprintf("Status: %x\n", buf2[0]);
+ //efm_spiFash_cmd(sflash_inst_pp, 0x000003F8, test, sizeof(test) - 1);
- efm_spiFlash_cmd(sflash_inst_read, 0x00000300, buf, sizeof(buf));
- rt_kprintf("READ: \n");
- for (i = 0; i < sizeof(buf); i++)
- {
- rt_kprintf("%c\n", buf[i]);
- }
+ efm_spiFlash_cmd(sflash_inst_rdsr, EFM32_NO_DATA, buf2, sizeof(buf2));
+ rt_kprintf("Status: %x\n", buf2[0]);
- //efm_spiFlash_deinit();
+ efm_spiFlash_cmd(sflash_inst_read, 0x00000300, buf, sizeof(buf));
+ rt_kprintf("READ: \n");
+ for (i = 0; i < sizeof(buf); i++)
+ {
+ rt_kprintf("%c\n", buf[i]);
+ }
+
+ //efm_spiFlash_deinit();
+ rt_kprintf("SPI Flash DEMO end.\n");
}
#endif
#if defined(EFM32_USING_ETHERNET)
- extern void lwip_sys_init(void);
- /* init lwip system */
- lwip_sys_init();
- rt_kprintf("TCP/IP stack init OK!\n");
+{
+ rt_kprintf("Ethernet DEMO start...\n");
+ extern void lwip_sys_init(void);
+ /* init lwip system */
+ lwip_sys_init();
+ rt_kprintf("TCP/IP stack init OK!\n");
#if defined(EFM32_USING_ETH_HTTPD)
- extern void httpd_init(void);
- /* init http server */
- httpd_init();
- rt_kprintf("Http service init OK!\n");
+ extern void httpd_init(void);
+ /* init http server */
+ httpd_init();
+ rt_kprintf("Http service init OK!\n");
#endif /* defined(EFM32_USING_ETH_HTTPD) */
+ rt_kprintf("Ethernet DEMO end.\n");
+}
#endif /* defined(EFM32_USING_ETHERNET) */
- rt_kprintf("Demo End\n");
- while(1)
- {
- rt_thread_sleep(10);
- }
+#if defined(EFM32_USING_LCD)
+{
+ rt_kprintf("LCD DEMO start...\n");
+
+ /* find lcd device */
+ rt_device_t lcd = rt_device_find(LCD_DEVICE_NAME);
+ if (lcd == RT_NULL)
+ {
+ rt_kprintf("Can't find LCD\n");
+ }
+
+ /* read LCD info */
+ struct rt_device_graphic_info lcd_info;
+ lcd->control(lcd, RTGRAPHIC_CTRL_GET_INFO, (void *)&lcd_info);
+ rt_kprintf("LCD size: %dX%d\n", lcd_info.width, lcd_info.height);
+
+ /* register panels */
+ rtgui_rect_t rect;
+ rect.x1 = 0;
+ rect.y1 = 0;
+ rect.x2 = lcd_info.width;
+ rect.y2 = 25;
+ rtgui_panel_register("info", &rect);
+ rect.x1 = 0;
+ rect.y1 = 25;
+ rect.x2 = lcd_info.width;
+ rect.y2 = lcd_info.height;
+ rtgui_panel_register("main", &rect);
+ rtgui_panel_set_default_focused("main");
+
+ /* Create workbenc threads */
+ rt_thread_t wb_tid;
+ wb_tid = rt_thread_create(
+ "wb_main",
+ wb_main,
+ RT_NULL,
+ 2048,
+ 25,
+ 10);
+ if (wb_tid != RT_NULL)
+ {
+ rt_thread_startup(wb_tid);
+ }
+ else
+ {
+ rt_kprintf("Create workbench \"main\" failed!\n");
+ }
+
+ wb_tid = rt_thread_create(
+ "wb_info",
+ wb_info,
+ RT_NULL,
+ 2048,
+ 25,
+ 10);
+ if (wb_tid != RT_NULL)
+ {
+ rt_thread_startup(wb_tid);
+ }
+ else
+ {
+ rt_kprintf("Create workbench \"info\" failed!\n");
+ }
+
+ wb_tid = rt_thread_create(
+ "win",
+ win_hello,
+ RT_NULL,
+ 2048,
+ 25,
+ 10);
+ if (wb_tid != RT_NULL)
+ {
+ rt_thread_startup(wb_tid);
+ }
+ else
+ {
+ rt_kprintf("Create window \"win\" failed!\n");
+ }
+
+ rt_kprintf("LCD DEMO end.\n");
+}
+#endif
+ rt_kprintf("All Demo end.\n");
+
+ while(1)
+ {
+ rt_thread_sleep(10);
+ }
}
void rt_led_thread_entry(void* parameter)
{
- rt_uint8_t n = 0;
+ rt_uint8_t n = 0;
- rt_hw_led_on(0);
- rt_hw_led_on(1);
- rt_hw_led_on(2);
- rt_hw_led_on(3);
+ rt_hw_led_on(0);
+ rt_hw_led_on(1);
+ rt_hw_led_on(2);
+ rt_hw_led_on(3);
- while(1)
- {
- /* Toggle a led per second */
- rt_hw_led_toggle(n++);
- if (n == LEDS_MAX_NUMBER)
- {
- n =0;
- }
- rt_thread_delay(100);
- }
+ while(1)
+ {
+ /* Toggle a led per second */
+ rt_hw_led_toggle(n++);
+ if (n == LEDS_MAX_NUMBER)
+ {
+ n =0;
+ }
+ rt_thread_delay(100);
+ }
}
int rt_application_init()
{
- rt_thread_t demo_thread, led_thread;
+ rt_thread_t demo_thread, led_thread;
#if defined(EFM32_USING_ACCEL)
- if (efm_accel_init() != RT_EOK)
- {
- rt_kprintf("*** Init accelerometer driver failed!");
- while(1); //Or do something?
- }
+ if (efm_accel_init() != RT_EOK)
+ {
+ rt_kprintf("*** Init accelerometer driver failed!");
+ while(1); //Or do something?
+ }
#endif
#if defined(EFM32_USING_SFLASH)
- if (efm_spiFlash_init() != RT_EOK)
- {
- rt_kprintf("*** Init SPI Flash driver failed!");
- while(1); //Or do something?
- }
+ if (efm_spiFlash_init() != RT_EOK)
+ {
+ rt_kprintf("*** Init SPI Flash driver failed!");
+ while(1); //Or do something?
+ }
#endif
#if defined(EFM32_USING_SPISD)
- if (efm_spiSd_init() != RT_EOK)
- {
- rt_kprintf("*** Init SD card driver failed!");
- while(1); //Or do something?
- }
+ if (efm_spiSd_init() != RT_EOK)
+ {
+ rt_kprintf("*** Init SD card driver failed!");
+ while(1); //Or do something?
+ }
#endif
- /* Initialize all device drivers (dev_?.c) */
- if (rt_hw_led_init() != RT_EOK)
- {
- rt_kprintf("*** Init LED driver failed!");
- while(1); //Or do something?
- }
+ /* Initialize all device drivers (dev_?.c) */
+ if (rt_hw_led_init() != RT_EOK)
+ {
+ rt_kprintf("*** Init LED driver failed!");
+ while(1); //Or do something?
+ }
#if defined(RT_USING_MISC)
- if (rt_hw_misc_init() != RT_EOK)
- {
- rt_kprintf("*** Init miscellaneous driver failed!");
- while(1); //Or do something?
- }
+ if (rt_hw_misc_init() != RT_EOK)
+ {
+ rt_kprintf("*** Init miscellaneous driver failed!");
+ while(1); //Or do something?
+ }
#endif
#if defined(RT_USING_LWIP)
- {
- /* Create Ethernet Threads */
- if (eth_system_device_init() != RT_EOK)
- {
- rt_kprintf("*** Create Ethernet threads failed!");
- while(1); //Or do something?
- }
+ {
+ /* Create Ethernet Threads */
+ if (eth_system_device_init() != RT_EOK)
+ {
+ rt_kprintf("*** Create Ethernet threads failed!");
+ while(1); //Or do something?
+ }
#if defined(EFM32_USING_ETHERNET)
- if (efm_hw_eth_init() != RT_EOK)
- {
- rt_kprintf("*** Init Ethernet driver failed!");
- while(1); //Or do something?
- }
+ if (efm_hw_eth_init() != RT_EOK)
+ {
+ rt_kprintf("*** Init Ethernet driver failed!");
+ while(1); //Or do something?
+ }
#endif
- }
+ }
#endif
#if (RT_THREAD_PRIORITY_MAX == 32)
- demo_thread = rt_thread_create(
- "demo",
- rt_demo_thread_entry,
- RT_NULL,
- 1024,
- 5,
- 20);
+ demo_thread = rt_thread_create(
+ "demo",
+ rt_demo_thread_entry,
+ RT_NULL,
+ 1024,
+ 5,
+ 20);
- led_thread = rt_thread_create(
- "led",
- rt_led_thread_entry,
- RT_NULL,
- 256,
- 5,
- 20);
+ led_thread = rt_thread_create(
+ "led",
+ rt_led_thread_entry,
+ RT_NULL,
+ 256,
+ 5,
+ 20);
#else
#endif
- if(demo_thread != RT_NULL)
- {
- rt_kprintf("demo sp:%x\n", demo_thread->sp);
- rt_thread_startup(demo_thread);
- }
+ if(demo_thread != RT_NULL)
+ {
+ rt_kprintf("demo sp:%x\n", demo_thread->sp);
+ rt_thread_startup(demo_thread);
+ }
- if(led_thread != RT_NULL)
- {
- rt_thread_startup(led_thread);
- }
+ if(led_thread != RT_NULL)
+ {
+ rt_thread_startup(led_thread);
+ }
- return 0;
+ return 0;
}
/***************************************************************************//**
diff --git a/bsp/efm32/board.c b/bsp/efm32/board.c
index 9c051189ac..6133dda79d 100644
--- a/bsp/efm32/board.c
+++ b/bsp/efm32/board.c
@@ -21,6 +21,7 @@
* function
* 2011-12-15 onelife Add MicroSD enabling routine in driver
* initialization function
+ * 2011-12-20 onelife Add LCD driver initialization routine
******************************************************************************/
/***************************************************************************//**
@@ -364,6 +365,11 @@ void rt_hw_driver_init(void)
#if defined(EFM32_USING_ETHERNET)
DVK_enablePeripheral(DVK_ETH);
#endif
+
+ /* Initialize LCD */
+#if defined(EFM32_USING_LCD)
+ efm32_spiLcd_init();
+#endif
}
/***************************************************************************//**
diff --git a/bsp/efm32/board.h b/bsp/efm32/board.h
index 90b9ad810a..091ea3c643 100644
--- a/bsp/efm32/board.h
+++ b/bsp/efm32/board.h
@@ -20,6 +20,7 @@
* 2011-12-09 onelife Add LEUART module support
* 2011-12-14 onelife Add LFXO enabling routine in driver initialization
* function
+ * 2011-12-20 onelife Move SPI Auto-CS setting to "rtconfig.h"
******************************************************************************/
#ifndef __BOARD_H__
#define __BOARD_H__
@@ -72,7 +73,6 @@ extern volatile rt_uint32_t rt_system_status;
/* SECTION: SPI Flash */
#if defined(EFM32_USING_SFLASH)
-#define USART_0_AUTOCS (0)
#define SFLASH_CS_PORT (gpioPortC)
#define SFLASH_CS_PIN (8)
#endif
@@ -80,11 +80,9 @@ extern volatile rt_uint32_t rt_system_status;
/* SECTION: Micro SD */
#if defined(EFM32_USING_SPISD)
#if defined(EFM32_GXXX_DK)
- #define USART_0_AUTOCS (1)
#define SD_CS_PORT (gpioPortC)
#define SD_CS_PIN (8)
#elif defined(EFM32GG_DK3750)
- #define USART_0_AUTOCS (1)
#define SD_CS_PORT (gpioPortE)
#define SD_CS_PIN (4)
#endif
@@ -93,16 +91,22 @@ extern volatile rt_uint32_t rt_system_status;
/* SECTION: Ethernet */
#if defined(EFM32_USING_ETHERNET)
#if defined(EFM32_GXXX_DK)
- #define USART_2_AUTOCS (0)
#define ETH_CS_PORT (gpioPortB)
#define ETH_CS_PIN (6)
#elif defined(EFM32GG_DK3750)
- #define USART_1_AUTOCS (0)
#define ETH_CS_PORT (gpioPortD)
#define ETH_CS_PIN (3)
#endif
#endif
+/* SECTION: LCD */
+#if defined(EFM32_USING_LCD)
+ #if defined(EFM32GG_DK3750)
+ #define LCD_CS_PORT (gpioPortD)
+ #define LCD_CS_PIN (3)
+ #endif
+#endif
+
/* SECTION: SYSTEM */
#define EFM32_SRAM_END (SRAM_BASE + SRAM_SIZE)
#define EFM32_BASE_PRI_DEFAULT (0x0UL << 5)
@@ -125,11 +129,11 @@ extern volatile rt_uint32_t rt_system_status;
#define USART_RX_BUFFER_SIZE (64)
#define LEUART_RX_BUFFER_SIZE (64)
/* Location count (start from 0) */
-#if defined(EFM32_GXXX_DK)
+#if defined(_EFM32_GECKO_FAMILY)
#define EFM32_USART_LOCATION_COUNT (3)
#define EFM32_UART_LOCATION_COUNT (4)
#define EFM32_LEUART_LOCATION_COUNT (3)
-#elif defined(EFM32GG_DK3750)
+#elif defined(_EFM32_GIANT_FAMILY)
#define EFM32_USART_LOCATION_COUNT (6)
#define EFM32_UART_LOCATION_COUNT (4)
#define EFM32_LEUART_LOCATION_COUNT (5)
@@ -142,25 +146,11 @@ extern volatile rt_uint32_t rt_system_status;
/* Max SPI clock: HFPERCLK/2 for master, HFPERCLK/8 for slave */
#define SPI_BAUDRATE (4000000)
-#ifndef USART_0_AUTOCS
-#define USART_0_AUTOCS (0)
-#endif
-#ifndef USART_1_AUTOCS
-#define USART_1_AUTOCS (0)
-#endif
-#ifndef USART_2_AUTOCS
-#define USART_2_AUTOCS (0)
-#endif
-/* Auto Slave Select */
-#define SPI_AUTOCS_ENABLE ((USART_2_AUTOCS << 2) | \
- (USART_1_AUTOCS << 1) | \
- (USART_0_AUTOCS << 0))
-
/* SECTION: I2C */
#define IIC_RX_BUFFER_SIZE (32)
-#if defined(EFM32_GXXX_DK)
+#if defined(_EFM32_GECKO_FAMILY)
#define EFM32_IIC_LOCATION_COUNT (4)
-#elif defined(EFM32GG_DK3750)
+#elif defined(_EFM32_GIANT_FAMILY)
#define EFM32_IIC_LOCATION_COUNT (7)
#endif
diff --git a/bsp/efm32/copy_this_file_dfs_elm.c b/bsp/efm32/copy_this_file_dfs_elm.c
index dc71bc2deb..d2c45f3d53 100644
--- a/bsp/efm32/copy_this_file_dfs_elm.c
+++ b/bsp/efm32/copy_this_file_dfs_elm.c
@@ -79,7 +79,7 @@ static int elm_result_to_dfs(FRESULT result)
return status;
}
-int dfs_elm_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* data)
+int dfs_elm_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *data)
{
FATFS *fat;
FRESULT result;
@@ -93,12 +93,13 @@ int dfs_elm_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* d
break;
}
}
- if (index == _VOLUMES) return -DFS_STATUS_ENOSPC;
+ if (index == _VOLUMES)
+ return -DFS_STATUS_ENOSPC;
/* get device */
disk[index] = fs->dev_id;
- fat = (FATFS *) rt_malloc(sizeof(FATFS));
+ fat = (FATFS *)rt_malloc(sizeof(FATFS));
if (fat == RT_NULL)
{
return -1;
@@ -117,13 +118,13 @@ int dfs_elm_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* d
return 0;
}
-int dfs_elm_unmount(struct dfs_filesystem* fs)
+int dfs_elm_unmount(struct dfs_filesystem *fs)
{
FATFS *fat;
FRESULT result;
rt_uint32_t index;
- fat = (FATFS*) fs->data;
+ fat = (FATFS *)fs->data;
RT_ASSERT(fat != RT_NULL);
@@ -147,7 +148,7 @@ int dfs_elm_unmount(struct dfs_filesystem* fs)
return -DFS_STATUS_ENOENT;
}
-int dfs_elm_mkfs(const char* device_name)
+int dfs_elm_mkfs(const char *device_name)
{
BYTE drv;
rt_device_t dev;
@@ -162,7 +163,7 @@ int dfs_elm_mkfs(const char* device_name)
/* 1: no partition table */
/* 0: auto selection of cluster size */
result = f_mkfs(drv, 1, 0);
- if ( result != FR_OK)
+ if (result != FR_OK)
{
rt_kprintf("format error\n");
return elm_result_to_dfs(result);
@@ -177,7 +178,7 @@ int dfs_elm_mkfs(const char* device_name)
return -DFS_STATUS_EIO;
}
-int dfs_elm_statfs(struct dfs_filesystem* fs, struct statfs *buf)
+int dfs_elm_statfs(struct dfs_filesystem *fs, struct statfs *buf)
{
FATFS *f;
FRESULT res;
@@ -187,11 +188,12 @@ int dfs_elm_statfs(struct dfs_filesystem* fs, struct statfs *buf)
RT_ASSERT(fs != RT_NULL);
RT_ASSERT(buf != RT_NULL);
- f = (FATFS*) fs->data;
+ f = (FATFS *)fs->data;
rt_snprintf(driver, sizeof(driver), "%d:", f->drv);
res = f_getfree(driver, &fre_clust, &f);
- if (res) return elm_result_to_dfs(res);
+ if (res)
+ return elm_result_to_dfs(res);
/* Get total sectors and free sectors */
tot_sect = (f->n_fatent - 2) * f->csize;
@@ -208,9 +210,9 @@ int dfs_elm_statfs(struct dfs_filesystem* fs, struct statfs *buf)
return 0;
}
-int dfs_elm_open(struct dfs_fd* file)
+int dfs_elm_open(struct dfs_fd *file)
{
- FIL* fd;
+ FIL *fd;
BYTE mode;
FRESULT result;
char *drivers_fn;
@@ -221,9 +223,11 @@ int dfs_elm_open(struct dfs_fd* file)
/* add path for ELM FatFS driver support */
vol = elm_get_vol((FATFS *)file->fs->data);
- if (vol < 0) return -DFS_STATUS_ENOENT;
+ if (vol < 0)
+ return -DFS_STATUS_ENOENT;
drivers_fn = rt_malloc(256);
- if (drivers_fn == RT_NULL) return -DFS_STATUS_ENOMEM;
+ if (drivers_fn == RT_NULL)
+ return -DFS_STATUS_ENOMEM;
rt_snprintf(drivers_fn, 256, "%d:%s", vol, file->path);
#else
@@ -273,17 +277,22 @@ int dfs_elm_open(struct dfs_fd* file)
{
mode = FA_READ;
- if (file->flags & DFS_O_WRONLY) mode |= FA_WRITE;
- if ((file->flags & DFS_O_ACCMODE) & DFS_O_RDWR) mode |= FA_WRITE;
+ if (file->flags & DFS_O_WRONLY)
+ mode |= FA_WRITE;
+ if ((file->flags & DFS_O_ACCMODE) & DFS_O_RDWR)
+ mode |= FA_WRITE;
/* Opens the file, if it is existing. If not, a new file is created. */
- if (file->flags & DFS_O_CREAT) mode |= FA_OPEN_ALWAYS;
+ if (file->flags & DFS_O_CREAT)
+ mode |= FA_OPEN_ALWAYS;
/* Creates a new file. If the file is existing, it is truncated and overwritten. */
- if (file->flags & DFS_O_TRUNC) mode |= FA_CREATE_ALWAYS;
+ if (file->flags & DFS_O_TRUNC)
+ mode |= FA_CREATE_ALWAYS;
/* Creates a new file. The function fails if the file is already existing. */
- if (file->flags & DFS_O_EXCL) mode |= FA_CREATE_NEW;
+ if (file->flags & DFS_O_EXCL)
+ mode |= FA_CREATE_NEW;
/* allocate a fd */
- fd = (FIL*)rt_malloc(sizeof(FIL));
+ fd = (FIL *)rt_malloc(sizeof(FIL));
if (fd == RT_NULL)
{
return -DFS_STATUS_ENOMEM;
@@ -315,16 +324,16 @@ int dfs_elm_open(struct dfs_fd* file)
return DFS_STATUS_OK;
}
-int dfs_elm_close(struct dfs_fd* file)
+int dfs_elm_close(struct dfs_fd *file)
{
FRESULT result;
result = FR_OK;
if (file->type == FT_DIRECTORY)
{
- DIR* dir;
+ DIR *dir;
- dir = (DIR*)(file->data);
+ dir = (DIR *)(file->data);
RT_ASSERT(dir != RT_NULL);
/* release memory */
@@ -332,8 +341,8 @@ int dfs_elm_close(struct dfs_fd* file)
}
else if (file->type == FT_REGULAR)
{
- FIL* fd;
- fd = (FIL*)(file->data);
+ FIL *fd;
+ fd = (FIL *)(file->data);
RT_ASSERT(fd != RT_NULL);
result = f_close(fd);
@@ -347,14 +356,14 @@ int dfs_elm_close(struct dfs_fd* file)
return elm_result_to_dfs(result);
}
-int dfs_elm_ioctl(struct dfs_fd* file, int cmd, void* args)
+int dfs_elm_ioctl(struct dfs_fd *file, int cmd, void *args)
{
return -DFS_STATUS_ENOSYS;
}
-int dfs_elm_read(struct dfs_fd* file, void* buf, rt_size_t len)
+int dfs_elm_read(struct dfs_fd *file, void *buf, rt_size_t len)
{
- FIL* fd;
+ FIL *fd;
FRESULT result;
UINT byte_read;
@@ -363,20 +372,21 @@ int dfs_elm_read(struct dfs_fd* file, void* buf, rt_size_t len)
return -DFS_STATUS_EISDIR;
}
- fd = (FIL*)(file->data);
+ fd = (FIL *)(file->data);
RT_ASSERT(fd != RT_NULL);
result = f_read(fd, buf, len, &byte_read);
/* update position */
file->pos = fd->fptr;
- if (result == FR_OK) return byte_read;
+ if (result == FR_OK)
+ return byte_read;
return elm_result_to_dfs(result);
}
-int dfs_elm_write(struct dfs_fd* file, const void* buf, rt_size_t len)
+int dfs_elm_write(struct dfs_fd *file, const void *buf, rt_size_t len)
{
- FIL* fd;
+ FIL *fd;
FRESULT result;
UINT byte_write;
@@ -385,39 +395,40 @@ int dfs_elm_write(struct dfs_fd* file, const void* buf, rt_size_t len)
return -DFS_STATUS_EISDIR;
}
- fd = (FIL*)(file->data);
+ fd = (FIL *)(file->data);
RT_ASSERT(fd != RT_NULL);
result = f_write(fd, buf, len, &byte_write);
/* update position and file size */
file->pos = fd->fptr;
file->size = fd->fsize;
- if (result == FR_OK) return byte_write;
+ if (result == FR_OK)
+ return byte_write;
return elm_result_to_dfs(result);
}
-int dfs_elm_flush(struct dfs_fd* file)
+int dfs_elm_flush(struct dfs_fd *file)
{
- FIL* fd;
+ FIL *fd;
FRESULT result;
- fd = (FIL*)(file->data);
+ fd = (FIL *)(file->data);
RT_ASSERT(fd != RT_NULL);
result = f_sync(fd);
return elm_result_to_dfs(result);
}
-int dfs_elm_lseek(struct dfs_fd* file, rt_off_t offset)
+int dfs_elm_lseek(struct dfs_fd *file, rt_off_t offset)
{
FRESULT result = FR_OK;
if (file->type == FT_REGULAR)
{
- FIL* fd;
+ FIL *fd;
/* regular file type */
- fd = (FIL*)(file->data);
+ fd = (FIL *)(file->data);
RT_ASSERT(fd != RT_NULL);
result = f_lseek(fd, offset);
@@ -430,9 +441,9 @@ int dfs_elm_lseek(struct dfs_fd* file, rt_off_t offset)
else if (file->type == FT_DIRECTORY)
{
/* which is a directory */
- DIR* dir;
+ DIR *dir;
- dir = (DIR*)(file->data);
+ dir = (DIR *)(file->data);
RT_ASSERT(dir != RT_NULL);
result = f_seekdir(dir, offset / sizeof(struct dirent));
@@ -447,20 +458,21 @@ int dfs_elm_lseek(struct dfs_fd* file, rt_off_t offset)
return elm_result_to_dfs(result);
}
-int dfs_elm_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count)
+int dfs_elm_getdents(struct dfs_fd *file, struct dirent *dirp, rt_uint32_t count)
{
- DIR* dir;
+ DIR *dir;
FILINFO fno;
FRESULT result;
rt_uint32_t index;
- struct dirent* d;
+ struct dirent *d;
- dir = (DIR*)(file->data);
+ dir = (DIR *)(file->data);
RT_ASSERT(dir != RT_NULL);
/* make integer count */
count = (count / sizeof(struct dirent)) * sizeof(struct dirent);
- if ( count == 0 ) return -DFS_STATUS_EINVAL;
+ if (count == 0)
+ return -DFS_STATUS_EINVAL;
#if _USE_LFN
/* allocate long file name */
@@ -476,7 +488,8 @@ int dfs_elm_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count
d = dirp + index;
result = f_readdir(dir, &fno);
- if (result != FR_OK || fno.fname[0] == 0) break;
+ if (result != FR_OK || fno.fname[0] == 0)
+ break;
#if _USE_LFN
fn = *fno.lfname? fno.lfname : fno.fname;
@@ -485,15 +498,17 @@ int dfs_elm_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count
#endif
d->d_type = DFS_DT_UNKNOWN;
- if (fno.fattrib & AM_DIR) d->d_type = DFS_DT_DIR;
- else d->d_type = DFS_DT_REG;
+ if (fno.fattrib & AM_DIR)
+ d->d_type = DFS_DT_DIR;
+ else
+ d->d_type = DFS_DT_REG;
d->d_namlen = rt_strlen(fn);
d->d_reclen = (rt_uint16_t)sizeof(struct dirent);
rt_strncpy(d->d_name, fn, rt_strlen(fn) + 1);
index ++;
- if ( index * sizeof(struct dirent) >= count )
+ if (index * sizeof(struct dirent) >= count)
break;
}
@@ -509,7 +524,7 @@ int dfs_elm_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count
return index * sizeof(struct dirent);
}
-int dfs_elm_unlink(struct dfs_filesystem* fs, const char* path)
+int dfs_elm_unlink(struct dfs_filesystem *fs, const char *path)
{
FRESULT result;
@@ -520,9 +535,11 @@ int dfs_elm_unlink(struct dfs_filesystem* fs, const char* path)
/* add path for ELM FatFS driver support */
vol = elm_get_vol((FATFS *)fs->data);
- if (vol < 0) return -DFS_STATUS_ENOENT;
+ if (vol < 0)
+ return -DFS_STATUS_ENOENT;
drivers_fn = rt_malloc(256);
- if (drivers_fn == RT_NULL) return -DFS_STATUS_ENOMEM;
+ if (drivers_fn == RT_NULL)
+ return -DFS_STATUS_ENOMEM;
rt_snprintf(drivers_fn, 256, "%d:%s", vol, path);
#else
@@ -537,7 +554,7 @@ int dfs_elm_unlink(struct dfs_filesystem* fs, const char* path)
return elm_result_to_dfs(result);
}
-int dfs_elm_rename(struct dfs_filesystem* fs, const char* oldpath, const char* newpath)
+int dfs_elm_rename(struct dfs_filesystem *fs, const char *oldpath, const char *newpath)
{
FRESULT result;
@@ -549,10 +566,12 @@ int dfs_elm_rename(struct dfs_filesystem* fs, const char* oldpath, const char* n
/* add path for ELM FatFS driver support */
vol = elm_get_vol((FATFS *)fs->data);
- if (vol < 0) return -DFS_STATUS_ENOENT;
+ if (vol < 0)
+ return -DFS_STATUS_ENOENT;
drivers_oldfn = rt_malloc(256);
- if (drivers_oldfn == RT_NULL) return -DFS_STATUS_ENOMEM;
+ if (drivers_oldfn == RT_NULL)
+ return -DFS_STATUS_ENOMEM;
drivers_newfn = newpath;
rt_snprintf(drivers_oldfn, 256, "%d:%s", vol, oldpath);
@@ -570,7 +589,7 @@ int dfs_elm_rename(struct dfs_filesystem* fs, const char* oldpath, const char* n
return elm_result_to_dfs(result);
}
-int dfs_elm_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
+int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st)
{
FILINFO file_info;
FRESULT result;
@@ -583,9 +602,11 @@ int dfs_elm_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
/* add path for ELM FatFS driver support */
vol = elm_get_vol((FATFS *)fs->data);
- if (vol < 0) return -DFS_STATUS_ENOENT;
+ if (vol < 0)
+ return -DFS_STATUS_ENOENT;
drivers_fn = rt_malloc(256);
- if (drivers_fn == RT_NULL) return -DFS_STATUS_ENOMEM;
+ if (drivers_fn == RT_NULL)
+ return -DFS_STATUS_ENOMEM;
rt_snprintf(drivers_fn, 256, "%d:%s", vol, path);
#else
@@ -606,7 +627,7 @@ int dfs_elm_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
if (result == FR_OK)
{
/* convert to dfs stat structure */
- st->st_dev = 0;
+ st->st_dev = 0;
st->st_mode = DFS_S_IFREG | DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH |
DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH;
@@ -816,19 +837,19 @@ DRESULT disk_ioctl (
#include "diskio.h"
/* Inidialize a Drive */
-DSTATUS disk_initialize (BYTE drv)
+DSTATUS disk_initialize(BYTE drv)
{
return 0;
}
/* Return Disk Status */
-DSTATUS disk_status (BYTE drv)
+DSTATUS disk_status(BYTE drv)
{
return 0;
}
/* Read Sector(s) */
-DRESULT disk_read (BYTE drv, BYTE *buff, DWORD sector, BYTE count)
+DRESULT disk_read(BYTE drv, BYTE *buff, DWORD sector, BYTE count)
{
rt_size_t result;
rt_device_t device = disk[drv];
@@ -843,7 +864,7 @@ DRESULT disk_read (BYTE drv, BYTE *buff, DWORD sector, BYTE count)
}
/* Write Sector(s) */
-DRESULT disk_write (BYTE drv, const BYTE *buff, DWORD sector, BYTE count)
+DRESULT disk_write(BYTE drv, const BYTE *buff, DWORD sector, BYTE count)
{
rt_size_t result;
rt_device_t device = disk[drv];
@@ -858,11 +879,12 @@ DRESULT disk_write (BYTE drv, const BYTE *buff, DWORD sector, BYTE count)
}
/* Miscellaneous Functions */
-DRESULT disk_ioctl (BYTE drv, BYTE ctrl, void *buff)
+DRESULT disk_ioctl(BYTE drv, BYTE ctrl, void *buff)
{
rt_device_t device = disk[drv];
- if (device == RT_NULL) return RES_ERROR;
+ if (device == RT_NULL)
+ return RES_ERROR;
if (ctrl == GET_SECTOR_COUNT)
{
@@ -871,8 +893,9 @@ DRESULT disk_ioctl (BYTE drv, BYTE ctrl, void *buff)
rt_memset(&geometry, 0, sizeof(geometry));
rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);
- *(DWORD*)buff = geometry.sector_count;
- if (geometry.sector_count == 0) return RES_ERROR;
+ *(DWORD *)buff = geometry.sector_count;
+ if (geometry.sector_count == 0)
+ return RES_ERROR;
}
else if (ctrl == GET_SECTOR_SIZE)
{
@@ -881,7 +904,7 @@ DRESULT disk_ioctl (BYTE drv, BYTE ctrl, void *buff)
rt_memset(&geometry, 0, sizeof(geometry));
rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);
- *(WORD*)buff = geometry.bytes_per_sector;
+ *(WORD *)buff = geometry.bytes_per_sector;
}
else if (ctrl == GET_BLOCK_SIZE) /* Get erase block size in unit of sectors (DWORD) */
{
@@ -890,20 +913,20 @@ DRESULT disk_ioctl (BYTE drv, BYTE ctrl, void *buff)
rt_memset(&geometry, 0, sizeof(geometry));
rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);
- *(DWORD*)buff = geometry.block_size/geometry.bytes_per_sector;
+ *(DWORD *)buff = geometry.block_size/geometry.bytes_per_sector;
}
return RES_OK;
}
#endif
-rt_time_t get_fattime()
+rt_time_t get_fattime(void)
{
return 0;
}
#if _FS_REENTRANT
-int ff_cre_syncobj(BYTE drv, _SYNC_t* m)
+int ff_cre_syncobj(BYTE drv, _SYNC_t *m)
{
char name[8];
rt_mutex_t mutex;
@@ -928,7 +951,8 @@ int ff_del_syncobj(_SYNC_t m)
int ff_req_grant(_SYNC_t m)
{
- if (rt_mutex_take(m, _FS_TIMEOUT) == RT_EOK) return RT_TRUE;
+ if (rt_mutex_take(m, _FS_TIMEOUT) == RT_EOK)
+ return RT_TRUE;
return RT_FALSE;
}
diff --git a/bsp/efm32/dev_lcd.c b/bsp/efm32/dev_lcd.c
new file mode 100644
index 0000000000..e678c9a617
--- /dev/null
+++ b/bsp/efm32/dev_lcd.c
@@ -0,0 +1,625 @@
+/***************************************************************************//**
+ * @file dev_lcd.c
+ * @brief LCD driver of RT-Thread RTOS for EFM32
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author onelife
+ * @version 0.4 beta
+ *******************************************************************************
+ * @section License
+ * The license and distribution terms for this file may be found in the file
+ * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
+ *******************************************************************************
+ * @section Change Logs
+ * Date Author Notes
+ * 2011-12-16 onelife Initial creation for EFM32
+ ******************************************************************************/
+
+/***************************************************************************//**
+ * @addtogroup efm32
+ * @{
+ ******************************************************************************/
+
+/* Includes ------------------------------------------------------------------*/
+#include "board.h"
+#include "drv_usart.h"
+#include "dev_lcd.h"
+
+#if defined(EFM32_USING_LCD)
+#include
+#include
+
+#include
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+#ifdef EFM32_LCD_DEBUG
+#define lcd_debug(format,args...) rt_kprintf(format, ##args)
+#else
+#define lcd_debug(format,args...)
+#endif
+
+/* Private function prototypes -----------------------------------------------*/
+static void efm32_spiLcd_setPixel(rtgui_color_t *c, int x, int y);
+static void efm32_spiLcd_getPixel(rtgui_color_t *c, int x, int y);
+static void efm32_spiLcd_drawRawHLine(rt_uint8_t *pixels, int x1, int x2, int y);
+static void efm32_spiLcd_drawHLine(rtgui_color_t *c, int x1, int x2, int y);
+static void efm32_spiLcd_drawVLine(rtgui_color_t *c, int x1, int x2, int y);
+
+/* Private variables ---------------------------------------------------------*/
+static rt_device_t lcd;
+static struct rt_device lcd_device;
+static struct rt_device_graphic_info lcd_info;
+static const struct rtgui_graphic_driver_ops lcd_ops =
+ {
+ efm32_spiLcd_setPixel,
+ efm32_spiLcd_getPixel,
+ efm32_spiLcd_drawHLine,
+ efm32_spiLcd_drawVLine,
+ efm32_spiLcd_drawRawHLine
+ };
+static rt_bool_t lcdAutoCs = true;
+
+/* Private functions ---------------------------------------------------------*/
+/***************************************************************************//**
+ * @brief
+ * Set/Clear chip select
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] enable
+ * Chip select pin setting
+ ******************************************************************************/
+static void efm32_spiLcd_cs(rt_uint8_t enable)
+{
+ if (!lcdAutoCs)
+ {
+ if (enable)
+ {
+ GPIO_PinOutClear(LCD_CS_PORT, LCD_CS_PIN);
+ }
+ else
+ {
+ GPIO_PinOutSet(LCD_CS_PORT, LCD_CS_PIN);
+ }
+ }
+}
+
+/***************************************************************************//**
+ * @brief
+ * Draw a pixel with specified color
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] c
+ * Pointer to color
+ *
+ * @param[in] x
+ * Horizontal position
+ *
+ * @param[in] y
+ * Vertical position
+ ******************************************************************************/
+static void efm32_spiLcd_setPixel(rtgui_color_t *c, int x, int y)
+{
+ rt_uint32_t ret = RT_EOK;
+
+ do
+ {
+ /* Check if pixel is outside clipping region */
+ if ((x < 0) || (x > lcd_info.width))
+ {
+ break;
+ }
+ if ((y < 0) || (y > lcd_info.height))
+ {
+ break;
+ }
+
+ /* Write color */
+ ret = DMD_writePixel((rt_uint16_t)x, (rt_uint16_t)y, (rt_uint16_t)*c, 1);
+ if (ret != 0)
+ {
+ break;
+ }
+ return;
+ } while(0);
+
+ lcd_debug("LCD err: Set pixel at (%d,%d: %x) failed (%x)!\n",
+ x, y, *c, ret);
+}
+
+/***************************************************************************//**
+ * @brief
+ * Get the color of a pixel
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[out] c
+ * Pointer to color
+ *
+ * @param[in] x
+ * Horizontal position
+ *
+ * @param[in] y
+ * Vertical position
+ ******************************************************************************/
+static void efm32_spiLcd_getPixel(rtgui_color_t *c, int x, int y)
+{
+ rt_uint32_t ret = RT_EOK;
+
+ do
+ {
+ /* Check if pixel is outside clipping region */
+ if ((x < 0) || (x > lcd_info.width))
+ {
+ break;
+ }
+ if ((y < 0) || (y > lcd_info.height))
+ {
+ break;
+ }
+
+ /* Read color */
+ ret = DMD_readPixel((rt_uint16_t)x, (rt_uint16_t)y, (rt_uint16_t *)c);
+ if (ret != 0)
+ {
+ break;
+ }
+ return;
+ } while(0);
+
+ lcd_debug("LCD err: Get pixel at (%d,%d: %x) failed (%x)!\n",
+ x, y, *c, ret);
+}
+
+/***************************************************************************//**
+ * @brief
+ * Draw a horizontal line with raw color
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] pixels
+ * Pointer to raw color
+ *
+ * @param[in] x1
+ * Horizontal start position
+ *
+ * @param[in] x2
+ * Horizontal end position
+ *
+ * @param[in] y
+ * Vertical position
+ ******************************************************************************/
+static void efm32_spiLcd_drawRawHLine(rt_uint8_t *pixels, int x1, int x2, int y)
+{
+ lcd_debug("LCD: RAW H LINE!\n");
+}
+
+/***************************************************************************//**
+ * @brief
+ * Draw a horizontal line with specified color
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] c
+ * Pointer to color
+ *
+ * @param[in] x1
+ * Horizontal start position
+ *
+ * @param[in] x2
+ * Horizontal end position
+ *
+ * @param[in] y
+ * Vertical position
+ ******************************************************************************/
+static void efm32_spiLcd_drawHLine(rtgui_color_t *c, int x1, int x2, int y)
+{
+ rt_uint32_t ret = RT_EOK;
+
+ do
+ {
+ /* Check if line is outside of clipping region */
+ if ((y < 0) || (y > lcd_info.height))
+ {
+ break;
+ }
+
+ /* Swap the coordinates if x1 is larger than x2 */
+ if (x1 > x2)
+ {
+ int swap;
+ swap = x1;
+ x1 = x2;
+ x2 = swap;
+ }
+
+ /* Check if entire line is outside clipping region */
+ if ((x1 > lcd_info.width) || (x2 < 0))
+ {
+ /* Nothing to draw */
+ break;
+ }
+
+ /* Clip the line if necessary */
+ if (x1 < 0)
+ {
+ x1 = 0;
+ }
+ if (x2 > lcd_info.width)
+ {
+ x2 = lcd_info.width;
+ }
+
+ /* Write color */
+ rt_uint32_t length = x2 - x1 + 1;
+ ret = DMD_writePixel((rt_uint16_t)x1, (rt_uint16_t)y,
+ (rt_uint16_t)*c, length);
+ if (ret != 0)
+ {
+ break;
+ }
+ return;
+ } while(0);
+
+ lcd_debug("LCD err: Draw hline at (%d-%d,%d: %x) failed (%x)!\n",
+ x1, x2, y, *c, ret);
+}
+
+/***************************************************************************//**
+ * @brief
+ * Draw a vertical line with specified color
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] c
+ * Pointer to color
+ *
+ * @param[in] x
+ * Horizontal position
+ *
+ * @param[in] y1
+ * Vertical start position
+ *
+ * @param[in] y2
+ * Vertical end position
+ ******************************************************************************/
+static void efm32_spiLcd_drawVLine(rtgui_color_t *c, int x , int y1, int y2)
+{
+ rt_uint32_t ret = RT_EOK;
+
+ do
+ {
+ /* Check if line is outside of clipping region */
+ if ((x < 0) || (x > lcd_info.width))
+ {
+ break;
+ }
+
+ /* Swap the coordinates if y1 is larger than y2 */
+ if (y1 > y2)
+ {
+ rt_uint16_t swap;
+ swap = y1;
+ y1 = y2;
+ y2 = swap;
+ }
+
+ /* Check if entire line is outside clipping region */
+ if ((y1 > lcd_info.height) || (y2 < 0))
+ {
+ /* Nothing to draw */
+ break;
+ }
+
+ /* Clip the line if necessary */
+ if (y1 < 0)
+ {
+ y1 = 0;
+ }
+
+ if (y2 > lcd_info.height)
+ {
+ y2 = lcd_info.height;
+ }
+
+ /* Set clipping area */
+ rt_uint16_t length = y2 - y1 + 1;
+ ret = DMD_setClippingArea((rt_uint16_t)x, (rt_uint16_t)y1, 1, length);
+ if (ret != DMD_OK)
+ {
+ break;
+ }
+
+ /* Write color */
+ ret= DMD_writePixel(0, 0, (rt_uint16_t)*c, length);
+ if (ret != DMD_OK)
+ {
+ break;
+ }
+
+ /* Reset clipping area */
+ ret = DMD_setClippingArea(0, 0, lcd_info.width, lcd_info.height);
+ if (ret != DMD_OK)
+ {
+ break;
+ }
+ return;
+ } while(0);
+
+ lcd_debug("LCD err: Draw vline at (%d,%d-%d: %x) failed (%x)!\n",
+ x, y1, y2, *c, ret);
+}
+
+/***************************************************************************//**
+* @brief
+* Configure LCD device
+*
+* @details
+*
+* @note
+*
+* @param[in] dev
+* Pointer to device descriptor
+*
+* @param[in] cmd
+* IIC control command
+*
+* @param[in] args
+* Arguments
+*
+* @return
+* Error code
+******************************************************************************/
+static rt_err_t efm32_spiLcd_control (rt_device_t dev, rt_uint8_t cmd, void *args)
+{
+ switch (cmd)
+ {
+ case RTGRAPHIC_CTRL_RECT_UPDATE:
+ break;
+ case RTGRAPHIC_CTRL_POWERON:
+ break;
+ case RTGRAPHIC_CTRL_POWEROFF:
+ break;
+ case RTGRAPHIC_CTRL_GET_INFO:
+ rt_memcpy(args, &lcd_info, sizeof(struct rt_device_graphic_info));
+ break;
+ case RTGRAPHIC_CTRL_SET_MODE:
+ break;
+ }
+
+ return RT_EOK;
+}
+
+/***************************************************************************//**
+ * @brief
+ * Write data to SSD2119 controller
+ *
+ * @param[in] reg
+ * Register to write to
+ *
+ * @param[in] data
+ * 16-bit data to write into register
+ *
+ * @note
+ * It's not possible to read back register value through SSD2119 SPI interface
+ ******************************************************************************/
+rt_err_t efm32_spiLed_writeRegister(rt_uint8_t reg, rt_uint16_t data)
+{
+ struct efm32_usart_device_t *usart;
+ rt_uint8_t buf_ins[3];
+ rt_uint8_t buf_res[3];
+
+ RT_ASSERT(lcd != RT_NULL);
+ usart = (struct efm32_usart_device_t *)(lcd->user_data);
+
+ /* Build instruction buffer */
+ buf_res[0] = (data & 0xff00) >> 8;
+ buf_res[1] = data & 0x00ff;
+ buf_ins[0] = 1; /* Instruction length */
+ buf_ins[1] = reg; /* Instruction */
+ *(rt_uint8_t **)(&buf_ins[2]) = buf_res; /* Data */
+ efm32_spiLcd_cs(1);
+ if (lcd->write(lcd, EFM32_NO_DATA, buf_ins, 2) == 0)
+ {
+ lcd_debug("LCD: Write data failed!\n");
+ return -RT_ERROR;
+ }
+ efm32_spiLcd_cs(0);
+
+ return RT_EOK;
+}
+
+/***************************************************************************//**
+ * @brief
+ * Register LCD device
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] device
+ * Pointer to device descriptor
+ *
+ * @param[in] name
+ * Device name
+ *
+ * @param[in] flag
+ * Configuration flags
+ *
+ * @param[in] iic
+ * Pointer to IIC device descriptor
+ *
+ * @return
+ * Error code
+ ******************************************************************************/
+rt_err_t efm32_spiLcd_register(
+ rt_device_t device,
+ const char *name,
+ rt_uint32_t flag,
+ void *data)
+{
+ RT_ASSERT(device != RT_NULL);
+
+ device->type = RT_Device_Class_Graphic;
+ device->rx_indicate = RT_NULL;
+ device->tx_complete = RT_NULL;
+ device->init = RT_NULL;
+ device->open = RT_NULL;
+ device->close = RT_NULL;
+ device->read = RT_NULL;
+ device->write = RT_NULL;
+ device->control = efm32_spiLcd_control;
+ device->user_data = data;
+
+ /* register a character device */
+ return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
+}
+
+/***************************************************************************//**
+ * @brief
+ * Initialize LCD device
+ *
+ * @details
+ *
+ * @note
+ *
+ ******************************************************************************/
+void efm32_spiLcd_init(void)
+{
+ struct efm32_usart_device_t *usart;
+ rt_uint32_t flag;
+ DMD_DisplayGeometry *geometry;
+ rt_uint32_t ret;
+
+ do
+ {
+ USART_InitSync_TypeDef init = USART_INITSYNC_DEFAULT;
+
+ /* Find SPI device */
+ lcd = rt_device_find(LCD_USING_DEVICE_NAME);
+ if (lcd == RT_NULL)
+ {
+ lcd_debug("LCD err: Can't find %s!\n", LCD_USING_DEVICE_NAME);
+ break;
+ }
+ lcd_debug("LCD: Find device %s\n", LCD_USING_DEVICE_NAME);
+
+ /* Reconfig speed */
+ usart = (struct efm32_usart_device_t *)(lcd->user_data);
+ USART_BaudrateSyncSet(usart->usart_device, 0, EFM32_LCD_SPICLK);
+
+ /* Config CS pin */
+ if (!(usart->state & USART_STATE_AUTOCS))
+ {
+ GPIO_PinModeSet(LCD_CS_PORT, LCD_CS_PIN, gpioModePushPull, 1);
+ lcdAutoCs = false;
+ }
+
+ // TODO: add another method
+ /* TFT initialize or reinitialize to Address Mapped Mode
+ Assumes EBI has been configured correctly in DVK_init(DVK_Init_EBI) */
+ rt_uint32_t freq = SystemCoreClockGet();
+ rt_uint32_t i;
+ rt_bool_t warning = RT_FALSE;
+
+ /* If we are in BC_UIF_AEM_EFM state, we can redraw graphics */
+ while (DVK_readRegister(&BC_REGISTER->UIF_AEM) != BC_UIF_AEM_EFM)
+ {
+ if (!warning)
+ {
+ lcd_debug("LCD: Please press AEM button!!!\n");
+ warning = RT_TRUE;
+ }
+ }
+
+ lcd_debug("LCD: Got LCD control\n");
+ /* If we're not BC_ARB_CTRL_EBI state, we need to reconfigure display controller */
+ if (DVK_readRegister(&BC_REGISTER->ARB_CTRL) != BC_ARB_CTRL_EBI)
+ {
+ lcd_debug("LCD: Set to EBI mode\n");
+ /* Configure for EBI mode and reset display */
+ DVK_displayControl(DVK_Display_EBI);
+ DVK_displayControl(DVK_Display_ResetAssert);
+ DVK_displayControl(DVK_Display_PowerDisable);
+ /* Short delay */
+ freq = SystemCoreClockGet();
+ for(i = 0; i < (freq / 100); i++)
+ {
+ __NOP();
+ }
+ /* Configure display for Direct Drive + SPI mode */
+ DVK_displayControl(DVK_Display_Mode8080);
+ DVK_displayControl(DVK_Display_PowerEnable);
+ DVK_displayControl(DVK_Display_ResetRelease);
+
+ /* Initialize graphics - abort on failure */
+ ret = DMD_init(BC_SSD2119_BASE, BC_SSD2119_BASE + 2);
+ if (ret == DMD_OK)
+ {
+ /* Make sure display is configured with correct rotation */
+ DMD_flipDisplay(1, 1);
+ }
+ else if (ret != DMD_ERROR_DRIVER_ALREADY_INITIALIZED)
+ {
+ lcd_debug("LCD err: driver init failed %x\n", ret);
+ break;
+ }
+ }
+
+ /* Get LCD geometry */
+ ret = DMD_getDisplayGeometry(&geometry);
+ if (ret != DMD_OK)
+ {
+ lcd_debug("LCD err: get geometry failed!\n");
+ break;
+ }
+
+ /* Init LCD info */
+ lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
+ lcd_info.bits_per_pixel = 16;
+ lcd_info.width = geometry->xSize - 1;
+ lcd_info.height = geometry->ySize - 1;
+ lcd_info.framebuffer = RT_NULL;
+
+ flag = RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_DMA_TX;
+ efm32_spiLcd_register(&lcd_device, LCD_DEVICE_NAME, flag, (void *)&lcd_ops);
+
+ /* Set clipping area */
+ ret = DMD_setClippingArea(0, 0, geometry->xSize, geometry->ySize);
+ if (ret != DMD_OK)
+ {
+ lcd_debug("LCD err: set clipping area failed!\n");
+ break;
+ }
+ /* Read device code */
+ rt_uint16_t code = 0xFFFF;
+ code = DMDIF_readDeviceCode();
+
+ /* Set as rtgui graphic driver */
+ rtgui_graphic_set_device(&lcd_device);
+
+ lcd_debug("LCD: H/W (%x) init OK!\n", code);
+ return;
+ } while(0);
+
+ lcd_debug("LCD err: H/W init failed!\n");
+}
+
+ #endif /* defined(EFM32_USING_LCD) */
+/***************************************************************************//**
+ * @}
+ ******************************************************************************/
diff --git a/bsp/efm32/dev_lcd.h b/bsp/efm32/dev_lcd.h
new file mode 100644
index 0000000000..af6a145b62
--- /dev/null
+++ b/bsp/efm32/dev_lcd.h
@@ -0,0 +1,29 @@
+/***************************************************************************//**
+ * @file dev_lcd.h
+ * @brief LCD driver of RT-Thread RTOS for EFM32
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author onelife
+ * @version 0.4 beta
+ *******************************************************************************
+ * @section License
+ * The license and distribution terms for this file may be found in the file
+ * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
+ *******************************************************************************
+ * @section Change Logs
+ * Date Author Notes
+ * 2011-12-16 onelife Initial creation for EFM32
+ ******************************************************************************/
+#ifndef __DEV_LCD_H__
+#define __DEV_LCD_H__
+
+/* Includes ------------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* Exported macro ------------------------------------------------------------*/
+#define EFM32_LCD_SPICLK (1000000)
+#define SPI_TFT_WriteRegister efm32_spiLed_writeRegister
+
+/* Exported functions ------------------------------------------------------- */
+void efm32_spiLcd_init(void);
+
+#endif /* __DEV_LCD_H__ */
diff --git a/bsp/efm32/drv_acmp.c b/bsp/efm32/drv_acmp.c
index 76b3db5187..4f575470a9 100644
--- a/bsp/efm32/drv_acmp.c
+++ b/bsp/efm32/drv_acmp.c
@@ -1,40 +1,41 @@
-/******************************************************************//**
- * @file drv_acmp.c
- * @brief ACMP (analog comparator) driver of RT-Thread RTOS for EFM32
+/***************************************************************************//**
+ * @file drv_acmp.c
+ * @brief ACMP (analog comparator) driver of RT-Thread RTOS for EFM32
* COPYRIGHT (C) 2011, RT-Thread Development Team
- * @author onelife
- * @version 0.4 beta
- **********************************************************************
+ * @author onelife
+ * @version 0.4 beta
+ *******************************************************************************
* @section License
- * The license and distribution terms for this file may be found in the file LICENSE in this
- * distribution or at http://www.rt-thread.org/license/LICENSE
- **********************************************************************
+ * The license and distribution terms for this file may be found in the file
+ * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
+ *******************************************************************************
* @section Change Logs
- * Date Author Notes
- * 2011-02-21 onelife Initial creation for EFM32
- * 2011-06-17 onelife Modify init and control function for efm32lib v2 upgrading
- *********************************************************************/
-
-/******************************************************************//**
-* @addtogroup efm32
-* @{
-*********************************************************************/
+ * Date Author Notes
+ * 2011-02-21 onelife Initial creation for EFM32
+ * 2011-06-17 onelife Modify init and control function for efm32lib v2
+ * upgrading
+ ******************************************************************************/
-/* Includes -------------------------------------------------------------------*/
+/***************************************************************************//**
+ * @addtogroup efm32
+ * @{
+ ******************************************************************************/
+
+/* Includes ------------------------------------------------------------------*/
#include "board.h"
#include "drv_acmp.h"
#if (defined(RT_USING_ACMP0) || defined(RT_USING_ACMP1))
-/* Private typedef -------------------------------------------------------------*/
-/* Private define --------------------------------------------------------------*/
-/* Private macro --------------------------------------------------------------*/
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
#ifdef RT_ACMP_DEBUG
#define acmp_debug(format,args...) rt_kprintf(format, ##args)
#else
#define acmp_debug(format,args...)
#endif
-/* Private variables ------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
#ifdef RT_USING_ACMP0
static struct rt_device acmp0_device;
#endif
@@ -43,11 +44,11 @@
static struct rt_device acmp1_device;
#endif
-/* Private function prototypes ---------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
ACMP_WarmTime_TypeDef efm32_acmp_WarmTimeCalc(rt_uint32_t hfperFreq);
-/* Private functions ------------------------------------------------------------*/
-/******************************************************************//**
+/* Private functions ---------------------------------------------------------*/
+/***************************************************************************//**
* @brief
* Initialize ACMP device
*
@@ -60,7 +61,7 @@ ACMP_WarmTime_TypeDef efm32_acmp_WarmTimeCalc(rt_uint32_t hfperFreq);
*
* @return
* Error code
- *********************************************************************/
+ ******************************************************************************/
static rt_err_t rt_acmp_init(rt_device_t dev)
{
RT_ASSERT(dev != RT_NULL);
@@ -75,29 +76,29 @@ ACMP_WarmTime_TypeDef efm32_acmp_WarmTimeCalc(rt_uint32_t hfperFreq);
return RT_EOK;
}
-/******************************************************************//**
-* @brief
-* Configure ACMP device
-*
-* @details
-*
-* @note
-*
-* @param[in] dev
-* Pointer to device descriptor
-*
-* @param[in] cmd
-* ACMP control command
-*
-* @param[in] args
-* Arguments
-*
-* @return
-* Error code
-*********************************************************************/
+/***************************************************************************//**
+ * @brief
+ * Configure ACMP device
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] dev
+ * Pointer to device descriptor
+ *
+ * @param[in] cmd
+ * ACMP control command
+ *
+ * @param[in] args
+ * Arguments
+ *
+ * @return
+ * Error code
+ ******************************************************************************/
static rt_err_t rt_acmp_control(
- rt_device_t dev,
- rt_uint8_t cmd,
+ rt_device_t dev,
+ rt_uint8_t cmd,
void *args)
{
RT_ASSERT(dev != RT_NULL);
@@ -129,7 +130,7 @@ static rt_err_t rt_acmp_control(
acmp_debug("ACMP: control -> init start\n");
/* Configure ACMPn */
- if (control->init == RT_NULL)
+ if (control->init == RT_NULL)
{
return -RT_ERROR;
}
@@ -138,9 +139,9 @@ static rt_err_t rt_acmp_control(
if (control->output != RT_NULL)
{
ACMP_GPIOSetup(
- acmp->acmp_device,
- control->output->location,
- control->output->enable,
+ acmp->acmp_device,
+ control->output->location,
+ control->output->enable,
control->output->invert);
int_en = true;
}
@@ -156,7 +157,7 @@ static rt_err_t rt_acmp_control(
/* Enable edge interrupt */
ACMP_IntEnable(acmp->acmp_device, ACMP_IEN_EDGE);
ACMP_IntClear(acmp->acmp_device, ACMP_IFC_EDGE);
-
+
/* Enable ACMP0/1 interrupt vector in NVIC */
NVIC_ClearPendingIRQ(ACMP0_IRQn);
NVIC_SetPriority(ACMP0_IRQn, EFM32_IRQ_PRI_DEFAULT);
@@ -169,7 +170,7 @@ static rt_err_t rt_acmp_control(
*((rt_bool_t *)args) = \
(acmp->acmp_device->STATUS & ACMP_STATUS_ACMPOUT) ? true : false;
break;
-
+
default:
return -RT_ERROR;
}
@@ -177,33 +178,33 @@ static rt_err_t rt_acmp_control(
return RT_EOK;
}
-/******************************************************************//**
-* @brief
-* Register ACMP device
-*
-* @details
-*
-* @note
-*
-* @param[in] device
-* Pointer to device descriptor
-*
-* @param[in] name
-* Device name
-*
-* @param[in] flag
-* Configuration flags
-*
-* @param[in] acmp
-* Pointer to ACMP device descriptor
-*
-* @return
-* Error code
-*********************************************************************/
+/***************************************************************************//**
+ * @brief
+ * Register ACMP device
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] device
+ * Pointer to device descriptor
+ *
+ * @param[in] name
+ * Device name
+ *
+ * @param[in] flag
+ * Configuration flags
+ *
+ * @param[in] acmp
+ * Pointer to ACMP device descriptor
+ *
+ * @return
+ * Error code
+ ******************************************************************************/
rt_err_t rt_hw_acmp_register(
- rt_device_t device,
- const char *name,
- rt_uint32_t flag,
+ rt_device_t device,
+ const char *name,
+ rt_uint32_t flag,
struct efm32_acmp_device_t *acmp)
{
RT_ASSERT(device != RT_NULL);
@@ -223,14 +224,14 @@ rt_err_t rt_hw_acmp_register(
return rt_device_register(device, name, flag);
}
-/******************************************************************//**
+/***************************************************************************//**
* @brief
* ACMP edge trigger interrupt handler
*
* @details
*
* @note
- *********************************************************************/
+ ******************************************************************************/
void rt_hw_acmp_isr(rt_device_t dev)
{
RT_ASSERT(dev != RT_NULL);
@@ -245,23 +246,23 @@ void rt_hw_acmp_isr(rt_device_t dev)
}
}
-/******************************************************************//**
-* @brief
-* Initialize the specified ACMP unit
-*
-* @details
-*
-* @note
-*
-* @param[in] device
-* Pointer to device descriptor
-*
-* @param[in] unitNumber
-* Unit number
-*
-* @return
-* Pointer to ACMP device
-*********************************************************************/
+/***************************************************************************//**
+ * @brief
+ * Initialize the specified ACMP unit
+ *
+ * @details
+ *
+ * @note
+ *
+ * @param[in] device
+ * Pointer to device descriptor
+ *
+ * @param[in] unitNumber
+ * Unit number
+ *
+ * @return
+ * Pointer to ACMP device
+ ******************************************************************************/
static struct efm32_acmp_device_t *rt_hw_acmp_unit_init(
rt_device_t device,
rt_uint8_t unitNumber)
@@ -291,7 +292,7 @@ static struct efm32_acmp_device_t *rt_hw_acmp_unit_init(
acmp->acmp_device = ACMP0;
acmpClock = (CMU_Clock_TypeDef)cmuClock_ACMP0;
break;
-
+
case 1:
acmp->acmp_device = ACMP1;
acmpClock = (CMU_Clock_TypeDef)cmuClock_ACMP1;
@@ -325,15 +326,16 @@ static struct efm32_acmp_device_t *rt_hw_acmp_unit_init(
return RT_NULL;
}
-/******************************************************************//**
-* @brief
-* Initialize all ACMP module related hardware and register ACMP device to kernel
-*
-* @details
-*
-* @note
-*
-*********************************************************************/
+/***************************************************************************//**
+ * @brief
+ * Initialize all ACMP module related hardware and register ACMP device to
+ * kernel
+ *
+ * @details
+ *
+ * @note
+ *
+ ******************************************************************************/
void rt_hw_acmp_init(void)
{
struct efm32_acmp_device_t *acmp;
@@ -341,30 +343,30 @@ void rt_hw_acmp_init(void)
#ifdef RT_USING_ACMP0
if ((acmp = rt_hw_acmp_unit_init(&acmp0_device, 0)) != RT_NULL)
{
- rt_hw_acmp_register(&acmp0_device, RT_ACMP0_NAME, EFM32_NO_DATA, acmp);
+ rt_hw_acmp_register(&acmp0_device, RT_ACMP0_NAME, EFM32_NO_DATA, acmp);
}
#endif
#ifdef RT_USING_ACMP1
if ((acmp = rt_hw_acmp_unit_init(&acmp1_device, 1)) != RT_NULL)
{
- rt_hw_acmp_register(&acmp1_device, RT_ACMP1_NAME, EFM32_NO_DATA, acmp);
+ rt_hw_acmp_register(&acmp1_device, RT_ACMP1_NAME, EFM32_NO_DATA, acmp);
}
#endif
}
-/******************************************************************//**
+/***************************************************************************//**
* @brief
* Calculate the warm-up time value providing at least 10us
*
- * @param[in] hfperFreq
- * Frequency in Hz of reference HFPER clock. Set to 0 to use currently defined HFPER clock
- * setting
+ * @param[in] hfperFreq
+ * Frequency in Hz of reference HFPER clock. Set to 0 to use currently defined
+ * HFPER clock setting
*
* @return
- * Warm-up time value to use for ACMP in order to achieve at least 10us
- *********************************************************************/
+ * Warm-up time value to use for ACMP in order to achieve at least 10us
+ ******************************************************************************/
ACMP_WarmTime_TypeDef efm32_acmp_WarmTimeCalc(rt_uint32_t hfperFreq)
{
if (!hfperFreq)
@@ -414,6 +416,6 @@ ACMP_WarmTime_TypeDef efm32_acmp_WarmTimeCalc(rt_uint32_t hfperFreq)
}
#endif
-/******************************************************************//**
+/***************************************************************************//**
* @}
-*********************************************************************/
+ ******************************************************************************/
diff --git a/bsp/efm32/drv_acmp.h b/bsp/efm32/drv_acmp.h
index 0d8e58d82a..54c35d7838 100644
--- a/bsp/efm32/drv_acmp.h
+++ b/bsp/efm32/drv_acmp.h
@@ -1,26 +1,26 @@
-/******************************************************************//**
- * @file drv_acmp.h
- * @brief ACMP (analog comparator) driver of RT-Thread RTOS for EFM32
+/***************************************************************************//**
+ * @file drv_acmp.h
+ * @brief ACMP (analog comparator) driver of RT-Thread RTOS for EFM32
* COPYRIGHT (C) 2011, RT-Thread Development Team
- * @author onelife
- * @version 0.4 beta
- **********************************************************************
+ * @author onelife
+ * @version 0.4 beta
+ *******************************************************************************
* @section License
- * The license and distribution terms for this file may be found in the file LICENSE in this
- * distribution or at http://www.rt-thread.org/license/LICENSE
- **********************************************************************
+ * The license and distribution terms for this file may be found in the file
+ * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
+ *******************************************************************************
* @section Change Logs
- * Date Author Notes
- * 2011-02-23 onelife Initial creation for EFM32
- * 2011-06-17 onelife Modify for efm32lib v2 upgrading
- *********************************************************************/
+ * Date Author Notes
+ * 2011-02-23 onelife Initial creation for EFM32
+ * 2011-06-17 onelife Modify for efm32lib v2 upgrading
+ ******************************************************************************/
#ifndef __DRV_ACMP_H__
#define __DRV_ACMP_H__
-/* Includes -------------------------------------------------------------------*/
+/* Includes ------------------------------------------------------------------*/
#include "hdl_interrupt.h"
-/* Exported types -------------------------------------------------------------*/
+/* Exported types ------------------------------------------------------------*/
struct efm32_acmp_device_t
{
ACMP_TypeDef *acmp_device;
@@ -29,8 +29,8 @@ struct efm32_acmp_device_t
struct efm32_acmp_output_t
{
- rt_uint32_t location;
- rt_bool_t enable;
+ rt_uint32_t location;
+ rt_bool_t enable;
rt_bool_t invert;
};
@@ -43,9 +43,9 @@ struct efm32_acmp_control_t
efm32_irq_hook_t hook;
};
-/* Exported constants ---------------------------------------------------------*/
-/* Exported macro -------------------------------------------------------------*/
-/* Exported functions --------------------------------------------------------- */
+/* Exported constants --------------------------------------------------------*/
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
void rt_hw_acmp_init(void);
#endif /*__DRV_ACMP_H__ */
diff --git a/bsp/efm32/drv_iic.c b/bsp/efm32/drv_iic.c
index d4881b9ca8..2468d66baf 100644
--- a/bsp/efm32/drv_iic.c
+++ b/bsp/efm32/drv_iic.c
@@ -21,6 +21,7 @@
* 2011-08-04 onelife Add a timer to prevent from forever waiting
* 2011-11-29 onelife Modify init function for EFM32 library v2.2.2
* upgrading
+ * 2011-12-27 onelife Utilize "I2C_PRESENT" and "I2C_COUNT"
******************************************************************************/
/***************************************************************************//**
@@ -34,6 +35,9 @@
#include "drv_iic.h"
#if (defined(RT_USING_IIC0) || defined(RT_USING_IIC1))
+ #if !defined(I2C_PRESENT)
+ #error "IIC module is not available"
+ #endif
/* Private typedef -----------------------------------------------------------*/
struct efm32_iic_block
{
@@ -59,6 +63,9 @@ static struct efm32_iic_block iic0;
#endif
#ifdef RT_USING_IIC1
+ #if (I2C_COUNT <= 1)
+ #error "Wrong unit number"
+ #endif
#if (RT_USING_IIC1 > EFM32_IIC_LOCATION_COUNT)
#error "Wrong location number"
#endif
@@ -241,18 +248,18 @@ static rt_size_t rt_iic_read (
if (ret != i2cTransferDone)
{
- iic_debug("IIC read error: %x\n", ret);
- iic_debug("IIC read address: %x\n", seq.addr);
- iic_debug("IIC read data0: %x -> %x\n", seq.buf[0].data, *seq.buf[0].data);
- iic_debug("IIC read len0: %x\n", seq.buf[0].len);
- iic_debug("IIC read data1: %x -> %x\n", seq.buf[1].data, *seq.buf[1].data);
- iic_debug("IIC read len1: %x\n", seq.buf[1].len);
+ iic_debug("IIC: read error %x\n", ret);
+ iic_debug("IIC: read address %x\n", seq.addr);
+ iic_debug("IIC: read data0 %x -> %x\n", seq.buf[0].data, *seq.buf[0].data);
+ iic_debug("IIC: read len0 %x\n", seq.buf[0].len);
+ iic_debug("IIC: read data1 %x -> %x\n", seq.buf[1].data, *seq.buf[1].data);
+ iic_debug("IIC: read len1 %x\n", seq.buf[1].len);
err_code = (rt_err_t)ret;
}
else
{
read_size = size;
- iic_debug("IIC read size: %d\n", read_size);
+ iic_debug("IIC: read size %d\n", read_size);
}
}
else
@@ -300,7 +307,7 @@ static rt_size_t rt_iic_read (
}
read_size = (rt_uint32_t)ptr - (rt_uint32_t)buffer;
- iic_debug("IIC slave read size: %d\n", read_size);
+ iic_debug("IIC: slave read size %d\n", read_size);
}
/* Unlock device */
@@ -485,7 +492,7 @@ static rt_err_t rt_iic_control (
iic->rx_buffer = rt_malloc(sizeof(struct efm32_iic_int_mode_t));
if (iic->rx_buffer == RT_NULL)
{
- iic_debug("no memory for IIC RX structure\n");
+ iic_debug("IIC err: no MEM for IIC RX structure\n");
return -RT_ENOMEM;
}
@@ -493,7 +500,7 @@ static rt_err_t rt_iic_control (
if ((iic->rx_buffer->data_ptr = \
rt_malloc(IIC_RX_BUFFER_SIZE)) == RT_NULL)
{
- iic_debug("no memory for IIC RX buffer\n");
+ iic_debug("IIC err: no MEM for IIC RX buffer\n");
rt_free(iic->rx_buffer);
return -RT_ENOMEM;
}
@@ -513,15 +520,13 @@ static rt_err_t rt_iic_control (
I2C_IntClear(iic->iic_device, _I2C_IFC_MASK);
/* Enable I2Cn interrupt vector in NVIC */
-#ifdef RT_USING_IIC0
if (dev == &iic0.device)
{
NVIC_ClearPendingIRQ(I2C0_IRQn);
NVIC_SetPriority(I2C0_IRQn, EFM32_IRQ_PRI_DEFAULT);
NVIC_EnableIRQ(I2C0_IRQn);
}
-#endif
-#ifdef RT_USING_IIC1
+#if (I2C_COUNT > 1)
if (dev == &iic1.device)
{
NVIC_ClearPendingIRQ(I2C1_IRQn);
@@ -718,7 +723,7 @@ static struct efm32_iic_device_t *rt_hw_iic_unit_init(
iic = rt_malloc(sizeof(struct efm32_iic_device_t));
if (iic == RT_NULL)
{
- iic_debug("IIC: no memory for IIC%d driver\n", unitNumber);
+ iic_debug("IIC err: no MEM for IIC%d driver\n", unitNumber);
break;
}
iic->counter = 0;
@@ -743,7 +748,6 @@ static struct efm32_iic_device_t *rt_hw_iic_unit_init(
port_sda = AF_I2C0_SDA_PORT(location);
pin_sda = AF_I2C0_SDA_PIN(location);
break;
-
#if (I2C_COUNT > 1)
case 1:
iic->iic_device = I2C1;
@@ -754,7 +758,6 @@ static struct efm32_iic_device_t *rt_hw_iic_unit_init(
pin_sda = AF_I2C1_SDA_PIN(location);
break;
#endif
-
default:
break;
}
@@ -814,7 +817,7 @@ static struct efm32_iic_device_t *rt_hw_iic_unit_init(
rt_free(iic);
}
- iic_debug("IIC: Unit %d init failed!\n", unitNumber);
+ iic_debug("IIC err: Unit %d init failed!\n", unitNumber);
return RT_NULL;
}
@@ -834,7 +837,6 @@ void rt_hw_iic_init(void)
do
{
flag = RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX;
-#ifdef RT_USING_IIC0
/* Initialize and register iic0 */
if ((iic = rt_hw_iic_unit_init(&iic0, 0, RT_USING_IIC0)) != RT_NULL)
{
@@ -844,9 +846,8 @@ void rt_hw_iic_init(void)
{
break;
}
-#endif
-#ifdef RT_USING_IIC1
+#if (I2C_COUNT > 1)
/* Initialize and register iic1 */
if ((iic = rt_hw_iic_unit_init(&iic1, 1, RT_USING_IIC1)) != RT_NULL)
{
diff --git a/bsp/efm32/drv_leuart.c b/bsp/efm32/drv_leuart.c
index 3fda466ad8..f23a60576e 100644
--- a/bsp/efm32/drv_leuart.c
+++ b/bsp/efm32/drv_leuart.c
@@ -12,6 +12,7 @@
* @section Change Logs
* Date Author Notes
* 2011-12-09 onelife Initial creation for EFM32
+ * 2011-12-27 onelife Utilize "LEUART_PRESENT" and "LEUART_COUNT"
******************************************************************************/
/***************************************************************************//**
@@ -25,6 +26,9 @@
#include "drv_leuart.h"
#if (defined(RT_USING_LEUART0) || defined(RT_USING_LEUART1))
+ #if !defined(LEUART_PRESENT)
+ #error "LEUART module is not available"
+ #endif
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
@@ -35,18 +39,21 @@
#endif
/* Private variables ---------------------------------------------------------*/
-#ifdef RT_USING_LEUART0
-#if (RT_USING_LEUART0 >= EFM32_LEUART_LOCATION_COUNT)
- #error "Wrong location number"
-#endif
+#if defined(RT_USING_LEUART0)
+ #if (RT_USING_LEUART0 >= EFM32_LEUART_LOCATION_COUNT)
+ #error "Wrong location number"
+ #endif
struct rt_device leuart0_device;
static struct rt_semaphore leuart0_lock;
#endif
-#ifdef RT_USING_LEUART1
-#if (RT_USING_LEUART1 >= EFM32_LEUART_LOCATION_COUNT)
- #error "Wrong location number"
-#endif
+#if defined(RT_USING_LEUART1)
+ #if (LEUART_COUNT <= 1)
+ #error "Wrong unit number"
+ #endif
+ #if (RT_USING_LEUART1 >= EFM32_LEUART_LOCATION_COUNT)
+ #error "Wrong location number"
+ #endif
struct rt_device leuart1_device;
static struct rt_semaphore leuart1_lock;
#endif
@@ -157,10 +164,12 @@ static rt_err_t rt_leuart_open(rt_device_t dev, rt_uint16_t oflag)
case 0:
rxIrq = LEUART0_IRQn;
break;
+#if (LEUART_COUNT > 1)
case 1:
rxIrq = LEUART1_IRQn;
break;
- }
+#endif
+ }
if (oflag != RT_DEVICE_OFLAG_WRONLY)
{
NVIC_ClearPendingIRQ(rxIrq);
@@ -854,7 +863,7 @@ static struct efm32_leuart_device_t *rt_hw_leuart_unit_init(
port_rx = AF_LEUART0_RX_PORT(location);
pin_rx = AF_LEUART0_RX_PIN(location);
break;
-
+#if (LEUART_COUNT > 1)
case 1:
leuart->leuart_device = LEUART1;
leuartClock = (CMU_Clock_TypeDef)cmuClock_LEUART1;
@@ -864,7 +873,7 @@ static struct efm32_leuart_device_t *rt_hw_leuart_unit_init(
port_rx = AF_LEUART1_RX_PORT(location);
pin_rx = AF_LEUART1_RX_PIN(location);
break;
-
+#endif
default:
break;
}
@@ -1025,7 +1034,7 @@ void rt_hw_leuart_init(void)
}
#endif
-#ifdef RT_USING_LEUART1
+#if ((LEUART_COUNT > 1) && defined(RT_USING_LEUART1))
config = 0;
flag = RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX;
diff --git a/bsp/efm32/drv_sdcard.c b/bsp/efm32/drv_sdcard.c
index e7cadf5603..bf361d8608 100644
--- a/bsp/efm32/drv_sdcard.c
+++ b/bsp/efm32/drv_sdcard.c
@@ -1,9 +1,9 @@
/***************************************************************************//**
- * @file drv_sdcard.c
- * @brief Memory card driver (SPI mode) of RT-Thread RTOS for using EFM32
+ * @file drv_sdcard.c
+ * @brief Memory card driver (SPI mode) of RT-Thread RTOS for using EFM32
* USART module
- * COPYRIGHT (C) 2011, RT-Thread Development Team
- * @author onelife
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author onelife
* @version 0.4 beta
*******************************************************************************
* @section License
@@ -11,12 +11,13 @@
* LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
*******************************************************************************
* @section Change Logs
- * Date Author Notes
- * 2011-05-13 onelife Initial creation for using EFM32 USART module
- * 2011-07-07 onelife Modify initialization function to return error code
- * 2011-12-08 onelife Add giant gecko development kit support
+ * Date Author Notes
+ * 2011-05-13 onelife Initial creation for using EFM32 USART module
+ * 2011-07-07 onelife Modify initialization function to return error code
+ * 2011-12-08 onelife Add giant gecko development kit support
* 2011-12-15 onelife Move MicroSD enabling routine to driver
* initialization function (board.c)
+ * 2011-12-21 onelife Modify code due to SPI write format changed
******************************************************************************/
/***************************************************************************//**
@@ -36,20 +37,20 @@
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
#ifdef EFM32_SDCARD_DEBUG
-#define sdcard_debug(format,args...) rt_kprintf(format, ##args)
+#define sdcard_debug(format,args...) rt_kprintf(format, ##args)
#else
#define sdcard_debug(format,args...)
#endif
/* Private constants ---------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
-static struct rt_device sd_device;
-static struct dfs_partition sdPart;
-static rt_device_t spi = RT_NULL;
-static rt_uint16_t sdType;
-static rt_bool_t sdAutoCs = true;
-static rt_timer_t sdTimer = RT_NULL;
-static volatile rt_bool_t sdInTime = true;
+static struct rt_device sd_device;
+static struct dfs_partition sdPart;
+static rt_device_t spi = RT_NULL;
+static rt_uint16_t sdType;
+static rt_bool_t sdAutoCs = true;
+static rt_timer_t sdTimer = RT_NULL;
+static volatile rt_bool_t sdInTime = true;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
@@ -62,11 +63,11 @@ static volatile rt_bool_t sdInTime = true;
* @note
*
* @param[in] parameter
- * Parameter
+ * Parameter
******************************************************************************/
static void efm_spiSd_timer(void* parameter)
{
- sdInTime = false;
+ sdInTime = false;
}
/***************************************************************************//**
@@ -82,17 +83,17 @@ static void efm_spiSd_timer(void* parameter)
******************************************************************************/
static void efm_spiSd_cs(rt_uint8_t enable)
{
- if (!sdAutoCs)
- {
- if (enable)
- {
- GPIO_PinOutClear(SD_CS_PORT, SD_CS_PIN);
- }
- else
- {
- GPIO_PinOutSet(SD_CS_PORT, SD_CS_PIN);
- }
- }
+ if (!sdAutoCs)
+ {
+ if (enable)
+ {
+ GPIO_PinOutClear(SD_CS_PORT, SD_CS_PIN);
+ }
+ else
+ {
+ GPIO_PinOutSet(SD_CS_PORT, SD_CS_PIN);
+ }
+ }
}
/***************************************************************************//**
@@ -108,21 +109,21 @@ static void efm_spiSd_cs(rt_uint8_t enable)
******************************************************************************/
static void efm_spiSd_speed(rt_uint8_t level)
{
- RT_ASSERT(spi != RT_NULL);
+ RT_ASSERT(spi != RT_NULL);
- struct efm32_usart_device_t *usart;
- rt_uint32_t baudrate;
+ struct efm32_usart_device_t *usart;
+ rt_uint32_t baudrate;
- usart = (struct efm32_usart_device_t *)(spi->user_data);
- if (level == SD_SPEED_HIGH)
- {
- baudrate = EFM32_SDCLK_HIGH;
- }
- else
- {
- baudrate = EFM32_SDCLK_LOW;
- }
- USART_BaudrateSyncSet(usart->usart_device, 0, baudrate);
+ usart = (struct efm32_usart_device_t *)(spi->user_data);
+ if (level == SD_SPEED_HIGH)
+ {
+ baudrate = EFM32_SDCLK_HIGH;
+ }
+ else
+ {
+ baudrate = EFM32_SDCLK_LOW;
+ }
+ USART_BaudrateSyncSet(usart->usart_device, 0, baudrate);
}
/***************************************************************************//**
@@ -144,22 +145,22 @@ static void efm_spiSd_speed(rt_uint8_t level)
******************************************************************************/
static rt_size_t efm_spiSd_read(void *buffer, rt_size_t size)
{
- RT_ASSERT(spi != RT_NULL);
+ RT_ASSERT(spi != RT_NULL);
- rt_uint8_t buf_read[5], ret;
+ rt_uint8_t buf_read[5], ret;
- /* Build instruction buffer */
- buf_read[0] = 0x00;
- *(rt_uint8_t **)(&buf_read[1]) = buffer;
- /* Read data */
- efm_spiSd_cs(1);
- if ((ret = spi->read(spi, EFM32_NO_DATA, buf_read, size)) == 0)
- {
- sdcard_debug("SPISD: Read failed!\n");
- }
- efm_spiSd_cs(0);
+ /* Build instruction buffer */
+ buf_read[0] = 0x00;
+ *(rt_uint8_t **)(&buf_read[1]) = buffer;
+ /* Read data */
+ efm_spiSd_cs(1);
+ if ((ret = spi->read(spi, EFM32_NO_DATA, buf_read, size)) == 0)
+ {
+ sdcard_debug("SPISD: Read failed!\n");
+ }
+ efm_spiSd_cs(0);
- return ret;
+ return ret;
}
/***************************************************************************//**
@@ -183,146 +184,146 @@ static rt_size_t efm_spiSd_read(void *buffer, rt_size_t size)
* Command response
******************************************************************************/
static rt_uint16_t efm_spiSd_cmd(
- rt_uint8_t cmd,
- rt_uint32_t arg,
- rt_uint8_t *trail)
+ rt_uint8_t cmd,
+ rt_uint32_t arg,
+ rt_uint8_t *trail)
{
- RT_ASSERT(spi != RT_NULL);
+ RT_ASSERT(spi != RT_NULL);
- rt_uint8_t buf_ins[11];
- rt_uint8_t buf_res[32]; /* Expect (x+1+4) bytes for CRC, (x+1+19) for CSD/CID */
- rt_uint8_t len_trl, i, j;
- rt_uint16_t ret;
- rt_bool_t skip;
+ rt_uint8_t buf_ins[11];
+ rt_uint8_t buf_res[32]; /* Expect (x+1+4) bytes for CRC, (x+1+19) for CSD/CID */
+ rt_uint8_t len_trl, i, j;
+ rt_uint16_t ret;
+ rt_bool_t skip;
- ret = 0xffff;
- rt_memset(buf_res, 0xff, sizeof(buf_res));
+ ret = 0xffff;
+ rt_memset(buf_res, 0xff, sizeof(buf_res));
- sdcard_debug("SPISD: Send command %d(%x)\n", cmd, arg);
- do
- {
- /* Build instruction buffer */
- buf_ins[0] = 6; /* Instruction length */
- buf_ins[1] = 0x40 | cmd; /* Command index */
- buf_ins[2] = (arg >> 24) & 0x000000ff; /* Argument: MSB first */
- buf_ins[3] = (arg >> 16) & 0x000000ff;
- buf_ins[4] = (arg >> 8) & 0x000000ff;
- buf_ins[5] = arg & 0x000000ff;
- if (cmd == CMD0)
- {
- buf_ins[6] = 0x95; /* Valid CRC for CMD0(0) */
- }
- else if (cmd == CMD8)
- {
- buf_ins[6] = 0x87; /* Valid CRC for CMD8(0x1AA) */
- }
- else if (cmd == CMD58)
- {
- buf_ins[6] = 0x01; /* Dummy CRC + Stop */
- }
- else
- {
- buf_ins[6] = 0x01; /* Dummy CRC + Stop */
- }
- *(rt_uint8_t **)(&buf_ins[7]) = buf_res; /* Pointer to RX buffer */
+ sdcard_debug("SPISD: Send command %d(%x)\n", cmd, arg);
+ do
+ {
+ /* Build instruction buffer */
+ buf_ins[0] = 6; /* Instruction length */
+ buf_ins[1] = 0x40 | cmd; /* Command index */
+ buf_ins[2] = (arg >> 24) & 0x000000ff; /* Argument: MSB first */
+ buf_ins[3] = (arg >> 16) & 0x000000ff;
+ buf_ins[4] = (arg >> 8) & 0x000000ff;
+ buf_ins[5] = arg & 0x000000ff;
+ if (cmd == CMD0)
+ {
+ buf_ins[6] = 0x95; /* Valid CRC for CMD0(0) */
+ }
+ else if (cmd == CMD8)
+ {
+ buf_ins[6] = 0x87; /* Valid CRC for CMD8(0x1AA) */
+ }
+ else if (cmd == CMD58)
+ {
+ buf_ins[6] = 0x01; /* Dummy CRC + Stop */
+ }
+ else
+ {
+ buf_ins[6] = 0x01; /* Dummy CRC + Stop */
+ }
+ *(rt_uint8_t **)(&buf_ins[7]) = buf_res; /* Pointer to RX buffer */
- /* Set trail length */
- if (cmd == CMD8)
- {
- len_trl = 4; /* R7 response */
- }
- else if (cmd == CMD9)
- {
- len_trl = SD_BLOCK_SIZE_CSD;
- }
- else if (cmd == CMD10)
- {
- len_trl = SD_BLOCK_SIZE_CID;
- }
- else if (cmd == CMD58)
- {
- len_trl = SD_BLOCK_SIZE_OCR; /* R3 response */
- }
- else
- {
- len_trl = 0;
- }
+ /* Set trail length */
+ if (cmd == CMD8)
+ {
+ len_trl = 4; /* R7 response */
+ }
+ else if (cmd == CMD9)
+ {
+ len_trl = SD_BLOCK_SIZE_CSD;
+ }
+ else if (cmd == CMD10)
+ {
+ len_trl = SD_BLOCK_SIZE_CID;
+ }
+ else if (cmd == CMD58)
+ {
+ len_trl = SD_BLOCK_SIZE_OCR; /* R3 response */
+ }
+ else
+ {
+ len_trl = 0;
+ }
- /* Send command and get response */
- efm_spiSd_cs(1);
- if (spi->read(spi, EFM32_NO_DATA, buf_ins, sizeof(buf_res)) == 0)
- {
- sdcard_debug("SPISD: Send command failed!\n");
- break;
- }
- efm_spiSd_cs(0);
+ /* Send command and get response */
+ efm_spiSd_cs(1);
+ if (spi->read(spi, EFM32_NO_DATA, buf_ins, sizeof(buf_res)) == 0)
+ {
+ sdcard_debug("SPISD: Send command failed!\n");
+ break;
+ }
+ efm_spiSd_cs(0);
- /* Skip a stuff byte when stop reading */
- if (cmd == CMD12)
- {
- skip = true;
- }
- else
- {
- skip = false;
- }
- /* Find valid response: The response is sent back within command response time
- (NCR), 0 to 8 bytes for SDC, 1 to 8 bytes for MMC */
- for (i = 0; i < sizeof(buf_res); i++)
- {
- if (buf_res[i] != 0xff)
- {
- if (skip)
- {
- skip = false;
- sdcard_debug("SPISD: Skip %x (at %d)\n", buf_res[i], i);
- continue;
- }
+ /* Skip a stuff byte when stop reading */
+ if (cmd == CMD12)
+ {
+ skip = true;
+ }
+ else
+ {
+ skip = false;
+ }
+ /* Find valid response: The response is sent back within command response time
+ (NCR), 0 to 8 bytes for SDC, 1 to 8 bytes for MMC */
+ for (i = 0; i < sizeof(buf_res); i++)
+ {
+ if (buf_res[i] != 0xff)
+ {
+ if (skip)
+ {
+ skip = false;
+ sdcard_debug("SPISD: Skip %x (at %d)\n", buf_res[i], i);
+ continue;
+ }
- if (cmd == ACMD13 & 0x7f)
- {
- ret = (rt_uint16_t)buf_res[i]; /* R2 response */
- }
- else
- {
- ret = (rt_uint8_t)buf_res[i];
- }
- break;
- }
- }
- sdcard_debug("SPISD: Response %x (at %d)\n", ret, i);
- i++;
- /* Copy the trailing data */
- if ((ret != 0xffff) && len_trl && trail)
- {
- if (cmd == CMD9 || cmd == CMD10)
- {
- /* Wait for data block */
- for (; i < sizeof(buf_res); i++)
- {
- if (buf_res[i] == 0xfe)
- {
- break;
- }
- }
- /* Check if valid */
- if (i >= sizeof(buf_res))
- {
- sdcard_debug("SPISD: Token is not found!\n");
- ret = 0xffff;
- break;
- }
- i++;
- }
- /* Copy the data */
- for (j = 0; j < len_trl; j++)
- {
- trail[j] = buf_res[i + j];
- }
- }
- } while(0);
+ if (cmd == ACMD13 & 0x7f)
+ {
+ ret = (rt_uint16_t)buf_res[i]; /* R2 response */
+ }
+ else
+ {
+ ret = (rt_uint8_t)buf_res[i];
+ }
+ break;
+ }
+ }
+ sdcard_debug("SPISD: Response %x (at %d)\n", ret, i);
+ i++;
+ /* Copy the trailing data */
+ if ((ret != 0xffff) && len_trl && trail)
+ {
+ if (cmd == CMD9 || cmd == CMD10)
+ {
+ /* Wait for data block */
+ for (; i < sizeof(buf_res); i++)
+ {
+ if (buf_res[i] == 0xfe)
+ {
+ break;
+ }
+ }
+ /* Check if valid */
+ if (i >= sizeof(buf_res))
+ {
+ sdcard_debug("SPISD: Token is not found!\n");
+ ret = 0xffff;
+ break;
+ }
+ i++;
+ }
+ /* Copy the data */
+ for (j = 0; j < len_trl; j++)
+ {
+ trail[j] = buf_res[i + j];
+ }
+ }
+ } while(0);
- return ret;
+ return ret;
}
/***************************************************************************//**
@@ -345,83 +346,83 @@ static rt_uint16_t efm_spiSd_cmd(
******************************************************************************/
static rt_err_t efm_spiSd_readBlock(void *buffer, rt_size_t size)
{
- RT_ASSERT(spi != RT_NULL);
+ RT_ASSERT(spi != RT_NULL);
- rt_uint8_t buf_ins[5];
- rt_uint8_t buf_res[8]; /* Expect 2 bytes for CRC */
- rt_uint8_t i, len_copy;
- rt_bool_t start;
+ rt_uint8_t buf_ins[5];
+ rt_uint8_t buf_res[8]; /* Expect 2 bytes for CRC */
+ rt_uint8_t i, len_copy;
+ rt_bool_t start;
- start = false;
- do
- {
- /* Build instruction buffer */
- buf_ins[0] = 0; /* Instruction length */
- *(rt_uint8_t **)(&buf_ins[1]) = buf_res; /* Pointer to RX buffer */
+ start = false;
+ do
+ {
+ /* Build instruction buffer */
+ buf_ins[0] = 0; /* Instruction length */
+ *(rt_uint8_t **)(&buf_ins[1]) = buf_res; /* Pointer to RX buffer */
- while(1)
- {
- /* Send read command */
- efm_spiSd_cs(1);
- if (spi->read(spi, EFM32_NO_DATA, buf_ins, \
- sizeof(buf_res)) == 0)
- {
- sdcard_debug("SPISD: Get read command response failed!\n");
- break;
- }
- efm_spiSd_cs(0);
- /* Wait for data */
- for (i = 0; i < sizeof(buf_res); i++)
- {
- if (buf_res[i] != 0xff)
- {
- start = true;
- break;
- }
- }
- if (start)
- {
- break;
- }
- };
+ while(1)
+ {
+ /* Send read command */
+ efm_spiSd_cs(1);
+ if (spi->read(spi, EFM32_NO_DATA, buf_ins, \
+ sizeof(buf_res)) == 0)
+ {
+ sdcard_debug("SPISD: Get read command response failed!\n");
+ break;
+ }
+ efm_spiSd_cs(0);
+ /* Wait for data */
+ for (i = 0; i < sizeof(buf_res); i++)
+ {
+ if (buf_res[i] != 0xff)
+ {
+ start = true;
+ break;
+ }
+ }
+ if (start)
+ {
+ break;
+ }
+ };
- /* Ckeck if valid */
- if (!start || (buf_res[i] != 0xfe))
- {
- sdcard_debug("SPISD: Token is invalid! (%x)\n", buf_res[i]);
- break;
- }
- /* Copy data to buffer and read the rest */
- len_copy = sizeof(buf_res) - i - 1;
- rt_memcpy(buffer, &buf_res[i + 1], len_copy);
- sdcard_debug("SPISD: Read block start at %d, copy %d bytes\n", i, \
- len_copy);
+ /* Ckeck if valid */
+ if (!start || (buf_res[i] != 0xfe))
+ {
+ sdcard_debug("SPISD: Token is invalid! (%x)\n", buf_res[i]);
+ break;
+ }
+ /* Copy data to buffer and read the rest */
+ len_copy = sizeof(buf_res) - i - 1;
+ rt_memcpy(buffer, &buf_res[i + 1], len_copy);
+ sdcard_debug("SPISD: Read block start at %d, copy %d bytes\n", i, \
+ len_copy);
- /* Build instruction buffer */
- buf_ins[0] = 0; /* Instruction length */
- *(rt_uint8_t **)(&buf_ins[1]) = (rt_uint8_t *)buffer + len_copy; /* Pointer to RX buffer */
+ /* Build instruction buffer */
+ buf_ins[0] = 0; /* Instruction length */
+ *(rt_uint8_t **)(&buf_ins[1]) = (rt_uint8_t *)buffer + len_copy; /* Pointer to RX buffer */
- /* Send read command */
- efm_spiSd_cs(1);
- if (spi->read(spi, EFM32_NO_DATA, buf_ins, size - len_copy) == 0)
- {
- sdcard_debug("SPISD: Read data block failed!\n");
- break;
- }
- *(rt_uint8_t **)(&buf_ins[1]) = buf_res; /* Pointer to RX buffer */
- if (spi->read(spi, EFM32_NO_DATA, buf_ins, sizeof(buf_res)) == 0)
- {
- sdcard_debug("SPISD: Read CRC failed!\n");
- break;
- }
- sdcard_debug("SPISD: Read CRC %x %x\n", buf_res[0], buf_res[1]);
- efm_spiSd_cs(0);
+ /* Send read command */
+ efm_spiSd_cs(1);
+ if (spi->read(spi, EFM32_NO_DATA, buf_ins, size - len_copy) == 0)
+ {
+ sdcard_debug("SPISD: Read data block failed!\n");
+ break;
+ }
+ *(rt_uint8_t **)(&buf_ins[1]) = buf_res; /* Pointer to RX buffer */
+ if (spi->read(spi, EFM32_NO_DATA, buf_ins, sizeof(buf_res)) == 0)
+ {
+ sdcard_debug("SPISD: Read CRC failed!\n");
+ break;
+ }
+ sdcard_debug("SPISD: Read CRC %x %x\n", buf_res[0], buf_res[1]);
+ efm_spiSd_cs(0);
- return RT_EOK;
- } while(0);
+ return RT_EOK;
+ } while(0);
- sdcard_debug("SPISD: Read block failed!\n");
- return -RT_ERROR;
+ sdcard_debug("SPISD: Read block failed!\n");
+ return -RT_ERROR;
}
/***************************************************************************//**
@@ -444,104 +445,114 @@ static rt_err_t efm_spiSd_readBlock(void *buffer, rt_size_t size)
******************************************************************************/
static rt_err_t efm_spiSd_writeBlock(void *buffer, rt_uint8_t token)
{
- RT_ASSERT(spi != RT_NULL);
+ RT_ASSERT(spi != RT_NULL);
- rt_err_t ret;
- rt_uint8_t buf_ins[11];
- rt_uint8_t buf_res[8]; /* Expect a byte for data response */
- rt_uint8_t i;
+ rt_err_t ret;
+ rt_uint8_t buf_ins[11];
+ rt_uint8_t buf_res[8]; /* Expect a byte for data response */
+ rt_uint8_t i;
- ret = RT_ERROR;
- do
- {
- /* Initialize timer */
- sdInTime = true;
- rt_timer_start(sdTimer);
- /* Wait for card ready */
- do
- {
- efm_spiSd_read(buf_res, sizeof(buf_res));
- } while (sdInTime && (buf_res[sizeof(buf_res) - 1] != 0xff));
- if (buf_res[sizeof(buf_res) - 1] != 0xff)
- {
- sdcard_debug("SPISD: Card is busy before writing! (%x)\n", \
- buf_res[sizeof(buf_res) - 1]);
- ret = -RT_EBUSY;
- break;
- }
- rt_timer_stop(sdTimer);
+ ret = RT_ERROR;
+ sdcard_debug("SPISD: Write block\n");
+ do
+ {
+ /* Initialize timer */
+ sdInTime = true;
+ rt_timer_start(sdTimer);
+ /* Wait for card ready */
+ do
+ {
+ efm_spiSd_read(buf_res, sizeof(buf_res));
+ } while (sdInTime && (buf_res[sizeof(buf_res) - 1] != 0xff));
+ if (buf_res[sizeof(buf_res) - 1] != 0xff)
+ {
+ sdcard_debug("SPISD: Card is busy before writing! (%x)\n", \
+ buf_res[sizeof(buf_res) - 1]);
+ ret = -RT_EBUSY;
+ break;
+ }
+ rt_timer_stop(sdTimer);
- /* Send token */
- buf_ins[0] = token;
- efm_spiSd_cs(1);
- if (spi->write(spi, EFM32_NO_DATA, buf_ins, 1) == 0)
- {
- sdcard_debug("SPISD: Write token failed!\n");
- break;
- }
- /* Send data */
- if (token != 0xfd)
- {
- if (spi->write(spi, EFM32_NO_DATA, buffer, SD_SECTOR_SIZE) == 0)
- {
- sdcard_debug("SPISD: Write data failed!\n");
- break;
- }
+ /* Send data */
+ sdcard_debug("SPISD: Send data, token %x\n", token);
+ if (token != 0xfd)
+ {
+ /* Send token and data */
+ buf_ins[0] = 1; /* Instruction length */
+ buf_ins[1] = token;
+ *(rt_uint8_t **)(&buf_ins[2]) = (rt_uint8_t *)buffer; /* Pointer to TX buffer */
+ efm_spiSd_cs(1);
+ if (spi->write(spi, EFM32_NO_DATA, buf_ins, SD_SECTOR_SIZE) == 0)
+ {
+ sdcard_debug("SPISD: Write data failed!\n");
+ break;
+ }
- /* Build instruction buffer */
- buf_ins[0] = 2; /* Instruction length */
- buf_ins[1] = 0xff; /* CRC (Dummy) */
- buf_ins[2] = 0xff;
- *(rt_uint8_t **)(&buf_ins[3]) = buf_res; /* Pointer to RX buffer */
- /* Send CRC and read a byte */
- if (spi->read(spi, EFM32_NO_DATA, buf_ins, sizeof(buf_res)) == 0)
- {
- sdcard_debug("SPISD: Write CRC failed!\n");
- break;
- }
- efm_spiSd_cs(0);
+ /* Build instruction buffer */
+ buf_ins[0] = 2; /* Instruction length */
+ buf_ins[1] = 0xff; /* CRC (Dummy) */
+ buf_ins[2] = 0xff;
+ *(rt_uint8_t **)(&buf_ins[3]) = buf_res; /* Pointer to RX buffer */
+ /* Send CRC and read a byte */
+ if (spi->read(spi, EFM32_NO_DATA, buf_ins, sizeof(buf_res)) == 0)
+ {
+ sdcard_debug("SPISD: Write CRC failed!\n");
+ break;
+ }
+ efm_spiSd_cs(0);
- /* Check if accepted */
- for (i = 0; i < sizeof(buf_res); i++)
- {
- if (buf_res[i] != 0xff)
- {
- buf_res[i] &= 0x1f;
- break;
- }
- }
- if (buf_res[i] != 0x05)
- {
- sdcard_debug("SPISD: Writing is not accepted! (%x at %d)\n", \
- buf_res[i], i);
- break;
- }
- }
- else
- {
- /* Initialize timer */
- sdInTime = true;
- rt_timer_start(sdTimer);
- /* Wait for card ready */
- do
- {
- efm_spiSd_read(buf_res, sizeof(buf_res));
- } while (sdInTime && (buf_res[sizeof(buf_res) - 1] != 0xff));
- if (buf_res[sizeof(buf_res) - 1] != 0xff)
- {
- sdcard_debug("SPISD: Card is busy after writing! (%x)\n", \
- buf_res[sizeof(buf_res) - 1] );
- ret = -RT_EBUSY;
- break;
- }
- rt_timer_stop(sdTimer);
- }
+ /* Check if accepted */
+ for (i = 0; i < sizeof(buf_res); i++)
+ {
+ if (buf_res[i] != 0xff)
+ {
+ buf_res[i] &= 0x1f;
+ break;
+ }
+ }
+ if (buf_res[i] != 0x05)
+ {
+ sdcard_debug("SPISD: Writing is not accepted! (%x at %d)\n", \
+ buf_res[i], i);
+ break;
+ }
+ }
+ else
+ {
+ /* Send token */
+ buf_ins[0] = 1; /* Instruction length */
+ buf_ins[1] = token;
+ *(rt_uint8_t **)(&buf_ins[2]) = RT_NULL; /* Pointer to TX buffer */
+ efm_spiSd_cs(1);
+ if (spi->write(spi, EFM32_NO_DATA, buf_ins, 0) != 0)
+ {
+ sdcard_debug("SPISD: Write token failed!\n");
+ break;
+ }
- return RT_EOK;
- } while(0);
+ /* Initialize timer */
+ sdInTime = true;
+ rt_timer_start(sdTimer);
+ /* Wait for card ready */
+ do
+ {
+ efm_spiSd_read(buf_res, sizeof(buf_res));
+ } while (sdInTime && (buf_res[sizeof(buf_res) - 1] != 0xff));
+ if (buf_res[sizeof(buf_res) - 1] != 0xff)
+ {
+ sdcard_debug("SPISD: Card is busy after writing! (%x)\n", \
+ buf_res[sizeof(buf_res) - 1] );
+ ret = -RT_EBUSY;
+ break;
+ }
+ rt_timer_stop(sdTimer);
+ }
- sdcard_debug("SPISD: Write block failed!\n");
- return ret;
+ return RT_EOK;
+ } while(0);
+
+ sdcard_debug("SPISD: Write block failed!\n");
+ return ret;
}
/***************************************************************************//**
@@ -565,24 +576,24 @@ static rt_err_t efm_spiSd_writeBlock(void *buffer, rt_uint8_t token)
* Command response
******************************************************************************/
rt_uint16_t efm_spiSd_sendCmd(
- rt_uint8_t cmd,
- rt_uint32_t arg,
- rt_uint8_t *trail)
+ rt_uint8_t cmd,
+ rt_uint32_t arg,
+ rt_uint8_t *trail)
{
- rt_uint16_t ret;
+ rt_uint16_t ret;
- /* ACMD is the command sequense of CMD55-CMD */
- if (cmd & 0x80)
- {
- cmd &= 0x7f;
- ret = efm_spiSd_cmd(CMD55, 0x00000000, EFM32_NO_POINTER);
- if (ret > 0x01)
- {
- return ret;
- }
- }
+ /* ACMD is the command sequense of CMD55-CMD */
+ if (cmd & 0x80)
+ {
+ cmd &= 0x7f;
+ ret = efm_spiSd_cmd(CMD55, 0x00000000, EFM32_NO_POINTER);
+ if (ret > 0x01)
+ {
+ return ret;
+ }
+ }
- return efm_spiSd_cmd(cmd, arg, trail);
+ return efm_spiSd_cmd(cmd, arg, trail);
}
/***************************************************************************//**
@@ -601,140 +612,140 @@ rt_uint16_t efm_spiSd_sendCmd(
******************************************************************************/
static rt_err_t rt_spiSd_init(rt_device_t dev)
{
- RT_ASSERT(spi != RT_NULL);
+ RT_ASSERT(spi != RT_NULL);
- rt_uint8_t type, cmd, tril[4];
- rt_uint8_t *buf_res;
+ rt_uint8_t type, cmd, tril[4];
+ rt_uint8_t *buf_res;
- type = 0;
- buf_res = RT_NULL;
+ type = 0;
+ buf_res = RT_NULL;
- do
- {
- /* Create and setup timer */
- if ((sdTimer = rt_timer_create(
- "sd_tmr",
- efm_spiSd_timer,
- RT_NULL,
- SD_WAIT_PERIOD,
- RT_TIMER_FLAG_ONE_SHOT)) == RT_NULL)
- {
- sdcard_debug("SPISD: Create timer failed!\n");
- break;
- }
+ do
+ {
+ /* Create and setup timer */
+ if ((sdTimer = rt_timer_create(
+ "sd_tmr",
+ efm_spiSd_timer,
+ RT_NULL,
+ SD_WAIT_PERIOD,
+ RT_TIMER_FLAG_ONE_SHOT)) == RT_NULL)
+ {
+ sdcard_debug("SPISD: Create timer failed!\n");
+ break;
+ }
- /* Open SPI device */
- if (spi->open(spi, RT_DEVICE_OFLAG_RDWR) != RT_EOK)
- {
- break;
- }
+ /* Open SPI device */
+ if (spi->open(spi, RT_DEVICE_OFLAG_RDWR) != RT_EOK)
+ {
+ break;
+ }
- /* Switch to low speed */
- efm_spiSd_speed(SD_SPEED_LOW);
+ /* Switch to low speed */
+ efm_spiSd_speed(SD_SPEED_LOW);
- /* 80 dummy clocks */
- efm_spiSd_read(RT_NULL, 80);
- /* Enter Idle state */
- if (efm_spiSd_sendCmd(CMD0, 0x00000000, EFM32_NO_POINTER) != 0x01)
- {
- break;
- }
- /* Check if SDv2 */
- if (efm_spiSd_sendCmd(CMD8, 0x000001AA, tril) == 0x01)
- {
- /* SDv2, Vdd: 2.7-3.6V */
- if (tril[2] == 0x01 && tril[3] == 0xAA)
- {
- /* Initialize timer */
- sdInTime = true;
- rt_timer_start(sdTimer);
- /* Wait for leaving idle state (ACMD41 with HCS bit) */
- while (efm_spiSd_sendCmd(ACMD41, 0x40000000, EFM32_NO_POINTER) \
- && sdInTime);
- /* Check CCS bit (bit 30) in the OCR */
- if (sdInTime && efm_spiSd_sendCmd(CMD58, 0x00000000, tril) \
- == 0x00)
- {
- type = (tril[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2;
- }
- }
- }
- else
- {
- if (efm_spiSd_sendCmd(ACMD41, 0x00000000, EFM32_NO_POINTER) <= 0x01)
- {
- /* SDv1 */
- type = CT_SD1;
- cmd = ACMD41;
- }
- else
- {
- /* MMCv3 */
- type = CT_MMC;
- cmd = CMD1;
- }
- /* Initialize timer */
- sdInTime = true;
- rt_timer_start(sdTimer);
- /* Wait for leaving idle state */
- while (efm_spiSd_sendCmd(cmd, 0x00000000, EFM32_NO_POINTER) && \
- sdInTime);
- /* Set read/write block length to SD_BLOCK_SIZE */
- if (!sdInTime || \
- (efm_spiSd_sendCmd(CMD16, SD_SECTOR_SIZE, EFM32_NO_POINTER) \
- != 0x00))
- {
- type = 0;
- break;
- }
- }
- rt_timer_stop(sdTimer);
+ /* 80 dummy clocks */
+ efm_spiSd_read(RT_NULL, 80);
+ /* Enter Idle state */
+ if (efm_spiSd_sendCmd(CMD0, 0x00000000, EFM32_NO_POINTER) != 0x01)
+ {
+ break;
+ }
+ /* Check if SDv2 */
+ if (efm_spiSd_sendCmd(CMD8, 0x000001AA, tril) == 0x01)
+ {
+ /* SDv2, Vdd: 2.7-3.6V */
+ if (tril[2] == 0x01 && tril[3] == 0xAA)
+ {
+ /* Initialize timer */
+ sdInTime = true;
+ rt_timer_start(sdTimer);
+ /* Wait for leaving idle state (ACMD41 with HCS bit) */
+ while (efm_spiSd_sendCmd(ACMD41, 0x40000000, EFM32_NO_POINTER) \
+ && sdInTime);
+ /* Check CCS bit (bit 30) in the OCR */
+ if (sdInTime && efm_spiSd_sendCmd(CMD58, 0x00000000, tril) \
+ == 0x00)
+ {
+ type = (tril[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2;
+ }
+ }
+ }
+ else
+ {
+ if (efm_spiSd_sendCmd(ACMD41, 0x00000000, EFM32_NO_POINTER) <= 0x01)
+ {
+ /* SDv1 */
+ type = CT_SD1;
+ cmd = ACMD41;
+ }
+ else
+ {
+ /* MMCv3 */
+ type = CT_MMC;
+ cmd = CMD1;
+ }
+ /* Initialize timer */
+ sdInTime = true;
+ rt_timer_start(sdTimer);
+ /* Wait for leaving idle state */
+ while (efm_spiSd_sendCmd(cmd, 0x00000000, EFM32_NO_POINTER) && \
+ sdInTime);
+ /* Set read/write block length to SD_BLOCK_SIZE */
+ if (!sdInTime || \
+ (efm_spiSd_sendCmd(CMD16, SD_SECTOR_SIZE, EFM32_NO_POINTER) \
+ != 0x00))
+ {
+ type = 0;
+ break;
+ }
+ }
+ rt_timer_stop(sdTimer);
- /* Check type */
- sdType = type;
- if (sdType)
- {
- /* Initialization succeded */
- efm_spiSd_speed(SD_SPEED_HIGH);
- }
- else
- {
- break;
- }
+ /* Check type */
+ sdType = type;
+ if (sdType)
+ {
+ /* Initialization succeded */
+ efm_spiSd_speed(SD_SPEED_HIGH);
+ }
+ else
+ {
+ break;
+ }
- /* Allocate buffer */
- if ((buf_res = rt_malloc(SD_SECTOR_SIZE)) == RT_NULL)
- {
- sdcard_debug("SPISD: No memory for sector buffer\n");
- break;
- }
- /* Read the first sector for partition table */
- if (dev->read(dev, 0, buf_res, 1) != 1)
- {
- sdcard_debug("SPISD: Read first sector failed!\n");
- break;
- }
- /* Fetch the partition table */
- if (dfs_filesystem_get_partition(&sdPart, buf_res, 0) != RT_EOK)
- {
- sdPart.offset = 0;
- sdPart.size = 0;
- sdcard_debug("SPISD: No partition table\n");
- }
- /* Release buffer */
- rt_free(buf_res);
- sdcard_debug("SPISD: Init OK, card type %x\n", sdType);
- return RT_EOK;
- } while (0);
+ /* Allocate buffer */
+ if ((buf_res = rt_malloc(SD_SECTOR_SIZE)) == RT_NULL)
+ {
+ sdcard_debug("SPISD: No memory for sector buffer\n");
+ break;
+ }
+ /* Read the first sector for partition table */
+ if (dev->read(dev, 0, buf_res, 1) != 1)
+ {
+ sdcard_debug("SPISD: Read first sector failed!\n");
+ break;
+ }
+ /* Fetch the partition table */
+ if (dfs_filesystem_get_partition(&sdPart, buf_res, 0) != RT_EOK)
+ {
+ sdPart.offset = 0;
+ sdPart.size = 0;
+ sdcard_debug("SPISD: No partition table\n");
+ }
+ /* Release buffer */
+ rt_free(buf_res);
+ sdcard_debug("SPISD: Init OK, card type %x\n", sdType);
+ return RT_EOK;
+ } while (0);
- /* Release buffer */
- if (buf_res)
- {
- rt_free(buf_res);
- }
- efm_spiSd_deinit();
- rt_kprintf("SPISD: Init failed!\n");
- return -RT_ERROR;
+ /* Release buffer */
+ if (buf_res)
+ {
+ rt_free(buf_res);
+ }
+ efm_spiSd_deinit();
+ rt_kprintf("SPISD: Init failed!\n");
+ return -RT_ERROR;
}
/***************************************************************************//**
@@ -756,8 +767,8 @@ static rt_err_t rt_spiSd_init(rt_device_t dev)
******************************************************************************/
static rt_err_t rt_spiSd_open(rt_device_t dev, rt_uint16_t oflag)
{
- sdcard_debug("SPISD: Open, flag %x\n", sd_device.flag);
- return RT_EOK;
+ sdcard_debug("SPISD: Open, flag %x\n", sd_device.flag);
+ return RT_EOK;
}
/***************************************************************************//**
@@ -776,8 +787,8 @@ static rt_err_t rt_spiSd_open(rt_device_t dev, rt_uint16_t oflag)
******************************************************************************/
static rt_err_t rt_spiSd_close(rt_device_t dev)
{
- sdcard_debug("SPISD: Close, flag %x\n", sd_device.flag);
- return RT_EOK;
+ sdcard_debug("SPISD: Close, flag %x\n", sd_device.flag);
+ return RT_EOK;
}
/***************************************************************************//**
@@ -804,70 +815,70 @@ static rt_err_t rt_spiSd_close(rt_device_t dev)
* Number of read sectors
******************************************************************************/
static rt_size_t rt_spiSd_read(
- rt_device_t dev,
- rt_off_t sector,
- void *buffer,
- rt_size_t count)
+ rt_device_t dev,
+ rt_off_t sector,
+ void *buffer,
+ rt_size_t count)
{
- rt_uint8_t buf_ins[11], buf_res[12];
- rt_uint8_t *ptr;
- rt_uint8_t cmd, i;
- rt_size_t cnt;
+ rt_uint8_t buf_ins[11], buf_res[12];
+ rt_uint8_t *ptr;
+ rt_uint8_t cmd, i;
+ rt_size_t cnt;
- ptr = (rt_uint8_t *)buffer;
- cnt = count;
+ ptr = (rt_uint8_t *)buffer;
+ cnt = count;
- sdcard_debug("SPISD: ****** Read Data ******\n");
- if (!(sdType & CT_BLOCK))
- {
- /* Convert to byte address if needed */
- sector *= SD_SECTOR_SIZE;
- }
+ sdcard_debug("SPISD: ****** Read Data ******\n");
+ if (!(sdType & CT_BLOCK))
+ {
+ /* Convert to byte address if needed */
+ sector *= SD_SECTOR_SIZE;
+ }
- do
- {
- if (cnt == 1)
- {
- /* Single block read */
- cmd = CMD17;
- sdcard_debug("SPISD: Read single block\n");
- }
- else
- {
- /* Multiple block read */
- cmd = CMD18;
- sdcard_debug("SPISD: Read multiple blocks\n");
- }
+ do
+ {
+ if (cnt == 1)
+ {
+ /* Single block read */
+ cmd = CMD17;
+ sdcard_debug("SPISD: Read single block\n");
+ }
+ else
+ {
+ /* Multiple block read */
+ cmd = CMD18;
+ sdcard_debug("SPISD: Read multiple blocks\n");
+ }
- if (efm_spiSd_sendCmd(cmd, sector, EFM32_NO_POINTER))
- {
- sdcard_debug("SPISD: Read command error!\n");
- break;
- }
+ if (efm_spiSd_sendCmd(cmd, sector, EFM32_NO_POINTER))
+ {
+ sdcard_debug("SPISD: Read command error!\n");
+ break;
+ }
- /* Read data */
- do
- {
- if (efm_spiSd_readBlock(ptr, SD_SECTOR_SIZE))
- {
- break;
- }
- ptr += SD_SECTOR_SIZE;
- } while(--cnt);
+ /* Read data */
+ do
+ {
+ if (efm_spiSd_readBlock(ptr, SD_SECTOR_SIZE))
+ {
+ break;
+ }
+ ptr += SD_SECTOR_SIZE;
+ } while(--cnt);
- /* Stop transmission */
- if (cmd == CMD18)
- {
- if (efm_spiSd_sendCmd(CMD12, 0x00000000, EFM32_NO_POINTER))
- {
- break;
- }
- }
+ /* Stop transmission */
+ if (cmd == CMD18)
+ {
+ if (efm_spiSd_sendCmd(CMD12, 0x00000000, EFM32_NO_POINTER))
+ {
+ break;
+ }
+ }
- return (count);
- } while(0);
+ return (count);
+ } while(0);
- return (0);
+ return (0);
}
/***************************************************************************//**
@@ -894,76 +905,76 @@ static rt_size_t rt_spiSd_read(
* Number of written sectors
******************************************************************************/
static rt_size_t rt_spiSd_write (
- rt_device_t dev,
- rt_off_t sector,
- const void *buffer,
- rt_size_t count)
+ rt_device_t dev,
+ rt_off_t sector,
+ const void *buffer,
+ rt_size_t count)
{
- rt_uint8_t buf_ins[11], buf_res[12];
- rt_uint8_t *ptr;
- rt_uint8_t cmd, token, i;
- rt_size_t cnt;
+ rt_uint8_t buf_ins[11], buf_res[12];
+ rt_uint8_t *ptr;
+ rt_uint8_t cmd, token, i;
+ rt_size_t cnt;
- ptr = (rt_uint8_t *)buffer;
- cnt = count;
+ ptr = (rt_uint8_t *)buffer;
+ cnt = count;
- sdcard_debug("SPISD: ****** Write Data ******\n");
- if (!(sdType & CT_BLOCK))
- {
- /* Convert to byte address if needed */
- sector *= SD_SECTOR_SIZE;
- }
+ sdcard_debug("SPISD: ****** Write Data ******\n");
+ if (!(sdType & CT_BLOCK))
+ {
+ /* Convert to byte address if needed */
+ sector *= SD_SECTOR_SIZE;
+ }
- do
- {
- if (cnt == 1)
- {
- /* Single block write */
- cmd = CMD24;
- token = 0xfe;
- sdcard_debug("SPISD: Write single block\n");
- }
- else
- {
- /* Multiple block write */
- cmd = CMD25;
- token = 0xfc;
- sdcard_debug("SPISD: Write multiple blocks\n");
- if (sdType & CT_SDC)
- {
- if (efm_spiSd_sendCmd(ACMD23, count, EFM32_NO_POINTER))
- {
- break;
- }
- }
- }
+ do
+ {
+ if (cnt == 1)
+ {
+ /* Single block write */
+ cmd = CMD24;
+ token = 0xfe;
+ sdcard_debug("SPISD: Write single block\n");
+ }
+ else
+ {
+ /* Multiple block write */
+ cmd = CMD25;
+ token = 0xfc;
+ sdcard_debug("SPISD: Write multiple blocks\n");
+ if (sdType & CT_SDC)
+ {
+ if (efm_spiSd_sendCmd(ACMD23, count, EFM32_NO_POINTER))
+ {
+ break;
+ }
+ }
+ }
- if (efm_spiSd_sendCmd(cmd, sector, EFM32_NO_POINTER))
- {
- sdcard_debug("SPISD: Write command error!\n");
- break;
- }
+ if (efm_spiSd_sendCmd(cmd, sector, EFM32_NO_POINTER))
+ {
+ sdcard_debug("SPISD: Write command error!\n");
+ break;
+ }
- /* Write data */
- do
- {
- if (efm_spiSd_writeBlock(ptr, token))
- {
- break;
- }
- ptr += SD_SECTOR_SIZE;
- } while(--cnt);
+ /* Write data */
+ do
+ {
+ if (efm_spiSd_writeBlock(ptr, token))
+ {
+ break;
+ }
+ ptr += SD_SECTOR_SIZE;
+ } while(--cnt);
- /* Stop transmission token */
- if (efm_spiSd_writeBlock(EFM32_NO_POINTER, 0xfd))
- {
- break;
- }
+ /* Stop transmission token */
+ if (efm_spiSd_writeBlock(EFM32_NO_POINTER, 0xfd))
+ {
+ break;
+ }
- return (count);
- } while(0);
+ return (count);
+ } while(0);
- return (0);
+ return (0);
}
/***************************************************************************//**
@@ -987,198 +998,198 @@ static rt_size_t rt_spiSd_write (
* Error code
******************************************************************************/
static rt_err_t rt_spiSd_control (
- rt_device_t dev,
- rt_uint8_t ctrl,
- void *buffer)
+ rt_device_t dev,
+ rt_uint8_t ctrl,
+ void *buffer)
{
- rt_err_t ret;
- rt_uint32_t c_size;
- rt_uint8_t n;
- rt_uint8_t *buf_res;
+ rt_err_t ret;
+ rt_uint32_t c_size;
+ rt_uint8_t n;
+ rt_uint8_t *buf_res;
- ret = -RT_ERROR;
- buf_res = RT_NULL;
- switch (ctrl)
- {
- case RT_DEVICE_CTRL_SD_SYNC:
- /* Flush dirty buffer if present */
- efm_spiSd_cs(1);
- efm_spiSd_cs(0);
- ret = RT_EOK;
- break;
+ ret = -RT_ERROR;
+ buf_res = RT_NULL;
+ switch (ctrl)
+ {
+ case RT_DEVICE_CTRL_SD_SYNC:
+ /* Flush dirty buffer if present */
+ efm_spiSd_cs(1);
+ efm_spiSd_cs(0);
+ ret = RT_EOK;
+ break;
- case RT_DEVICE_CTRL_SD_GET_SCOUNT:
- {
- /* Allocate buffer */
- if ((buf_res = rt_malloc(SD_BLOCK_SIZE_CSD)) == RT_NULL)
- {
- sdcard_debug("SPISD: No memory for RX buffer\n");
- break;
- }
- /* Get number of sectors on the disk (32 bits) */
- if (efm_spiSd_sendCmd(CMD9, 0x00000000, buf_res))
- {
- sdcard_debug("SPISD: Get CSD failed!\n");
- break;
- }
+ case RT_DEVICE_CTRL_SD_GET_SCOUNT:
+ {
+ /* Allocate buffer */
+ if ((buf_res = rt_malloc(SD_BLOCK_SIZE_CSD)) == RT_NULL)
+ {
+ sdcard_debug("SPISD: No memory for RX buffer\n");
+ break;
+ }
+ /* Get number of sectors on the disk (32 bits) */
+ if (efm_spiSd_sendCmd(CMD9, 0x00000000, buf_res))
+ {
+ sdcard_debug("SPISD: Get CSD failed!\n");
+ break;
+ }
- if ((buf_res[0] >> 6) == 0x01)
- {
- /* SDv2 */
- /* C_SIZE: Bit 48~69 */
- c_size = ((rt_uint32_t)(buf_res[7] & 0x3f) << 16) + \
- ((rt_uint32_t)buf_res[8] << 8) + buf_res[9] + 1;
- /* Result = Capacity / Sector Size */
- *(rt_uint32_t *)buffer = (rt_uint32_t)c_size << \
- (19 - SD_SECTOR_SIZE_SHIFT);
- }
- else
- {
- /* SDv1 or MMC */
- /* C_SIZE: Bit 62~73 */
- c_size = ((rt_uint32_t)(buf_res[6] & 0x03) << 10) + \
- ((rt_uint16_t)buf_res[7] << 2) + (buf_res[8] >> 6) + 1;
- /* READ_BL_LEN: Bit 80~83, C_SIZE_MULT: Bit 47~49 */
- n = ((buf_res[9] & 0x03) << 1) + ((buf_res[10] & 0x80) >> 7) + \
- 2 + (buf_res[5] & 0x0f);
- /* Result = Capacity / Sector Size */
- *(rt_uint32_t *)buffer = (rt_uint32_t)c_size << \
- (n - SD_SECTOR_SIZE_SHIFT);
- }
- ret = RT_EOK;
- break;
- }
+ if ((buf_res[0] >> 6) == 0x01)
+ {
+ /* SDv2 */
+ /* C_SIZE: Bit 48~69 */
+ c_size = ((rt_uint32_t)(buf_res[7] & 0x3f) << 16) + \
+ ((rt_uint32_t)buf_res[8] << 8) + buf_res[9] + 1;
+ /* Result = Capacity / Sector Size */
+ *(rt_uint32_t *)buffer = (rt_uint32_t)c_size << \
+ (19 - SD_SECTOR_SIZE_SHIFT);
+ }
+ else
+ {
+ /* SDv1 or MMC */
+ /* C_SIZE: Bit 62~73 */
+ c_size = ((rt_uint32_t)(buf_res[6] & 0x03) << 10) + \
+ ((rt_uint16_t)buf_res[7] << 2) + (buf_res[8] >> 6) + 1;
+ /* READ_BL_LEN: Bit 80~83, C_SIZE_MULT: Bit 47~49 */
+ n = ((buf_res[9] & 0x03) << 1) + ((buf_res[10] & 0x80) >> 7) + \
+ 2 + (buf_res[5] & 0x0f);
+ /* Result = Capacity / Sector Size */
+ *(rt_uint32_t *)buffer = (rt_uint32_t)c_size << \
+ (n - SD_SECTOR_SIZE_SHIFT);
+ }
+ ret = RT_EOK;
+ break;
+ }
- case RT_DEVICE_CTRL_SD_GET_SSIZE:
- /* Get sectors on the disk (16 bits) */
- *(rt_uint16_t *)buffer = SD_SECTOR_SIZE;
- ret = RT_EOK;
- break;
+ case RT_DEVICE_CTRL_SD_GET_SSIZE:
+ /* Get sectors on the disk (16 bits) */
+ *(rt_uint16_t *)buffer = SD_SECTOR_SIZE;
+ ret = RT_EOK;
+ break;
- case RT_DEVICE_CTRL_SD_GET_BSIZE:
- /* Get erase block size in unit of sectors (32 bits) */
- if (sdType & CT_SD2)
- {
- /* Allocate buffer */
- if ((buf_res = rt_malloc(SD_BLOCK_SIZE_SDSTAT)) == RT_NULL)
- {
- sdcard_debug("SPISD: No memory for RX buffer\n");
- break;
- }
- /* SDv2 */
- if (efm_spiSd_sendCmd(ACMD13, 0x00000000, EFM32_NO_POINTER))
- {
- sdcard_debug("SPISD: Get SD status failed!\n");
- break;
- }
- if (efm_spiSd_readBlock(buf_res, SD_BLOCK_SIZE_SDSTAT))
- {
- sdcard_debug("SPISD: Read SD status failed!\n");
- break;
- }
- /* AU_SIZE: Bit 428~431 */
- *(rt_uint32_t *)buffer = 16UL << ((buf_res[10] >> 4) + 9 - \
- SD_SECTOR_SIZE_SHIFT);
- }
- else
- {
- /* Allocate buffer */
- if ((buf_res = rt_malloc(SD_BLOCK_SIZE_CSD)) == RT_NULL)
- {
- sdcard_debug("SPISD: No memory for RX buffer\n");
- break;
- }
- /* SDv1 or MMC */
- if (efm_spiSd_sendCmd(CMD9, 0x00000000, buf_res))
- {
- sdcard_debug("SPISD: Get CSD failed!\n");
- break;
- }
+ case RT_DEVICE_CTRL_SD_GET_BSIZE:
+ /* Get erase block size in unit of sectors (32 bits) */
+ if (sdType & CT_SD2)
+ {
+ /* Allocate buffer */
+ if ((buf_res = rt_malloc(SD_BLOCK_SIZE_SDSTAT)) == RT_NULL)
+ {
+ sdcard_debug("SPISD: No memory for RX buffer\n");
+ break;
+ }
+ /* SDv2 */
+ if (efm_spiSd_sendCmd(ACMD13, 0x00000000, EFM32_NO_POINTER))
+ {
+ sdcard_debug("SPISD: Get SD status failed!\n");
+ break;
+ }
+ if (efm_spiSd_readBlock(buf_res, SD_BLOCK_SIZE_SDSTAT))
+ {
+ sdcard_debug("SPISD: Read SD status failed!\n");
+ break;
+ }
+ /* AU_SIZE: Bit 428~431 */
+ *(rt_uint32_t *)buffer = 16UL << ((buf_res[10] >> 4) + 9 - \
+ SD_SECTOR_SIZE_SHIFT);
+ }
+ else
+ {
+ /* Allocate buffer */
+ if ((buf_res = rt_malloc(SD_BLOCK_SIZE_CSD)) == RT_NULL)
+ {
+ sdcard_debug("SPISD: No memory for RX buffer\n");
+ break;
+ }
+ /* SDv1 or MMC */
+ if (efm_spiSd_sendCmd(CMD9, 0x00000000, buf_res))
+ {
+ sdcard_debug("SPISD: Get CSD failed!\n");
+ break;
+ }
- if (sdType & CT_SD1)
- {
- /* SECTOR_SIZE: Bit 39~45, WRITE_BL_LEN: Bit 22~25 (9, 10 or 11) */
- *(rt_uint32_t *)buffer = (((buf_res[10] & 0x3f) << 1) + \
- ((rt_uint32_t)(buf_res[11] & 0x80) >> 7) + 1) << \
- (8 + (buf_res[13] >> 6) - SD_SECTOR_SIZE_SHIFT);
- }
- else
- {
- /* ERASE_GRP_SIZE: Bit 42~46, ERASE_GRP_MULT: Bit 37~41 */
- *(rt_uint32_t *)buffer = \
- ((rt_uint16_t)((buf_res[10] & 0x7c) >> 2) + 1) * \
- (((buf_res[10] & 0x03) << 3) + \
- ((buf_res[11] & 0xe0) >> 5) + 1);
- }
- }
- ret = RT_EOK;
- break;
+ if (sdType & CT_SD1)
+ {
+ /* SECTOR_SIZE: Bit 39~45, WRITE_BL_LEN: Bit 22~25 (9, 10 or 11) */
+ *(rt_uint32_t *)buffer = (((buf_res[10] & 0x3f) << 1) + \
+ ((rt_uint32_t)(buf_res[11] & 0x80) >> 7) + 1) << \
+ (8 + (buf_res[13] >> 6) - SD_SECTOR_SIZE_SHIFT);
+ }
+ else
+ {
+ /* ERASE_GRP_SIZE: Bit 42~46, ERASE_GRP_MULT: Bit 37~41 */
+ *(rt_uint32_t *)buffer = \
+ ((rt_uint16_t)((buf_res[10] & 0x7c) >> 2) + 1) * \
+ (((buf_res[10] & 0x03) << 3) + \
+ ((buf_res[11] & 0xe0) >> 5) + 1);
+ }
+ }
+ ret = RT_EOK;
+ break;
- case RT_DEVICE_CTRL_SD_GET_TYPE:
- /* Get card type flags (1 byte) */
- *(rt_uint8_t *)buffer = sdType;
- ret = RT_EOK;
- break;
+ case RT_DEVICE_CTRL_SD_GET_TYPE:
+ /* Get card type flags (1 byte) */
+ *(rt_uint8_t *)buffer = sdType;
+ ret = RT_EOK;
+ break;
- case RT_DEVICE_CTRL_SD_GET_CSD:
- /* Receive CSD as a data block (16 bytes) */
- if (efm_spiSd_sendCmd(CMD9, 0x00000000, buffer))
- {
- sdcard_debug("SPISD: Get CSD failed!\n");
- break;
- }
- ret = RT_EOK;
- break;
+ case RT_DEVICE_CTRL_SD_GET_CSD:
+ /* Receive CSD as a data block (16 bytes) */
+ if (efm_spiSd_sendCmd(CMD9, 0x00000000, buffer))
+ {
+ sdcard_debug("SPISD: Get CSD failed!\n");
+ break;
+ }
+ ret = RT_EOK;
+ break;
- case RT_DEVICE_CTRL_SD_GET_CID:
- /* Receive CID as a data block (16 bytes) */
- if (efm_spiSd_sendCmd(CMD10, 0x00000000, buffer))
- {
- sdcard_debug("SPISD: Get CID failed!\n");
- break;
- }
- ret = RT_EOK;
- break;
+ case RT_DEVICE_CTRL_SD_GET_CID:
+ /* Receive CID as a data block (16 bytes) */
+ if (efm_spiSd_sendCmd(CMD10, 0x00000000, buffer))
+ {
+ sdcard_debug("SPISD: Get CID failed!\n");
+ break;
+ }
+ ret = RT_EOK;
+ break;
- case RT_DEVICE_CTRL_SD_GET_OCR:
- /* Receive OCR as an R3 resp (4 bytes) */
- if (efm_spiSd_sendCmd(CMD58, 0x00000000, buffer))
- {
- sdcard_debug("SPISD: Get OCR failed!\n");
- break;
- }
- ret = RT_EOK;
- break;
+ case RT_DEVICE_CTRL_SD_GET_OCR:
+ /* Receive OCR as an R3 resp (4 bytes) */
+ if (efm_spiSd_sendCmd(CMD58, 0x00000000, buffer))
+ {
+ sdcard_debug("SPISD: Get OCR failed!\n");
+ break;
+ }
+ ret = RT_EOK;
+ break;
- case RT_DEVICE_CTRL_SD_GET_SDSTAT:
- /* Receive SD statsu as a data block (64 bytes) */
- if (efm_spiSd_sendCmd(ACMD13, 0x00000000, buffer))
- {
- sdcard_debug("SPISD: Get SD status failed!\n");
- break;
- }
- if (efm_spiSd_readBlock(buffer, SD_BLOCK_SIZE_SDSTAT))
- {
- sdcard_debug("SPISD: Read SD status failed!\n");
- break;
- }
- ret = RT_EOK;
- break;
+ case RT_DEVICE_CTRL_SD_GET_SDSTAT:
+ /* Receive SD statsu as a data block (64 bytes) */
+ if (efm_spiSd_sendCmd(ACMD13, 0x00000000, buffer))
+ {
+ sdcard_debug("SPISD: Get SD status failed!\n");
+ break;
+ }
+ if (efm_spiSd_readBlock(buffer, SD_BLOCK_SIZE_SDSTAT))
+ {
+ sdcard_debug("SPISD: Read SD status failed!\n");
+ break;
+ }
+ ret = RT_EOK;
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- if (buf_res)
- {
- rt_free(buf_res);
- }
- return ret;
+ if (buf_res)
+ {
+ rt_free(buf_res);
+ }
+ return ret;
}
/***************************************************************************//**
* @brief
-* Initialize all memory card related hardware and register the device to
+* Initialize all memory card related hardware and register the device to
* kernel
*
* @details
@@ -1186,52 +1197,53 @@ static rt_err_t rt_spiSd_control (
* @note
*
* @return
-* Error code
+* Error code
******************************************************************************/
rt_err_t efm_spiSd_init(void)
{
- struct efm32_usart_device_t *usart;
+ struct efm32_usart_device_t *usart;
- do
- {
- /* Find SPI device */
- spi = rt_device_find(SPISD_USING_DEVICE_NAME);
- if (spi == RT_NULL)
- {
- sdcard_debug("SPISD: Can't find device %s!\n",
- SPISD_USING_DEVICE_NAME);
- break;
- }
- sdcard_debug("SPISD: Find device %s\n", SPISD_USING_DEVICE_NAME);
+ do
+ {
+ /* Find SPI device */
+ spi = rt_device_find(SPISD_USING_DEVICE_NAME);
+ if (spi == RT_NULL)
+ {
+ sdcard_debug("SPISD: Can't find device %s!\n",
+ SPISD_USING_DEVICE_NAME);
+ break;
+ }
+ sdcard_debug("SPISD: Find device %s\n", SPISD_USING_DEVICE_NAME);
- /* Config chip slect pin */
- usart = (struct efm32_usart_device_t *)(spi->user_data);
- if (!(usart->state & USART_STATE_AUTOCS))
- {
- GPIO_PinModeSet(SD_CS_PORT, SD_CS_PIN, gpioModePushPull, 1);
- sdAutoCs = false;
- }
+ /* Config chip slect pin */
+ usart = (struct efm32_usart_device_t *)(spi->user_data);
+ if (!(usart->state & USART_STATE_AUTOCS))
+ {
+ GPIO_PinModeSet(SD_CS_PORT, SD_CS_PIN, gpioModePushPull, 1);
+ sdAutoCs = false;
+ }
- /* Register SPI SD device */
- sd_device.init = rt_spiSd_init;
- sd_device.open = rt_spiSd_open;
- sd_device.close = rt_spiSd_close;
- sd_device.read = rt_spiSd_read;
- sd_device.write = rt_spiSd_write;
- sd_device.control = rt_spiSd_control;
- sd_device.user_data = RT_NULL;
- rt_device_register(
- &sd_device,
- SPISD_DEVICE_NAME,
- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
+ /* Register SPI SD device */
+ sd_device.type = RT_Device_Class_MTD;
+ sd_device.init = rt_spiSd_init;
+ sd_device.open = rt_spiSd_open;
+ sd_device.close = rt_spiSd_close;
+ sd_device.read = rt_spiSd_read;
+ sd_device.write = rt_spiSd_write;
+ sd_device.control = rt_spiSd_control;
+ sd_device.user_data = RT_NULL;
+ rt_device_register(
+ &sd_device,
+ SPISD_DEVICE_NAME,
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
- sdcard_debug("SPISD: HW init OK, card type %x\n", sdType);
- return RT_EOK;
- } while (0);
+ sdcard_debug("SPISD: HW init OK, card type %x\n", sdType);
+ return RT_EOK;
+ } while (0);
- /* Release buffer */
- rt_kprintf("SPISD: HW init failed!\n");
- return -RT_ERROR;
+ /* Release buffer */
+ rt_kprintf("SPISD: HW init failed!\n");
+ return -RT_ERROR;
}
/***************************************************************************//**
@@ -1244,73 +1256,73 @@ rt_err_t efm_spiSd_init(void)
******************************************************************************/
void efm_spiSd_deinit(void)
{
- /* Close SPI device */
- if (spi != RT_NULL)
- {
- spi->close(spi);
- spi = RT_NULL;
- sdcard_debug("SPISD: Close device %s\n", SPISD_USING_DEVICE_NAME);
- }
- /* Delete timer */
- if (sdTimer != RT_NULL)
- {
- rt_timer_delete(sdTimer);
- sdTimer = RT_NULL;
- sdcard_debug("SPISD: Delete timer\n");
- }
+ /* Close SPI device */
+ if (spi != RT_NULL)
+ {
+ spi->close(spi);
+ spi = RT_NULL;
+ sdcard_debug("SPISD: Close device %s\n", SPISD_USING_DEVICE_NAME);
+ }
+ /* Delete timer */
+ if (sdTimer != RT_NULL)
+ {
+ rt_timer_delete(sdTimer);
+ sdTimer = RT_NULL;
+ sdcard_debug("SPISD: Delete timer\n");
+ }
- sdcard_debug("SPISD: Deinit OK\n");
+ sdcard_debug("SPISD: Deinit OK\n");
}
/*******************************************************************************
- * Export to FINSH
+ * Export to FINSH
******************************************************************************/
#ifdef RT_USING_FINSH
#include
void list_sd(void)
{
- rt_uint8_t buf_res[16];
- rt_uint32_t capacity, temp32;
- rt_uint16_t temp16;
+ rt_uint8_t buf_res[16];
+ rt_uint32_t capacity, temp32;
+ rt_uint16_t temp16;
- rt_kprintf(" SD Card on %s\n", SPISD_USING_DEVICE_NAME);
- rt_kprintf(" ------------------------------\n");
- sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_CID, buf_res);
- rt_kprintf(" Manufacturer ID:\t%x\n", buf_res[0]);
- rt_kprintf(" OEM/Application ID:\t%x%x\n", buf_res[1], buf_res[2]);
- rt_kprintf(" Product revision:\t%x\n", buf_res[8]);
- buf_res[8] = 0;
- rt_kprintf(" Product name:\t\t%s\n", &buf_res[3]);
- rt_kprintf(" Serial number:\t\t%x%x%x%x\n", \
- buf_res[9], buf_res[10], buf_res[11], buf_res[12]);
- rt_kprintf(" Manufacturing date:\t%d.%d\n", \
- 2000 + ((buf_res[13] & 0x0F) << 4) + ((buf_res[14] & 0xF0) >> 4), \
- buf_res[14] & 0x0F);
- rt_kprintf(" Card type:\t\t");
- sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_TYPE, buf_res);
- if (buf_res[0] == CT_MMC)
- {
- rt_kprintf("%s\n", "MMC");
- }
- else if (buf_res[0] == CT_SDC)
- {
- rt_kprintf("%s\n", "SDXC");
- }
- else if (buf_res[0] == CT_SD1)
- {
- rt_kprintf("%s\n", "SDSC");
- }
- else if (buf_res[0] == CT_SD2)
- {
- rt_kprintf("%s\n", "SDHC");
- }
- sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_SSIZE, &temp16);
- sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_SCOUNT, &temp32);
- capacity = ((temp32 & 0x0000FFFF) * temp16) >> 16;
- capacity += ((temp32 >> 16) * temp16);
- capacity >>= 4;
- rt_kprintf(" Card capacity:\t\t%dMB\n", capacity);
+ rt_kprintf(" SD Card on %s\n", SPISD_USING_DEVICE_NAME);
+ rt_kprintf(" ------------------------------\n");
+ sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_CID, buf_res);
+ rt_kprintf(" Manufacturer ID:\t%x\n", buf_res[0]);
+ rt_kprintf(" OEM/Application ID:\t%x%x\n", buf_res[1], buf_res[2]);
+ rt_kprintf(" Product revision:\t%x\n", buf_res[8]);
+ buf_res[8] = 0;
+ rt_kprintf(" Product name:\t\t%s\n", &buf_res[3]);
+ rt_kprintf(" Serial number:\t\t%x%x%x%x\n", \
+ buf_res[9], buf_res[10], buf_res[11], buf_res[12]);
+ rt_kprintf(" Manufacturing date:\t%d.%d\n", \
+ 2000 + ((buf_res[13] & 0x0F) << 4) + ((buf_res[14] & 0xF0) >> 4), \
+ buf_res[14] & 0x0F);
+ rt_kprintf(" Card type:\t\t");
+ sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_TYPE, buf_res);
+ if (buf_res[0] == CT_MMC)
+ {
+ rt_kprintf("%s\n", "MMC");
+ }
+ else if (buf_res[0] == CT_SDC)
+ {
+ rt_kprintf("%s\n", "SDXC");
+ }
+ else if (buf_res[0] == CT_SD1)
+ {
+ rt_kprintf("%s\n", "SDSC");
+ }
+ else if (buf_res[0] == CT_SD2)
+ {
+ rt_kprintf("%s\n", "SDHC");
+ }
+ sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_SSIZE, &temp16);
+ sd_device.control(&sd_device, RT_DEVICE_CTRL_SD_GET_SCOUNT, &temp32);
+ capacity = ((temp32 & 0x0000FFFF) * temp16) >> 16;
+ capacity += ((temp32 >> 16) * temp16);
+ capacity >>= 4;
+ rt_kprintf(" Card capacity:\t\t%dMB\n", capacity);
}
FINSH_FUNCTION_EXPORT(list_sd, list the SD card.)
#endif
diff --git a/bsp/efm32/drv_usart.c b/bsp/efm32/drv_usart.c
index b08e341865..9094cedae1 100644
--- a/bsp/efm32/drv_usart.c
+++ b/bsp/efm32/drv_usart.c
@@ -1,8 +1,8 @@
/***************************************************************************//**
- * @file drv_usart.c
- * @brief USART driver of RT-Thread RTOS for EFM32
- * COPYRIGHT (C) 2011, RT-Thread Development Team
- * @author onelife
+ * @file drv_usart.c
+ * @brief USART driver of RT-Thread RTOS for EFM32
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author onelife
* @version 0.4 beta
*******************************************************************************
* @section License
@@ -10,27 +10,32 @@
* LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
*******************************************************************************
* @section Change Logs of serial.c
- * Date Author Notes
- * 2009-02-05 Bernard first version
- * 2009-10-25 Bernard fix rt_serial_read bug when there is no data in the
+ * Date Author Notes
+ * 2009-02-05 Bernard first version
+ * 2009-10-25 Bernard fix rt_serial_read bug when there is no data in the
* buffer.
- * 2010-03-29 Bernard cleanup code.
+ * 2010-03-29 Bernard cleanup code.
*
* @section Change Logs
- * Date Author Notes
- * 2010-12-22 onelife Initial creation for EFM32
- * 2011-01-17 onelife Merge with serial.c
- * 2011-05-06 onelife Add sync mode (SPI) support
- * 2011-06-14 onelife Fix a bug of TX by DMA
- * 2011-06-16 onelife Modify init function for EFM32 library v2.0.0
+ * Date Author Notes
+ * 2010-12-22 onelife Initial creation for EFM32
+ * 2011-01-17 onelife Merge with serial.c
+ * 2011-05-06 onelife Add sync mode (SPI) support
+ * 2011-06-14 onelife Fix a bug of TX by DMA
+ * 2011-06-16 onelife Modify init function for EFM32 library v2.0.0
* upgrading
- * 2011-07-07 onelife Modify write function to avoid sleep in ISR
- * 2011-07-26 onelife Add lock (semaphore) to prevent simultaneously
+ * 2011-07-07 onelife Modify write function to avoid sleep in ISR
+ * 2011-07-26 onelife Add lock (semaphore) to prevent simultaneously
* access
- * 2011-11-29 onelife Modify init function for EFM32 library v2.2.2
+ * 2011-11-29 onelife Modify init function for EFM32 library v2.2.2
* upgrading
- * 2011-12-09 onelife Add giant gecko support
+ * 2011-12-09 onelife Add giant gecko support
* 2011-12-09 onelife Add UART module support
+ * 2011-12-20 onelife Add 9-bit SPI mode support
+ * 2011-12-20 onelife Change SPI write format (same as SPI read)
+ * 2011-12-20 onelife Change USART status format
+ * 2011-12-27 onelife Utilize "USART_PRESENT", "USART_COUNT",
+ * "UART_PRESENT" and "UART_COUNT"
******************************************************************************/
/***************************************************************************//**
@@ -46,56 +51,72 @@
#if (defined(RT_USING_USART0) || defined(RT_USING_USART1) || \
defined(RT_USING_USART2) || defined(RT_USING_UART0) || \
defined(RT_USING_UART1))
+ #if ((defined(RT_USING_USART0) || defined(RT_USING_USART1) || \
+ defined(RT_USING_USART2)) && !defined(USART_PRESENT))
+ #error "USART module is not available"
+ #endif
+ #if ((defined(RT_USING_UART0) || defined(RT_USING_UART1)) && \
+ !defined(UART_PRESENT))
+ #error "UART module is not available"
+ #endif
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
#ifdef RT_USART_DEBUG
-#define usart_debug(format,args...) rt_kprintf(format, ##args)
+#define usart_debug(format,args...) rt_kprintf(format, ##args)
#else
#define usart_debug(format,args...)
#endif
/* Private variables ---------------------------------------------------------*/
#ifdef RT_USING_USART0
-#if (RT_USING_USART0 >= EFM32_USART_LOCATION_COUNT)
- #error "Wrong location number"
-#endif
- struct rt_device usart0_device;
- static struct rt_semaphore usart0_lock;
+ #if (RT_USING_USART0 >= EFM32_USART_LOCATION_COUNT)
+ #error "Wrong location number"
+ #endif
+ struct rt_device usart0_device;
+ static struct rt_semaphore usart0_lock;
#endif
#ifdef RT_USING_USART1
-#if (RT_USING_USART1 >= EFM32_USART_LOCATION_COUNT)
- #error "Wrong location number"
-#endif
- struct rt_device usart1_device;
- static struct rt_semaphore usart1_lock;
+ #if (USART_COUNT <= 1)
+ #error "Wrong unit number"
+ #endif
+ #if (RT_USING_USART1 >= EFM32_USART_LOCATION_COUNT)
+ #error "Wrong location number"
+ #endif
+ struct rt_device usart1_device;
+ static struct rt_semaphore usart1_lock;
#endif
#ifdef RT_USING_USART2
-#if (RT_USING_USART2 >= EFM32_USART_LOCATION_COUNT)
- #error "Wrong location number"
-#endif
- struct rt_device usart2_device;
- static struct rt_semaphore usart2_lock;
+ #if (USART_COUNT <= 2)
+ #error "Wrong unit number"
+ #endif
+ #if (RT_USING_USART2 >= EFM32_USART_LOCATION_COUNT)
+ #error "Wrong location number"
+ #endif
+ struct rt_device usart2_device;
+ static struct rt_semaphore usart2_lock;
#endif
#ifdef RT_USING_UART0
-#if (RT_USING_UART0 >= EFM32_UART_LOCATION_COUNT)
- #error "Wrong location number"
-#endif
- struct rt_device uart0_device;
- static struct rt_semaphore uart0_lock;
+ #if (RT_USING_UART0 >= EFM32_UART_LOCATION_COUNT)
+ #error "Wrong location number"
+ #endif
+ struct rt_device uart0_device;
+ static struct rt_semaphore uart0_lock;
#endif
#ifdef RT_USING_UART1
-#if (RT_USING_UART1 >= EFM32_UART_LOCATION_COUNT)
- #error "Wrong location number"
+ #if (UART_COUNT <= 1)
+ #error "Wrong unit number"
+ #endif
+ #if (RT_USING_UART1 >= EFM32_UART_LOCATION_COUNT)
+ #error "Wrong location number"
+ #endif
+ struct rt_device uart1_device;
+ static struct rt_semaphore uart1_lock;
#endif
- struct rt_device uart1_device;
- static struct rt_semaphore uart1_lock;
-#endif
-
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
@@ -115,37 +136,37 @@
******************************************************************************/
static rt_err_t rt_usart_init (rt_device_t dev)
{
- struct efm32_usart_device_t *usart;
+ struct efm32_usart_device_t *usart;
- usart = (struct efm32_usart_device_t *)(dev->user_data);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
- if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
- {
- if (dev->flag & RT_DEVICE_FLAG_DMA_TX)
- {
- struct efm32_usart_dma_mode_t *dma_tx;
+ if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
+ {
+ if (dev->flag & RT_DEVICE_FLAG_DMA_TX)
+ {
+ struct efm32_usart_dma_mode_t *dma_tx;
- dma_tx = (struct efm32_usart_dma_mode_t *)(usart->tx_mode);
+ dma_tx = (struct efm32_usart_dma_mode_t *)(usart->tx_mode);
- usart->state |= USART_STATE_RX_BUSY;
- }
+ usart->state |= USART_STATE_RX_BUSY;
+ }
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- struct efm32_usart_int_mode_t *int_rx;
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ struct efm32_usart_int_mode_t *int_rx;
- int_rx = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
+ int_rx = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
- int_rx->data_ptr = RT_NULL;
- }
+ int_rx->data_ptr = RT_NULL;
+ }
- /* Enable USART */
- USART_Enable(usart->usart_device, usartEnable);
+ /* Enable USART */
+ USART_Enable(usart->usart_device, usartEnable);
- dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
- }
+ dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
+ }
- return RT_EOK;
+ return RT_EOK;
}
/***************************************************************************//**
@@ -167,99 +188,120 @@ static rt_err_t rt_usart_init (rt_device_t dev)
******************************************************************************/
static rt_err_t rt_usart_open(rt_device_t dev, rt_uint16_t oflag)
{
- RT_ASSERT(dev != RT_NULL);
+ RT_ASSERT(dev != RT_NULL);
- struct efm32_usart_device_t *usart;
+ struct efm32_usart_device_t *usart;
- usart = (struct efm32_usart_device_t *)(dev->user_data);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- IRQn_Type rxIrq;
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ IRQn_Type rxIrq;
- //if (usart->state & USART_STATE_CONSOLE)
- { /* Allocate new RX buffer */
- struct efm32_usart_int_mode_t *int_mode;
+ //if (usart->state & USART_STATE_CONSOLE)
+ { /* Allocate new RX buffer */
+ struct efm32_usart_int_mode_t *int_mode;
- int_mode = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
+ int_mode = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
- if ((int_mode->data_ptr = rt_malloc(USART_RX_BUFFER_SIZE)) == RT_NULL)
- {
- usart_debug("USART%d err: no mem for RX BUF\n", usart->unit);
- return -RT_ENOMEM;
- }
- rt_memset(int_mode->data_ptr, 0, USART_RX_BUFFER_SIZE);
- int_mode->data_size = USART_RX_BUFFER_SIZE;
- int_mode->read_index = 0;
- int_mode->save_index = 0;
- }
+ if ((int_mode->data_ptr = rt_malloc(USART_RX_BUFFER_SIZE)) == RT_NULL)
+ {
+ usart_debug("USART%d err: no mem for RX BUF\n", usart->unit);
+ return -RT_ENOMEM;
+ }
+ rt_memset(int_mode->data_ptr, 0, USART_RX_BUFFER_SIZE);
+ int_mode->data_size = USART_RX_BUFFER_SIZE;
+ int_mode->read_index = 0;
+ int_mode->save_index = 0;
+ }
- /* Enable RX interrupt */
+ /* Enable RX interrupt */
+#if defined(UART_PRESENT)
if (usart->state & USART_STATE_ASYNC_ONLY)
{
- usart->usart_device->IEN = UART_IEN_RXDATAV;
+ usart->usart_device->IEN = UART_IEN_RXDATAV;
}
else
+#endif
{
usart->usart_device->IEN = USART_IEN_RXDATAV;
}
- /* Enable IRQ */
- switch (usart->unit)
- {
- case 0:
+ /* Enable IRQ */
+ switch (usart->unit)
+ {
+ case 0:
+#if defined(UART_PRESENT)
if (usart->state & USART_STATE_ASYNC_ONLY)
{
- rxIrq = UART0_RX_IRQn;
- }
- else
- {
- rxIrq = USART0_RX_IRQn;
- }
- break;
- case 1:
-#if defined(EFM32_GIANT_FAMILY)
- if (usart->state & USART_STATE_ASYNC_ONLY)
- {
- rxIrq = UART1_RX_IRQn;
+ rxIrq = UART0_RX_IRQn;
}
else
#endif
{
- rxIrq = USART1_RX_IRQn;
+ rxIrq = USART0_RX_IRQn;
}
- break;
- case 2:
- rxIrq = USART2_RX_IRQn;
- break;
- }
- if (oflag != RT_DEVICE_OFLAG_WRONLY)
- {
- NVIC_ClearPendingIRQ(rxIrq);
- NVIC_SetPriority(rxIrq, EFM32_IRQ_PRI_DEFAULT);
- NVIC_EnableIRQ(rxIrq);
- }
- }
+ break;
+#if ((defined(USART_PRESENT) && (USART_COUNT > 1)) || \
+ (defined(UART_PRESENT) && (UART_COUNT > 1)))
+ case 1:
+ #if (defined(UART_PRESENT) && (UART_COUNT > 1))
+ if (usart->state & USART_STATE_ASYNC_ONLY)
+ {
+ rxIrq = UART1_RX_IRQn;
+ }
+ else
+ #endif
+ {
+ rxIrq = USART1_RX_IRQn;
+ }
+ break;
+#endif
+#if ((defined(USART_PRESENT) && (USART_COUNT > 2)) || \
+ (defined(UART_PRESENT) && (UART_COUNT > 2)))
+ case 2:
+ #if (defined(UART_PRESENT) && (UART_COUNT > 2))
+ if (usart->state & USART_STATE_ASYNC_ONLY)
+ {
+ rxIrq = UART2_RX_IRQn;
+ }
+ else
+ #endif
+ {
+ rxIrq = USART2_RX_IRQn;
+ }
+ break;
+#endif
+ }
+ if (oflag != RT_DEVICE_OFLAG_WRONLY)
+ {
+ NVIC_ClearPendingIRQ(rxIrq);
+ NVIC_SetPriority(rxIrq, EFM32_IRQ_PRI_DEFAULT);
+ NVIC_EnableIRQ(rxIrq);
+ }
+ }
/* Clear Flag */
+#if defined(UART_PRESENT)
if (usart->state & USART_STATE_ASYNC_ONLY)
{
usart->usart_device->IFC = _UART_IFC_MASK;
}
else
+#endif
{
- usart->usart_device->IFC = _USART_IFC_MASK;
+ usart->usart_device->IFC = _USART_IFC_MASK;
}
- if ((dev->flag & RT_DEVICE_FLAG_DMA_TX) && (oflag != RT_DEVICE_OFLAG_RDONLY))
- {
- /* DMA IRQ is enabled by DMA_Init() */
- NVIC_SetPriority(DMA_IRQn, EFM32_IRQ_PRI_DEFAULT);
- }
+ if ((dev->flag & RT_DEVICE_FLAG_DMA_TX) && (oflag != RT_DEVICE_OFLAG_RDONLY))
+ {
+ /* DMA IRQ is enabled by DMA_Init() */
+ NVIC_SetPriority(DMA_IRQn, EFM32_IRQ_PRI_DEFAULT);
+ }
- usart->counter++;
- usart_debug("USART%d: Open with flag %x\n", usart->unit, oflag);
- return RT_EOK;
+ usart->counter++;
+ usart_debug("USART%d: Open with flag %x\n", usart->unit, oflag);
+ return RT_EOK;
}
/***************************************************************************//**
@@ -278,208 +320,227 @@ static rt_err_t rt_usart_open(rt_device_t dev, rt_uint16_t oflag)
******************************************************************************/
static rt_err_t rt_usart_close(rt_device_t dev)
{
- RT_ASSERT(dev != RT_NULL);
+ RT_ASSERT(dev != RT_NULL);
- struct efm32_usart_device_t *usart;
+ struct efm32_usart_device_t *usart;
- usart = (struct efm32_usart_device_t *)(dev->user_data);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
- if (--usart->counter == 0)
- {
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- struct efm32_usart_int_mode_t *int_rx;
+ if (--usart->counter == 0)
+ {
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ struct efm32_usart_int_mode_t *int_rx;
- int_rx = (struct efm32_usart_int_mode_t *)usart->rx_mode;
+ int_rx = (struct efm32_usart_int_mode_t *)usart->rx_mode;
- rt_free(int_rx->data_ptr);
- int_rx->data_ptr = RT_NULL;
- }
- }
+ rt_free(int_rx->data_ptr);
+ int_rx->data_ptr = RT_NULL;
+ }
+ }
- return RT_EOK;
+ return RT_EOK;
}
/***************************************************************************//**
* @brief
- * Read from USART device
+ * Read from USART device
*
* @details
*
* @note
+ * 9-bit SPI mode and SPI slave mode is untested
*
* @param[in] dev
- * Pointer to device descriptor
+ * Pointer to device descriptor
*
* @param[in] pos
- * Offset
+ * Offset
*
* @param[in] buffer
- * Poniter to the buffer
+ * Poniter to the buffer
*
* @param[in] size
- * Buffer size in byte
+ * Buffer size in byte
*
* @return
- * Number of read bytes
+ * Number of read bytes
******************************************************************************/
static rt_size_t rt_usart_read (
- rt_device_t dev,
- rt_off_t pos,
- void *buffer,
- rt_size_t size)
+ rt_device_t dev,
+ rt_off_t pos,
+ void *buffer,
+ rt_size_t size)
{
- struct efm32_usart_device_t *usart;
- rt_uint8_t *ptr;
- rt_err_t err_code;
- rt_size_t read_len;
+ struct efm32_usart_device_t *usart;
+ rt_uint8_t *ptr;
+ rt_err_t err_code;
+ rt_size_t read_len;
+ rt_uint32_t rx_flag, tx_flag, b8_flag;
- usart = (struct efm32_usart_device_t *)(dev->user_data);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
+#if defined(UART_PRESENT)
+ if (usart->state & USART_STATE_ASYNC_ONLY)
+ {
+ rx_flag = UART_STATUS_RXDATAV;
+ tx_flag = UART_STATUS_TXBL;
+ b8_flag = UART_CTRL_BIT8DV;
+ }
+ else
+#endif
+ {
+ rx_flag = USART_STATUS_RXDATAV;
+ tx_flag = USART_STATUS_TXBL;
+ b8_flag = USART_CTRL_BIT8DV;
+ }
- /* Lock device */
- if (rt_hw_interrupt_check())
- {
- err_code = rt_sem_take(usart->lock, RT_WAITING_NO);
- }
- else
- {
- err_code = rt_sem_take(usart->lock, RT_WAITING_FOREVER);
- }
- if (err_code != RT_EOK)
- {
- rt_set_errno(err_code);
- return 0;
- }
+ /* Lock device */
+ if (rt_hw_interrupt_check())
+ {
+ err_code = rt_sem_take(usart->lock, RT_WAITING_NO);
+ }
+ else
+ {
+ err_code = rt_sem_take(usart->lock, RT_WAITING_FOREVER);
+ }
+ if (err_code != RT_EOK)
+ {
+ rt_set_errno(err_code);
+ return 0;
+ }
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- ptr = buffer;
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ rt_size_t len = size;
+ ptr = buffer;
- /* interrupt mode Rx */
- while (size)
- {
- rt_base_t level;
- struct efm32_usart_int_mode_t *int_rx;
+ /* interrupt mode Rx */
+ while (len)
+ {
+ rt_base_t level;
+ struct efm32_usart_int_mode_t *int_rx;
- int_rx = (struct efm32_usart_int_mode_t *)\
- (((struct efm32_usart_device_t *)(dev->user_data))->rx_mode);
+ int_rx = (struct efm32_usart_int_mode_t *)\
+ (((struct efm32_usart_device_t *)(dev->user_data))->rx_mode);
- /* disable interrupt */
- level = rt_hw_interrupt_disable();
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
- if (int_rx->read_index != int_rx->save_index)
- {
- /* read a character */
- *ptr++ = int_rx->data_ptr[int_rx->read_index];
- size--;
-
- /* move to next position */
- int_rx->read_index ++;
- if (int_rx->read_index >= USART_RX_BUFFER_SIZE)
- {
- int_rx->read_index = 0;
- }
- }
- else
- {
- /* set error code */
- err_code = -RT_EEMPTY;
-
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- break;
- }
-
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- }
-
- read_len = (rt_uint32_t)ptr - (rt_uint32_t)buffer;
- }
- else
- {
- struct efm32_usart_device_t *usart;
- USART_TypeDef *usart_device;
-
- usart = (struct efm32_usart_device_t *)(dev->user_data);
- usart_device = ((struct efm32_usart_device_t *)(dev->user_data))->usart_device;
-
- if (usart->state & USART_STATE_SYNC)
- {
- /* SPI read */
- rt_uint8_t inst_len = *((rt_uint8_t *)buffer);
- rt_uint8_t *inst_ptr = (rt_uint8_t *)(buffer + 1);
- rt_uint8_t *rx_buf = *((rt_uint8_t **)(buffer + inst_len + 1));
- rt_off_t i;
-
- ptr = rx_buf;
-
- /* write instruction */
- while (inst_len)
- {
- while (!(usart->usart_device->STATUS & USART_STATUS_TXBL));
- usart->usart_device->TXDATA = (rt_uint32_t)*inst_ptr;
- ++inst_ptr; --inst_len;
- }
-
- /* Flushing RX */
- usart_device->CMD = USART_CMD_CLEARRX;
- /* Skip some bytes if necessary */
- for (i = 0; i < pos; i++)
- {
- /* dummy write */
- while (!(usart_device->STATUS & USART_STATUS_TXBL));
- usart_device->TXDATA = (rt_uint32_t)0xff;
- /* dummy read */
- while (!(usart_device->STATUS & USART_STATUS_RXDATAV));
- *((rt_uint32_t *)0x00) = usart_device->RXDATA;
- }
-
- while ((rt_uint32_t)ptr - (rt_uint32_t)rx_buf < size)
- {
- /* dummy write */
- while (!(usart_device->STATUS & USART_STATUS_TXBL));
- usart_device->TXDATA = (rt_uint32_t)0xff;
- /* read a byte of data */
- while (!(usart_device->STATUS & USART_STATUS_RXDATAV));
- *ptr = usart_device->RXDATA & 0xff;
- ptr ++;
- }
- }
- else
- {
- rt_uint32_t flag;
-
- if (usart->state & USART_STATE_ASYNC_ONLY)
+ if (int_rx->read_index != int_rx->save_index)
{
- flag = UART_STATUS_RXDATAV;
+ /* read a character */
+ *ptr++ = int_rx->data_ptr[int_rx->read_index];
+ len--;
+
+ /* move to next position */
+ int_rx->read_index ++;
+ if (int_rx->read_index >= USART_RX_BUFFER_SIZE)
+ {
+ int_rx->read_index = 0;
+ }
}
else
{
- flag = USART_STATUS_RXDATAV;
+ /* set error code */
+ err_code = -RT_EEMPTY;
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ break;
}
- ptr = buffer;
- /* polling mode */
- while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size)
- {
- while (usart_device->STATUS & flag)
- {
- *ptr = usart_device->RXDATA & 0xff;
- ptr ++;
- }
- }
- }
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ }
- read_len = size;
- }
+ read_len = (rt_uint32_t)ptr - (rt_uint32_t)buffer;
+ }
+ else
+ {
+ struct efm32_usart_device_t *usart;
+ USART_TypeDef *usart_device;
+ rt_size_t len;
- /* Unlock device */
- rt_sem_release(usart->lock);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
+ usart_device = ((struct efm32_usart_device_t *)(dev->user_data))->usart_device;
- /* set error code */
- rt_set_errno(err_code);
- return read_len;
+ if (usart->state & USART_STATE_SYNC)
+ {
+ /* SPI read */
+ rt_uint8_t inst_len = *((rt_uint8_t *)buffer);
+ rt_uint8_t *inst_ptr = (rt_uint8_t *)(buffer + 1);
+ rt_uint8_t *rx_buf = *((rt_uint8_t **)(buffer + inst_len + 1));
+ rt_off_t i;
+
+ ptr = rx_buf;
+ len = inst_len;
+
+ /* Write instructions */
+ if (len)
+ {
+ if (usart->state & USART_STATE_9BIT)
+ {
+ usart_device->CTRL &= ~b8_flag;
+ }
+ while (len)
+ {
+ while (!(usart->usart_device->STATUS & tx_flag));
+ usart->usart_device->TXDATA = (rt_uint32_t)*inst_ptr;
+ ++inst_ptr; --len;
+ }
+ if (usart->state & USART_STATE_9BIT)
+ {
+ usart_device->CTRL |= b8_flag;
+ }
+ }
+ /* Flushing RX */
+ usart_device->CMD = USART_CMD_CLEARRX;
+ /* Skip some bytes if necessary */
+ for (i = 0; i < pos; i++)
+ {
+ /* dummy write */
+ while (!(usart_device->STATUS & tx_flag));
+ usart_device->TXDATA = (rt_uint32_t)0xff;
+ /* dummy read */
+ while (!(usart_device->STATUS & rx_flag));
+ *((rt_uint32_t *)0x00) = usart_device->RXDATA;
+ }
+
+ while (((rt_uint32_t)ptr - (rt_uint32_t)rx_buf) < size)
+ {
+ /* dummy write */
+ while (!(usart_device->STATUS & tx_flag));
+ usart_device->TXDATA = (rt_uint32_t)0xff;
+ /* read a byte of data */
+ while (!(usart_device->STATUS & rx_flag));
+ *ptr = usart_device->RXDATA & 0xff;
+ ptr ++;
+ }
+ }
+ else
+ {
+ ptr = buffer;
+
+ /* polling mode */
+ while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size)
+ {
+ while (usart_device->STATUS & rx_flag)
+ {
+ *ptr = usart_device->RXDATA & 0xff;
+ ptr ++;
+ }
+ }
+ }
+
+ read_len = size;
+ }
+
+ /* Unlock device */
+ rt_sem_release(usart->lock);
+
+ /* set error code */
+ rt_set_errno(err_code);
+ return read_len;
}
/***************************************************************************//**
@@ -506,391 +567,435 @@ static rt_size_t rt_usart_read (
* Number of written bytes
******************************************************************************/
static rt_size_t rt_usart_write (
- rt_device_t dev,
- rt_off_t pos,
- const void* buffer,
- rt_size_t size)
+ rt_device_t dev,
+ rt_off_t pos,
+ const void* buffer,
+ rt_size_t size)
{
- rt_err_t err_code;
- rt_size_t write_size;
- struct efm32_usart_device_t* usart;
+ rt_err_t err_code;
+ rt_size_t write_size = 0;
+ struct efm32_usart_device_t* usart = (struct efm32_usart_device_t*)(dev->user_data);
+ rt_uint8_t inst_len = *((rt_uint8_t *)buffer);
+ rt_uint8_t *inst_ptr = (rt_uint8_t *)(buffer + 1);
+ rt_uint8_t *tx_buf = *((rt_uint8_t **)(buffer + inst_len + 1));
+ rt_uint32_t tx_flag, b8_flag;
- write_size = 0;
- usart = (struct efm32_usart_device_t*)(dev->user_data);
+#if defined(UART_PRESENT)
+ if (usart->state & USART_STATE_ASYNC_ONLY)
+ {
+ tx_flag = UART_STATUS_TXBL;
+ b8_flag = UART_CTRL_BIT8DV;
+ }
+ else
+#endif
+ {
+ tx_flag = USART_STATUS_TXBL;
+ b8_flag = USART_CTRL_BIT8DV;
+ }
- /* Lock device */
- if (rt_hw_interrupt_check())
- {
- err_code = rt_sem_take(usart->lock, RT_WAITING_NO);
- }
- else
- {
- err_code = rt_sem_take(usart->lock, RT_WAITING_FOREVER);
- }
- if (err_code != RT_EOK)
- {
- rt_set_errno(err_code);
- return 0;
- }
+ /* Lock device */
+ if (rt_hw_interrupt_check())
+ {
+ err_code = rt_sem_take(usart->lock, RT_WAITING_NO);
+ }
+ else
+ {
+ err_code = rt_sem_take(usart->lock, RT_WAITING_FOREVER);
+ }
+ if (err_code != RT_EOK)
+ {
+ rt_set_errno(err_code);
+ return 0;
+ }
- if ((dev->flag & RT_DEVICE_FLAG_DMA_TX) && (size > 2))
- { /* DMA mode Tx */
- struct efm32_usart_dma_mode_t *dma_tx;
+ if (dev->flag & RT_DEVICE_FLAG_STREAM)
+ {
+ if (*(tx_buf + size - 1) == '\n')
+ {
+ *(tx_buf + size - 1) = '\r';
+ *(tx_buf + size++) = '\n';
+ *(tx_buf + size) = 0;
+ }
+ }
- if (dev->flag & RT_DEVICE_FLAG_STREAM)
- {
- if (*((rt_uint8_t *)buffer + size - 1) == '\n')
- {
- *((rt_uint8_t *)buffer + size - 1) = '\r';
- *((rt_uint8_t *)buffer + size++) = '\n';
- *((rt_uint8_t *)buffer + size) = 0;
- }
- }
+ /* Write instructions */
+ if (inst_len)
+ {
+ if (usart->state & USART_STATE_9BIT)
+ {
+ usart->usart_device->CTRL &= ~b8_flag;
+ }
+ if ((dev->flag & RT_DEVICE_FLAG_DMA_TX) && (inst_len > 2))
+ { /* DMA mode Tx */
+ struct efm32_usart_dma_mode_t *dma_tx;
- dma_tx = (struct efm32_usart_dma_mode_t *)(usart->tx_mode);
- dma_tx->data_ptr = (rt_uint32_t *)buffer;
- dma_tx->data_size = size;
+ usart_debug("USART: DMA TX INS (%d)\n", inst_len);
+ dma_tx = (struct efm32_usart_dma_mode_t *)(usart->tx_mode);
+ dma_tx->data_ptr = (rt_uint32_t *)inst_ptr;
+ dma_tx->data_size = inst_len;
- usart->state |= USART_STATE_TX_BUSY;
+ usart->state |= USART_STATE_TX_BUSY;
+ DMA_ActivateBasic(
+ dma_tx->dma_channel,
+ true,
+ false,
+ (void *)&(usart->usart_device->TXDATA),
+ (void *)inst_ptr,
+ (rt_uint32_t)(inst_len - 1));
+ /* Wait, otherwise the TX buffer is overwrite */
+ // TODO: This function blocks the process => goto low power mode?
+ // if (usart->state & USART_STATE_CONSOLE)
+ // {
+ while(usart->state & USART_STATE_TX_BUSY);
+ // }
+ // else
+ // {
+ // while(usart->state & USART_STATE_TX_BUSY)
+ // {
+ // rt_thread_sleep(USART_WAIT_TIME_TX);
+ // }
+ // }
+ }
+ else
+ { /* polling mode */
+ rt_uint8_t *ptr = (rt_uint8_t *)inst_ptr;
+ rt_size_t len = inst_len;
- DMA_ActivateBasic(
- dma_tx->dma_channel,
- true,
- false,
- (void *)&(usart->usart_device->TXDATA),
- (void *)buffer,
- (rt_uint32_t)(size - 1));
-
- /* Wait, otherwise the TX buffer is overwrite */
-// if (usart->state & USART_STATE_CONSOLE)
-// {
- while(usart->state & USART_STATE_TX_BUSY);
-// }
-// else
-// {
-// while(usart->state & USART_STATE_TX_BUSY)
-// {
-// rt_thread_sleep(USART_WAIT_TIME_TX);
-// }
-// }
-// TODO: This function blocks the process
- write_size = size;
- }
- else
- { /* polling mode */
- rt_uint8_t *ptr = (rt_uint8_t *)buffer;
-
- if (dev->flag & RT_DEVICE_FLAG_STREAM)
- {
- /* stream mode */
- while (size)
- {
- if (*ptr == '\n')
- {
- while (!(usart->usart_device->STATUS & USART_STATUS_TXBL));
- usart->usart_device->TXDATA = '\r';
- }
-
- while (!(usart->usart_device->STATUS & USART_STATUS_TXBL));
- usart->usart_device->TXDATA = (rt_uint32_t)*ptr;
- ++ptr; --size;
- }
- }
- else
- {
- rt_uint32_t flag;
-
- if (usart->state & USART_STATE_ASYNC_ONLY)
+ usart_debug("USART: Polling TX INS (%d)\n", inst_len);
+ while (len)
{
- flag = UART_STATUS_TXBL;
- }
- else
- {
- flag = USART_STATUS_TXBL;
+ while (!(usart->usart_device->STATUS & tx_flag));
+ usart->usart_device->TXDATA = (rt_uint32_t)*ptr;
+ ++ptr; --len;
}
+ }
+ if (usart->state & USART_STATE_9BIT)
+ {
+ usart->usart_device->CTRL |= b8_flag;
+ }
+ }
- /* write data directly */
- while (size)
- {
- while (!(usart->usart_device->STATUS & flag));
- usart->usart_device->TXDATA = (rt_uint32_t)*ptr;
- ++ptr; --size;
- }
- }
+ /* Write data */
+ if ((dev->flag & RT_DEVICE_FLAG_DMA_TX) && (size > 2))
+ { /* DMA mode Tx */
+ struct efm32_usart_dma_mode_t *dma_tx;
- write_size = (rt_size_t)ptr - (rt_size_t)buffer;
- }
+ usart_debug("USART: DMA TX data (%d)\n", size);
+ dma_tx = (struct efm32_usart_dma_mode_t *)(usart->tx_mode);
+ dma_tx->data_ptr = (rt_uint32_t *)tx_buf;
+ dma_tx->data_size = size;
- /* Unlock device */
- rt_sem_release(usart->lock);
+ usart->state |= USART_STATE_TX_BUSY;
+ DMA_ActivateBasic(
+ dma_tx->dma_channel,
+ true,
+ false,
+ (void *)&(usart->usart_device->TXDATA),
+ (void *)tx_buf,
+ (rt_uint32_t)(size - 1));
- /* set error code */
- rt_set_errno(err_code);
- return write_size;
+ /* Wait, otherwise the TX buffer is overwrite */
+ // TODO: This function blocks the process => goto low power mode?
+// if (usart->state & USART_STATE_CONSOLE)
+// {
+ while(usart->state & USART_STATE_TX_BUSY);
+// }
+// else
+// {
+// while(usart->state & USART_STATE_TX_BUSY)
+// {
+// rt_thread_sleep(USART_WAIT_TIME_TX);
+// }
+// }
+ write_size = size;
+ }
+ else
+ { /* polling mode */
+ rt_uint8_t *ptr = (rt_uint8_t *)tx_buf;
+ rt_size_t len = size;
+
+ usart_debug("USART: Polling TX data (%d)\n", size);
+ while (len)
+ {
+ while (!(usart->usart_device->STATUS & tx_flag));
+ usart->usart_device->TXDATA = (rt_uint32_t)*ptr;
+ ++ptr; --len;
+ }
+
+ write_size = (rt_size_t)ptr - (rt_size_t)tx_buf;
+ }
+
+ /* Unlock device */
+ rt_sem_release(usart->lock);
+
+ /* set error code */
+ rt_set_errno(err_code);
+ return write_size;
}
/***************************************************************************//**
* @brief
-* Configure USART device
+* Configure USART device
*
* @details
*
* @note
*
* @param[in] dev
-* Pointer to device descriptor
+* Pointer to device descriptor
*
* @param[in] cmd
-* IIC control command
+* IIC control command
*
* @param[in] args
-* Arguments
+* Arguments
*
* @return
-* Error code
+* Error code
******************************************************************************/
static rt_err_t rt_usart_control (
- rt_device_t dev,
- rt_uint8_t cmd,
- void *args)
+ rt_device_t dev,
+ rt_uint8_t cmd,
+ void *args)
{
- RT_ASSERT(dev != RT_NULL);
+ RT_ASSERT(dev != RT_NULL);
- rt_err_t err_code;
- struct efm32_usart_device_t *usart;
+ rt_err_t err_code;
+ struct efm32_usart_device_t *usart;
- usart = (struct efm32_usart_device_t *)(dev->user_data);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
- /* Lock device */
- if (rt_hw_interrupt_check())
- {
- err_code = rt_sem_take(usart->lock, RT_WAITING_NO);
- }
- else
- {
- err_code = rt_sem_take(usart->lock, RT_WAITING_FOREVER);
- }
- if (err_code != RT_EOK)
- {
- return err_code;
- }
+ /* Lock device */
+ if (rt_hw_interrupt_check())
+ {
+ err_code = rt_sem_take(usart->lock, RT_WAITING_NO);
+ }
+ else
+ {
+ err_code = rt_sem_take(usart->lock, RT_WAITING_FOREVER);
+ }
+ if (err_code != RT_EOK)
+ {
+ return err_code;
+ }
- switch (cmd)
- {
- case RT_DEVICE_CTRL_SUSPEND:
- /* Suspend device */
- dev->flag |= RT_DEVICE_FLAG_SUSPENDED;
- USART_Enable(usart->usart_device, usartDisable);
- break;
+ switch (cmd)
+ {
+ case RT_DEVICE_CTRL_SUSPEND:
+ /* Suspend device */
+ dev->flag |= RT_DEVICE_FLAG_SUSPENDED;
+ USART_Enable(usart->usart_device, usartDisable);
+ break;
- case RT_DEVICE_CTRL_RESUME:
- /* Resume device */
- dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED;
- USART_Enable(usart->usart_device, usartEnable);
- break;
+ case RT_DEVICE_CTRL_RESUME:
+ /* Resume device */
+ dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED;
+ USART_Enable(usart->usart_device, usartEnable);
+ break;
- case RT_DEVICE_CTRL_USART_RBUFFER:
- /* Set RX buffer */
- {
- struct efm32_usart_int_mode_t *int_rx;
- rt_uint8_t size;
+ case RT_DEVICE_CTRL_USART_RBUFFER:
+ /* Set RX buffer */
+ {
+ struct efm32_usart_int_mode_t *int_rx;
+ rt_uint8_t size;
- int_rx = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
- size = (rt_uint8_t)((rt_uint32_t)args & 0xFFUL);
+ int_rx = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
+ size = (rt_uint8_t)((rt_uint32_t)args & 0xFFUL);
- /* Free previous RX buffer */
- if (int_rx->data_ptr != RT_NULL)
- {
- if (size == 0)
- { /* Free RX buffer */
- rt_free(int_rx->data_ptr);
- int_rx->data_ptr = RT_NULL;
- }
- else if (size != int_rx->data_size)
- {
- /* Re-allocate RX buffer */
- if ((int_rx->data_ptr = rt_realloc(int_rx->data_ptr, size)) \
- == RT_NULL)
- {
- usart_debug("USART%d err: no mem for RX BUF\n", usart->unit);
- err_code = -RT_ENOMEM;
- break;
- }
- // TODO: Is the following line necessary?
- //rt_memset(int_rx->data_ptr, 0, size);
- }
- }
- else
- {
- /* Allocate new RX buffer */
- if ((int_rx->data_ptr = rt_malloc(size)) == RT_NULL)
- {
- usart_debug("USART%d err: no mem for RX BUF\n", usart->unit);
- err_code = -RT_ENOMEM;
- break;
- }
- }
- int_rx->data_size = size;
- int_rx->read_index = 0;
- int_rx->save_index = 0;
- }
- break;
+ /* Free previous RX buffer */
+ if (int_rx->data_ptr != RT_NULL)
+ {
+ if (size == 0)
+ { /* Free RX buffer */
+ rt_free(int_rx->data_ptr);
+ int_rx->data_ptr = RT_NULL;
+ }
+ else if (size != int_rx->data_size)
+ {
+ /* Re-allocate RX buffer */
+ if ((int_rx->data_ptr = rt_realloc(int_rx->data_ptr, size)) \
+ == RT_NULL)
+ {
+ usart_debug("USART%d err: no mem for RX BUF\n", usart->unit);
+ err_code = -RT_ENOMEM;
+ break;
+ }
+ // TODO: Is the following line necessary?
+ //rt_memset(int_rx->data_ptr, 0, size);
+ }
+ }
+ else
+ {
+ /* Allocate new RX buffer */
+ if ((int_rx->data_ptr = rt_malloc(size)) == RT_NULL)
+ {
+ usart_debug("USART%d err: no mem for RX BUF\n", usart->unit);
+ err_code = -RT_ENOMEM;
+ break;
+ }
+ }
+ int_rx->data_size = size;
+ int_rx->read_index = 0;
+ int_rx->save_index = 0;
+ }
+ break;
- }
+ }
- /* Unlock device */
- rt_sem_release(usart->lock);
+ /* Unlock device */
+ rt_sem_release(usart->lock);
- return err_code;
+ return err_code;
}
/***************************************************************************//**
* @brief
- * USART RX data valid interrupt handler
+ * USART RX data valid interrupt handler
*
* @details
*
* @note
+ * 9-bit SPI mode has not implemented yet and SPI slave mode is untested
*
* @param[in] dev
- * Pointer to device descriptor
+ * Pointer to device descriptor
******************************************************************************/
void rt_hw_usart_rx_isr(rt_device_t dev)
{
- struct efm32_usart_device_t *usart;
- struct efm32_usart_int_mode_t *int_rx;
+ struct efm32_usart_device_t *usart;
+ struct efm32_usart_int_mode_t *int_rx;
rt_uint32_t flag;
- /* interrupt mode receive */
- RT_ASSERT(dev->flag & RT_DEVICE_FLAG_INT_RX);
-
- usart = (struct efm32_usart_device_t *)(dev->user_data);
- int_rx = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
-
- RT_ASSERT(int_rx->data_ptr != RT_NULL);
-
- /* Set status */
- usart->state |= USART_STATE_RX_BUSY;
-
- /* save into rx buffer */
+ /* interrupt mode receive */
+ RT_ASSERT(dev->flag & RT_DEVICE_FLAG_INT_RX);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
+ int_rx = (struct efm32_usart_int_mode_t *)(usart->rx_mode);
+ RT_ASSERT(int_rx->data_ptr != RT_NULL);
+#if defined(UART_PRESENT)
if (usart->state & USART_STATE_ASYNC_ONLY)
{
flag = UART_STATUS_RXDATAV;
}
else
+#endif
{
flag = USART_STATUS_RXDATAV;
}
- while (usart->usart_device->STATUS & flag)
- {
- rt_base_t level;
- /* disable interrupt */
- level = rt_hw_interrupt_disable();
+ /* Set status */
+ usart->state |= USART_STATE_RX_BUSY;
- /* save character */
- int_rx->data_ptr[int_rx->save_index] = \
- (rt_uint8_t)(usart->usart_device->RXDATA & 0xFFUL);
- int_rx->save_index ++;
- if (int_rx->save_index >= USART_RX_BUFFER_SIZE)
- int_rx->save_index = 0;
+ /* save into rx buffer */
+ while (usart->usart_device->STATUS & flag)
+ {
+ rt_base_t level;
- /* if the next position is read index, discard this 'read char' */
- if (int_rx->save_index == int_rx->read_index)
- {
- int_rx->read_index ++;
- if (int_rx->read_index >= USART_RX_BUFFER_SIZE)
- {
- int_rx->read_index = 0;
- }
- }
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- }
+ /* save character */
+ int_rx->data_ptr[int_rx->save_index] = \
+ (rt_uint8_t)(usart->usart_device->RXDATA & 0xFFUL);
+ int_rx->save_index ++;
+ if (int_rx->save_index >= USART_RX_BUFFER_SIZE)
+ int_rx->save_index = 0;
- /* invoke callback */
- if (dev->rx_indicate != RT_NULL)
- {
- rt_size_t rx_length;
+ /* if the next position is read index, discard this 'read char' */
+ if (int_rx->save_index == int_rx->read_index)
+ {
+ int_rx->read_index ++;
+ if (int_rx->read_index >= USART_RX_BUFFER_SIZE)
+ {
+ int_rx->read_index = 0;
+ }
+ }
- /* get rx length */
- rx_length = int_rx->read_index > int_rx->save_index ?
- USART_RX_BUFFER_SIZE - int_rx->read_index + int_rx->save_index : \
- int_rx->save_index - int_rx->read_index;
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ }
- dev->rx_indicate(dev, rx_length);
- }
+ /* invoke callback */
+ if (dev->rx_indicate != RT_NULL)
+ {
+ rt_size_t rx_length;
+
+ /* get rx length */
+ rx_length = int_rx->read_index > int_rx->save_index ?
+ USART_RX_BUFFER_SIZE - int_rx->read_index + int_rx->save_index : \
+ int_rx->save_index - int_rx->read_index;
+
+ dev->rx_indicate(dev, rx_length);
+ }
}
/***************************************************************************//**
* @brief
- * DMA for USART TX interrupt handler
+ * DMA for USART TX interrupt handler
*
* @details
*
* @note
*
* @param[in] dev
- * Pointer to device descriptor
+ * Pointer to device descriptor
******************************************************************************/
void rt_hw_usart_dma_tx_isr(rt_device_t dev)
{
- /* DMA mode receive */
- struct efm32_usart_device_t *usart;
- struct efm32_usart_dma_mode_t *dma_tx;
+ /* DMA mode receive */
+ struct efm32_usart_device_t *usart;
+ struct efm32_usart_dma_mode_t *dma_tx;
- RT_ASSERT(dev->flag & RT_DEVICE_FLAG_DMA_TX);
+ RT_ASSERT(dev->flag & RT_DEVICE_FLAG_DMA_TX);
- usart = (struct efm32_usart_device_t *)(dev->user_data);
- dma_tx = (struct efm32_usart_dma_mode_t *)(usart->tx_mode);
+ usart = (struct efm32_usart_device_t *)(dev->user_data);
+ dma_tx = (struct efm32_usart_dma_mode_t *)(usart->tx_mode);
- /* invoke call to notify tx complete */
- if (dev->tx_complete != RT_NULL)
- {
- dev->tx_complete(dev, dma_tx->data_ptr);
- }
+ /* invoke call to notify tx complete */
+ if (dev->tx_complete != RT_NULL)
+ {
+ dev->tx_complete(dev, dma_tx->data_ptr);
+ }
- /* Set status */
- usart->state &= ~(rt_uint32_t)USART_STATE_TX_BUSY;
+ /* Set status */
+ usart->state &= ~(rt_uint32_t)USART_STATE_TX_BUSY;
}
/***************************************************************************//**
* @brief
-* Register USART device
+* Register USART device
*
* @details
*
* @note
*
* @param[in] device
-* Pointer to device descriptor
+* Pointer to device descriptor
*
* @param[in] name
-* Device name
+* Device name
*
* @param[in] flag
-* Configuration flags
+* Configuration flags
*
* @param[in] usart
-* Pointer to USART device descriptor
+* Pointer to USART device descriptor
*
* @return
-* Error code
+* Error code
******************************************************************************/
rt_err_t rt_hw_usart_register(
- rt_device_t device,
- const char *name,
- rt_uint32_t flag,
- struct efm32_usart_device_t *usart)
+ rt_device_t device,
+ const char *name,
+ rt_uint32_t flag,
+ struct efm32_usart_device_t *usart)
{
- RT_ASSERT(device != RT_NULL);
+ RT_ASSERT(device != RT_NULL);
- if ((flag & RT_DEVICE_FLAG_DMA_RX) ||
- (flag & RT_DEVICE_FLAG_INT_TX))
- {
- RT_ASSERT(0);
- }
+ if ((flag & RT_DEVICE_FLAG_DMA_RX) ||
+ (flag & RT_DEVICE_FLAG_INT_TX))
+ {
+ RT_ASSERT(0);
+ }
if (usart->state & USART_STATE_SYNC)
{
@@ -900,353 +1005,403 @@ rt_err_t rt_hw_usart_register(
{
device->type = RT_Device_Class_Char;
}
- device->rx_indicate = RT_NULL;
- device->tx_complete = RT_NULL;
- device->init = rt_usart_init;
- device->open = rt_usart_open;
- device->close = rt_usart_close;
- device->read = rt_usart_read;
- device->write = rt_usart_write;
- device->control = rt_usart_control;
- device->user_data = usart;
+ device->rx_indicate = RT_NULL;
+ device->tx_complete = RT_NULL;
+ device->init = rt_usart_init;
+ device->open = rt_usart_open;
+ device->close = rt_usart_close;
+ device->read = rt_usart_read;
+ device->write = rt_usart_write;
+ device->control = rt_usart_control;
+ device->user_data = usart;
- /* register a character device */
- return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
+ /* register a character device */
+ return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
}
/***************************************************************************//**
* @brief
-* Initialize the specified USART unit
+* Initialize the specified USART unit
*
* @details
*
* @note
*
* @param[in] device
-* Pointer to device descriptor
+* Pointer to device descriptor
*
* @param[in] unitNumber
-* Unit number
+* Unit number
*
* @param[in] location
-* Pin location number
+* Pin location number
*
* @param[in] flag
-* Configuration flag
+* Configuration flag
*
* @param[in] dmaChannel
-* DMA channel number for TX
+* DMA channel number for TX
*
* @param[in] console
-* Indicate if using as console
+* Indicate if using as console
*
* @return
-* Pointer to USART device
+* Pointer to USART device
******************************************************************************/
static struct efm32_usart_device_t *rt_hw_usart_unit_init(
- rt_device_t device,
- rt_uint8_t unitNumber,
- rt_uint8_t location,
- rt_uint32_t flag,
- rt_uint32_t dmaChannel,
- rt_uint8_t config)
+ rt_device_t device,
+ rt_uint8_t unitNumber,
+ rt_uint8_t location,
+ rt_uint32_t flag,
+ rt_uint32_t dmaChannel,
+ rt_uint8_t config)
{
- struct efm32_usart_device_t *usart;
- struct efm32_usart_dma_mode_t *dma_mode;
- DMA_CB_TypeDef *callback;
- CMU_Clock_TypeDef usartClock;
- rt_uint32_t txDmaSelect;
- GPIO_Port_TypeDef port_tx, port_rx, port_clk, port_cs;
- rt_uint32_t pin_tx, pin_rx, pin_clk, pin_cs;
- efm32_irq_hook_init_t hook;
+ struct efm32_usart_device_t *usart;
+ struct efm32_usart_dma_mode_t *dma_mode;
+ DMA_CB_TypeDef *callback;
+ CMU_Clock_TypeDef usartClock;
+ rt_uint32_t txDmaSelect;
+ GPIO_Port_TypeDef port_tx, port_rx, port_clk, port_cs;
+ rt_uint32_t pin_tx, pin_rx, pin_clk, pin_cs;
+ efm32_irq_hook_init_t hook;
- do
- {
- /* Allocate device */
- usart = rt_malloc(sizeof(struct efm32_usart_device_t));
- if (usart == RT_NULL)
- {
- usart_debug("USART%d err: no mem\n", usart->unit);
- break;
- }
- usart->counter = 0;
- usart->unit = unitNumber;
- usart->state = config;
- usart->tx_mode = RT_NULL;
- usart->rx_mode = RT_NULL;
+ do
+ {
+ /* Allocate device */
+ usart = rt_malloc(sizeof(struct efm32_usart_device_t));
+ if (usart == RT_NULL)
+ {
+ usart_debug("USART%d err: no mem\n", usart->unit);
+ break;
+ }
+ usart->counter = 0;
+ usart->unit = unitNumber;
+ usart->state = config;
+ usart->tx_mode = RT_NULL;
+ usart->rx_mode = RT_NULL;
- /* Allocate TX */
- dma_mode = RT_NULL;
- if (flag & RT_DEVICE_FLAG_DMA_TX)
- {
- usart->tx_mode = dma_mode = rt_malloc(sizeof(struct efm32_usart_dma_mode_t));
- if (dma_mode == RT_NULL)
- {
- usart_debug("USART%d err: no mem for DMA TX\n", usart->unit);
- break;
- }
- dma_mode->dma_channel = dmaChannel;
- }
+ /* Allocate TX */
+ dma_mode = RT_NULL;
+ if (flag & RT_DEVICE_FLAG_DMA_TX)
+ {
+ usart->tx_mode = dma_mode = rt_malloc(sizeof(struct efm32_usart_dma_mode_t));
+ if (dma_mode == RT_NULL)
+ {
+ usart_debug("USART%d err: no mem for DMA TX\n", usart->unit);
+ break;
+ }
+ dma_mode->dma_channel = dmaChannel;
+ }
- /* Allocate RX */
- if (flag & RT_DEVICE_FLAG_INT_RX)
- {
- usart->rx_mode = rt_malloc(sizeof(struct efm32_usart_int_mode_t));
- if (usart->rx_mode == RT_NULL)
- {
- usart_debug("USART%d err: no mem for INT RX\n", usart->unit);
- break;
- }
- }
+ /* Allocate RX */
+ if (flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ usart->rx_mode = rt_malloc(sizeof(struct efm32_usart_int_mode_t));
+ if (usart->rx_mode == RT_NULL)
+ {
+ usart_debug("USART%d err: no mem for INT RX\n", usart->unit);
+ break;
+ }
+ }
- /* Initialization */
- if ((!(config & USART_STATE_ASYNC_ONLY) && (unitNumber >= USART_COUNT)) || \
+ /* Initialization */
+#if defined(UART_PRESENT)
+ if ((!(config & USART_STATE_ASYNC_ONLY) && (unitNumber >= USART_COUNT)) || \
((config & USART_STATE_ASYNC_ONLY) && (unitNumber >= UART_COUNT)))
- {
- break;
- }
- switch (unitNumber)
- {
- case 0:
- if (config & USART_STATE_ASYNC_ONLY)
- {
- usart->usart_device = UART0;
- usartClock = (CMU_Clock_TypeDef)cmuClock_UART0;
- txDmaSelect = DMAREQ_UART0_TXBL;
- port_tx = AF_UART0_TX_PORT(location);
- pin_tx = AF_UART0_TX_PIN(location);
- port_rx = AF_UART0_RX_PORT(location);
- pin_rx = AF_UART0_RX_PIN(location);
- }
- else
- {
- usart->usart_device = USART0;
- usartClock = (CMU_Clock_TypeDef)cmuClock_USART0;
- txDmaSelect = DMAREQ_USART0_TXBL;
- port_tx = AF_USART0_TX_PORT(location);
- pin_tx = AF_USART0_TX_PIN(location);
- port_rx = AF_USART0_RX_PORT(location);
- pin_rx = AF_USART0_RX_PIN(location);
- port_clk = AF_USART0_CLK_PORT(location);
- pin_clk = AF_USART0_CLK_PIN(location);
- port_cs = AF_USART0_CS_PORT(location);
- pin_cs = AF_USART0_CS_PIN(location);
- }
- break;
-
- case 1:
-#if defined(EFM32_GIANT_FAMILY)
- if (config & USART_STATE_ASYNC_ONLY)
- {
- usart->usart_device = UART1;
- usartClock = (CMU_Clock_TypeDef)cmuClock_UART1;
- txDmaSelect = DMAREQ_UART1_TXBL;
- port_tx = AF_UART1_TX_PORT(location);
- pin_tx = AF_UART1_TX_PIN(location);
- port_rx = AF_UART1_RX_PORT(location);
- pin_rx = AF_UART1_RX_PIN(location);
- }
- else
+#else
+ if (unitNumber >= USART_COUNT)
#endif
+ {
+ break;
+ }
+ switch (unitNumber)
+ {
+ case 0:
+#if defined(UART_PRESENT)
+ if (config & USART_STATE_ASYNC_ONLY)
{
- usart->usart_device = USART1;
- usartClock = (CMU_Clock_TypeDef)cmuClock_USART1;
- txDmaSelect = DMAREQ_USART1_TXBL;
- port_tx = AF_USART1_TX_PORT(location);
- pin_tx = AF_USART1_TX_PIN(location);
- port_rx = AF_USART1_RX_PORT(location);
- pin_rx = AF_USART1_RX_PIN(location);
- port_clk = AF_USART1_CLK_PORT(location);
- pin_clk = AF_USART1_CLK_PIN(location);
- port_cs = AF_USART1_CS_PORT(location);
- pin_cs = AF_USART1_CS_PIN(location);
+ usart->usart_device = UART0;
+ usartClock = (CMU_Clock_TypeDef)cmuClock_UART0;
+ txDmaSelect = DMAREQ_UART0_TXBL;
+ port_tx = AF_UART0_TX_PORT(location);
+ pin_tx = AF_UART0_TX_PIN(location);
+ port_rx = AF_UART0_RX_PORT(location);
+ pin_rx = AF_UART0_RX_PIN(location);
}
- break;
+ else
+ #endif
+ {
+ usart->usart_device = USART0;
+ usartClock = (CMU_Clock_TypeDef)cmuClock_USART0;
+ txDmaSelect = DMAREQ_USART0_TXBL;
+ port_tx = AF_USART0_TX_PORT(location);
+ pin_tx = AF_USART0_TX_PIN(location);
+ port_rx = AF_USART0_RX_PORT(location);
+ pin_rx = AF_USART0_RX_PIN(location);
+ port_clk = AF_USART0_CLK_PORT(location);
+ pin_clk = AF_USART0_CLK_PIN(location);
+ port_cs = AF_USART0_CS_PORT(location);
+ pin_cs = AF_USART0_CS_PIN(location);
+ }
+ break;
+#if ((defined(USART_PRESENT) && (USART_COUNT > 1)) || \
+ (defined(UART_PRESENT) && (UART_COUNT > 1)))
+ case 1:
+ #if (defined(UART_PRESENT) && (UART_COUNT > 1))
+ if (config & USART_STATE_ASYNC_ONLY)
+ {
+ usart->usart_device = UART1;
+ usartClock = (CMU_Clock_TypeDef)cmuClock_UART1;
+ txDmaSelect = DMAREQ_UART1_TXBL;
+ port_tx = AF_UART1_TX_PORT(location);
+ pin_tx = AF_UART1_TX_PIN(location);
+ port_rx = AF_UART1_RX_PORT(location);
+ pin_rx = AF_UART1_RX_PIN(location);
+ }
+ else
+ #endif
+ {
+ usart->usart_device = USART1;
+ usartClock = (CMU_Clock_TypeDef)cmuClock_USART1;
+ txDmaSelect = DMAREQ_USART1_TXBL;
+ port_tx = AF_USART1_TX_PORT(location);
+ pin_tx = AF_USART1_TX_PIN(location);
+ port_rx = AF_USART1_RX_PORT(location);
+ pin_rx = AF_USART1_RX_PIN(location);
+ port_clk = AF_USART1_CLK_PORT(location);
+ pin_clk = AF_USART1_CLK_PIN(location);
+ port_cs = AF_USART1_CS_PORT(location);
+ pin_cs = AF_USART1_CS_PIN(location);
+ }
+ break;
+#endif
+#if ((defined(USART_PRESENT) && (USART_COUNT > 2)) || \
+ (defined(UART_PRESENT) && (UART_COUNT > 2)))
+ case 2:
+ #if (defined(UART_PRESENT) && (UART_COUNT > 2))
+ if (config & USART_STATE_ASYNC_ONLY)
+ {
+ usart->usart_device = UART2;
+ usartClock = (CMU_Clock_TypeDef)cmuClock_UART2;
+ txDmaSelect = DMAREQ_UART2_TXBL;
+ port_tx = AF_UART2_TX_PORT(location);
+ pin_tx = AF_UART2_TX_PIN(location);
+ port_rx = AF_UART2_RX_PORT(location);
+ pin_rx = AF_UART2_RX_PIN(location);
+ }
+ else
+ #endif
+ {
+ usart->usart_device = USART2;
+ usartClock = (CMU_Clock_TypeDef)cmuClock_USART2;
+ txDmaSelect = DMAREQ_USART2_TXBL;
+ port_tx = AF_USART2_TX_PORT(location);
+ pin_tx = AF_USART2_TX_PIN(location);
+ port_rx = AF_USART2_RX_PORT(location);
+ pin_rx = AF_USART2_RX_PIN(location);
+ port_clk = AF_USART2_CLK_PORT(location);
+ pin_clk = AF_USART2_CLK_PIN(location);
+ port_cs = AF_USART2_CS_PORT(location);
+ pin_cs = AF_USART2_CS_PIN(location);
+ }
+ break;
+#endif
+ default:
+ break;
+ }
- case 2:
- usart->usart_device = USART2;
- usartClock = (CMU_Clock_TypeDef)cmuClock_USART2;
- txDmaSelect = DMAREQ_USART2_TXBL;
- port_tx = AF_USART2_TX_PORT(location);
- pin_tx = AF_USART2_TX_PIN(location);
- port_rx = AF_USART2_RX_PORT(location);
- pin_rx = AF_USART2_RX_PIN(location);
- port_clk = AF_USART2_CLK_PORT(location);
- pin_clk = AF_USART2_CLK_PIN(location);
- port_cs = AF_USART2_CS_PORT(location);
- pin_cs = AF_USART2_CS_PIN(location);
- break;
+ /* Enable USART clock */
+ CMU_ClockEnable(usartClock, true);
- default:
- break;
- }
+ /* Config GPIO */
+ GPIO_PinModeSet(
+ port_tx,
+ pin_tx,
+ gpioModePushPull,
+ 0);
+ GPIO_PinModeSet(
+ port_rx,
+ pin_rx,
+ gpioModeInputPull,
+ 1);
+ if (config & USART_STATE_SYNC)
+ {
+ GPIO_PinModeSet(
+ port_clk,
+ pin_clk,
+ gpioModePushPull,
+ 0);
+ }
+ if (config & USART_STATE_AUTOCS)
+ {
+ GPIO_PinModeSet(
+ port_cs,
+ pin_cs,
+ gpioModePushPull,
+ 1);
+ }
- /* Enable USART clock */
- CMU_ClockEnable(usartClock, true);
-
- /* Config GPIO */
- GPIO_PinModeSet(
- port_tx,
- pin_tx,
- gpioModePushPull,
- 0);
- GPIO_PinModeSet(
- port_rx,
- pin_rx,
- gpioModeInputPull,
- 1);
- if (config & USART_STATE_SYNC)
- {
- GPIO_PinModeSet(
- port_clk,
- pin_clk,
- gpioModePushPull,
- 0);
- }
- if (config & USART_STATE_AUTOCS)
- {
- GPIO_PinModeSet(
- port_cs,
- pin_cs,
- gpioModePushPull,
- 1);
- }
-
- /* Config interrupt and NVIC */
- if (flag & RT_DEVICE_FLAG_INT_RX)
- {
- hook.type = efm32_irq_type_usart;
- hook.unit = unitNumber * 2 + 1;
+ /* Config interrupt and NVIC */
+ if (flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ hook.type = efm32_irq_type_usart;
+ hook.unit = unitNumber * 2 + 1;
+#if defined(UART_PRESENT)
if (config & USART_STATE_ASYNC_ONLY)
{
hook.unit += USART_COUNT * 2;
}
- hook.cbFunc = rt_hw_usart_rx_isr;
- hook.userPtr = device;
- efm32_irq_hook_register(&hook);
- }
+#endif
+ hook.cbFunc = rt_hw_usart_rx_isr;
+ hook.userPtr = device;
+ efm32_irq_hook_register(&hook);
+ }
- /* Config DMA */
- if (flag & RT_DEVICE_FLAG_DMA_TX)
- {
- DMA_CfgChannel_TypeDef chnlCfg;
- DMA_CfgDescr_TypeDef descrCfg;
+ /* Config DMA */
+ if (flag & RT_DEVICE_FLAG_DMA_TX)
+ {
+ DMA_CfgChannel_TypeDef chnlCfg;
+ DMA_CfgDescr_TypeDef descrCfg;
- hook.type = efm32_irq_type_dma;
- hook.unit = dmaChannel;
- hook.cbFunc = rt_hw_usart_dma_tx_isr;
- hook.userPtr = device;
- efm32_irq_hook_register(&hook);
+ hook.type = efm32_irq_type_dma;
+ hook.unit = dmaChannel;
+ hook.cbFunc = rt_hw_usart_dma_tx_isr;
+ hook.userPtr = device;
+ efm32_irq_hook_register(&hook);
- callback = (DMA_CB_TypeDef *)rt_malloc(sizeof(DMA_CB_TypeDef));
- if (callback == RT_NULL)
- {
- usart_debug("USART%d err: no mem for callback\n", usart->unit);
- break;
- }
- callback->cbFunc = DMA_IRQHandler_All;
- callback->userPtr = RT_NULL;
- callback->primary = 0;
+ callback = (DMA_CB_TypeDef *)rt_malloc(sizeof(DMA_CB_TypeDef));
+ if (callback == RT_NULL)
+ {
+ usart_debug("USART%d err: no mem for callback\n", usart->unit);
+ break;
+ }
+ callback->cbFunc = DMA_IRQHandler_All;
+ callback->userPtr = RT_NULL;
+ callback->primary = 0;
- /* Setting up DMA channel */
- chnlCfg.highPri = false; /* Can't use with peripherals */
- chnlCfg.enableInt = true; /* Interrupt for callback function */
- chnlCfg.select = txDmaSelect;
- chnlCfg.cb = callback;
- DMA_CfgChannel(dmaChannel, &chnlCfg);
+ /* Setting up DMA channel */
+ chnlCfg.highPri = false; /* Can't use with peripherals */
+ chnlCfg.enableInt = true; /* Interrupt for callback function */
+ chnlCfg.select = txDmaSelect;
+ chnlCfg.cb = callback;
+ DMA_CfgChannel(dmaChannel, &chnlCfg);
- /* Setting up DMA channel descriptor */
- descrCfg.dstInc = dmaDataIncNone;
- descrCfg.srcInc = dmaDataInc1;
- descrCfg.size = dmaDataSize1;
- descrCfg.arbRate = dmaArbitrate1;
- descrCfg.hprot = 0;
- DMA_CfgDescr(dmaChannel, true, &descrCfg);
- }
+ /* Setting up DMA channel descriptor */
+ descrCfg.dstInc = dmaDataIncNone;
+ descrCfg.srcInc = dmaDataInc1;
+ descrCfg.size = dmaDataSize1;
+ descrCfg.arbRate = dmaArbitrate1;
+ descrCfg.hprot = 0;
+ DMA_CfgDescr(dmaChannel, true, &descrCfg);
+ }
- /* Init specified USART unit */
- if (config & USART_STATE_SYNC)
- {
- USART_InitSync_TypeDef init_sync = USART_INITSYNC_DEFAULT;
+ /* Init specified USART unit */
+ if (config & USART_STATE_SYNC)
+ {
+ USART_InitSync_TypeDef init_sync = USART_INITSYNC_DEFAULT;
- init_sync.enable = usartEnable;
- init_sync.refFreq = 0;
- init_sync.baudrate = SPI_BAUDRATE;
- init_sync.databits = usartDatabits8;
- if (config & USART_STATE_MASTER)
- {
- init_sync.master = true;
- }
- else
- {
- init_sync.master = false;
- }
- init_sync.msbf = true;
- init_sync.clockMode = usartClockMode0; /* Clock idle low, sample on rising edge. */
- USART_InitSync(usart->usart_device, &init_sync);
- }
- else
- {
- USART_InitAsync_TypeDef init_async = USART_INITASYNC_DEFAULT;
+ init_sync.enable = usartEnable;
+ init_sync.refFreq = 0;
+ init_sync.baudrate = SPI_BAUDRATE;
+ if (config & USART_STATE_9BIT)
+ {
+ init_sync.databits = usartDatabits9;
+ }
+ else
+ {
+ init_sync.databits = usartDatabits8;
+ }
+ if (config & USART_STATE_MASTER)
+ {
+ init_sync.master = true;
+ }
+ else
+ {
+ init_sync.master = false;
+ }
+ init_sync.msbf = true;
- init_async.enable = usartEnable;
- init_async.refFreq = 0;
- init_async.baudrate = UART_BAUDRATE;
- init_async.oversampling = USART_CTRL_OVS_X4;
- init_async.databits = USART_FRAME_DATABITS_EIGHT;
- init_async.parity = USART_FRAME_PARITY_NONE;
- init_async.stopbits = USART_FRAME_STOPBITS_ONE;
- USART_InitAsync(usart->usart_device, &init_async);
- }
+ switch (USART_CLK_MODE_GET(config))
+ {
+ case 0:
+ init_sync.clockMode = usartClockMode0;
+ break;
+ case 1:
+ init_sync.clockMode = usartClockMode1;
+ break;
+ case 2:
+ init_sync.clockMode = usartClockMode2;
+ break;
+ case 3:
+ init_sync.clockMode = usartClockMode3;
+ break;
+ }
+ USART_InitSync(usart->usart_device, &init_sync);
+ }
+ else
+ {
+ USART_InitAsync_TypeDef init_async = USART_INITASYNC_DEFAULT;
- /* Enable RX and TX pins and set location */
- usart->usart_device->ROUTE = USART_ROUTE_RXPEN | USART_ROUTE_TXPEN | \
- (location << _USART_ROUTE_LOCATION_SHIFT);
- if (config & USART_STATE_SYNC)
- {
- usart->usart_device->ROUTE |= USART_ROUTE_CLKPEN;
- }
- if (config & USART_STATE_AUTOCS)
- {
- usart->usart_device->ROUTE |= USART_ROUTE_CSPEN;
- if (config & USART_STATE_MASTER)
- {
- usart->usart_device->CTRL |= USART_CTRL_AUTOCS;
- }
- }
+ init_async.enable = usartEnable;
+ init_async.refFreq = 0;
+ init_async.baudrate = UART_BAUDRATE;
+ init_async.oversampling = USART_CTRL_OVS_X4;
+ init_async.databits = USART_FRAME_DATABITS_EIGHT;
+ init_async.parity = USART_FRAME_PARITY_NONE;
+ init_async.stopbits = USART_FRAME_STOPBITS_ONE;
+ USART_InitAsync(usart->usart_device, &init_async);
+ }
- /* Clear RX/TX buffers */
- usart->usart_device->CMD = USART_CMD_CLEARRX | USART_CMD_CLEARTX;
+ /* Enable RX and TX pins and set location */
+ usart->usart_device->ROUTE = USART_ROUTE_RXPEN | USART_ROUTE_TXPEN | \
+ (location << _USART_ROUTE_LOCATION_SHIFT);
+ if (config & USART_STATE_SYNC)
+ {
+ usart->usart_device->ROUTE |= USART_ROUTE_CLKPEN;
+ }
+ if (config & USART_STATE_AUTOCS)
+ {
+ usart->usart_device->ROUTE |= USART_ROUTE_CSPEN;
+ if (config & USART_STATE_MASTER)
+ {
+ usart->usart_device->CTRL |= USART_CTRL_AUTOCS;
+ }
+ }
- return usart;
- } while(0);
+ /* Clear RX/TX buffers */
+ usart->usart_device->CMD = USART_CMD_CLEARRX | USART_CMD_CLEARTX;
- if (usart->rx_mode)
- {
- rt_free(usart->rx_mode);
- }
- if (usart->tx_mode)
- {
- rt_free(usart->tx_mode);
- }
- if (usart)
- {
- rt_free(usart);
- }
- if (callback)
- {
- rt_free(usart);
- }
+ return usart;
+ } while(0);
+ if (usart->rx_mode)
+ {
+ rt_free(usart->rx_mode);
+ }
+ if (usart->tx_mode)
+ {
+ rt_free(usart->tx_mode);
+ }
+ if (usart)
+ {
+ rt_free(usart);
+ }
+ if (callback)
+ {
+ rt_free(usart);
+ }
+
+#if defined(UART_PRESENT)
if (config & USART_STATE_ASYNC_ONLY)
{
usart_debug("UART%d err: init failed!\n", unitNumber);
}
else
+#endif
{
usart_debug("USART%d err: init failed!\n", unitNumber);
}
- return RT_NULL;
+ return RT_NULL;
}
/***************************************************************************//**
@@ -1260,178 +1415,163 @@ static struct efm32_usart_device_t *rt_hw_usart_unit_init(
******************************************************************************/
void rt_hw_usart_init(void)
{
- struct efm32_usart_device_t *usart;
- rt_uint32_t flag;
- rt_uint8_t config;
+ struct efm32_usart_device_t *usart;
+ rt_uint32_t flag;
+ rt_uint8_t config;
- do
- {
-#ifdef RT_USING_USART0
- config = 0x00;
- flag = RT_DEVICE_FLAG_RDWR;
+ do
+ {
+#if (defined(USART_PRESENT) && defined(RT_USING_USART0))
+ config = 0x00;
+ flag = RT_DEVICE_FLAG_RDWR;
#ifdef RT_USART0_SYNC_MODE
- config |= USART_STATE_SYNC;
- #if (RT_USART0_SYNC_MODE != 0x0UL)
- config |= USART_STATE_MASTER;
- #else
- flag |= RT_DEVICE_FLAG_INT_RX;
+ config |= USART_STATE_SYNC;
+ config |= (RT_USART0_SYNC_MODE & SYNC_SETTING_MASK) << SYNC_SETTING_SHIFT;
+ #if (!(RT_USART0_SYNC_MODE & EFM32_SPI_MASTER))
+ flag |= RT_DEVICE_FLAG_INT_RX;
#endif
#else
- flag |= RT_DEVICE_FLAG_INT_RX;
- #endif
-
- #if (SPI_AUTOCS_ENABLE & (1 << 0))
- config |= USART_STATE_AUTOCS;
+ flag |= RT_DEVICE_FLAG_INT_RX;
#endif
#if (RT_CONSOLE_DEVICE == EFM_USART0)
- config |= USART_STATE_CONSOLE;
- flag |= RT_DEVICE_FLAG_STREAM;
+ config |= USART_STATE_CONSOLE;
+ flag |= RT_DEVICE_FLAG_STREAM;
#endif
#ifdef RT_USART0_USING_DMA
- RT_ASSERT(RT_USART0_USING_DMA < DMA_CHAN_COUNT);
- flag |= RT_DEVICE_FLAG_DMA_TX;
+ RT_ASSERT(RT_USART0_USING_DMA < DMA_CHAN_COUNT);
+ flag |= RT_DEVICE_FLAG_DMA_TX;
#else
- #define RT_USART0_USING_DMA EFM32_NO_DMA
+ #define RT_USART0_USING_DMA EFM32_NO_DMA
#endif
- /* Initialize and Register usart0 */
- if ((usart = rt_hw_usart_unit_init(
- &usart0_device,
- 0,
- RT_USING_USART0,
- flag,
- RT_USART0_USING_DMA,
- config)) != RT_NULL)
- {
- rt_hw_usart_register(&usart0_device, RT_USART0_NAME, flag, usart);
- }
- else
- {
- break;
- }
- /* Initialize lock for usart0 */
- usart->lock = &usart0_lock;
- if (rt_sem_init(usart->lock, RT_USART0_NAME, 1, RT_IPC_FLAG_FIFO) != RT_EOK)
- {
- break;
- }
+ /* Initialize and Register usart0 */
+ if ((usart = rt_hw_usart_unit_init(
+ &usart0_device,
+ 0,
+ RT_USING_USART0,
+ flag,
+ RT_USART0_USING_DMA,
+ config)) != RT_NULL)
+ {
+ rt_hw_usart_register(&usart0_device, RT_USART0_NAME, flag, usart);
+ }
+ else
+ {
+ break;
+ }
+ /* Initialize lock for usart0 */
+ usart->lock = &usart0_lock;
+ if (rt_sem_init(usart->lock, RT_USART0_NAME, 1, RT_IPC_FLAG_FIFO) != RT_EOK)
+ {
+ break;
+ }
#endif
-#ifdef RT_USING_USART1
- config = 0x00;
- flag = RT_DEVICE_FLAG_RDWR;
+#if (defined(USART_PRESENT) && (USART_COUNT > 1) && defined(RT_USING_USART1))
+ config = 0x00;
+ flag = RT_DEVICE_FLAG_RDWR;
#ifdef RT_USART1_SYNC_MODE
- config |= USART_STATE_SYNC;
- #if (RT_USART1_SYNC_MODE != 0x0UL)
- config |= USART_STATE_MASTER;
- #else
- flag |= RT_DEVICE_FLAG_INT_RX;
+ config |= USART_STATE_SYNC;
+ config |= (RT_USART1_SYNC_MODE & SYNC_SETTING_MASK) << SYNC_SETTING_SHIFT;
+ #if (!(RT_USART1_SYNC_MODE & EFM32_SPI_MASTER))
+ flag |= RT_DEVICE_FLAG_INT_RX;
#endif
#else
- flag |= RT_DEVICE_FLAG_INT_RX;
- #endif
-
- #if (SPI_AUTOCS_ENABLE & (1 << 1))
- config |= USART_STATE_AUTOCS;
+ flag |= RT_DEVICE_FLAG_INT_RX;
#endif
#if (RT_CONSOLE_DEVICE == EFM_USART1)
- config |= USART_STATE_CONSOLE;
- flag |= RT_DEVICE_FLAG_STREAM;
+ config |= USART_STATE_CONSOLE;
+ flag |= RT_DEVICE_FLAG_STREAM;
#endif
#ifdef RT_USART1_USING_DMA
- RT_ASSERT(RT_USART1_USING_DMA < DMA_CHAN_COUNT);
- flag |= RT_DEVICE_FLAG_DMA_TX;
+ RT_ASSERT(RT_USART1_USING_DMA < DMA_CHAN_COUNT);
+ flag |= RT_DEVICE_FLAG_DMA_TX;
#else
- #define RT_USART1_USING_DMA EFM32_NO_DMA
+ #define RT_USART1_USING_DMA EFM32_NO_DMA
#endif
- /* Initialize and Register usart1 */
- if ((usart = rt_hw_usart_unit_init(
- &usart1_device,
- 1,
- RT_USING_USART1,
- flag,
- RT_USART1_USING_DMA,
- config)) != RT_NULL)
- {
- rt_hw_usart_register(&usart1_device, RT_USART1_NAME, flag, usart);
- }
- else
- {
- break;
- }
- /* Initialize lock for usart1 */
- usart->lock = &usart1_lock;
- if (rt_sem_init(usart->lock, RT_USART1_NAME, 1, RT_IPC_FLAG_FIFO) != RT_EOK)
- {
- break;
- }
+ /* Initialize and Register usart1 */
+ if ((usart = rt_hw_usart_unit_init(
+ &usart1_device,
+ 1,
+ RT_USING_USART1,
+ flag,
+ RT_USART1_USING_DMA,
+ config)) != RT_NULL)
+ {
+ rt_hw_usart_register(&usart1_device, RT_USART1_NAME, flag, usart);
+ }
+ else
+ {
+ break;
+ }
+ /* Initialize lock for usart1 */
+ usart->lock = &usart1_lock;
+ if (rt_sem_init(usart->lock, RT_USART1_NAME, 1, RT_IPC_FLAG_FIFO) != RT_EOK)
+ {
+ break;
+ }
#endif
-#ifdef RT_USING_USART2
- config = 0x00;
- flag = RT_DEVICE_FLAG_RDWR;
+#if (defined(USART_PRESENT) && (USART_COUNT > 2) && defined(RT_USING_USART2))
+ config = 0x00;
+ flag = RT_DEVICE_FLAG_RDWR;
#ifdef RT_USART2_SYNC_MODE
- config |= USART_STATE_SYNC;
- #if (RT_USART2_SYNC_MODE != 0x0UL)
- config |= USART_STATE_MASTER;
- #else
- flag |= RT_DEVICE_FLAG_INT_RX;
+ config |= USART_STATE_SYNC;
+ config |= (RT_USART1_SYNC_MODE & SYNC_SETTING_MASK) << SYNC_SETTING_SHIFT;
+ #if (!(RT_USART2_SYNC_MODE & EFM32_SPI_MASTER))
+ flag |= RT_DEVICE_FLAG_INT_RX;
#endif
#else
- flag |= RT_DEVICE_FLAG_INT_RX;
+ flag |= RT_DEVICE_FLAG_INT_RX;
#endif
-#if (SPI_AUTOCS_ENABLE & (1 << 2))
- config |= USART_STATE_AUTOCS;
-#endif
-
#if (RT_CONSOLE_DEVICE == EFM_USART2)
- config |= USART_STATE_CONSOLE;
- flag |= RT_DEVICE_FLAG_STREAM;
+ config |= USART_STATE_CONSOLE;
+ flag |= RT_DEVICE_FLAG_STREAM;
#endif
#ifdef RT_USART2_USING_DMA
- RT_ASSERT(RT_USART2_USING_DMA < DMA_CHAN_COUNT);
- flag |= RT_DEVICE_FLAG_DMA_TX;
+ RT_ASSERT(RT_USART2_USING_DMA < DMA_CHAN_COUNT);
+ flag |= RT_DEVICE_FLAG_DMA_TX;
#else
- #define RT_USART2_USING_DMA EFM32_NO_DMA
+ #define RT_USART2_USING_DMA EFM32_NO_DMA
#endif
- /* Initialize and Register usart2 */
- if ((usart = rt_hw_usart_unit_init(
- &usart2_device,
- 2,
- RT_USING_USART2,
- flag,
- RT_USART2_USING_DMA,
- config)) != RT_NULL)
- {
- rt_hw_usart_register(&usart2_device, RT_USART2_NAME, flag, usart);
- }
- else
- {
- break;
- }
- /* Initialize lock for usart2 */
- usart->lock = &usart2_lock;
- if (rt_sem_init(usart->lock, RT_USART2_NAME, 1, RT_IPC_FLAG_FIFO) != RT_EOK)
- {
- break;
- }
+ /* Initialize and Register usart2 */
+ if ((usart = rt_hw_usart_unit_init(
+ &usart2_device,
+ 2,
+ RT_USING_USART2,
+ flag,
+ RT_USART2_USING_DMA,
+ config)) != RT_NULL)
+ {
+ rt_hw_usart_register(&usart2_device, RT_USART2_NAME, flag, usart);
+ }
+ else
+ {
+ break;
+ }
+ /* Initialize lock for usart2 */
+ usart->lock = &usart2_lock;
+ if (rt_sem_init(usart->lock, RT_USART2_NAME, 1, RT_IPC_FLAG_FIFO) != RT_EOK)
+ {
+ break;
+ }
#endif
-#ifdef RT_USING_UART0
+#if (defined(UART_PRESENT) && defined(RT_USING_UART0))
config = USART_STATE_ASYNC_ONLY;
flag = RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX;
@@ -1470,7 +1610,7 @@ void rt_hw_usart_init(void)
}
#endif
-#ifdef RT_USING_UART1
+#if (defined(UART_PRESENT) && (UART_COUNT > 1) && defined(RT_USING_UART1))
config = USART_STATE_ASYNC_ONLY;
flag = RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX;
@@ -1509,11 +1649,11 @@ void rt_hw_usart_init(void)
}
#endif
- usart_debug("USART: H/W init OK!\n");
- return;
- } while (0);
+ usart_debug("USART: H/W init OK!\n");
+ return;
+ } while (0);
- rt_kprintf("USART: H/W init failed!\n");
+ rt_kprintf("USART: H/W init failed!\n");
}
#endif /* (defined(RT_USING_USART0) || defined(RT_USING_USART1) || \
diff --git a/bsp/efm32/drv_usart.h b/bsp/efm32/drv_usart.h
index 5ad28b7b5e..7419686704 100644
--- a/bsp/efm32/drv_usart.h
+++ b/bsp/efm32/drv_usart.h
@@ -1,8 +1,8 @@
/***************************************************************************//**
- * @file drv_usart.h
- * @brief USART driver of RT-Thread RTOS for EFM32
- * COPYRIGHT (C) 2011, RT-Thread Development Team
- * @author onelife
+ * @file drv_usart.h
+ * @brief USART driver of RT-Thread RTOS for EFM32
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author onelife
* @version 0.4 beta
*******************************************************************************
* @section License
@@ -10,13 +10,14 @@
* LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
*******************************************************************************
* @section Change Logs
- * Date Author Notes
- * 2010-12-22 onelife Initial creation for EFM32
- * 2011-06-27 onelife Fix a bug when using compiler optimization
- * 2011-07-26 onelife Add lock (semaphore) to prevent simultaneously
+ * Date Author Notes
+ * 2010-12-22 onelife Initial creation for EFM32
+ * 2011-06-27 onelife Fix a bug when using compiler optimization
+ * 2011-07-26 onelife Add lock (semaphore) to prevent simultaneously
* access
- * 2011-12-09 onelife Add giant gecko support
+ * 2011-12-09 onelife Add giant gecko support
* 2011-12-09 onelife Add UART module support
+ * 2011-12-20 onelife Change USART status format
******************************************************************************/
#ifndef __DRV_USART_H__
#define __DRV_USART_H__
@@ -25,51 +26,57 @@
/* Exported types ------------------------------------------------------------*/
struct efm32_usart_int_mode_t
{
- rt_uint8_t *data_ptr;
- rt_uint8_t data_size;
- rt_uint32_t read_index, save_index;
+ rt_uint8_t *data_ptr;
+ rt_uint8_t data_size;
+ rt_uint32_t read_index, save_index;
};
struct efm32_usart_dma_mode_t
{
- /* DMA Channel */
- rt_uint32_t dma_channel;
+ /* DMA Channel */
+ rt_uint32_t dma_channel;
- /* buffer info */
- rt_uint32_t *data_ptr;
- rt_uint8_t data_size;
+ /* buffer info */
+ rt_uint32_t *data_ptr;
+ rt_uint8_t data_size;
};
struct efm32_usart_device_t
{
- /* Counter */
- rt_uint32_t counter;
- /* Lock */
- struct rt_semaphore *lock;
- /* Unit number */
- rt_uint8_t unit;
- /* State */
- volatile rt_uint8_t state;
- /* Pointer to USART device structure */
- USART_TypeDef *usart_device;
- /* Pointer to RX structure */
- void *rx_mode;
- /* Pointer to TX structure */
- void *tx_mode;
+ /* Counter */
+ rt_uint32_t counter;
+ /* Lock */
+ struct rt_semaphore *lock;
+ /* Unit number */
+ rt_uint8_t unit;
+ /* State */
+ volatile rt_uint8_t state;
+ /* Pointer to USART device structure */
+ USART_TypeDef *usart_device;
+ /* Pointer to RX structure */
+ void *rx_mode;
+ /* Pointer to TX structure */
+ void *tx_mode;
};
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
-#define USART_WAIT_TIME_TX (RT_TICK_PER_SECOND / 100 * 3)
+#define USART_WAIT_TIME_TX (RT_TICK_PER_SECOND / 100 * 3)
-#define USART_STATE_CONSOLE (1 << 0)
-#define USART_STATE_ASYNC_ONLY (1 << 1)
-#define USART_STATE_SYNC (1 << 2)
-#define USART_STATE_MASTER (1 << 3)
-#define USART_STATE_AUTOCS (1 << 4)
-#define USART_STATE_TX_BUSY (1 << 5)
-#define USART_STATE_RX_BUSY (1 << 6)
+#define USART_STATE_CONSOLE (1 << 0)
+#define USART_STATE_TX_BUSY (1 << 1)
+#define USART_STATE_RX_BUSY (1 << 2)
+#if defined(UART_PRESENT)
+#define USART_STATE_ASYNC_ONLY (1 << 3)
+#endif
+#define USART_STATE_SYNC (1 << 4)
+#define USART_STATE_MASTER (1 << 5)
+#define USART_STATE_AUTOCS (1 << 6)
+#define USART_STATE_9BIT (1 << 7)
+#define USART_CLK_MODE_GET(state) ((state >> 8) & 0x03)
+#define SYNC_SETTING_MASK (0x1F)
+#define SYNC_SETTING_SHIFT (5)
/* Exported functions ------------------------------------------------------- */
void rt_hw_usart_init(void);
diff --git a/bsp/efm32/graphics/SConscript b/bsp/efm32/graphics/SConscript
new file mode 100644
index 0000000000..aa6db6c732
--- /dev/null
+++ b/bsp/efm32/graphics/SConscript
@@ -0,0 +1,14 @@
+import rtconfig
+from building import *
+
+if rtconfig.EFM32_LCD == 'Mapped':
+ src = Split("""
+ dmd/ssd2119/dmd_ssd2119_16bit.c
+ dmd/ssd2119/dmdif_ssd2119_ebi16.c
+ """)
+ CPPPATH = [GetCurrentDir()]
+ CPPPATH.append(GetCurrentDir() + '/dmd/ssd2119')
+ group = DefineGroup('EFM32GG_DK3750_LCD', src, depend = [''], CPPPATH = CPPPATH)
+ Return('group')
+else:
+ Return('')
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119.h b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119.h
new file mode 100644
index 0000000000..a8a96af204
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119.h
@@ -0,0 +1,155 @@
+/**
+ * @section LICENSE
+ ******************************************************************************
+ * (C) Copyright 2009 Energy Micro AS, www.energymicro.com
+ ******************************************************************************
+ *
+ * This source code is the property of Energy Micro AS. The source/compiled
+ * code may not be used, redistributed or modified without a written consent
+ * from Energy Micro AS.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ * @file dmd_ssd2119.h
+ * @brief Dot matrix display driver for LCD controller SSD2119
+ * @author Energy Micro AS
+ ******************************************************************************
+ */
+
+#ifndef __DMD_SSD2119_H
+#define __DMD_SSD2119_H
+
+#include
+#include "graphics/em_types.h"
+/* TODO: remove this and replace with include types and ecodes */
+#define ECODE_DMD_BASE 0x00000000
+
+
+/* Error codes */
+/** Successful call */
+#define DMD_OK 0x00000000
+/** Driver not initialized correctly */
+#define DMD_ERROR_DRIVER_NOT_INITIALIZED (ECODE_DMD_BASE | 0x0001)
+/** Driver is already initialized */
+#define DMD_ERROR_DRIVER_ALREADY_INITIALIZED (ECODE_DMD_BASE | 0x0002)
+/** Length of data is larger than size of clip */
+#define DMD_ERROR_TOO_MUCH_DATA (ECODE_DMD_BASE | 0x0003)
+/** Pixel is outside current clipping area */
+#define DMD_ERROR_PIXEL_OUT_OF_BOUNDS (ECODE_DMD_BASE | 0x0004)
+/** Clipping area is empty */
+#define DMD_ERROR_EMPTY_CLIPPING_AREA (ECODE_DMD_BASE | 0x0005)
+/** Wrong device code */
+#define DMD_ERROR_WRONG_DEVICE_CODE (ECODE_DMD_BASE | 0x0006)
+/** Memory error */
+#define DMD_ERROR_MEMORY_ERROR (ECODE_DMD_BASE | 0x0007)
+/** Error code expected, but didn't happen */
+#define DMD_ERROR_NO_ERROR_CODE (ECODE_DMD_BASE | 0x0008)
+/** Test run failed */
+#define DMD_ERROR_TEST_FAILED (ECODE_DMD_BASE | 0x0009)
+
+
+/** Frame update frequency of display */
+#define DMD_FRAME_FREQUENCY 80
+/** Horizontal size of the display */
+#define DMD_HORIZONTAL_SIZE 320
+/** Vertical size of the display */
+#define DMD_VERTICAL_SIZE 240
+
+/* Tests */
+/** Device code test */
+#define DMD_TEST_DEVICE_CODE 0x00000001
+/** Memory test */
+#define DMD_TEST_MEMORY 0x00000002
+/** Parameter checks test */
+#define DMD_TEST_PARAMETER_CHECKS 0x00000004
+/** Color test */
+#define DMD_TEST_COLORS 0x00000008
+/** Clipping test */
+#define DMD_TEST_CLIPPING 0x00000010
+
+#define DMD_MEMORY_TEST_WIDTH 4
+#define DMD_MEMORY_TEST_HEIGHT 3
+
+/** @struct __DMD_DisplayGeometry
+ * @brief Dimensions of the display
+ */
+typedef struct __DMD_DisplayGeometry
+{
+ /** Horizontal size of the display, in pixels */
+ uint16_t xSize;
+ /** Vertical size of the display, in pixels */
+ uint16_t ySize;
+ /** X coordinate of the top left corner of the clipping area */
+ uint16_t xClipStart;
+ /** Y coordinate of the top left corner of the clipping area */
+ uint16_t yClipStart;
+ /** Width of the clipping area */
+ uint16_t clipWidth;
+ /** Height of the clipping area */
+ uint16_t clipHeight;
+} DMD_DisplayGeometry; /**< Typedef for display dimensions */
+
+/** @struct __DMD_MemoryError
+ * @brief Information about a memory error
+ */
+typedef struct __DMD_MemoryError
+{
+ /** X coordinate of the address where the error happened */
+ uint16_t x;
+ /** Y coordinate of the address where the error happened */
+ uint16_t y;
+ /** The color that was written to the memory address */
+ uint8_t writtenColor[3];
+ /** The color that was read from the memory address */
+ uint8_t readColor[3];
+} DMD_MemoryError; /**< Typedef for memory error information */
+
+/* Module prototypes */
+EMSTATUS DMD_init(uint32_t cmdRegAddr, uint32_t dataRegAddr);
+EMSTATUS DMD_getDisplayGeometry(DMD_DisplayGeometry **geometry);
+EMSTATUS DMD_setClippingArea(uint16_t xStart, uint16_t yStart,
+ uint16_t width, uint16_t height);
+EMSTATUS DMD_writeData(uint16_t x, uint16_t y,
+ const uint8_t data[], uint32_t numPixels);
+EMSTATUS DMD_writeDataRLE(uint16_t x, uint16_t y, uint16_t xlen, uint16_t ylen,
+ const uint8_t *data);
+EMSTATUS DMD_writeDataRLEFade(uint16_t x, uint16_t y, uint16_t xlen, uint16_t ylen,
+ const uint8_t *data,
+ int red, int green, int blue, int weight);
+EMSTATUS DMD_readData(uint16_t x, uint16_t y,
+ uint8_t data[], uint32_t numPixels);
+EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red,
+ uint8_t green, uint8_t blue, uint32_t numPixels);
+EMSTATUS DMD_writePixel(uint16_t x, uint16_t y, uint16_t color,
+ uint32_t numPixels);
+EMSTATUS DMD_readPixel(uint16_t x, uint16_t y, uint16_t *color);
+EMSTATUS DMD_sleep(void);
+EMSTATUS DMD_wakeUp(void);
+
+/* Test functions */
+EMSTATUS DMD_testParameterChecks(void);
+EMSTATUS DMD_testMemory(uint16_t x, uint16_t y,
+ uint32_t useClipWrite, uint32_t useClipRead,
+ DMD_MemoryError *memoryError);
+EMSTATUS DMD_testMemory2(uint16_t x, uint16_t y,
+ uint32_t useClipWrite);
+EMSTATUS DMD_testDeviceCode(void);
+EMSTATUS DMD_testColors(uint32_t delay);
+EMSTATUS DMD_testClipping(void);
+EMSTATUS DMD_runTests(uint32_t tests, uint32_t *result);
+
+EMSTATUS DMD_flipDisplay(int horizontal, int vertical);
+
+#endif
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_16bit.c b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_16bit.c
new file mode 100644
index 0000000000..897a7fe1ec
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_16bit.c
@@ -0,0 +1,941 @@
+/**
+ * @section LICENSE
+ ******************************************************************************
+ * (C) Copyright 2009 Energy Micro AS, www.energymicro.com
+ ******************************************************************************
+ *
+ * This source code is the property of Energy Micro AS. The source/compiled
+ * code may not be used, redistributed or modified without a written consent
+ * from Energy Micro AS.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ * @file dmd_ssd2119.c
+ * @brief Dot matrix display driver for LCD controller SSD2119
+ * @author Energy Micro AS
+ ******************************************************************************
+ */
+
+#include
+#include
+#include
+#include "dmd_ssd2119.h"
+#include "dmd_ssd2119_registers.h"
+#include "dmdif_ssd2119_ebi.h"
+
+/** Dimensions of the display */
+DMD_DisplayGeometry dimensions;
+
+/* Local variables */
+static uint32_t initialized = 0;
+static uint16_t rcDriverOutputControl;
+
+/* Local function prototypes */
+static uint32_t colorTransform24To16bpp( uint8_t red, uint8_t green, uint8_t blue);
+static void colorTransform16To24bpp(uint32_t color,
+ uint8_t *red, uint8_t *green, uint8_t *blue);
+/**************************************************************************//**
+* @brief
+* Initializes the LCD display
+*
+* @param cmdRegAddr
+* The address in memory where data to the command register in the display
+* controller are written
+* @param dataRegAddr
+* The address in memory where data to the data register in the display
+* controller are written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_init(uint32_t cmdRegAddr, uint32_t dataRegAddr){
+
+ EMSTATUS stat;
+ uint16_t data;
+
+ /* Initialize register cache variables */
+ rcDriverOutputControl = 0;
+
+ /* Initialize DMD interface */
+ if ((stat = DMDIF_init(cmdRegAddr, dataRegAddr)) != DMD_OK)
+ {
+ return stat;
+ }
+
+ /* Initialization sequence, see UMSH-8252MD-T page 13 */
+
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_VCOM_OTP_1, 0x0006); */
+ DMDIF_writeReg(DMD_SSD2119_VCOM_OTP_1, 0x0006);
+
+ /* Start oscillation */
+ data = DMD_SSD2119_OSCILLATION_START_OSCEN;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_OSCILLATION_START, data); */
+ DMDIF_writeReg(DMD_SSD2119_OSCILLATION_START, data);
+
+ /* Exit sleep mode */
+ data = 0;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_SLEEP_MODE_1, data); */
+ DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data);
+
+ /* Display control */
+ data = DMD_SSD2119_DISPLAY_CONTROL_DTE;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_GON;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D1;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D0;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_DISPLAY_CONTROL, data); */
+ DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, data);
+
+ /* Entry mode */
+ data = DMD_SSD2119_ENTRY_MODE_DFM_65K << DMD_SSD2119_ENTRY_MODE_DFM_SHIFT;
+ data |= DMD_SSD2119_ENTRY_MODE_DENMODE;
+ data |= DMD_SSD2119_ENTRY_MODE_WMODE;
+ data |= DMD_SSD2119_ENTRY_MODE_NOSYNC;
+ data |= DMD_SSD2119_ENTRY_MODE_TY_TYPE_B << DMD_SSD2119_ENTRY_MODE_TY_SHIFT;
+ data |= DMD_SSD2119_ENTRY_MODE_ID1;
+ data |= DMD_SSD2119_ENTRY_MODE_ID0;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_ENTRY_MODE, data); */
+ DMDIF_writeReg(DMD_SSD2119_ENTRY_MODE, data);
+
+ /* LCD AC control */
+ data = DMD_SSD2119_LCD_AC_CONTROL_BC;
+ data |= DMD_SSD2119_LCD_AC_CONTROL_EOR;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_LCD_AC_CONTROL, data); */
+ DMDIF_writeReg(DMD_SSD2119_LCD_AC_CONTROL, data);
+
+ /* Power control */
+ data = 0x06 << DMD_SSD2119_POWER_CONTROL_1_DCT_SHIFT;
+ data |= 0x05 << DMD_SSD2119_POWER_CONTROL_1_BT_SHIFT;
+ data |= 0x03 << DMD_SSD2119_POWER_CONTROL_1_DC_SHIFT;
+ data |= 0x04 << DMD_SSD2119_POWER_CONTROL_1_AP_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_POWER_CONTROL_1, data); */
+ DMDIF_writeReg(DMD_SSD2119_POWER_CONTROL_1, data);
+
+ /* Driver output control */
+ data = DMD_SSD2119_DRIVER_OUTPUT_CONTROL_RL;
+ data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_REV;
+ data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_GD;
+ data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_TB;
+ data |= (DMD_VERTICAL_SIZE - 1) << DMD_SSD2119_DRIVER_OUTPUT_CONTROL_MUX_SHIFT;
+ rcDriverOutputControl = data;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_DRIVER_OUTPUT_CONTROL, data); */
+ DMDIF_writeReg(DMD_SSD2119_DRIVER_OUTPUT_CONTROL, data);
+
+ /* Power Control */
+ data = 0x05 << DMD_SSD2119_POWER_CONTROL_2_VRC_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_POWER_CONTROL_2, data); */
+ DMDIF_writeReg(DMD_SSD2119_POWER_CONTROL_2, data);
+
+ data = 0x0D << DMD_SSD2119_POWER_CONTROL_3_VRH_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_POWER_CONTROL_3, data); */
+ DMDIF_writeReg(DMD_SSD2119_POWER_CONTROL_3, data);
+
+ data = DMD_SSD2119_POWER_CONTROL_4_VCOMG;
+ data |= 0x0D << DMD_SSD2119_POWER_CONTROL_4_VDV_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_POWER_CONTROL_4, data); */
+ DMDIF_writeReg(DMD_SSD2119_POWER_CONTROL_4, data);
+
+ data = DMD_SSD2119_POWER_CONTROL_5_NOTP;
+ data |= 0x3E << DMD_SSD2119_POWER_CONTROL_5_VCM_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_POWER_CONTROL_5, data); */
+ DMDIF_writeReg(DMD_SSD2119_POWER_CONTROL_5, data);
+
+ data = 0x0058;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GENERIC_INTERFACE_CONTROL, data); */
+ DMDIF_writeReg(DMD_SSD2119_GENERIC_INTERFACE_CONTROL, data);
+
+ /* Gamma settings */
+ data = 0x00 << DMD_SSD2119_GAMMA_1_PKP1_SHIFT;
+ data |= 0x00 << DMD_SSD2119_GAMMA_1_PKP0_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_1, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_1, data);
+
+ data = 0x01 << DMD_SSD2119_GAMMA_2_PKP3_SHIFT;
+ data |= 0x01 << DMD_SSD2119_GAMMA_2_PKP2_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_2, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_2, data);
+
+ data = 0x01 << DMD_SSD2119_GAMMA_3_PKP5_SHIFT;
+ data |= 0x00 << DMD_SSD2119_GAMMA_3_PKP4_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_3, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_3, data);
+
+ data = 0x03 << DMD_SSD2119_GAMMA_4_PRP1_SHIFT;
+ data |= 0x05 << DMD_SSD2119_GAMMA_4_PRP0_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_4, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_4, data);
+
+ data = 0x07 << DMD_SSD2119_GAMMA_5_PKN1_SHIFT;
+ data |= 0x07 << DMD_SSD2119_GAMMA_5_PKN0_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_5, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_5, data);
+
+ data = 0x03 << DMD_SSD2119_GAMMA_6_PKN3_SHIFT;
+ data |= 0x05 << DMD_SSD2119_GAMMA_6_PKN2_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_6, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_6, data);
+
+ data = 0x07 << DMD_SSD2119_GAMMA_7_PKN5_SHIFT;
+ data |= 0x07 << DMD_SSD2119_GAMMA_7_PKN4_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_7, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_7, data);
+
+ data = 0x02 << DMD_SSD2119_GAMMA_8_PRN1_SHIFT;
+ data |= 0x01 << DMD_SSD2119_GAMMA_8_PRN0_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_8, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_8, data);
+
+ data = 0x12 << DMD_SSD2119_GAMMA_9_VRP1_SHIFT;
+ data |= 0x00 << DMD_SSD2119_GAMMA_9_VRP0_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_9, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_9, data);
+
+ data = 0x09 << DMD_SSD2119_GAMMA_10_VRN1_SHIFT;
+ data |= 0x00 << DMD_SSD2119_GAMMA_10_VRN0_SHIFT;
+ /* printf("R%x: 0x%x\n", DMD_SSD2119_GAMMA_10, data); */
+ DMDIF_writeReg(DMD_SSD2119_GAMMA_10, data);
+
+ /* Set up dimensions of the display */
+ dimensions.xSize = DMD_HORIZONTAL_SIZE;
+ dimensions.ySize = DMD_VERTICAL_SIZE;
+
+ /* At initialization, the clip is the entire display */
+ dimensions.xClipStart = 0;
+ dimensions.yClipStart = 0;
+ dimensions.clipWidth = dimensions.xSize;
+ dimensions.clipHeight = dimensions.ySize;
+
+ initialized = 1;
+
+ /* Fill the entire display with black color */
+ DMD_writeColor(0, 0, 0x00, 0x00, 0x00, dimensions.xSize * dimensions.ySize);
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* \brief
+* Get the dimensions of the display and of the current clipping area
+*
+* \return
+* DMD_Dimensions structure containing the size of the display and the
+* clipping area
+******************************************************************************/
+EMSTATUS DMD_getDisplayGeometry(DMD_DisplayGeometry **geometry)
+{
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+ *geometry = &dimensions;
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Sets the clipping area. All coordinates given to writeData/writeColor/readData
+* are relative to this clipping area.
+*
+* @param xStart
+* X coordinate of the upper left corner of the clipping area
+* @param yStart
+* Y coordinate of the upper left corner of the clipping area
+* @param width
+* Width of the clipping area
+* @param height
+* Height of the clipping area
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_setClippingArea(uint16_t xStart, uint16_t yStart,
+ uint16_t width, uint16_t height)
+{
+ uint16_t verticalPos;
+ uint16_t xEnd;
+ uint16_t yEnd;
+
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Check parameters */
+ if (xStart + width > dimensions.xSize ||
+ yStart + height > dimensions.ySize)
+ {
+ return DMD_ERROR_PIXEL_OUT_OF_BOUNDS;
+ }
+
+ if (width == 0 || height == 0)
+ {
+ return DMD_ERROR_EMPTY_CLIPPING_AREA;
+ }
+
+ xEnd = xStart + width - 1;
+ yEnd = yStart + height - 1;
+
+ /* Set the clipping region in the display */
+ DMDIF_writeReg(DMD_SSD2119_HORIZONTAL_RAM_ADDRESS_START_POS, xStart);
+ DMDIF_writeReg(DMD_SSD2119_HORIZONTAL_RAM_ADDRESS_END_POS, xEnd);
+
+ verticalPos = yEnd << DMD_SSD2119_VERTICAL_RAM_ADDRESS_POS_END_SHIFT;
+ verticalPos |= yStart << DMD_SSD2119_VERTICAL_RAM_ADDRESS_POS_START_SHIFT;
+ DMDIF_writeReg(DMD_SSD2119_VERTICAL_RAM_ADDRESS_POS, verticalPos);
+
+ /* Update the dimensions structure */
+ dimensions.xClipStart = xStart;
+ dimensions.yClipStart = yStart;
+ dimensions.clipWidth = width;
+ dimensions.clipHeight = height;
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Set the x and y coordinate of the next pixel to draw
+*
+* @param x
+* X address of the pixel, relative to the current clipping area
+* @param y
+* Y address of the pixel, relative to the current clipping area
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS setPixelAddress(uint16_t x, uint16_t y)
+{
+ /* Check parameters */
+ if (x > dimensions.clipWidth || y > dimensions.clipHeight)
+ {
+ return DMD_ERROR_PIXEL_OUT_OF_BOUNDS;
+ }
+
+ /* Set pixel position */
+ DMDIF_writeReg(DMD_SSD2119_SET_X_ADDRESS_COUNTER,
+ x + dimensions.xClipStart);
+ DMDIF_writeReg(DMD_SSD2119_SET_Y_ADDRESS_COUNTER,
+ y + dimensions.yClipStart);
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Draws pixels to the display
+*
+* @param x
+* X coordinate of the first pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be written, relative to the clipping area
+* @param data
+* Array containing the pixel data. Each 8-bit element in the array are one color
+* component of the pixel, so that 3 bytes represent one pixel. The pixels are
+* ordered by increasing x coordinate, after the last pixel of a row, the next
+* pixel will be the first pixel on the next row.
+* @param numPixels
+* Number of pixels to be written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_writeData(uint16_t x, uint16_t y, const uint8_t data[],
+ uint32_t numPixels)
+{
+ uint32_t statusCode;
+ uint32_t clipRemaining;
+ uint32_t color;
+ uint32_t i;
+
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Set the address of the first pixel */
+ statusCode = setPixelAddress(x, y);
+ if (statusCode != DMD_OK)
+ {
+ return statusCode;
+ }
+
+ /* Number of pixels from the first pixel (given by x and y) to the end
+ * of the clipping area */
+ clipRemaining = (dimensions.clipHeight - y - 1) * dimensions.clipWidth +
+ dimensions.clipWidth - x;
+
+ /* Check that the length of data isn't longer than the number of pixels
+ * in the rest of the clipping area */
+ if (numPixels > clipRemaining)
+ {
+ return DMD_ERROR_TOO_MUCH_DATA;
+ }
+
+ /* Write data */
+ DMDIF_prepareDataAccess( );
+ for (i = 0; i < numPixels; i++)
+ {
+ color = colorTransform24To16bpp(data[3 * i], data[3 * i + 1],
+ data[3 * i + 2]);
+ DMDIF_writeData(color);
+ }
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Draws pixels to the display at location x,y, from a source data array in
+* GIMP RLE compressed C-format, mixing with another RGB color to create a
+* "blended" look or for fading images in and out
+* @param x
+* X coordinate of the first pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be written, relative to the clipping area
+* @param data
+* Array containing the pixel data in GIMP RLE compressed format
+* @param numPixels
+* Number of pixels to be written
+* @param red
+* Red component of color to mix with orignal
+* @param green
+* Red component of color to mix with orignal
+* @param blue
+* Red component of color to mix with orignal
+* @param weight
+* Ratio to which red/green/blue component and original color should be combined
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_writeDataRLEFade(uint16_t x, uint16_t y, uint16_t xlen, uint16_t ylen,
+ const uint8_t *data,
+ int red, int green, int blue, int weight)
+{
+ uint32_t color = 0;
+ int xpos, ypos;
+ const uint8_t *ptr;
+ int r,g,b;
+ uint8_t readRGB = 0;
+ uint8_t copyColor = 0;
+
+
+ ptr = data;
+ for (ypos = y; ypos < (ylen+y); ypos++){
+
+ setPixelAddress(x, ypos);
+ DMDIF_prepareDataAccess( );
+
+ for (xpos = x; xpos < (xlen+x); xpos++){
+
+ if ( readRGB ) {
+ readRGB--;
+ r = *ptr++;
+ g = *ptr++;
+ b = *ptr++;
+ r = ((r * weight/100) + (red * (100-weight)/100));
+ g = ((g * weight/100) + (green * (100-weight)/100));
+ b = ((b * weight/100) + (blue * (100-weight)/100));
+ color = colorTransform24To16bpp(r,g,b);
+ DMDIF_writeData(color);
+ continue;
+ }
+ if ( copyColor ) {
+ copyColor--;
+ DMDIF_writeData( color );
+ continue;
+ }
+ if ( *ptr & 0x80 ) {
+ copyColor = (*ptr - 0x80);
+ ptr++;
+ r = *ptr++;
+ g = *ptr++;
+ b = *ptr++;
+ r = ((r * weight/100) + (red * (100-weight)/100));
+ g = ((g * weight/100) + (green * (100-weight)/100));
+ b = ((b * weight/100) + (blue * (100-weight)/100));
+ copyColor--;
+ }
+ else {
+ readRGB = *ptr;
+ ptr++;
+ r = *ptr++;
+ g = *ptr++;
+ b = *ptr++;
+ r = ((r * weight/100) + (red * (100-weight)/100));
+ g = ((g * weight/100) + (green * (100-weight)/100));
+ b = ((b * weight/100) + (blue * (100-weight)/100));
+ readRGB--;
+ }
+
+ color = colorTransform24To16bpp(r,g,b);
+ DMDIF_writeData( color );
+
+ }
+
+ }
+
+ return DMD_OK;
+
+}
+
+
+/**************************************************************************//**
+* @brief
+* Draws pixels to the display at location x,y, from a source data array in
+* GIMP RLE compressed C-format
+* @param x
+* X coordinate of the first pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be written, relative to the clipping area
+* @param data
+* Array containing the pixel data in GIMP RLE compressed format
+* @param numPixels
+* Number of pixels to be written
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_writeDataRLE(uint16_t x, uint16_t y, uint16_t xlen, uint16_t ylen,
+ const uint8_t *data)
+{
+ uint32_t color = 0;
+ int xpos, ypos;
+ const uint8_t *ptr;
+ uint8_t r,g,b;
+ uint8_t readRGB = 0;
+ uint8_t copyColor = 0;
+
+ ptr = data;
+ for (ypos = y; ypos < (ylen+y); ypos++){
+
+ setPixelAddress(x, ypos);
+ DMDIF_prepareDataAccess( );
+ for (xpos = x; xpos < (xlen+x); xpos++){
+
+ if ( readRGB ) {
+ readRGB--;
+ r = *ptr++;
+ g = *ptr++;
+ b = *ptr++;
+ color = colorTransform24To16bpp(r,g,b);
+ DMDIF_writeData(color);
+ continue;
+ }
+ if ( copyColor ) {
+ copyColor--;
+ DMDIF_writeData( color );
+ continue;
+ }
+
+ if ( *ptr & 0x80 ) {
+ copyColor = (*ptr - 0x80);
+ ptr++;
+ r = *ptr++;
+ g = *ptr++;
+ b = *ptr++;
+ copyColor--;
+ } else {
+ readRGB = *ptr;
+ ptr++;
+ r = *ptr++;
+ g = *ptr++;
+ b = *ptr++;
+ readRGB--;
+ }
+
+ color = colorTransform24To16bpp(r,g,b);
+ DMDIF_writeData( color );
+
+ }
+
+ }
+
+ return DMD_OK;
+
+}
+
+/**************************************************************************//**
+* @brief
+* Reads data from display memory
+* WORKING NOW, fixed by onelife
+*
+* @param x
+* X coordinate of the first pixel to be read, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be read, relative to the clipping area
+* @param data
+* Pointer to where the pixel data will be stored
+* @param numPixels
+* Number of pixels to be read
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_readData(uint16_t x, uint16_t y,
+ uint8_t data[], uint32_t numPixels)
+{
+ uint32_t statusCode;
+ uint32_t clipRemaining;
+ uint32_t i;
+ uint32_t color;
+ uint8_t red, green, blue;
+
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Set the address of the first pixel */
+ statusCode = setPixelAddress(x, y);
+ if (statusCode != DMD_OK)
+ {
+ return statusCode;
+ }
+
+ /* Number of pixels from the first pixel (given by x and y) to the end
+ * of the clipping area */
+ clipRemaining = (dimensions.clipHeight - y - 1) * dimensions.clipWidth +
+ dimensions.clipWidth - x;
+ /* Check that the length of data isn't longer than the number of pixels
+ * in the rest of the clipping area */
+ if (numPixels > clipRemaining)
+ {
+ return DMD_ERROR_TOO_MUCH_DATA;
+ }
+
+ /* Read data */
+ DMDIF_prepareDataAccess();
+ /* Dummy read */
+ color = DMDIF_readData();
+ for (i = 0; i < numPixels; i++)
+ {
+ /* Read the color value */
+ color = DMDIF_readData();
+
+ /* Transform into 24bpp */
+ colorTransform16To24bpp(color, &red, &green, &blue);
+
+ data[3 * i] = red;
+ data[3 * i + 1] = green;
+ data[3 * i + 2] = blue;
+ }
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* \brief
+* Draws a number of pixels of the same color to the display
+*
+* @param x
+* X coordinate of the first pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be written, relative to the clipping area
+* @param red
+* Red component of the color
+* @param green
+* Green component of the color
+* @param blue
+* Blue component of the color
+* @param numPixels
+* Number of pixels to be written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red,
+ uint8_t green, uint8_t blue, uint32_t numPixels)
+{
+
+ uint32_t clipRemaining;
+ uint32_t statusCode;
+ uint32_t color;
+
+ if (!initialized){
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Set the address of the first pixel */
+ statusCode = setPixelAddress(x, y);
+ if (statusCode != DMD_OK){
+ return statusCode;
+ }
+
+ /* Number of pixels from the first pixel (given by x and y) to the end
+ * of the clipping area */
+ clipRemaining = (dimensions.clipHeight - y - 1) * dimensions.clipWidth +
+ dimensions.clipWidth - x;
+
+ /* Check that the length of data isn't longer than the number of pixels
+ * in the rest of the clipping area */
+ if (numPixels > clipRemaining){
+ return DMD_ERROR_TOO_MUCH_DATA;
+ }
+
+ /* Write data */
+ DMDIF_prepareDataAccess( );
+ color = colorTransform24To16bpp(red, green, blue);
+
+ DMDIF_writeDataRepeated(color, numPixels);
+
+ return DMD_OK;
+
+}
+
+/**************************************************************************//**
+* @brief
+* Draws a number of pixels of the same color to the display
+* This function is added by onelife
+*
+* @param x
+* X coordinate of the pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the pixel to be written, relative to the clipping area
+* @param color
+* RGB565 format
+* @param numPixels
+* Number of pixels to be written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_writePixel(uint16_t x, uint16_t y, uint16_t color,
+ uint32_t numPixels)
+{
+
+ uint32_t clipRemaining;
+ uint32_t statusCode;
+
+ if (!initialized){
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Set the address of the first pixel */
+ statusCode = setPixelAddress(x, y);
+ if (statusCode != DMD_OK){
+ return statusCode;
+ }
+
+ /* Number of pixels from the first pixel (given by x and y) to the end
+ * of the clipping area */
+ clipRemaining = (dimensions.clipHeight - y - 1) * dimensions.clipWidth +
+ dimensions.clipWidth - x;
+
+ /* Check that the length of data isn't longer than the number of pixels
+ * in the rest of the clipping area */
+ if (numPixels > clipRemaining){
+ return DMD_ERROR_TOO_MUCH_DATA;
+ }
+
+ /* Write data */
+ DMDIF_prepareDataAccess( );
+ DMDIF_writeDataRepeated((uint32_t)color, numPixels);
+
+ return DMD_OK;
+
+}
+
+/**************************************************************************//**
+* @brief
+* Read the color of a specified pixel
+* This function is added by onelife
+*
+* @param x
+* X coordinate of the pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the pixel to be written, relative to the clipping area
+* @param color
+* RGB565 format
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_readPixel(uint16_t x, uint16_t y, uint16_t *color)
+{
+
+ uint32_t statusCode;
+
+ if (!initialized){
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Set the address of the first pixel */
+ statusCode = setPixelAddress(x, y);
+ if (statusCode != DMD_OK){
+ return statusCode;
+ }
+
+ /* Read color */
+ DMDIF_prepareDataAccess( );
+ *color = DMDIF_readData() & 0x0000FFFF;
+
+ return DMD_OK;
+
+}
+
+/**************************************************************************//**
+* @brief
+* Turns off the display and puts it into sleep mode
+* Does not turn off backlight
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_sleep(void){
+
+ uint16_t data;
+
+ if (!initialized){
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Put into sleep mode */
+ data = DMD_SSD2119_SLEEP_MODE_1_SLP;
+ DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data);
+
+ /* Turn off display */
+ data = 0;
+ DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, 0x0000);
+
+ /* Delay 1.5 frame */
+ /*DMDIF_delay((1000 / DMD_FRAME_FREQUENCY) * 3 / 2);*/
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Wakes up the display from sleep mode
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_wakeUp(void){
+
+ uint16_t data;
+
+ if (!initialized){
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Get out of sleep mode */
+ data = 0;
+ DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data);
+
+ /* Turn on display */
+ data = DMD_SSD2119_DISPLAY_CONTROL_DTE;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_GON;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D1;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D0;
+ DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, 0x0033);
+
+ /* Delay 10 frames */
+ /*DMDIF_delay((1000 / DMD_FRAME_FREQUENCY) * 10);*/
+
+ return DMD_OK;
+
+}
+
+/**************************************************************************//**
+* @brief
+* Transforms a 24bpp pixel data into an 16bpp pixel
+*
+* @param red
+* 8-bit red component of the pixel
+* @param green
+* 8-bit green component of the pixel
+* @param blue
+* 8-bit blue component of the pixel
+* @return
+* 16bpp value of pixel
+******************************************************************************/
+static uint32_t colorTransform24To16bpp(uint8_t red, uint8_t green, uint8_t blue){
+
+ /* Transform each color into 6 bits by dropping the 2 LSB */
+ red = (red >> 3) & 0x1F;
+ green = (green >> 2) & 0x3F;
+ blue = (blue >> 3) & 0x1F;
+
+ /* Put it together to one 16bpp color number */
+ return (red << 11) | (green << 5) | blue;
+
+}
+
+/**************************************************************************//**
+* @brief
+* Transforms an 18 bpp pixel into a 24bpp pixel
+*
+* @param color
+* 16bpp color pixel
+* @param red
+* return value for red component of 24bpp pixel
+* @param green
+* return value for green component of 24bpp pixel
+* @param blue
+* return value for blue component of 24bpp pixel
+******************************************************************************/
+static void colorTransform16To24bpp(uint32_t color, uint8_t *red,
+ uint8_t *green, uint8_t *blue){
+
+ /* Get the individual colors out of the 16bpp number */
+ uint8_t redValue = (color & 0x0000F800) >> 11;
+ uint8_t greenValue = (color & 0x000007E0) >> 5;
+ uint8_t blueValue = (color & 0x0000001F);
+
+ /* Convert each color to 8-bit */
+ redValue <<= 3;
+ greenValue <<= 2;
+ blueValue <<= 3;
+
+ *red = redValue;
+ *green = greenValue;
+ *blue = blueValue;
+
+ return;
+
+}
+
+
+/**************************************************************************//**
+* @brief
+* Set horizontal and vertical flip mode of display controller
+*
+* @param hor
+* Set to flip display horizontally
+*
+* @param ver
+* Set to flip display vertically
+*
+* @return
+* Returns DMD_OK is successful, error otherwise.
+******************************************************************************/
+EMSTATUS DMD_flipDisplay(int horizontal, int vertical){
+
+ uint16_t reg;
+
+ reg = rcDriverOutputControl;
+
+ if (horizontal) reg &= ~DMD_SSD2119_DRIVER_OUTPUT_CONTROL_RL;
+ else reg |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_RL;
+
+ if (vertical) reg &= ~DMD_SSD2119_DRIVER_OUTPUT_CONTROL_TB;
+ else reg |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_TB;
+
+ rcDriverOutputControl = reg;
+ DMDIF_writeReg(DMD_SSD2119_DRIVER_OUTPUT_CONTROL, rcDriverOutputControl);
+
+ return DMD_OK;
+
+}
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_direct.c b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_direct.c
new file mode 100644
index 0000000000..5aa3d46f34
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_direct.c
@@ -0,0 +1,521 @@
+/***************************************************************************//**
+* @file
+* @brief Dot matrix display Direct Driver for TFT SSD2119 "Generic" mode
+* @author Energy Micro AS
+* @version 1.2.2
+*******************************************************************************
+* @section License
+* (C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
+*******************************************************************************
+*
+* 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.
+*
+******************************************************************************/
+#include
+#include "graphics/em_types.h"
+#include "dmd_ssd2119_registers.h"
+#include "dmd_ssd2119.h"
+#include "efm32.h"
+#include "efm32_usart.h"
+#include "efm32_cmu.h"
+#include "efm32_gpio.h"
+#include "tftspi.h"
+
+/** Dimensions of the display */
+DMD_DisplayGeometry dimensions =
+{
+ .xSize = 320,
+ .ySize = 240,
+ .xClipStart = 0,
+ .yClipStart = 0,
+ .clipWidth = 320,
+ .clipHeight = 240,
+};
+
+/** FramePointer base address */
+static volatile uint16_t *frameBuffer;
+
+/* Local variables */
+static uint32_t initialized = 0;
+static uint16_t rcDriverOutputControl = 0;
+
+/* Local function prototypes */
+static uint16_t colorTransform24ToRGB565(uint8_t red, uint8_t green, uint8_t blue);
+
+#if 0
+static void colorTransformRGB565To24bpp(uint16_t color, uint8_t *red, uint8_t *green, uint8_t *blue);
+#endif
+
+/**************************************************************************//**
+* @brief
+* Transforms a 24bpp pixel data into an RGB565 pixel
+*
+* @param red
+* 8-bit red component of the pixel
+* @param green
+* 8-bit green component of the pixel
+* @param blue
+* 8-bit blue component of the pixel
+* @return
+* 16-bit RGB565 value of pixel
+******************************************************************************/
+static uint16_t colorTransform24ToRGB565(uint8_t red, uint8_t green, uint8_t blue)
+{
+ /* Transform each color into 6 bits by dropping the 2 LSB */
+ red = red >> 3;
+ green = green >> 2;
+ blue = blue >> 3;
+
+ /* Put it together to one 18bpp color number */
+ return (red << 11) | (green << 5) | blue;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Transforms an 16-bit RGB565 pixel into a 24bpp pixel
+*
+* @param[in] color
+* RGB565 16-bit color pixel
+* @param red
+* return value for red component of 24bpp pixel
+* @param green
+* return value for green component of 24bpp pixel
+* @param blue
+* return value for blue component of 24bpp pixel
+******************************************************************************/
+#if 0
+static void colorTransformRGB565To24bpp(uint16_t color, uint8_t *red,
+ uint8_t *green, uint8_t *blue)
+{
+ /* Get the individual colors out of the 18bpp number */
+ uint8_t redValue = (color & 0x0003F000) >> 12;
+ uint8_t greenValue = (color & 0x00000FC0) >> 6;
+ uint8_t blueValue = (color & 0x0000003F);
+
+ /* Convert each color to 8-bit */
+ redValue <<= 2;
+ greenValue <<= 2;
+ blueValue <<= 2;
+
+ *red = redValue;
+ *green = greenValue;
+ *blue = blueValue;
+
+ return;
+}
+#endif
+
+/**************************************************************************//**
+* @brief
+* Writes a value to a control register in the LCD controller
+*
+* @param reg
+* The register that will be written to
+* @param data
+* The value to write to the register
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_writeReg(uint8_t reg, uint16_t data)
+{
+ SPI_TFT_WriteRegister(reg, data);
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Initializes the LCD display
+*
+* @param cmdRegAddr
+* If set to 0, initialize SSD2119 for direct drive, if set to 1 update
+* frame buffer base pointer (offset to EBI bank) only
+* @param dataRegAddr
+* Address in memory for frame buffer base pointer
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_init(uint32_t cmdRegAddr, uint32_t dataRegAddr)
+{
+ uint16_t data;
+ volatile uint32_t i;
+ (void) cmdRegAddr;
+ (void) dataRegAddr;
+
+ /* Use data reg addr as pointer to frame buffer */
+ frameBuffer = (uint16_t *) dataRegAddr;
+
+ if(cmdRegAddr==1) return DMD_OK;
+
+ SPI_TFT_Init();
+
+ DMDIF_writeReg(DMD_SSD2119_VCOM_OTP_1, 0x0006);
+
+ /* Oscillation driven DCLK */
+#if 0
+ data = DMD_SSD2119_OSCILLATION_START_OSCEN;
+ DMDIF_writeReg(DMD_SSD2119_OSCILLATION_START, data);
+#endif
+
+ /* Display control */
+ data = 0;
+ // data |= DMD_SSD2119_DISPLAY_CONTROL_DTE;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_GON;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D1;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D0;
+ DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, data);
+
+ /* Exit sleep mode */
+ data = 0;
+ DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data);
+
+ /* Wait */
+ for (i = 0; i < 100000; i++);
+
+ /* Display control */
+ DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, 0x33);
+
+ /* Entry mode */
+
+ data = DMD_SSD2119_ENTRY_MODE_DFM_65K << DMD_SSD2119_ENTRY_MODE_DFM_SHIFT;
+ data |= DMD_SSD2119_ENTRY_MODE_WMODE;
+ data |= DMD_SSD2119_ENTRY_MODE_NOSYNC;
+ data |= DMD_SSD2119_ENTRY_MODE_DMODE;
+ data |= DMD_SSD2119_ENTRY_MODE_ID1;
+ data |= DMD_SSD2119_ENTRY_MODE_ID0;
+
+ DMDIF_writeReg(DMD_SSD2119_ENTRY_MODE, data);
+
+ // DMDIF_writeReg(DMD_SSD2119_DRIVER_OUTPUT_CONTROL, 0x3aef);
+
+ /* Generic Interface Control */
+ // data = DMD_SSD2119_GENERIC_INTERFACE_CONTROL_INVDEN;
+ // DMDIF_writeReg(DMD_SSD2119_GENERIC_INTERFACE_CONTROL, data);
+
+ /* Driver output control */
+ data = 0;
+ data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_REV;
+ data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_GD;
+ // data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_TB;
+ // data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_SM;
+ // data |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_RL;
+ data |= ((DMD_VERTICAL_SIZE - 1) << DMD_SSD2119_DRIVER_OUTPUT_CONTROL_MUX_SHIFT);
+ DMDIF_writeReg(DMD_SSD2119_DRIVER_OUTPUT_CONTROL, data);
+
+ /* LCD AC control */
+ data = DMD_SSD2119_LCD_AC_CONTROL_BC;
+ data |= DMD_SSD2119_LCD_AC_CONTROL_EOR;
+ /* data |= DMD_SSD2119_LCD_AC_CONTROL_FLC; */
+ DMDIF_writeReg(DMD_SSD2119_LCD_AC_CONTROL, data);
+
+ /* RAM data write */
+ data = 0xff;
+ DMDIF_writeReg(DMD_SSD2119_ACCESS_DATA, data);
+
+ /* Mark graphics as initialized */
+ initialized = 1;
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Get the dimensions of the display and of the current clipping area
+*
+* @return
+* DMD_Dimensions structure containing the size of the display and the
+* clipping area
+******************************************************************************/
+EMSTATUS DMD_getDisplayGeometry(DMD_DisplayGeometry **geometry)
+{
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+ *geometry = &dimensions;
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Sets the clipping area. All coordinates given to writeData/writeColor/readData
+* are relative to this clipping area.
+*
+* @param xStart
+* X coordinate of the upper left corner of the clipping area
+* @param yStart
+* Y coordinate of the upper left corner of the clipping area
+* @param width
+* Width of the clipping area
+* @param height
+* Height of the clipping area
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_setClippingArea(uint16_t xStart, uint16_t yStart,
+uint16_t width, uint16_t height)
+{
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Check parameters */
+ if (xStart + width > dimensions.xSize ||
+ yStart + height > dimensions.ySize)
+ {
+ return DMD_ERROR_PIXEL_OUT_OF_BOUNDS;
+ }
+
+ if (width == 0 || height == 0)
+ {
+ return DMD_ERROR_EMPTY_CLIPPING_AREA;
+ }
+
+ /* Update the dimensions structure */
+ dimensions.xClipStart = xStart;
+ dimensions.yClipStart = yStart;
+ dimensions.clipWidth = width;
+ dimensions.clipHeight = height;
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Draws pixels to the display
+*
+* @param x
+* X coordinate of the first pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be written, relative to the clipping area
+* @param data
+* Array containing the pixel data. Each 8-bit element in the array are one color
+* component of the pixel, so that 3 bytes represent one pixel. The pixels are
+* ordered by increasing x coordinate, after the last pixel of a row, the next
+* pixel will be the first pixel on the next row.
+* @param numPixels
+* Number of pixels to be written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_writeData(uint16_t x, uint16_t y, const uint8_t data[],
+ uint32_t numPixels)
+{
+ uint8_t *dest = (uint8_t *)((uint32_t) frameBuffer +
+ (uint32_t) (y*dimensions.xSize*sizeof(uint16_t)) +
+ (uint32_t) (x*sizeof(uint16_t)));
+
+ while(numPixels--)
+ {
+ *dest++ = *data++;
+ }
+
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Reads data from display memory
+* DOESN'T WORK yet - TIMING ISSUE?
+*
+* @param x
+* X coordinate of the first pixel to be read, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be read, relative to the clipping area
+* @param data
+* Pointer to where the pixel data will be stored
+* @param numPixels
+* Number of pixels to be read
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_readData(uint16_t x, uint16_t y,
+ uint8_t data[], uint32_t numPixels)
+{
+ uint8_t *source = (uint8_t *)((uint32_t) frameBuffer +
+ (uint32_t) (y*dimensions.xSize*sizeof(uint16_t)) +
+ (uint32_t) (x*sizeof(uint16_t)));
+ if (y > dimensions.ySize) return DMD_ERROR_PIXEL_OUT_OF_BOUNDS;
+
+ while(numPixels--)
+ {
+ *data++ = *source++;
+ }
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* \brief
+* Draws a number of pixels of the same color to the display
+*
+* @param x
+* X coordinate of the first pixel to be written, relative to the clipping area
+* @param y
+* Y coordinate of the first pixel to be written, relative to the clipping area
+* @param red
+* Red component of the color
+* @param green
+* Green component of the color
+* @param blue
+* Blue component of the color
+* @param numPixels
+* Number of pixels to be written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_writeColor(uint16_t x, uint16_t y,
+ uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)
+{
+ uint16_t color;
+ uint16_t xStart = x;
+ uint16_t *pixelPointer = (uint16_t *)
+ ((uint32_t) frameBuffer +
+ (uint32_t) ((y+dimensions.yClipStart)*dimensions.xSize*sizeof(uint16_t)) +
+ (uint32_t) ((x+dimensions.xClipStart)*sizeof(uint16_t)));
+ color = colorTransform24ToRGB565(red,green,blue);
+
+ /* Draw the requied number of pixels */
+ while(numPixels--)
+ {
+ x++;
+ *pixelPointer++ = color;
+ /* Increment line, start at the right x position inside clipping region */
+ if (x>=dimensions.clipWidth)
+ {
+ x = xStart;
+ pixelPointer = (uint16_t *)
+ ((uint32_t) frameBuffer +
+ (uint32_t) (((++y)+dimensions.yClipStart)*dimensions.xSize*sizeof(uint16_t)) +
+ (uint32_t) ((xStart+dimensions.xClipStart)*sizeof(uint16_t)));
+ }
+ }
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Turns off the display and puts it into sleep mode
+* Does not turn off backlight
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_sleep(void)
+{
+ uint16_t data;
+
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Put into sleep mode */
+ data = DMD_SSD2119_SLEEP_MODE_1_SLP;
+ DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data);
+
+ /* Turn off display */
+ data = 0;
+ DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, 0x0000);
+
+ /* Delay 1.5 frame */
+ /*DMDIF_delay((1000 / DMD_FRAME_FREQUENCY) * 3 / 2);*/
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Wakes up the display from sleep mode
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMD_wakeUp(void)
+{
+ uint16_t data;
+
+ if (!initialized)
+ {
+ return DMD_ERROR_DRIVER_NOT_INITIALIZED;
+ }
+
+ /* Get out of sleep mode */
+ data = 0;
+ DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data);
+
+ /* Turn on display */
+ data = DMD_SSD2119_DISPLAY_CONTROL_DTE;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_GON;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D1;
+ data |= DMD_SSD2119_DISPLAY_CONTROL_D0;
+ DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, data);
+
+ /* Delay 10 frames */
+ /*DMDIF_delay((1000 / DMD_FRAME_FREQUENCY) * 10);*/
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Set horizontal and vertical flip mode of display controller
+*
+* @param hor
+* Set to flip display horizontally
+*
+* @param ver
+* Set to flip display vertically
+*
+* @return
+* Returns DMD_OK is successful, error otherwise.
+******************************************************************************/
+EMSTATUS DMD_flipDisplay(int horizontal, int vertical)
+{
+ uint16_t reg;
+
+ reg = rcDriverOutputControl;
+
+ if (horizontal) reg &= ~DMD_SSD2119_DRIVER_OUTPUT_CONTROL_RL;
+ else reg |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_RL;
+
+ if (vertical) reg &= ~DMD_SSD2119_DRIVER_OUTPUT_CONTROL_TB;
+ else reg |= DMD_SSD2119_DRIVER_OUTPUT_CONTROL_TB;
+
+ rcDriverOutputControl = reg;
+ DMDIF_writeReg(DMD_SSD2119_DRIVER_OUTPUT_CONTROL, rcDriverOutputControl);
+
+ return DMD_OK;
+}
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_registers.h b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_registers.h
new file mode 100644
index 0000000000..c61b42201f
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmd_ssd2119_registers.h
@@ -0,0 +1,199 @@
+/**
+ * @section LICENSE
+ ******************************************************************************
+ * (C) Copyright 2009 Energy Micro AS, www.energymicro.com
+ ******************************************************************************
+ *
+ * This source code is the property of Energy Micro AS. The source/compiled
+ * code may not be used, redistributed or modified without a written consent
+ * from Energy Micro AS.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ * @file dmd_ssd2119.h
+ * @brief Register definitions for LCD controller SSD2119
+ * @author Energy Micro AS
+ ******************************************************************************
+ */
+
+#ifndef __DMD_SSD2119_REGISTERS_H_
+#define __DMD_SSD2119_REGISTERS_H_
+
+#define DMD_SSD2119_DEVICE_CODE_READ 0x00
+#define DMD_SSD2119_OSCILLATION_START 0x00
+#define DMD_SSD2119_OSCILLATION_START_OSCEN 0x0001
+
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL 0x01
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL_RL 0x4000
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL_REV 0x2000
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL_GD 0x1000
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL_BGR 0x0800
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL_SM 0x0400
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL_TB 0x0200
+#define DMD_SSD2119_DRIVER_OUTPUT_CONTROL_MUX_SHIFT 0
+
+#define DMD_SSD2119_LCD_AC_CONTROL 0x02
+#define DMD_SSD2119_LCD_AC_CONTROL_FLC 0x1000
+#define DMD_SSD2119_LCD_AC_CONTROL_ENWS 0x0800
+#define DMD_SSD2119_LCD_AC_CONTROL_BC 0x0400
+#define DMD_SSD2119_LCD_AC_CONTROL_EOR 0x0200
+#define DMD_SSD2119_LCD_AC_CONTROL_WSMD 0x0100
+#define DMD_SSD2119_LCD_AC_CONTROL_NW_SHIFT 0
+
+#define DMD_SSD2119_POWER_CONTROL_1 0x03
+#define DMD_SSD2119_POWER_CONTROL_1_DCT_SHIFT 12
+#define DMD_SSD2119_POWER_CONTROL_1_BT_SHIFT 9
+#define DMD_SSD2119_POWER_CONTROL_1_DC_SHIFT 4
+#define DMD_SSD2119_POWER_CONTROL_1_AP_SHIFT 1
+
+#define DMD_SSD2119_DISPLAY_CONTROL 0x07
+#define DMD_SSD2119_DISPLAY_CONTROL_PT1 0x1000
+#define DMD_SSD2119_DISPLAY_CONTROL_PT0 0x0800
+#define DMD_SSD2119_DISPLAY_CONTROL_VLE2 0x0400
+#define DMD_SSD2119_DISPLAY_CONTROL_VLE1 0x0200
+#define DMD_SSD2119_DISPLAY_CONTROL_SPT 0x0100
+#define DMD_SSD2119_DISPLAY_CONTROL_GON 0x0020
+#define DMD_SSD2119_DISPLAY_CONTROL_DTE 0x0010
+#define DMD_SSD2119_DISPLAY_CONTROL_CM 0x0008
+#define DMD_SSD2119_DISPLAY_CONTROL_D1 0x0002
+#define DMD_SSD2119_DISPLAY_CONTROL_D0 0x0001
+
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL 0x0B
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_NO_SHIFT 14
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_SDT_SHIFT 12
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_EQ_SHIFT 8
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_DIV_SHIFT 6
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_DIV_1 0x0
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_DIV_2 0x1
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_DIV_4 0x2
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_DIV_8 0x3
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_SDIV 0x0020
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_SRTN 0x0010
+#define DMD_SSD2119_FRAME_CYCLE_CONTROL_RTN_SHIFT 0
+
+#define DMD_SSD2119_POWER_CONTROL_2 0x0C
+#define DMD_SSD2119_POWER_CONTROL_2_VRC_SHIFT 0
+
+#define DMD_SSD2119_POWER_CONTROL_3 0x0D
+#define DMD_SSD2119_POWER_CONTROL_3_VRH_SHIFT 0
+
+#define DMD_SSD2119_POWER_CONTROL_4 0x0E
+#define DMD_SSD2119_POWER_CONTROL_4_VCOMG 0x2000
+#define DMD_SSD2119_POWER_CONTROL_4_VDV_SHIFT 8
+
+#define DMD_SSD2119_GATE_SCAN_START_POSITION 0x0F
+
+#define DMD_SSD2119_SLEEP_MODE_1 0x10
+#define DMD_SSD2119_SLEEP_MODE_1_SLP 0x0001
+
+#define DMD_SSD2119_ENTRY_MODE 0x11
+#define DMD_SSD2119_ENTRY_MODE_VSMODE 0x8000
+#define DMD_SSD2119_ENTRY_MODE_DFM_SHIFT 13
+#define DMD_SSD2119_ENTRY_MODE_DFM_65K 0x3
+#define DMD_SSD2119_ENTRY_MODE_DFM_262K 0x2
+#define DMD_SSD2119_ENTRY_MODE_DENMODE 0x0800
+#define DMD_SSD2119_ENTRY_MODE_WMODE 0x0400
+#define DMD_SSD2119_ENTRY_MODE_NOSYNC 0x0200
+#define DMD_SSD2119_ENTRY_MODE_DMODE 0x0100
+#define DMD_SSD2119_ENTRY_MODE_TY_SHIFT 6
+#define DMD_SSD2119_ENTRY_MODE_TY_TYPE_A 0x0
+#define DMD_SSD2119_ENTRY_MODE_TY_TYPE_B 0x1
+#define DMD_SSD2119_ENTRY_MODE_TY_TYPE_C 0x2
+#define DMD_SSD2119_ENTRY_MODE_ID1 0x0020
+#define DMD_SSD2119_ENTRY_MODE_ID0 0x0010
+#define DMD_SSD2119_ENTRY_MODE_AM 0x0008
+
+#define DMD_SSD2119_SLEEP_MODE_2 0x12
+#define DMD_SSD2119_SLEEP_MODE_2_DSLP 0x2000
+#define DMD_SSD2119_SLEEP_MODE_2_HVCI 0x4000
+
+#define DMD_SSD2119_GENERIC_INTERFACE_CONTROL 0x15
+#define DMD_SSD2119_GENERIC_INTERFACE_CONTROL_INVDOT 0x0008
+#define DMD_SSD2119_GENERIC_INTERFACE_CONTROL_INVDEN 0x0004
+#define DMD_SSD2119_GENERIC_INTERFACE_CONTROL_INVHS 0x0002
+#define DMD_SSD2119_GENERIC_INTERFACE_CONTROL_INVVS 0x0001
+
+#define DMD_SSD2119_POWER_CONTROL_5 0x1E
+#define DMD_SSD2119_POWER_CONTROL_5_NOTP 0x0080
+#define DMD_SSD2119_POWER_CONTROL_5_VCM_SHIFT 0
+
+#define DMD_SSD2119_ACCESS_DATA 0x22
+
+#define DMD_SSD2119_FRAME_FREQUENCY_CONTROL 0x25
+#define DMD_SSD2119_FRAME_FREQUENCY_CONTROL_OSC_SHIFT 12
+
+#define DMD_SSD2119_VCOM_OTP_1 0x28
+#define DMD_SSD2119_VCOM_OTP_2 0x29
+
+#define DMD_SSD2119_GAMMA_1 0x30
+#define DMD_SSD2119_GAMMA_1_PKP1_SHIFT 8
+#define DMD_SSD2119_GAMMA_1_PKP0_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_2 0x31
+#define DMD_SSD2119_GAMMA_2_PKP3_SHIFT 8
+#define DMD_SSD2119_GAMMA_2_PKP2_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_3 0x32
+#define DMD_SSD2119_GAMMA_3_PKP5_SHIFT 8
+#define DMD_SSD2119_GAMMA_3_PKP4_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_4 0x33
+#define DMD_SSD2119_GAMMA_4_PRP1_SHIFT 8
+#define DMD_SSD2119_GAMMA_4_PRP0_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_5 0x34
+#define DMD_SSD2119_GAMMA_5_PKN1_SHIFT 8
+#define DMD_SSD2119_GAMMA_5_PKN0_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_6 0x35
+#define DMD_SSD2119_GAMMA_6_PKN3_SHIFT 8
+#define DMD_SSD2119_GAMMA_6_PKN2_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_7 0x36
+#define DMD_SSD2119_GAMMA_7_PKN5_SHIFT 8
+#define DMD_SSD2119_GAMMA_7_PKN4_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_8 0x37
+#define DMD_SSD2119_GAMMA_8_PRN1_SHIFT 8
+#define DMD_SSD2119_GAMMA_8_PRN0_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_9 0x3A
+#define DMD_SSD2119_GAMMA_9_VRP1_SHIFT 8
+#define DMD_SSD2119_GAMMA_9_VRP0_SHIFT 0
+
+#define DMD_SSD2119_GAMMA_10 0x3B
+#define DMD_SSD2119_GAMMA_10_VRN1_SHIFT 8
+#define DMD_SSD2119_GAMMA_10_VRN0_SHIFT 0
+
+#define DMD_SSD2119_VERTICAL_SCROLL_CONTROL_1 0x41
+#define DMD_SSD2119_VERTICAL_SCROLL_CONTROL_2 0x42
+
+#define DMD_SSD2119_VERTICAL_RAM_ADDRESS_POS 0x44
+#define DMD_SSD2119_VERTICAL_RAM_ADDRESS_POS_END_SHIFT 8
+#define DMD_SSD2119_VERTICAL_RAM_ADDRESS_POS_START_SHIFT 0
+
+#define DMD_SSD2119_HORIZONTAL_RAM_ADDRESS_START_POS 0x45
+#define DMD_SSD2119_HORIZONTAL_RAM_ADDRESS_END_POS 0x46
+
+#define DMD_SSD2119_FIRST_WINDOW_START 0x48
+#define DMD_SSD2119_FIRST_WINDOW_END 0x49
+
+#define DMD_SSD2119_SECOND_WINDOW_START 0x4A
+#define DMD_SSD2119_SECOND_WINDOW_END 0x4B
+
+#define DMD_SSD2119_SET_X_ADDRESS_COUNTER 0x4E
+#define DMD_SSD2119_SET_Y_ADDRESS_COUNTER 0x4F
+
+#endif
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_ebi.h b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_ebi.h
new file mode 100644
index 0000000000..5440de700c
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_ebi.h
@@ -0,0 +1,45 @@
+/**
+ * @section LICENSE
+ ******************************************************************************
+ * (C) Copyright 2009 Energy Micro AS, www.energymicro.com
+ ******************************************************************************
+ *
+ * This source code is the property of Energy Micro AS. The source/compiled
+ * code may not be used, redistributed or modified without a written consent
+ * from Energy Micro AS.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ * @file dmd_if_ssd2119_ebi.h
+ * @brief Dot matrix display SSD2119 interface using EBI
+ * @author Energy Micro AS
+ ******************************************************************************
+ */
+
+#ifndef __DMD_IF_SSD2119_EBI_H_
+#define __DMD_IF_SSD2119_EBI_H_
+
+#include
+
+/* Module Prototypes */
+EMSTATUS DMDIF_init(uint32_t cmdRegAddr, uint32_t dataRegAddr);
+EMSTATUS DMDIF_writeReg(uint8_t reg, uint16_t data);
+uint16_t DMDIF_readDeviceCode(void);
+EMSTATUS DMDIF_prepareDataAccess(void);
+EMSTATUS DMDIF_writeData(uint32_t data);
+EMSTATUS DMDIF_writeDataRepeated(uint32_t data, int len);
+uint32_t DMDIF_readData(void);
+
+#endif
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_ebi16.c b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_ebi16.c
new file mode 100644
index 0000000000..ca054786a2
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_ebi16.c
@@ -0,0 +1,235 @@
+/**
+ * @section LICENSE
+ ******************************************************************************
+ * (C) Copyright 2009 Energy Micro AS, www.energymicro.com
+ ******************************************************************************
+ *
+ * This source code is the property of Energy Micro AS. The source/compiled
+ * code may not be used, redistributed or modified without a written consent
+ * from Energy Micro AS.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ * @file dmdif_ssd2119_ebi.c
+ * @brief Dot matrix display interface using EBI
+ * @author Energy Micro AS
+ ******************************************************************************
+ */
+
+#include
+#include "dmd_ssd2119_registers.h"
+#include "dmd_ssd2119.h"
+#include "dmdif_ssd2119_ebi.h"
+#include "dvk.h"
+
+/* Local function prototypes */
+static EMSTATUS setNextReg(uint8_t reg);
+
+static volatile uint16_t *command_register;
+static volatile uint16_t *data_register;
+
+/**************************************************************************//**
+* @brief
+* Initializes the data interface to the LCD controller SSD2119
+*
+*
+* @param cmdRegAddr
+* The address in memory where data to the command register in the display
+* controller are written
+* @param dataRegAddr
+* The address in memory where data to the data register in the display
+* controller are written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_init(uint32_t cmdRegAddr, uint32_t dataRegAddr)
+{
+ command_register = (volatile uint16_t*) cmdRegAddr;
+ data_register = (volatile uint16_t*) dataRegAddr;
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Writes a value to a control register in the LCD controller
+*
+* @param reg
+* The register that will be written to
+* @param data
+* The value to write to the register
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_writeReg(uint8_t reg, uint16_t data)
+{
+ setNextReg(reg);
+
+ *data_register = data;
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Reads the device code of the LCD controller
+* WORKING NOW
+*
+* @return
+* The device code of the LCD controller
+******************************************************************************/
+uint16_t DMDIF_readDeviceCode(void)
+{
+ uint16_t deviceCode;
+
+ /* Reading from the oscillation control register gives the device code */
+ setNextReg(DMD_SSD2119_DEVICE_CODE_READ);
+
+ deviceCode = *data_register;
+
+ return deviceCode;
+}
+
+/**************************************************************************//**
+* @brief
+* Sends the data access command to the LCD controller to prepare for one or more
+* writes or reads using the DMDIF_writeData() and DMDIF_readData()
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_prepareDataAccess(void)
+{
+ setNextReg(DMD_SSD2119_ACCESS_DATA);
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be
+* called before writing data using this function.
+*
+* @param data
+* The color value of the pixel to be written in 18bpp format
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_writeData(uint32_t data)
+{
+ *data_register = (data & 0x0000FFFF);
+
+ return DMD_OK;
+}
+
+
+/**************************************************************************//**
+* @brief
+* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be
+* called before writing data using this function.
+*
+* @param data
+* The color value of the pixel to be written in 18bpp format
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_writeDataRepeated( uint32_t data, int len ){
+
+ uint16_t pixelData;
+ int i;
+
+ /* Write bits [8:0] of the pixel data to bits [8:0] on the output lines */
+ pixelData = data & 0x0000FFFF;
+
+ for (i=0; i> 1;
+ pixel |= (a << 8) & 0xFF00;
+
+ *data_register = pixel;
+
+ return DMD_OK;
+
+}
+
+
+/**************************************************************************//**
+* @brief
+* Reads a byte of data from the memory of the LCD controller.
+* DMDIF_prepareDataAccess() needs to be called before using this function.
+* DWORKING NOW
+*
+* @return
+* 18bpp value of pixel
+******************************************************************************/
+uint32_t DMDIF_readData(void)
+{
+ uint32_t data;
+
+ data = *data_register;
+
+ return data;
+}
+
+
+/**************************************************************************//**
+* \brief
+* Sets the register in the LCD controller to write commands to
+*
+* \param reg
+* The next register in the LCD controller to write to
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+static EMSTATUS setNextReg(uint8_t reg)
+{
+ uint16_t data;
+
+ data = reg & 0xff;
+ /* Write the register address to bits [8:1] in the index register */
+ *command_register = data;
+
+ return DMD_OK;
+}
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_spi.c b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_spi.c
new file mode 100644
index 0000000000..e29b1a6a57
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_spi.c
@@ -0,0 +1,199 @@
+/**
+ * @section LICENSE
+ ******************************************************************************
+ * (C) Copyright 2009 Energy Micro AS, www.energymicro.com
+ ******************************************************************************
+ *
+ * This source code is the property of Energy Micro AS. The source/compiled
+ * code may not be used, redistributed or modified without a written consent
+ * from Energy Micro AS.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ * @file dmdif_ssd2119_ebi.c
+ * @brief Dot matrix display SSD2119 interface using EBI
+ * @author Energy Micro AS
+ ******************************************************************************
+ */
+
+#include
+#include "dmd_ssd2119_registers.h"
+#include "dmd_ssd2119.h"
+#include "dmdif_ssd2119_spi.h"
+#include "dvk.h"
+
+/* Local function prototypes */
+static EMSTATUS setNextReg(uint8_t reg);
+
+static uint32_t command_register;
+static uint32_t data_register;
+
+/**************************************************************************//**
+* @brief
+* Initializes the data interface to the LCD controller SSD2119
+*
+*
+* @param cmdRegAddr
+* The address in memory where data to the command register in the display
+* controller are written
+* @param dataRegAddr
+* The address in memory where data to the data register in the display
+* controller are written
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_init(uint32_t cmdRegAddr, uint32_t dataRegAddr)
+{
+ command_register = cmdRegAddr;
+ data_register = dataRegAddr;
+
+ DVK_displayControl(DVK_Display_SPI);
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Writes a value to a control register in the LCD controller
+*
+* @param reg
+* The register that will be written to
+* @param data
+* The value to write to the register
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_writeReg(uint8_t reg, uint16_t data)
+{
+ setNextReg(reg);
+
+ /* Write bits [15:8] of the data to bits [8:1] of the output lines */
+ DVK_writeRegister( (uint16_t *) data_register, ((data & 0xff00) >> 8) << 1);
+
+ /* Write bits [7:0] of the data to bits [8:1] of the output lines */
+ DVK_writeRegister( (uint16_t *) data_register, (data & 0x00ff) << 1);
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Reads the device code of the LCD controller
+* DOESN'T WORK
+*
+* @return
+* The device code of the LCD controller
+******************************************************************************/
+uint16_t DMDIF_readDeviceCode(void)
+{
+ uint16_t readData;
+ uint16_t deviceCode;
+
+ /* Reading from the oscillation control register gives the device code */
+ setNextReg(DMD_SSD2119_DEVICE_CODE_READ);
+
+ readData = DVK_readRegister( (uint16_t *) data_register );
+ deviceCode = ((readData >> 1) & 0x00ff) << 8;
+ readData = DVK_readRegister( (uint16_t *) data_register );
+ deviceCode |= ((readData >> 1) & 0x00ff);
+
+ return deviceCode;
+}
+
+/**************************************************************************//**
+* @brief
+* Sends the data access command to the LCD controller to prepare for one or more
+* writes or reads using the DMDIF_writeData() and DMDIF_readData()
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_prepareDataAccess(void)
+{
+ setNextReg(DMD_SSD2119_ACCESS_DATA);
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be
+* called before writing data using this function.
+*
+* @param data
+* The color value of the pixel to be written in 18bpp format
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+EMSTATUS DMDIF_writeData(uint32_t data)
+{
+ /* Write bits [17:9] of the pixel data to bits [8:0] on the output lines */
+ DVK_writeRegister( (uint16_t *) data_register, (data & 0x0003FE00) >> 9);
+ /* Write bits [8:0] of the pixel data to bits [8:0] on the output lines */
+ DVK_writeRegister( (uint16_t *) data_register, (data & 0x000001FF));
+
+ return DMD_OK;
+}
+
+/**************************************************************************//**
+* @brief
+* Reads a byte of data from the memory of the LCD controller.
+* DMDIF_prepareDataAccess() needs to be called before using this function.
+* DOESN'T WORK
+*
+* @return
+* 18bpp value of pixel
+******************************************************************************/
+uint32_t DMDIF_readData(void)
+{
+ uint32_t data;
+
+ /* Read bits [17:9] of the pixel */
+ data = DVK__readRegister( (uint16_t *) data_register ) << 9;
+ /* Read bits [8:0] of the pixel */
+ data |= DVK_readRegister( (uint16_t *) data_register );
+
+ return data;
+}
+
+/**************************************************************************//**
+* \brief
+* Sets the register in the LCD controller to write commands to
+*
+* \param reg
+* The next register in the LCD controller to write to
+*
+* @return
+* DMD_OK on success, otherwise error code
+******************************************************************************/
+static EMSTATUS setNextReg(uint8_t reg)
+{
+ uint16_t data;
+
+ data = ((uint16_t) reg) << 1;
+
+ /* First 9 bits is 0 */
+ DVK_writeRegister( (uint16_t *) command_register, 0 );
+
+ /* Write the register address to bits [8:1] in the index register */
+ DVK_writeRegister( (uint16_t *) command_register, data );
+
+ return DMD_OK;
+}
+
+
diff --git a/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_spi.h b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_spi.h
new file mode 100644
index 0000000000..1383ddcb91
--- /dev/null
+++ b/bsp/efm32/graphics/dmd/ssd2119/dmdif_ssd2119_spi.h
@@ -0,0 +1,44 @@
+/**
+ * @section LICENSE
+ ******************************************************************************
+ * (C) Copyright 2009 Energy Micro AS, www.energymicro.com
+ ******************************************************************************
+ *
+ * This source code is the property of Energy Micro AS. The source/compiled
+ * code may not be used, redistributed or modified without a written consent
+ * from Energy Micro AS.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ * @file dmdif_ssd2119_spi.h
+ * @brief Dot matrix display SSD2119 interface using EBI
+ * @author Energy Micro AS
+ ******************************************************************************
+ */
+
+#ifndef __DMDIF_SSD2119_SPI_H_
+#define __DMDIF_SSD2119_SPI_H_
+
+#include
+
+/* Module Prototypes */
+EMSTATUS DMDIF_init(uint32_t cmdRegAddr, uint32_t dataRegAddr);
+EMSTATUS DMDIF_writeReg(uint8_t reg, uint16_t data);
+uint16_t DMDIF_readDeviceCode(void);
+EMSTATUS DMDIF_prepareDataAccess(void);
+EMSTATUS DMDIF_writeData(uint32_t data);
+uint32_t DMDIF_readData(void);
+
+#endif
diff --git a/bsp/efm32/graphics/em_types.h b/bsp/efm32/graphics/em_types.h
new file mode 100644
index 0000000000..d93a3f4504
--- /dev/null
+++ b/bsp/efm32/graphics/em_types.h
@@ -0,0 +1,36 @@
+/**************************************************************************//**
+ * @file
+ * @brief Definition of EMSTATUS used by graphics library
+ * @author Energy Micro AS
+ * @version 1.2.2
+ ******************************************************************************
+ * @section License
+ * (C) Copyright 2009 Energy Micro AS, http://www.energymicro.com
+ ******************************************************************************
+ *
+ * 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 __EM_TYPES_H_
+#define __EM_TYPES_H_
+
+#include
+
+typedef uint32_t EMSTATUS;
+
+#endif
diff --git a/bsp/efm32/hdl_interrupt.c b/bsp/efm32/hdl_interrupt.c
index 98f812c5b9..29e8e67313 100644
--- a/bsp/efm32/hdl_interrupt.c
+++ b/bsp/efm32/hdl_interrupt.c
@@ -16,6 +16,7 @@
* 2011-12-09 onelife Add giant gecko support
* 2011-12-09 onelife Add UART module support
* 2011-12-09 onelife Add LEUART module support
+ * 2011-12-27 onelife Utilize "XXX_PRESENT" and "XXX_COUNT"
******************************************************************************/
/* Includes ------------------------------------------------------------------*/
@@ -42,9 +43,19 @@ efm32_irq_hook_t timerCbTable[TIMER_COUNT] = {RT_NULL};
efm32_irq_hook_t rtcCbTable[RTC_COUNT] = {RT_NULL};
efm32_irq_hook_t gpioCbTable[16] = {RT_NULL};
efm32_irq_hook_t acmpCbTable[ACMP_COUNT] = {RT_NULL};
+#if defined(USART_PRESENT)
+ #if defined(UART_PRESENT)
efm32_irq_hook_t usartCbTable[USART_COUNT * 2 + UART_COUNT * 2] = {RT_NULL};
+ #else
+efm32_irq_hook_t usartCbTable[USART_COUNT * 2] = {RT_NULL};
+ #endif
+#endif
+#if defined(LEUART_PRESENT)
efm32_irq_hook_t leuartCbTable[LEUART_COUNT] = {RT_NULL};
+#endif
+#if defined(I2C_PRESENT)
efm32_irq_hook_t iicCbTable[I2C_COUNT] = {RT_NULL};
+#endif
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
@@ -166,7 +177,7 @@ void SysTick_Handler(void)
* @note
*
******************************************************************************/
-void DMA_IRQHandler_All(unsigned int channel, bool primary, void *user)
+void DMA_IRQHandler_All(rt_uint32_t channel, rt_bool_t primary, void *user)
{
/* enter interrupt */
rt_interrupt_enter();
@@ -378,6 +389,7 @@ void ACMP0_IRQHandler(void)
rt_interrupt_leave();
}
+#if defined(USART_PRESENT)
/***************************************************************************//**
* @brief
* Common USART0 TX interrupt handler
@@ -430,7 +442,9 @@ void USART0_RX_IRQHandler(void)
}
}
}
+#endif
+#if (defined(USART_PRESENT) && (USART_COUNT > 1))
/***************************************************************************//**
* @brief
* Common USART1 TX interrupt handler
@@ -483,7 +497,9 @@ void USART1_RX_IRQHandler(void)
}
}
}
+#endif
+#if (defined(USART_PRESENT) && (USART_COUNT > 2))
/***************************************************************************//**
* @brief
* Common USART2 TX interrupt handler
@@ -536,7 +552,9 @@ void USART2_RX_IRQHandler(void)
}
}
}
+#endif
+#if defined(UART_PRESENT)
/***************************************************************************//**
* @brief
* Common UART0 TX interrupt handler
@@ -589,8 +607,9 @@ void UART0_RX_IRQHandler(void)
}
}
}
+#endif
-#if defined(EFM32_GIANT_FAMILY)
+#if (defined(UART_PRESENT) && (UART_COUNT > 1))
/***************************************************************************//**
* @brief
* Common UART1 TX interrupt handler
@@ -645,6 +664,7 @@ void UART1_RX_IRQHandler(void)
}
#endif
+#if defined(LEUART_PRESENT)
/***************************************************************************//**
* @brief
* Common LEUART0 interrupt handler
@@ -666,7 +686,9 @@ void LEUART0_IRQHandler(void)
}
}
}
+#endif
+#if (defined(LEUART_PRESENT) && (LEUART_COUNT > 1))
/***************************************************************************//**
* @brief
* Common LEUART1 interrupt handler
@@ -688,7 +710,9 @@ void LEUART1_IRQHandler(void)
}
}
}
+#endif
+#if defined(I2C_PRESENT)
/***************************************************************************//**
* @brief
* Common IIC0 interrupt handler
@@ -714,6 +738,7 @@ void I2C0_IRQHandler(void)
I2C_IntClear(I2C0, I2C_IFC_ADDR | I2C_IFC_SSTOP);
}
+#endif
/***************************************************************************//**
* @brief
@@ -752,22 +777,24 @@ void efm32_irq_hook_register(efm32_irq_hook_init_t *hook)
acmpCbTable[hook->unit].cbFunc = hook->cbFunc;
acmpCbTable[hook->unit].userPtr = hook->userPtr;
break;
-
+#if defined(USART_PRESENT)
case efm32_irq_type_usart:
usartCbTable[hook->unit].cbFunc = hook->cbFunc;
usartCbTable[hook->unit].userPtr = hook->userPtr;
break;
-
+#endif
+#if defined(LEUART_PRESENT)
case efm32_irq_type_leuart:
leuartCbTable[hook->unit].cbFunc = hook->cbFunc;
leuartCbTable[hook->unit].userPtr = hook->userPtr;
break;
-
+#endif
+#if defined(I2C_PRESENT)
case efm32_irq_type_iic:
iicCbTable[hook->unit].cbFunc = hook->cbFunc;
iicCbTable[hook->unit].userPtr = hook->userPtr;
break;
-
+#endif
default:
break;
}
diff --git a/bsp/efm32/hdl_interrupt.h b/bsp/efm32/hdl_interrupt.h
index 576ece7927..cf1b12f30e 100644
--- a/bsp/efm32/hdl_interrupt.h
+++ b/bsp/efm32/hdl_interrupt.h
@@ -56,7 +56,7 @@ typedef struct
//void UsageFault_Handler(void);
//void SVC_Handler(void);
//void DebugMon_Handler(void);
-void DMA_IRQHandler_All(unsigned int channel, bool primary, void *user);
+void DMA_IRQHandler_All(rt_uint32_t channel, rt_bool_t primary, void *user);
void efm32_irq_hook_register(efm32_irq_hook_init_t *hook);
#endif /* __HDL_INTERRUPT_H__ */
diff --git a/bsp/efm32/rtconfig.h b/bsp/efm32/rtconfig.h
index 05a7e6e6f0..ac4f09c51e 100644
--- a/bsp/efm32/rtconfig.h
+++ b/bsp/efm32/rtconfig.h
@@ -53,7 +53,8 @@
#define EFM32_ACCEL_DEBUG
#define EFM32_SFLASH_DEBUG
//#define EFM32_SDCARD_DEBUG
-//#define EFM32_ETHERNET_DEBUG
+#define EFM32_ETHERNET_DEBUG
+#define EFM32_LCD_DEBUG
/* Using Hook */
@@ -67,15 +68,15 @@
/* SECTION: IPC */
/* Using Semaphore*/
-#define RT_USING_SEMAPHORE /* Using by DFS and lwIP */
+#define RT_USING_SEMAPHORE /* Required by DFS and lwIP */
/* Using Mutex */
-#define RT_USING_MUTEX /* Using by DFS */
+#define RT_USING_MUTEX /* Required by DFS */
/* Using Event */
//#define RT_USING_EVENT
/* Using MailBox */
-#define RT_USING_MAILBOX /* Using by lwIP */
+#define RT_USING_MAILBOX /* Required by lwIP */
/* Using Message Queue */
-//#define RT_USING_MESSAGEQUEUE
+#define RT_USING_MESSAGEQUEUE /* Required by RTGUI */
/* SECTION: Memory Management */
/* Using Memory Pool Management*/
//#define RT_USING_MEMPOOL
@@ -90,6 +91,7 @@
/* Using Device System */
#define RT_USING_DEVICE
+/* SECTION: UART options */
/* USART/UART/LEUART Device for Console */
#if defined(EFM32_G8XX_STK)
#define RT_USING_USART1 (0x1UL)
@@ -104,7 +106,7 @@
#if defined(EFM32GG_DK3750_USING_LEUART1)
#define RT_USING_LEUART1 (0x0UL)
#define RT_LEUART1_NAME "debug0"
- //#define RT_LEUART1_USING_DMA (0x0UL)
+ #define RT_LEUART1_USING_DMA (0x0UL)
#else
#define RT_USING_UART1 (0x2UL)
#define RT_UART1_NAME "debug"
@@ -113,33 +115,46 @@
#endif
/* SECTION: SPI options */
+#define EFM32_SPI_MASTER (1 << 0) /* Master mode */
+#define EFM32_SPI_AUTOCS (1 << 1) /* Auto chip select */
+#define EFM32_SPI_9BIT (1 << 2) /* 9-bit data */
+/*
+ 0: Clock idle low, sample on rising edge
+ 1: Clock idle low, sample on falling edge
+ 2: Clock idle high, sample on falling edge
+ 3: Clock idle high, sample on rising edge.
+*/
+#define EFM32_SPI_CLK_MODE(mode) (mode << 3) /* clock mode */
+
#if defined(EFM32_G8XX_STK)
//#define RT_USING_USART0 (0x0UL)
-//#define RT_USART0_SYNC_MODE (0x1UL) /* Master */
+//#define RT_USART0_SYNC_MODE (EFM32_SPI_MASTER)
//#define RT_USART0_NAME "spi0"
//#define RT_USART0_USING_DMA (0x1UL)
#elif defined(EFM32_GXXX_DK)
#define RT_USING_USART0 (0x2UL)
-#define RT_USART0_SYNC_MODE (0x1UL) /* Master */
+#define RT_USART0_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_AUTOCS | \
+ EFM32_SPI_CLK_MODE(0))
#define RT_USART0_NAME "spi0"
#define RT_USART0_USING_DMA (0x1UL)
#define RT_USING_USART2 (0x1UL)
-#define RT_USART2_SYNC_MODE (0x1UL) /* Master */
+#define RT_USART2_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_CLK_MODE(0))
#define RT_USART2_NAME "spi2"
#define RT_USART2_USING_DMA (0x2UL)
#elif defined(EFM32GG_DK3750)
#define RT_USING_USART0 (0x1UL)
-#define RT_USART0_SYNC_MODE (0x1UL) /* Master */
+#define RT_USART0_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_AUTOCS | \
+ EFM32_SPI_CLK_MODE(0))
#define RT_USART0_NAME "spi0"
#define RT_USART0_USING_DMA (0x1UL)
#define RT_USING_USART1 (0x1UL)
-#define RT_USART1_SYNC_MODE (0x1UL) /* Master */
+#define RT_USART1_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_AUTOCS | \
+ EFM32_SPI_9BIT | EFM32_SPI_CLK_MODE(3))
#define RT_USART1_NAME "spi1"
#define RT_USART1_USING_DMA (0x2UL)
-
#endif
/* SECTION: IIC options */
@@ -188,6 +203,10 @@
#endif
#endif
+/* SECTION: Runtime library */
+// #define RT_USING_NOLIBC
+// #define RT_USING_NEWLIB
+
/* SECTION: Console options */
#define RT_USING_CONSOLE
/* the buffer size of console*/
@@ -208,6 +227,7 @@
//#define EFM32_USING_SFLASH /* SPI Flash */
#define EFM32_USING_SPISD /* MicroSD card */
//#define EFM32_USING_ETHERNET /* Ethernet controller */
+#define EFM32_USING_LCD /* TFT LCD */
#endif
#if defined(EFM32_USING_ACCEL)
@@ -239,17 +259,22 @@
#endif
/* SECTION: device filesystem */
-#if defined(EFM32_USING_SPISD)
+#if (defined(RT_USING_NEWLIB) || defined(EFM32_USING_SPISD))
#define RT_USING_DFS
-#define RT_USING_DFS_ELMFAT
-#define DFS_ELMFAT_INTERFACE_EFM
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX (2)
/* the max number of opened files */
#define DFS_FD_MAX (4)
/* the max number of cached sector */
#define DFS_CACHE_MAX_NUM (4)
+#endif /* defined(RT_USING_NEWLIB) || defined(EFM32_USING_SPISD) */
+#if defined(EFM32_USING_SPISD)
+#define RT_USING_DFS_ELMFAT
+#define DFS_ELMFAT_INTERFACE_EFM
#endif /* defined(EFM32_USING_SPISD) */
+#if defined(RT_USING_NEWLIB)
+#define RT_USING_DFS_DEVFS
+#endif /* defined(RT_USING_DFS_DEVFS) */
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
#if defined(EFM32_USING_ETHERNET)
@@ -260,6 +285,7 @@
//#define RT_USING_LWIP
//#define RT_USING_NETUTILS
+//#define RT_LWIP_DHCP
/* LwIP uses RT-Thread Memory Management */
#define RT_LWIP_USING_RT_MEM
/* Enable ICMP protocol*/
@@ -283,13 +309,11 @@
#define RT_LWIP_IPADDR1 (168)
#define RT_LWIP_IPADDR2 (1)
#define RT_LWIP_IPADDR3 (118)
-
/* gateway address of target*/
#define RT_LWIP_GWADDR0 (192)
#define RT_LWIP_GWADDR1 (168)
#define RT_LWIP_GWADDR2 (1)
#define RT_LWIP_GWADDR3 (1)
-
/* mask address of target*/
#define RT_LWIP_MSKADDR0 (255)
#define RT_LWIP_MSKADDR1 (255)
@@ -300,13 +324,44 @@
#define RT_LWIP_TCPTHREAD_PRIORITY (12)
#define RT_LWIP_TCPTHREAD_MBOX_SIZE (4)
#define RT_LWIP_TCPTHREAD_STACKSIZE (1024)
-
/* ethernet if thread options */
#define RT_LWIP_ETHTHREAD_PRIORITY (15)
#define RT_LWIP_ETHTHREAD_MBOX_SIZE (4)
#define RT_LWIP_ETHTHREAD_STACKSIZE (512)
#endif /* defined(EFM32_USING_ETHERNET) */
+/* SECTION: RTGUI support */
+#if defined(EFM32_USING_LCD)
+#define LCD_USING_DEVICE_NAME RT_USART1_NAME
+#define LCD_DEVICE_NAME "spiLcd"
+/* using RTGUI support */
+#define RT_USING_RTGUI
+
+/* name length of RTGUI object */
+#define RTGUI_NAME_MAX (16)
+/* support 16 weight font */
+#define RTGUI_USING_FONT16
+/* support 12 weight font */
+#define RTGUI_USING_FONT12
+/* support Chinese font */
+#define RTGUI_USING_FONTHZ
+/* use DFS as file interface */
+#define RTGUI_USING_DFS_FILERW
+/* use font file as Chinese font */
+/* #define RTGUI_USING_HZ_FILE */
+/* use Chinese bitmap font */
+#define RTGUI_USING_HZ_BMP
+/* use small size in RTGUI */
+/* #define RTGUI_USING_SMALL_SIZE */
+/* use mouse cursor */
+/* #define RTGUI_USING_MOUSE_CURSOR */
+/* RTGUI image options */
+#define RTGUI_IMAGE_XPM
+//#define RTGUI_IMAGE_JPEG
+//#define RTGUI_IMAGE_PNG
+#define RTGUI_IMAGE_BMP
+#endif /* defined(EFM32_USING_LCD) */
+
/* Exported functions ------------------------------------------------------- */
#endif /* __RTTHREAD_CFG_H__ */
diff --git a/bsp/efm32/rtconfig.py b/bsp/efm32/rtconfig.py
index e0a7c006c8..bfe546a01b 100644
--- a/bsp/efm32/rtconfig.py
+++ b/bsp/efm32/rtconfig.py
@@ -22,6 +22,8 @@ elif EFM32_BOARD == 'EFM32_GXXX_DK':
elif EFM32_BOARD == 'EFM32GG_DK3750':
EFM32_FAMILY = 'Giant Gecko'
EFM32_TYPE = 'EFM32GG990F1024'
+ EFM32_LCD = 'Mapped'
+# EFM32_LCD = 'Direct'
if PLATFORM == 'gcc':
# toolchains
@@ -36,7 +38,6 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- #CFLAGS = DEVICE + ' -DRT_USING_MINILIBC'
CFLAGS = DEVICE
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-efm32.map,-cref,-u,__cs3_reset -T'
diff --git a/bsp/efm32/startup.c b/bsp/efm32/startup.c
index afcee25628..64db1125b0 100644
--- a/bsp/efm32/startup.c
+++ b/bsp/efm32/startup.c
@@ -1,33 +1,34 @@
-/******************************************************************//**
- * @file interrupt.c
- * @brief This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2011, RT-Thread Development Team
- * @author Bernard, onelife
- * @version 0.4 beta
- **********************************************************************
+/***************************************************************************//**
+ * @file interrupt.c
+ * @brief This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author Bernard, onelife
+ * @version 0.4 beta
+ *******************************************************************************
* @section License
- * The license and distribution terms for this file may be found in the file LICENSE in this
- * distribution or at http://www.rt-thread.org/license/LICENSE
- **********************************************************************
+ * The license and distribution terms for this file may be found in the file
+ * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
+ *******************************************************************************
* @section Change Logs
* Date Author Notes
- * 2006-08-31 Bernard first implementation
- * 2010-12-29 onelife Modify for EFM32
- *********************************************************************/
-
-/******************************************************************//**
-* @addtogroup efm32
-* @{
-*********************************************************************/
+ * 2006-08-31 Bernard first implementation
+ * 2010-12-29 onelife Modify for EFM32
+ * 2011-12-20 onelife Add RTGUI initialization routine
+ ******************************************************************************/
-/* Includes -------------------------------------------------------------------*/
+/***************************************************************************//**
+ * @addtogroup efm32
+ * @{
+ ******************************************************************************/
+
+/* Includes ------------------------------------------------------------------*/
#include "board.h"
#include
-/* Private typedef -------------------------------------------------------------*/
-/* Private define --------------------------------------------------------------*/
-/* Private macro --------------------------------------------------------------*/
-/* External variables -----------------------------------------------------------*/
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+/* External variables --------------------------------------------------------*/
#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
#elif __ICCARM__
@@ -36,136 +37,141 @@ extern int Image$$RW_IRAM1$$ZI$$Limit;
extern int __bss_end;
#endif
-/* Private variables ------------------------------------------------------------*/
-/* External function prototypes --------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* External function prototypes ----------------------------------------------*/
extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
-/* Private function prototypes ---------------------------------------------------*/
-/* Private functions ------------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
#ifdef DEBUG
-/******************************************************************//**
+/***************************************************************************//**
* @brief
- * Reports the name of the source file and the source line number where the assert error
- * has occurred.
+ * Reports the name of the source file and the source line number where the
+ * assert error has occurred.
*
* @details
*
* @note
*
* @param[in] file
- * Pointer to the source file name
+ * Pointer to the source file name
*
* @param[in] line
- * Assert error line source number
- *********************************************************************/
+ * Assert error line source number
+ ******************************************************************************/
void assert_failed(u8* file, u32 line)
{
- rt_kprintf("\n\r Wrong parameter value detected on\r\n");
- rt_kprintf(" file %s\r\n", file);
- rt_kprintf(" line %d\r\n", line);
+ rt_kprintf("\n\r Wrong parameter value detected on\r\n");
+ rt_kprintf(" file %s\r\n", file);
+ rt_kprintf(" line %d\r\n", line);
- while (1) ;
+ while (1) ;
}
#endif
-/******************************************************************//**
+/***************************************************************************//**
* @brief
- * Startup RT-Thread
+ * Startup RT-Thread
*
* @details
*
* @note
*
- *********************************************************************/
+ ******************************************************************************/
void rtthread_startup(void)
{
- /* init board */
- rt_hw_board_init();
+ /* init board */
+ rt_hw_board_init();
#ifdef RT_USING_HEAP
- #ifdef __CC_ARM
- rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)EFM32_SRAM_END);
- #elif __ICCARM__
+ #ifdef __CC_ARM
+ rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)EFM32_SRAM_END);
+ #elif __ICCARM__
rt_system_heap_init(__segment_end("HEAP"), (void*)EFM32_SRAM_END);
- #else
- /* init memory system */
- rt_system_heap_init((void*)&__bss_end, (void*)EFM32_SRAM_END);
- #endif
+ #else
+ /* init memory system */
+ rt_system_heap_init((void*)&__bss_end, (void*)EFM32_SRAM_END);
+ #endif
#endif
- /* enable interrupt */
- rt_hw_interrupt_enable(0x0UL);
+ /* enable interrupt */
+ rt_hw_interrupt_enable(0x0UL);
- /* init drivers */
- rt_hw_driver_init();
+ /* init drivers */
+ rt_hw_driver_init();
- /* show version */
- rt_show_version();
-
- /* init tick */
- rt_system_tick_init();
+ /* show version */
+ rt_show_version();
- /* init kernel object */
- rt_system_object_init();
+ /* init tick */
+ rt_system_tick_init();
- /* init timer system */
- rt_system_timer_init();
+ /* init kernel object */
+ rt_system_object_init();
- /* init scheduler system */
- rt_system_scheduler_init();
+ /* init timer system */
+ rt_system_timer_init();
- /* init all devices */
- rt_device_init_all();
+ /* init scheduler system */
+ rt_system_scheduler_init();
+ /* init all devices */
+ rt_device_init_all();
+
+ /* init finsh */
#ifdef RT_USING_FINSH
- /* init finsh */
- finsh_system_init();
- finsh_set_device(CONSOLE_DEVICE);
+ finsh_system_init();
+ finsh_set_device(CONSOLE_DEVICE);
+#endif
+
+ /* Initialize gui server */
+#ifdef RT_USING_RTGUI
+ rtgui_system_server_init();
#endif
/* init timer thread */
rt_system_timer_thread_init();
- /* init idle thread */
- rt_thread_idle_init();
+ /* init idle thread */
+ rt_thread_idle_init();
- /* init application */
- rt_application_init();
+ /* init application */
+ rt_application_init();
- /* start scheduler */
- rt_system_scheduler_start();
+ /* start scheduler */
+ rt_system_scheduler_start();
- /* never reach here */
- return ;
+ /* never reach here */
+ return ;
}
-/******************************************************************//**
+/***************************************************************************//**
* @brief
- * Program entry point
+ * Program entry point
*
* @details
*
* @note
*
- *********************************************************************/
+ ******************************************************************************/
int main(void)
{
- /* disable interrupt first */
- rt_hw_interrupt_disable();
+ /* disable interrupt first */
+ rt_hw_interrupt_disable();
- /* init system setting */
- SystemInit();
+ /* init system setting */
+ SystemInit();
- /* startup RT-Thread RTOS */
- rtthread_startup();
+ /* startup RT-Thread RTOS */
+ rtthread_startup();
- return 0;
+ return 0;
}
-/******************************************************************//**
+/***************************************************************************//**
* @}
-*********************************************************************/
+ ******************************************************************************/