mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
EFM32: Fix GPIO configuration logic; Add missing board initializatin logic; Fix LED naming
This commit is contained in:
+9
-9
@@ -143,20 +143,20 @@ Installation Directories with Spaces in the Path
|
|||||||
Downloading from Repositories
|
Downloading from Repositories
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
Cloning the Repository
|
Cloning the Repository
|
||||||
|
|
||||||
The current NuttX du jour is available in from a GIT repository. Cloning
|
The current NuttX du jour is available in from a GIT repository. Cloning
|
||||||
instructions are available here:
|
instructions are available here:
|
||||||
|
|
||||||
https://sourceforge.net/p/nuttx/git
|
https://sourceforge.net/p/nuttx/git
|
||||||
|
|
||||||
Cloning NuttX Inside Cygwin
|
Cloning NuttX Inside Cygwin
|
||||||
|
|
||||||
If you are cloning the NuttX repository, it is recommended to avoid
|
If you are cloning the NuttX repository, it is recommended to avoid
|
||||||
automatic end of lines conversions by git. These conversions may break
|
automatic end of lines conversions by git. These conversions may break
|
||||||
some scripts like configure.sh. Before cloning, do the following:
|
some scripts like configure.sh. Before cloning, do the following:
|
||||||
|
|
||||||
git config --global core.autocrlf false
|
git config --global core.autocrlf false
|
||||||
|
|
||||||
Notes about Header Files
|
Notes about Header Files
|
||||||
------------------------
|
------------------------
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ static inline void efm32_setmode(uintptr_t base, uint8_t pin, uint8_t mode)
|
|||||||
|
|
||||||
regval = getreg32(regaddr);
|
regval = getreg32(regaddr);
|
||||||
regval &= ~((uint32_t)15 << shift);
|
regval &= ~((uint32_t)15 << shift);
|
||||||
regval |= ~((uint32_t)mode << shift);
|
regval |= (uint32_t)mode << shift;
|
||||||
putreg32(regval, regaddr);
|
putreg32(regval, regaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,15 +51,23 @@
|
|||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
#include "efm32_config.h"
|
#include "efm32_config.h"
|
||||||
#include "efm32_lowputc.h"
|
#include "efm32_lowputc.h"
|
||||||
#include "efm32_clockconfig.h"
|
#include "efm32_clockconfig.h"
|
||||||
#include "efm32_start.h"
|
#include "efm32_start.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
# include "nvic.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function prototypes
|
* Private Function prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
static inline void efm32_fpuconfig(void);
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#ifdef CONFIG_DEBUG_STACK
|
||||||
static void go_os_start(void *pv, unsigned int nbytes)
|
static void go_os_start(void *pv, unsigned int nbytes)
|
||||||
__attribute__ ((naked,no_instrument_function,noreturn));
|
__attribute__ ((naked,no_instrument_function,noreturn));
|
||||||
@@ -89,6 +97,96 @@ static void go_os_start(void *pv, unsigned int nbytes)
|
|||||||
# define showprogress(c)
|
# define showprogress(c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: efm32_fpuconfig
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the FPU. Relative bit settings:
|
||||||
|
*
|
||||||
|
* CPACR: Enables access to CP10 and CP11
|
||||||
|
* CONTROL.FPCA: Determines whether the FP extension is active in the
|
||||||
|
* current context:
|
||||||
|
* FPCCR.ASPEN: Enables automatic FP state preservation, then the
|
||||||
|
* processor sets this bit to 1 on successful completion of any FP
|
||||||
|
* instruction.
|
||||||
|
* FPCCR.LSPEN: Enables lazy context save of FP state. When this is
|
||||||
|
* done, the processor reserves space on the stack for the FP state,
|
||||||
|
* but does not save that state information to the stack.
|
||||||
|
*
|
||||||
|
* Software must not change the value of the ASPEN bit or LSPEN bit while either:
|
||||||
|
* - the CPACR permits access to CP10 and CP11, that give access to the FP
|
||||||
|
* extension, or
|
||||||
|
* - the CONTROL.FPCA bit is set to 1
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
#ifdef CONFIG_ARMV7M_CMNVECTOR
|
||||||
|
|
||||||
|
static inline void efm32_fpuconfig(void)
|
||||||
|
{
|
||||||
|
uint32_t regval;
|
||||||
|
|
||||||
|
/* Set CONTROL.FPCA so that we always get the extended context frame
|
||||||
|
* with the volatile FP registers stacked above the basic context.
|
||||||
|
*/
|
||||||
|
|
||||||
|
regval = getcontrol();
|
||||||
|
regval |= (1 << 2);
|
||||||
|
setcontrol(regval);
|
||||||
|
|
||||||
|
/* Ensure that FPCCR.LSPEN is disabled, so that we don't have to contend
|
||||||
|
* with the lazy FP context save behaviour. Clear FPCCR.ASPEN since we
|
||||||
|
* are going to turn on CONTROL.FPCA for all contexts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
regval = getreg32(NVIC_FPCCR);
|
||||||
|
regval &= ~((1 << 31) | (1 << 30));
|
||||||
|
putreg32(regval, NVIC_FPCCR);
|
||||||
|
|
||||||
|
/* Enable full access to CP10 and CP11 */
|
||||||
|
|
||||||
|
regval = getreg32(NVIC_CPACR);
|
||||||
|
regval |= ((3 << (2*10)) | (3 << (2*11)));
|
||||||
|
putreg32(regval, NVIC_CPACR);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static inline void efm32_fpuconfig(void)
|
||||||
|
{
|
||||||
|
uint32_t regval;
|
||||||
|
|
||||||
|
/* Clear CONTROL.FPCA so that we do not get the extended context frame
|
||||||
|
* with the volatile FP registers stacked in the saved context.
|
||||||
|
*/
|
||||||
|
|
||||||
|
regval = getcontrol();
|
||||||
|
regval &= ~(1 << 2);
|
||||||
|
setcontrol(regval);
|
||||||
|
|
||||||
|
/* Ensure that FPCCR.LSPEN is disabled, so that we don't have to contend
|
||||||
|
* with the lazy FP context save behaviour. Clear FPCCR.ASPEN since we
|
||||||
|
* are going to keep CONTROL.FPCA off for all contexts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
regval = getreg32(NVIC_FPCCR);
|
||||||
|
regval &= ~((1 << 31) | (1 << 30));
|
||||||
|
putreg32(regval, NVIC_FPCCR);
|
||||||
|
|
||||||
|
/* Enable full access to CP10 and CP11 */
|
||||||
|
|
||||||
|
regval = getreg32(NVIC_CPACR);
|
||||||
|
regval |= ((3 << (2*10)) | (3 << (2*11)));
|
||||||
|
putreg32(regval, NVIC_CPACR);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
# define efm32_fpuconfig()
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: go_os_start
|
* Name: go_os_start
|
||||||
*
|
*
|
||||||
@@ -149,6 +247,7 @@ void __start(void)
|
|||||||
/* Configure the uart so that we can get debug output as soon as possible */
|
/* Configure the uart so that we can get debug output as soon as possible */
|
||||||
|
|
||||||
efm32_clockconfig();
|
efm32_clockconfig();
|
||||||
|
efm32_fpuconfig();
|
||||||
efm32_lowsetup();
|
efm32_lowsetup();
|
||||||
showprogress('A');
|
showprogress('A');
|
||||||
|
|
||||||
@@ -179,7 +278,6 @@ void __start(void)
|
|||||||
/* Perform early serial initialization */
|
/* Perform early serial initialization */
|
||||||
|
|
||||||
up_earlyserialinit();
|
up_earlyserialinit();
|
||||||
|
|
||||||
showprogress('D');
|
showprogress('D');
|
||||||
|
|
||||||
/* For the case of the separate user-/kernel-space build, perform whatever
|
/* For the case of the separate user-/kernel-space build, perform whatever
|
||||||
@@ -193,6 +291,11 @@ void __start(void)
|
|||||||
showprogress('E');
|
showprogress('E');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialize onboard resources */
|
||||||
|
|
||||||
|
efm32_boardinitialize();
|
||||||
|
showprogress('F');
|
||||||
|
|
||||||
/* Then start NuttX */
|
/* Then start NuttX */
|
||||||
|
|
||||||
showprogress('\r');
|
showprogress('\r');
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ LEDs
|
|||||||
include/board.h and src/efm32_autoleds.c. The LEDs are used to
|
include/board.h and src/efm32_autoleds.c. The LEDs are used to
|
||||||
encode OS-related events as follows:
|
encode OS-related events as follows:
|
||||||
|
|
||||||
SYMBOL Meaning LED1* LED2 LED3 LED4
|
SYMBOL Meaning LED0* LED1 LED2 LED3
|
||||||
----------------- ----------------------- ------ ----- ----- ------
|
----------------- ----------------------- ------ ----- ----- ------
|
||||||
LED_STARTED NuttX has been started ON OFF OFF OFF
|
LED_STARTED NuttX has been started ON OFF OFF OFF
|
||||||
LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
|
LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
|
||||||
@@ -66,12 +66,12 @@ LEDs
|
|||||||
LED_PANIC The system has crashed N/C N/C N/C ON
|
LED_PANIC The system has crashed N/C N/C N/C ON
|
||||||
LED_IDLE STM32 is is sleep mode (Optional, not used)
|
LED_IDLE STM32 is is sleep mode (Optional, not used)
|
||||||
|
|
||||||
* If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
|
* If LED0, LED1, LED2 are statically on, then NuttX probably failed to boot
|
||||||
and these LEDs will give you some indication of where the failure was
|
and these LEDs will give you some indication of where the failure was
|
||||||
** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
|
** The normal state is LED2 ON and LED3 faintly glowing. This faint glow
|
||||||
is because of timer interrupt that result in the LED being illuminated
|
is because of timer interrupt that result in the LED being illuminated
|
||||||
on a small proportion of the time.
|
on a small proportion of the time.
|
||||||
*** LED2 may also flicker normally if signals are processed.
|
*** LED1 may also flicker normally if signals are processed.
|
||||||
|
|
||||||
SERIAL CONSOLE
|
SERIAL CONSOLE
|
||||||
==============
|
==============
|
||||||
|
|||||||
@@ -172,37 +172,32 @@
|
|||||||
|
|
||||||
/* LED index values for use with efm32_setled() */
|
/* LED index values for use with efm32_setled() */
|
||||||
|
|
||||||
#define BOARD_LED1 0
|
#define BOARD_LED0 0
|
||||||
#define BOARD_LED2 1
|
#define BOARD_LED1 1
|
||||||
#define BOARD_LED3 2
|
#define BOARD_LED2 2
|
||||||
#define BOARD_LED4 3
|
#define BOARD_LED3 3
|
||||||
#define BOARD_NLEDS 4
|
#define BOARD_NLEDS 4
|
||||||
|
|
||||||
#define BOARD_LED_GREEN BOARD_LED1
|
|
||||||
#define BOARD_LED_ORANGE BOARD_LED2
|
|
||||||
#define BOARD_LED_RED BOARD_LED3
|
|
||||||
#define BOARD_LED_BLUE BOARD_LED4
|
|
||||||
|
|
||||||
/* LED bits for use with efm32_setleds() */
|
/* LED bits for use with efm32_setleds() */
|
||||||
|
|
||||||
|
#define BOARD_LED0_BIT (1 << BOARD_LED0)
|
||||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||||
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||||
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
||||||
#define BOARD_LED4_BIT (1 << BOARD_LED4)
|
|
||||||
|
|
||||||
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on
|
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on
|
||||||
* board the EFM32 Gecko Starter Kit. The following definitions describe
|
* board the EFM32 Gecko Starter Kit. The following definitions describe
|
||||||
* how NuttX controls the LEDs in this configuration:
|
* how NuttX controls the LEDs in this configuration:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LED_STARTED 0 /* LED1 */
|
#define LED_STARTED 0 /* LED0 */
|
||||||
#define LED_HEAPALLOCATE 1 /* LED2 */
|
#define LED_HEAPALLOCATE 1 /* LED1 */
|
||||||
#define LED_IRQSENABLED 2 /* LED1 + LED2 */
|
#define LED_IRQSENABLED 2 /* LED0 + LED1 */
|
||||||
#define LED_STACKCREATED 3 /* LED3 */
|
#define LED_STACKCREATED 3 /* LED2 */
|
||||||
#define LED_INIRQ 4 /* LED1 + LED3 */
|
#define LED_INIRQ 4 /* LED0 + LED2 */
|
||||||
#define LED_SIGNAL 5 /* LED2 + LED3 */
|
#define LED_SIGNAL 5 /* LED1 + LED3 */
|
||||||
#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
|
#define LED_ASSERTION 6 /* LED0 + LED2 + LED2 */
|
||||||
#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
|
#define LED_PANIC 7 /* N/C + N/C + N/C + LED3 */
|
||||||
|
|
||||||
/* Pin routing **************************************************************/
|
/* Pin routing **************************************************************/
|
||||||
/* UART0:
|
/* UART0:
|
||||||
|
|||||||
@@ -78,13 +78,13 @@
|
|||||||
* value to the LED.
|
* value to the LED.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GPIO_LED1 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
#define GPIO_LED0 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
||||||
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN0)
|
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN0)
|
||||||
#define GPIO_LED2 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
#define GPIO_LED1 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
||||||
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN1)
|
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN1)
|
||||||
#define GPIO_LED3 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
#define GPIO_LED2 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
||||||
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN2)
|
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN2)
|
||||||
#define GPIO_LED4 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
#define GPIO_LED3 (GPIO_OUTPUT_WIREDOR_PULLDOWN|\
|
||||||
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN3)
|
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN3)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -72,10 +72,10 @@
|
|||||||
|
|
||||||
/* The following definitions map the encoded LED setting to GPIO settings */
|
/* The following definitions map the encoded LED setting to GPIO settings */
|
||||||
|
|
||||||
#define EFM32F4_LED1 (1 << 0)
|
#define EFM32_LED0 (1 << 0)
|
||||||
#define EFM32F4_LED2 (1 << 1)
|
#define EFM32_LED1 (1 << 1)
|
||||||
#define EFM32F4_LED3 (1 << 2)
|
#define EFM32_LED2 (1 << 2)
|
||||||
#define EFM32F4_LED4 (1 << 3)
|
#define EFM32_LED3 (1 << 3)
|
||||||
|
|
||||||
#define ON_SETBITS_SHIFT (0)
|
#define ON_SETBITS_SHIFT (0)
|
||||||
#define ON_CLRBITS_SHIFT (4)
|
#define ON_CLRBITS_SHIFT (4)
|
||||||
@@ -92,45 +92,45 @@
|
|||||||
#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
|
#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
|
||||||
#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
|
#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
|
||||||
|
|
||||||
#define LED_STARTED_ON_SETBITS ((EFM32F4_LED1) << ON_SETBITS_SHIFT)
|
#define LED_STARTED_ON_SETBITS ((EFM32_LED0) << ON_SETBITS_SHIFT)
|
||||||
#define LED_STARTED_ON_CLRBITS ((EFM32F4_LED2|EFM32F4_LED3|EFM32F4_LED4) << ON_CLRBITS_SHIFT)
|
#define LED_STARTED_ON_CLRBITS ((EFM32_LED1|EFM32_LED2|EFM32_LED3) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
|
#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
|
||||||
#define LED_STARTED_OFF_CLRBITS ((EFM32F4_LED1|EFM32F4_LED2|EFM32F4_LED3|EFM32F4_LED4) << OFF_CLRBITS_SHIFT)
|
#define LED_STARTED_OFF_CLRBITS ((EFM32_LED0|EFM32_LED1|EFM32_LED2|EFM32_LED3) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
#define LED_HEAPALLOCATE_ON_SETBITS ((EFM32F4_LED2) << ON_SETBITS_SHIFT)
|
#define LED_HEAPALLOCATE_ON_SETBITS ((EFM32_LED1) << ON_SETBITS_SHIFT)
|
||||||
#define LED_HEAPALLOCATE_ON_CLRBITS ((EFM32F4_LED1|EFM32F4_LED3|EFM32F4_LED4) << ON_CLRBITS_SHIFT)
|
#define LED_HEAPALLOCATE_ON_CLRBITS ((EFM32_LED0|EFM32_LED2|EFM32_LED3) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_HEAPALLOCATE_OFF_SETBITS ((EFM32F4_LED1) << OFF_SETBITS_SHIFT)
|
#define LED_HEAPALLOCATE_OFF_SETBITS ((EFM32_LED0) << OFF_SETBITS_SHIFT)
|
||||||
#define LED_HEAPALLOCATE_OFF_CLRBITS ((EFM32F4_LED2|EFM32F4_LED3|EFM32F4_LED4) << OFF_CLRBITS_SHIFT)
|
#define LED_HEAPALLOCATE_OFF_CLRBITS ((EFM32_LED1|EFM32_LED2|EFM32_LED3) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
#define LED_IRQSENABLED_ON_SETBITS ((EFM32F4_LED1|EFM32F4_LED2) << ON_SETBITS_SHIFT)
|
#define LED_IRQSENABLED_ON_SETBITS ((EFM32_LED0|EFM32_LED1) << ON_SETBITS_SHIFT)
|
||||||
#define LED_IRQSENABLED_ON_CLRBITS ((EFM32F4_LED3|EFM32F4_LED4) << ON_CLRBITS_SHIFT)
|
#define LED_IRQSENABLED_ON_CLRBITS ((EFM32_LED2|EFM32_LED3) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_IRQSENABLED_OFF_SETBITS ((EFM32F4_LED2) << OFF_SETBITS_SHIFT)
|
#define LED_IRQSENABLED_OFF_SETBITS ((EFM32_LED1) << OFF_SETBITS_SHIFT)
|
||||||
#define LED_IRQSENABLED_OFF_CLRBITS ((EFM32F4_LED1|EFM32F4_LED3|EFM32F4_LED4) << OFF_CLRBITS_SHIFT)
|
#define LED_IRQSENABLED_OFF_CLRBITS ((EFM32_LED0|EFM32_LED2|EFM32_LED3) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
#define LED_STACKCREATED_ON_SETBITS ((EFM32F4_LED3) << ON_SETBITS_SHIFT)
|
#define LED_STACKCREATED_ON_SETBITS ((EFM32_LED2) << ON_SETBITS_SHIFT)
|
||||||
#define LED_STACKCREATED_ON_CLRBITS ((EFM32F4_LED1|EFM32F4_LED2|EFM32F4_LED4) << ON_CLRBITS_SHIFT)
|
#define LED_STACKCREATED_ON_CLRBITS ((EFM32_LED0|EFM32_LED1|EFM32_LED3) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_STACKCREATED_OFF_SETBITS ((EFM32F4_LED1|EFM32F4_LED2) << OFF_SETBITS_SHIFT)
|
#define LED_STACKCREATED_OFF_SETBITS ((EFM32_LED0|EFM32_LED1) << OFF_SETBITS_SHIFT)
|
||||||
#define LED_STACKCREATED_OFF_CLRBITS ((EFM32F4_LED3|EFM32F4_LED4) << OFF_CLRBITS_SHIFT)
|
#define LED_STACKCREATED_OFF_CLRBITS ((EFM32_LED2|EFM32_LED3) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
#define LED_INIRQ_ON_SETBITS ((EFM32F4_LED1) << ON_SETBITS_SHIFT)
|
#define LED_INIRQ_ON_SETBITS ((EFM32_LED0) << ON_SETBITS_SHIFT)
|
||||||
#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||||
#define LED_INIRQ_OFF_CLRBITS ((EFM32F4_LED1) << OFF_CLRBITS_SHIFT)
|
#define LED_INIRQ_OFF_CLRBITS ((EFM32_LED0) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
#define LED_SIGNAL_ON_SETBITS ((EFM32F4_LED2) << ON_SETBITS_SHIFT)
|
#define LED_SIGNAL_ON_SETBITS ((EFM32_LED1) << ON_SETBITS_SHIFT)
|
||||||
#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||||
#define LED_SIGNAL_OFF_CLRBITS ((EFM32F4_LED2) << OFF_CLRBITS_SHIFT)
|
#define LED_SIGNAL_OFF_CLRBITS ((EFM32_LED1) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
#define LED_ASSERTION_ON_SETBITS ((EFM32F4_LED4) << ON_SETBITS_SHIFT)
|
#define LED_ASSERTION_ON_SETBITS ((EFM32_LED3) << ON_SETBITS_SHIFT)
|
||||||
#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||||
#define LED_ASSERTION_OFF_CLRBITS ((EFM32F4_LED4) << OFF_CLRBITS_SHIFT)
|
#define LED_ASSERTION_OFF_CLRBITS ((EFM32_LED3) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
#define LED_PANIC_ON_SETBITS ((EFM32F4_LED4) << ON_SETBITS_SHIFT)
|
#define LED_PANIC_ON_SETBITS ((EFM32_LED3) << ON_SETBITS_SHIFT)
|
||||||
#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||||
#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||||
#define LED_PANIC_OFF_CLRBITS ((EFM32F4_LED4) << OFF_CLRBITS_SHIFT)
|
#define LED_PANIC_OFF_CLRBITS ((EFM32_LED3) << OFF_CLRBITS_SHIFT)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@@ -169,48 +169,48 @@ static const uint16_t g_ledbits[8] =
|
|||||||
|
|
||||||
static inline void led_clrbits(unsigned int clrbits)
|
static inline void led_clrbits(unsigned int clrbits)
|
||||||
{
|
{
|
||||||
if ((clrbits & EFM32F4_LED1) != 0)
|
if ((clrbits & EFM32_LED0) != 0)
|
||||||
|
{
|
||||||
|
efm32_gpiowrite(GPIO_LED0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((clrbits & EFM32_LED1) != 0)
|
||||||
{
|
{
|
||||||
efm32_gpiowrite(GPIO_LED1, false);
|
efm32_gpiowrite(GPIO_LED1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((clrbits & EFM32F4_LED2) != 0)
|
if ((clrbits & EFM32_LED2) != 0)
|
||||||
{
|
{
|
||||||
efm32_gpiowrite(GPIO_LED2, false);
|
efm32_gpiowrite(GPIO_LED2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((clrbits & EFM32F4_LED3) != 0)
|
if ((clrbits & EFM32_LED3) != 0)
|
||||||
{
|
{
|
||||||
efm32_gpiowrite(GPIO_LED3, false);
|
efm32_gpiowrite(GPIO_LED3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((clrbits & EFM32F4_LED4) != 0)
|
|
||||||
{
|
|
||||||
efm32_gpiowrite(GPIO_LED4, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void led_setbits(unsigned int setbits)
|
static inline void led_setbits(unsigned int setbits)
|
||||||
{
|
{
|
||||||
if ((setbits & EFM32F4_LED1) != 0)
|
if ((setbits & EFM32_LED0) != 0)
|
||||||
|
{
|
||||||
|
efm32_gpiowrite(GPIO_LED0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((setbits & EFM32_LED1) != 0)
|
||||||
{
|
{
|
||||||
efm32_gpiowrite(GPIO_LED1, true);
|
efm32_gpiowrite(GPIO_LED1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setbits & EFM32F4_LED2) != 0)
|
if ((setbits & EFM32_LED2) != 0)
|
||||||
{
|
{
|
||||||
efm32_gpiowrite(GPIO_LED2, true);
|
efm32_gpiowrite(GPIO_LED2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setbits & EFM32F4_LED3) != 0)
|
if ((setbits & EFM32_LED3) != 0)
|
||||||
{
|
{
|
||||||
efm32_gpiowrite(GPIO_LED3, true);
|
efm32_gpiowrite(GPIO_LED3, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setbits & EFM32F4_LED4) != 0)
|
|
||||||
{
|
|
||||||
efm32_gpiowrite(GPIO_LED4, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void led_setonoff(unsigned int bits)
|
static void led_setonoff(unsigned int bits)
|
||||||
@@ -229,12 +229,12 @@ static void led_setonoff(unsigned int bits)
|
|||||||
|
|
||||||
void board_led_initialize(void)
|
void board_led_initialize(void)
|
||||||
{
|
{
|
||||||
/* Configure LED1-4 GPIOs for output */
|
/* Configure LED0-4 GPIOs for output */
|
||||||
|
|
||||||
|
efm32_configgpio(GPIO_LED0);
|
||||||
efm32_configgpio(GPIO_LED1);
|
efm32_configgpio(GPIO_LED1);
|
||||||
efm32_configgpio(GPIO_LED2);
|
efm32_configgpio(GPIO_LED2);
|
||||||
efm32_configgpio(GPIO_LED3);
|
efm32_configgpio(GPIO_LED3);
|
||||||
efm32_configgpio(GPIO_LED4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
static gpio_pinset_t g_ledcfg[BOARD_NLEDS] =
|
static gpio_pinset_t g_ledcfg[BOARD_NLEDS] =
|
||||||
{
|
{
|
||||||
GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4
|
GPIO_LED0, GPIO_LED1, GPIO_LED2, GPIO_LED3
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -193,12 +193,12 @@ static int led_pm_prepare(struct pm_callback_s *cb , enum pm_state_e pmstate)
|
|||||||
|
|
||||||
void efm32_ledinit(void)
|
void efm32_ledinit(void)
|
||||||
{
|
{
|
||||||
/* Configure LED1-4 GPIOs for output */
|
/* Configure LED0-4 GPIOs for output */
|
||||||
|
|
||||||
|
efm32_configgpio(GPIO_LED0);
|
||||||
efm32_configgpio(GPIO_LED1);
|
efm32_configgpio(GPIO_LED1);
|
||||||
efm32_configgpio(GPIO_LED2);
|
efm32_configgpio(GPIO_LED2);
|
||||||
efm32_configgpio(GPIO_LED3);
|
efm32_configgpio(GPIO_LED3);
|
||||||
efm32_configgpio(GPIO_LED4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -219,10 +219,10 @@ void efm32_setled(int led, bool ledon)
|
|||||||
|
|
||||||
void efm32_setleds(uint8_t ledset)
|
void efm32_setleds(uint8_t ledset)
|
||||||
{
|
{
|
||||||
efm32_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0);
|
efm32_gpiowrite(GPIO_LED0, (ledset & BOARD_LED0_BIT) != 0);
|
||||||
efm32_gpiowrite(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);
|
efm32_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) != 0);
|
||||||
efm32_gpiowrite(GPIO_LED3, (ledset & BOARD_LED3_BIT) == 0);
|
efm32_gpiowrite(GPIO_LED2, (ledset & BOARD_LED2_BIT) != 0);
|
||||||
efm32_gpiowrite(GPIO_LED4, (ledset & BOARD_LED4_BIT) == 0);
|
efm32_gpiowrite(GPIO_LED3, (ledset & BOARD_LED3_BIT) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user