diff --git a/configs/same70-xplained/README.txt b/configs/same70-xplained/README.txt index 0d8f87e8069..ca8a69e035f 100644 --- a/configs/same70-xplained/README.txt +++ b/configs/same70-xplained/README.txt @@ -2,7 +2,7 @@ README ====== This README file discusses the port of NuttX to the Atmel SAM E70 Xplained -Evaluation Kit (SAME70-XPLD). This board features the ATSAMV70Q21 Cortex-M7 +Evaluation Kit (ATSAME70-XPLD). This board features the ATSAME70Q21 Cortex-M7 microcontroller. Contents @@ -241,69 +241,39 @@ LEDs and Buttons LEDs ---- -There are two yellow LED available on the SAM E70 Xplained board that can be -turned on and off. The LEDs can be activated by driving the connected I/O -line to GND. - - ------ ----------- --------------------- - SAME70 Function Shared functionality - PIO - ------ ----------- --------------------- - PA23 Yellow LED0 EDBG GPIO - PC09 Yellow LED1 LCD, and Shield - ------ ----------- --------------------- +A single LED is available driven by PC8. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is defined. In that case, the usage by the board port is defined in include/board.h and src/sam_autoleds.c. The LEDs are used to encode OS-related events as follows: - ------------------- ----------------------- -------- -------- - SYMBOL Meaning LED state - LED0 LED1 - ------------------- ----------------------- -------- -------- - LED_STARTED NuttX has been started OFF OFF - LED_HEAPALLOCATE Heap has been allocated OFF OFF - LED_IRQSENABLED Interrupts enabled OFF OFF - LED_STACKCREATED Idle stack created ON OFF - LED_INIRQ In an interrupt No change - LED_SIGNAL In a signal handler No change - LED_ASSERTION An assertion failed No change - LED_PANIC The system has crashed N/C Blinking - LED_IDLE MCU is is sleep mode Not used - ------------------- ----------------------- -------- -------- + ------------------- ----------------------- ------ + SYMBOL Meaning LED + ------------------- ----------------------- ------ + LED_STARTED NuttX has been started OFF + LED_HEAPALLOCATE Heap has been allocated OFF + LED_IRQSENABLED Interrupts enabled OFF + LED_STACKCREATED Idle stack created ON + LED_INIRQ In an interrupt N/C + LED_SIGNAL In a signal handler N/C + LED_ASSERTION An assertion failed N/C + LED_PANIC The system has crashed FLASH -Thus if LED0 is statically on, NuttX has successfully booted and is, -apparently, running normally. If LED1 is flashing at approximately +Thus is LED is statically on, NuttX has successfully booted and is, +apparently, running normally. If LED is flashing at approximately 2Hz, then a fatal error has been detected and the system has halted. -NOTE: That LED0 is not used after completion of booting and may -be used by other board-specific logic. - Buttons ------- -SAM E70 Xplained contains three mechanical buttons. One button is the RESET -button connected to the SAM E70 reset line and the others are generic user -configurable buttons. When a button is pressed it will drive the I/O line -to GND. +SAM E70 Xplained contains two mechanical buttons. One button is the RESET +button connected to the SAM E70 reset line and the other, PA11, is a generic +user configurable button. When a button is pressed it will drive the I/O +line to GND. - ------ ----------- --------------------- - SAME70 Function Shared functionality - PIO - ------ ----------- --------------------- - RESET RESET Trace, Shield, and EDBG - PA09 SW0 EDBG GPIO and Camera - PB12 SW1 EDBG SWD and Chip Erase - ------ ----------- --------------------- - -NOTES: - - - There are no pull-up resistors connected to the generic user buttons so - it is necessary to enable the internal pull-up in the SAM E70 to use the - button. - - PB12 is set up as a system flash ERASE pin when the firmware boots. To - use the SW1, PB12 has to be configured as a normal regular I/O pin in - the MATRIX module. For more information see the SAM E70 datasheet. +NOTE: There are no pull-up resistors connected to the generic user buttons +so it is necessary to enable the internal pull-up in the SAM E70 to use the +button. AT24MAC402 Serial EEPROM ======================== diff --git a/configs/same70-xplained/include/board.h b/configs/same70-xplained/include/board.h index 9923384f719..a8577f84e7d 100644 --- a/configs/same70-xplained/include/board.h +++ b/configs/same70-xplained/include/board.h @@ -187,93 +187,59 @@ /* LED definitions ******************************************************************/ /* LEDs * - * There are two yellow LED available on the SAM E70 Xplained board that can - * be turned on and off. The LEDs can be activated by driving the connected - * I/O line to GND. - * - * ------ ----------- --------------------- - * SAME70 Function Shared functionality - * PIO - * ------ ----------- --------------------- - * PA23 Yellow LED0 EDBG GPIO - * PC09 Yellow LED1 LCD, and Shield - * ------ ----------- --------------------- - * - * If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any - * way. The following definitions are used to access individual LEDs. + * A single LED is available driven by PC8. */ /* LED index values for use with board_userled() */ #define BOARD_LED0 0 -#define BOARD_LED1 1 -#define BOARD_NLEDS 2 +#define BOARD_NLEDS 1 /* LED bits for use with board_userled_all() */ #define BOARD_LED0_BIT (1 << BOARD_LED0) -#define BOARD_LED1_BIT (1 << BOARD_LED1) /* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is * defined. In that case, the usage by the board port is defined in * include/board.h and src/sam_autoleds.c. The LEDs are used to encode * OS-related events as follows: * - * SYMBOL Meaning LED state - * LED2 LED1 - * ------------------------ -------------------------- ------ ------ */ + * ------------------- ---------------------------- ------ + * SYMBOL Meaning LED + * ------------------- ---------------------------- ------ */ -#define LED_STARTED 0 /* NuttX has been started OFF OFF */ -#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */ -#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */ -#define LED_STACKCREATED 1 /* Idle stack created ON OFF */ -#define LED_INIRQ 2 /* In an interrupt No change */ -#define LED_SIGNAL 2 /* In a signal handler No change */ -#define LED_ASSERTION 2 /* An assertion failed No change */ -#define LED_PANIC 3 /* The system has crashed N/C Blinking */ -#undef LED_IDLE /* MCU is is sleep mode Not used */ +#define LED_STARTED 0 /* NuttX has been started OFF */ +#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */ +#define LED_IRQSENABLED 0 /* Interrupts enabled OFF */ +#define LED_STACKCREATED 1 /* Idle stack created ON */ +#define LED_INIRQ 2 /* In an interrupt N/C */ +#define LED_SIGNAL 2 /* In a signal handler N/C */ +#define LED_ASSERTION 2 /* An assertion failed N/C */ +#define LED_PANIC 3 /* The system has crashed FLASH */ +#undef LED_IDLE /* MCU is is sleep mode Not used */ -/* Thus if LED0 is statically on, NuttX has successfully booted and is, - * apparently, running normally. If LED1 is flashing at approximately +/* Thus is LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If LED is flashing at approximately * 2Hz, then a fatal error has been detected and the system has halted. - * - * NOTE: That LED0 is not used after completion of booting and may - * be used by other board-specific logic. */ /* Button definitions ***************************************************************/ /* Buttons * - * SAM E70 Xplained contains three mechanical buttons. One button is the RESET - * button connected to the SAM E70 reset line and the others are generic user - * configurable buttons. When a button is pressed it will drive the I/O line - * to GND. + * SAM E70 Xplained contains two mechanical buttons. One button is the RESET + * button connected to the SAM E70 reset line and the other, PA11, is a generic + * user configurable button. When a button is pressed it will drive the I/O + * line to GND. * - * ------ ----------- --------------------- - * SAME70 Function Shared functionality - * PIO - * ------ ----------- --------------------- - * RESET RESET Trace, Shield, and EDBG - * PA09 SW0 EDBG GPIO and Camera - * PB12 SW1 EDBG SWD and Chip Erase - * ------ ----------- --------------------- - * - * NOTES: - * - * - There are no pull-up resistors connected to the generic user buttons so - * it is necessary to enable the internal pull-up in the SAM E70 to use the - * button. - * - PB12 is set up as a system flash ERASE pin when the firmware boots. To - * use the SW1, PB12 has to be configured as a normal regular I/O pin in - * the MATRIX module. For more information see the SAM E70 datasheet. + * NOTE: There are no pull-up resistors connected to the generic user buttons + * so it is necessary to enable the internal pull-up in the SAM E70 to use the + * button. */ #define BUTTON_SW0 0 -#define BUTTON_SW1 1 -#define NUM_BUTTONS 2 +#define NUM_BUTTONS 1 #define BUTTON_SW0_BIT (1 << BUTTON_SW0) -#define BUTTON_SW1_BIT (1 << BUTTON_SW1) /* PIO Disambiguation ***************************************************************/ /* Serial Console diff --git a/configs/same70-xplained/src/sam_autoleds.c b/configs/same70-xplained/src/sam_autoleds.c index 96c80a1b6ec..8fda597e741 100644 --- a/configs/same70-xplained/src/sam_autoleds.c +++ b/configs/same70-xplained/src/sam_autoleds.c @@ -35,44 +35,28 @@ /* LEDs * - * There are two yellow LED available on the SAM E70 Xplained board that - * can be turned on and off. The LEDs can be activated by driving the - * connected I/O line to GND. - * - * ------ ----------- --------------------- - * SAME70 Function Shared functionality - * PIO - * ------ ----------- --------------------- - * PA23 Yellow LED0 EDBG GPIO - * PC09 Yellow LED1 LCD, and Shield - * ------ ----------- --------------------- + * A single LED is available driven by PC8. * * These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is * defined. In that case, the usage by the board port is defined in * include/board.h and src/sam_autoleds.c. The LEDs are used to encode * OS-related events as follows: * - * ------------------- ----------------------- -------- -------- - * SYMBOL Meaning LED state - * LED0 LED1 - * ------------------- ----------------------- -------- -------- - * LED_STARTED NuttX has been started OFF OFF - * LED_HEAPALLOCATE Heap has been allocated OFF OFF - * LED_IRQSENABLED Interrupts enabled OFF OFF - * LED_STACKCREATED Idle stack created ON OFF - * LED_INIRQ In an interrupt No change - * LED_SIGNAL In a signal handler No change - * LED_ASSERTION An assertion failed No change - * LED_PANIC The system has crashed N/C Blinking - * LED_IDLE MCU is is sleep mode Not used - * ------------------- ----------------------- -------- -------- + * ------------------- ----------------------- ------ + * SYMBOL Meaning LED + * ------------------- ----------------------- ------ + * LED_STARTED NuttX has been started OFF + * LED_HEAPALLOCATE Heap has been allocated OFF + * LED_IRQSENABLED Interrupts enabled OFF + * LED_STACKCREATED Idle stack created ON + * LED_INIRQ In an interrupt N/C + * LED_SIGNAL In a signal handler N/C + * LED_ASSERTION An assertion failed N/C + * LED_PANIC The system has crashed FLASH * - * Thus if LED0 is statically on, NuttX has successfully booted and is, - * apparently, running normally. If LED1 is flashing at approximately + * Thus is LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If LED is flashing at approximately * 2Hz, then a fatal error has been detected and the system has halted. - * - * NOTE: That LED0 is not used after completion of booting and may - * be used by other board-specific logic. */ /**************************************************************************** @@ -130,7 +114,6 @@ void board_autoled_initialize(void) /* Configure LED PIOs for output */ sam_configgpio(GPIO_LED0); - sam_configgpio(GPIO_LED1); } /**************************************************************************** @@ -139,22 +122,9 @@ void board_autoled_initialize(void) void board_autoled_on(int led) { - switch (led) + if (led == 1 || led == 3) { - case 0: /* LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED */ - break; - - case 1: /* LED_STACKCREATED */ - sam_gpiowrite(GPIO_LED0, false); /* Low illuminates */ - break; - - default: - case 2: /* LED_INIRQ, LED_SIGNAL, LED_ASSERTION */ - return; - - case 3: /* LED_PANIC */ - sam_gpiowrite(GPIO_LED1, false); /* Low illuminates */ - break; + sam_gpiowrite(GPIO_LED0, false); /* Low illuminates */ } } @@ -166,7 +136,7 @@ void board_autoled_off(int led) { if (led == 3) { - sam_gpiowrite(GPIO_LED1, true); /* High extinguishes */ + sam_gpiowrite(GPIO_LED0, true); /* High extinguishes */ } } diff --git a/configs/same70-xplained/src/sam_buttons.c b/configs/same70-xplained/src/sam_buttons.c index b005fd937a3..040af796a50 100644 --- a/configs/same70-xplained/src/sam_buttons.c +++ b/configs/same70-xplained/src/sam_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/sam4e-ek/src/sam_buttons.c * - * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -66,16 +66,13 @@ #ifdef CONFIG_ARCH_IRQBUTTONS #define HAVE_IRQBUTTONS 1 -#if !defined(CONFIG_SAMV7_GPIOA_IRQ) && !defined(CONFIG_SAMV7_GPIOB_IRQ) +#ifndef CONFIG_SAMV7_GPIOA_IRQ # undef HAVE_IRQBUTTONS #endif #ifdef CONFIG_SAMV7_GPIOA_IRQ static xcpt_t g_irq_sw0; #endif -#ifdef CONFIG_SAMV7_GPIOB_IRQ -static xcpt_t g_irq_sw1; -#endif #endif /**************************************************************************** @@ -151,21 +148,9 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq, void board_button_initialize(void) { - uint32_t regval; - - /* PB12 is set up as a system flash ERASE pin when the firmware boots. To - * use the SW1, PB12 has to be configured as a normal regular I/O pin in - * the MATRIX module. For more information see the SAM E70 datasheet. - */ - - regval = getreg32(SAM_MATRIX_CCFG_SYSIO); - regval |= MATRIX_CCFG_SYSIO_SYSIO12; - putreg32(regval, SAM_MATRIX_CCFG_SYSIO); - /* Configure button PIOs */ (void)sam_configgpio(GPIO_SW0); - (void)sam_configgpio(GPIO_SW1); } /**************************************************************************** @@ -181,12 +166,7 @@ void board_button_initialize(void) uint8_t board_buttons(void) { - uint8_t retval; - - retval = sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; - retval |= sam_gpioread(GPIO_SW1) ? 0 : BUTTON_SW1_BIT; - - return retval; + return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; } /**************************************************************************** @@ -211,28 +191,14 @@ uint8_t board_buttons(void) xcpt_t board_button_irq(int id, xcpt_t irqhandler) { #ifdef HAVE_IRQBUTTONS - - switch (id) + if (id == BUTTON_SW0) { -#ifdef CONFIG_SAMV7_GPIOA_IRQ - case BUTTON_SW0: - return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0); -#endif - -#ifdef CONFIG_SAMV7_GPIOB_IRQ - case BUTTON_SW1: - return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, &g_irq_sw1); -#endif - - default: - return NULL; + return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0); } - -#else +#endif return NULL; -#endif } #endif diff --git a/configs/same70-xplained/src/sam_userleds.c b/configs/same70-xplained/src/sam_userleds.c index 5116ee14f1f..a805f0ea689 100644 --- a/configs/same70-xplained/src/sam_userleds.c +++ b/configs/same70-xplained/src/sam_userleds.c @@ -69,7 +69,6 @@ void board_userled_initialize(void) /* Configure LED PIOs for output */ sam_configgpio(GPIO_LED0); - sam_configgpio(GPIO_LED1); } /**************************************************************************** @@ -78,22 +77,10 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - uint32_t ledcfg; - if (led == BOARD_LED0) { - ledcfg = GPIO_LED0; + sam_gpiowrite(GPIO_LED0, !ledon); /* Low illuminates */ } - else if (led == BOARD_LED1) - { - ledcfg = GPIO_LED1; - } - else - { - return; - } - - sam_gpiowrite(ledcfg, !ledon); /* Low illuminates */ } /**************************************************************************** @@ -104,6 +91,5 @@ void board_userled_all(uint8_t ledset) { /* Low illuminates */ - sam_gpiowrite(GPIO_LED0, (ledset & BOARD_LED0_BIT) == 0); - sam_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0); + sam_gpiowrite(GPIO_LED0, (ledset & BOARD_LED0_BIT) == 0)); } diff --git a/configs/same70-xplained/src/same70-xplained.h b/configs/same70-xplained/src/same70-xplained.h index 1d4fd4ef5a2..f65f501a14a 100644 --- a/configs/same70-xplained/src/same70-xplained.h +++ b/configs/same70-xplained/src/same70-xplained.h @@ -228,57 +228,27 @@ /* LEDs * - * There are two yellow LED available on the SAM E70 Xplained board that can - * be turned on and off. The LEDs can be activated by driving the connected - * I/O line to GND. - * - * ------ ----------- --------------------- - * SAME70 Function Shared functionality - * PIO - * ------ ----------- --------------------- - * PA23 Yellow LED0 EDBG GPIO - * PC09 Yellow LED1 LCD, and Shield - * ------ ----------- --------------------- + * A single LED is available driven by PC8. */ #define GPIO_LED0 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ - GPIO_PORT_PIOA | GPIO_PIN23) -#define GPIO_LED1 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ - GPIO_PORT_PIOC | GPIO_PIN9) + GPIO_PORT_PIOC | GPIO_PIN8) /* Buttons * - * SAM E70 Xplained contains three mechanical buttons. One button is the - * RESET button connected to the SAME70 reset line and the others are generic - * user configurable buttons. When a button is pressed it will drive the I/O + * SAM E70 Xplained contains two mechanical buttons. One button is the RESET + * button connected to the SAM E70 reset line and the other, PA11, is a generic + * user configurable button. When a button is pressed it will drive the I/O * line to GND. * - * ------ ----------- --------------------- - * SAME70 Function Shared functionality - * PIO - * ------ ----------- --------------------- - * RESET RESET Trace, Shield, and EDBG - * PA09 SW0 EDBG GPIO and Camera - * PB12 SW1 EDBG SWD and Chip Erase - * ------ ----------- --------------------- - * - * NOTES: - * - * - There are no pull-up resistors connected to the generic user buttons so - * it is necessary to enable the internal pull-up in the SAM E70 to use the - * button. - * - PB12 is set up as a system flash ERASE pin when the firmware boots. To - * use the SW1, PB12 has to be configured as a normal regular I/O pin in - * the MATRIX module. For more information see the SAM E70 datasheet. + * NOTE: There are no pull-up resistors connected to the generic user buttons + * so it is necessary to enable the internal pull-up in the SAM E70 to use the + * button. */ #define GPIO_SW0 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \ - GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN9) -#define GPIO_SW1 (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \ - GPIO_INT_BOTHEDGES | GPIO_PORT_PIOB | GPIO_PIN12) - -#define IRQ_SW0 SAM_IRQ_PA9 -#define IRQ_SW1 SAM_IRQ_PB12 + GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN11) +#define IRQ_SW0 SAM_IRQ_PA11 /* HSMCI SD Card Detect *