SAMV7-XULT: Integrate button support and apps/examples/buttons into the NSH configuration
This commit is contained in:
parent
3d60cc7768
commit
90bc4b81ee
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
/* BAUD definitions
|
/* BAUD definitions
|
||||||
*
|
*
|
||||||
* The source clock is selectable and could be one of:
|
* The source clock is selectable and could be one of:
|
||||||
*
|
*
|
||||||
* - The peripheral clock
|
* - The peripheral clock
|
||||||
* - A division of the peripheral clock, where the divider is product-
|
* - A division of the peripheral clock, where the divider is product-
|
||||||
@ -406,7 +406,7 @@ void sam_lowsetup(void)
|
|||||||
{
|
{
|
||||||
/* Use the divided USART clock */
|
/* Use the divided USART clock */
|
||||||
|
|
||||||
divb3 = ((SLOW_USART_CLOCK + (SAM_CONSOLE_BAUD << 3)) << 3) /
|
divb3 = ((SLOW_USART_CLOCK + (SAM_CONSOLE_BAUD << 3)) << 3) /
|
||||||
(SAM_CONSOLE_BAUD << 4);
|
(SAM_CONSOLE_BAUD << 4);
|
||||||
intpart = (divb3 >> 3);
|
intpart = (divb3 >> 3);
|
||||||
fracpart = (divb3 & 7);
|
fracpart = (divb3 & 7);
|
||||||
|
@ -290,7 +290,7 @@
|
|||||||
|
|
||||||
/* BAUD definitions
|
/* BAUD definitions
|
||||||
*
|
*
|
||||||
* The source clock is selectable and could be one of:
|
* The source clock is selectable and could be one of:
|
||||||
*
|
*
|
||||||
* - The peripheral clock
|
* - The peripheral clock
|
||||||
* - A division of the peripheral clock, where the divider is product-
|
* - A division of the peripheral clock, where the divider is product-
|
||||||
|
@ -279,10 +279,39 @@ Configuration sub-directories
|
|||||||
3. NSH built-in applications are supported.
|
3. NSH built-in applications are supported.
|
||||||
|
|
||||||
Binary Formats:
|
Binary Formats:
|
||||||
CONFIG_BUILTIN=y : Enable support for built-in programs
|
CONFIG_BUILTIN=y : Enable support for built-in programs
|
||||||
|
|
||||||
Application Configuration:
|
Application Configuration:
|
||||||
CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line
|
CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line
|
||||||
|
|
||||||
|
3. The button test at apps/examples/buttons is included in the
|
||||||
|
configuration. This configuration illustrates (1) use of the buttons
|
||||||
|
on the evaluation board, and (2) the use of PIO interrupts. Example
|
||||||
|
usage:
|
||||||
|
|
||||||
|
NuttShell (NSH) NuttX-7.8
|
||||||
|
nsh> help
|
||||||
|
help usage: help [-v] [<cmd>]
|
||||||
|
...
|
||||||
|
Builtin Apps:
|
||||||
|
buttons
|
||||||
|
nsh> buttons 3
|
||||||
|
maxbuttons: 3
|
||||||
|
Attached handler at 4078f7 to button 0 [SW0], oldhandler:0
|
||||||
|
Attached handler at 4078e9 to button 1 [SW1], oldhandler:0
|
||||||
|
IRQ:125 Button 1:SW1 SET:00:
|
||||||
|
SW1 released
|
||||||
|
IRQ:125 Button 1:SW1 SET:02:
|
||||||
|
SW1 depressed
|
||||||
|
IRQ:125 Button 1:SW1 SET:00:
|
||||||
|
SW1 released
|
||||||
|
IRQ:90 Button 0:SW0 SET:01:
|
||||||
|
SW0 depressed
|
||||||
|
IRQ:90 Button 0:SW0 SET:00:
|
||||||
|
SW0 released
|
||||||
|
IRQ:125 Button 1:SW1 SET:02:
|
||||||
|
SW1 depressed
|
||||||
|
nsh>
|
||||||
|
|
||||||
4. Performance-related Configuration settings:
|
4. Performance-related Configuration settings:
|
||||||
|
|
||||||
@ -290,5 +319,6 @@ Configuration sub-directories
|
|||||||
CONFIG_ARMV7M_DCACHE=y : Data cache is enabled
|
CONFIG_ARMV7M_DCACHE=y : Data cache is enabled
|
||||||
CONFIG_ARCH_FPU=y : H/W floating point support is enabled
|
CONFIG_ARCH_FPU=y : H/W floating point support is enabled
|
||||||
CONFIG_ARCH_DPFPU=y : 64-bit H/W floating point support is enabled
|
CONFIG_ARCH_DPFPU=y : 64-bit H/W floating point support is enabled
|
||||||
|
|
||||||
# CONFIG_ARMV7M_ITCM is not set : Support not yet in place
|
# CONFIG_ARMV7M_ITCM is not set : Support not yet in place
|
||||||
# CONFIG_ARMV7M_DTCM is not set : Support not yet in place
|
# CONFIG_ARMV7M_DTCM is not set : Support not yet in place
|
||||||
|
@ -225,7 +225,12 @@ CONFIG_SAMV7_UART3=y
|
|||||||
# CONFIG_SAMV7_USART2 is not set
|
# CONFIG_SAMV7_USART2 is not set
|
||||||
# CONFIG_SAMV7_WDT0 is not set
|
# CONFIG_SAMV7_WDT0 is not set
|
||||||
# CONFIG_SAMV7_WDT1 is not set
|
# CONFIG_SAMV7_WDT1 is not set
|
||||||
# CONFIG_SAMV7_GPIO_IRQ is not set
|
CONFIG_SAMV7_GPIO_IRQ=y
|
||||||
|
CONFIG_SAMV7_GPIOA_IRQ=y
|
||||||
|
CONFIG_SAMV7_GPIOB_IRQ=y
|
||||||
|
# CONFIG_SAMV7_GPIOC_IRQ is not set
|
||||||
|
# CONFIG_SAMV7_GPIOD_IRQ is not set
|
||||||
|
# CONFIG_SAMV7_GPIOE_IRQ is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Architecture Options
|
# Architecture Options
|
||||||
@ -296,8 +301,9 @@ CONFIG_ARCH_BOARD="samv71-xult"
|
|||||||
CONFIG_ARCH_HAVE_LEDS=y
|
CONFIG_ARCH_HAVE_LEDS=y
|
||||||
CONFIG_ARCH_LEDS=y
|
CONFIG_ARCH_LEDS=y
|
||||||
CONFIG_ARCH_HAVE_BUTTONS=y
|
CONFIG_ARCH_HAVE_BUTTONS=y
|
||||||
# CONFIG_ARCH_BUTTONS is not set
|
CONFIG_ARCH_BUTTONS=y
|
||||||
CONFIG_ARCH_HAVE_IRQBUTTONS=y
|
CONFIG_ARCH_HAVE_IRQBUTTONS=y
|
||||||
|
CONFIG_ARCH_IRQBUTTONS=y
|
||||||
CONFIG_NSH_MMCSDMINOR=0
|
CONFIG_NSH_MMCSDMINOR=0
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -510,7 +516,6 @@ CONFIG_MCU_SERIAL=y
|
|||||||
CONFIG_STANDARD_SERIAL=y
|
CONFIG_STANDARD_SERIAL=y
|
||||||
# CONFIG_SERIAL_IFLOWCONTROL is not set
|
# CONFIG_SERIAL_IFLOWCONTROL is not set
|
||||||
# CONFIG_SERIAL_OFLOWCONTROL is not set
|
# CONFIG_SERIAL_OFLOWCONTROL is not set
|
||||||
# CONFIG_SERIAL_TIOCSERGSTRUCT is not set
|
|
||||||
CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y
|
CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y
|
||||||
# CONFIG_SERIAL_TERMIOS is not set
|
# CONFIG_SERIAL_TERMIOS is not set
|
||||||
CONFIG_UART3_SERIAL_CONSOLE=y
|
CONFIG_UART3_SERIAL_CONSOLE=y
|
||||||
@ -673,7 +678,19 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024
|
|||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
#
|
#
|
||||||
# CONFIG_EXAMPLES_BUTTONS is not set
|
CONFIG_EXAMPLES_BUTTONS=y
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_MIN=0
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_MAX=1
|
||||||
|
CONFIG_EXAMPLES_IRQBUTTONS_MIN=0
|
||||||
|
CONFIG_EXAMPLES_IRQBUTTONS_MAX=1
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME0="SW0"
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME1="SW1"
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME2="Button 2"
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME3="Button 3"
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME4="Button 4"
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME5="Button 5"
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME6="Button 6"
|
||||||
|
CONFIG_EXAMPLES_BUTTONS_NAME7="Button 7"
|
||||||
# CONFIG_EXAMPLES_CAN is not set
|
# CONFIG_EXAMPLES_CAN is not set
|
||||||
# CONFIG_EXAMPLES_CONFIGDATA is not set
|
# CONFIG_EXAMPLES_CONFIGDATA is not set
|
||||||
# CONFIG_EXAMPLES_CPUHOG is not set
|
# CONFIG_EXAMPLES_CPUHOG is not set
|
||||||
|
@ -48,8 +48,10 @@
|
|||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
#include "sam_gpio.h"
|
#include "sam_gpio.h"
|
||||||
#include "samv7i-xult.h"
|
#include "chip/sam_matrix.h"
|
||||||
|
#include "samv71-xult.h"
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
@ -61,10 +63,19 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
#define HAVE_IRQBUTTONS 1
|
||||||
|
#if !defined(CONFIG_SAMV7_GPIO1_IRQ) && !defined(CONFIG_SAMV7_GPIOB_IRQ)
|
||||||
|
# undef HAVE_IRQBUTTONS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
|
#ifdef CONFIG_SAMV7_GPIOA_IRQ
|
||||||
static xcpt_t g_irq_sw0;
|
static xcpt_t g_irq_sw0;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SAMV7_GPIOB_IRQ
|
||||||
static xcpt_t g_irq_sw1;
|
static xcpt_t g_irq_sw1;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@ -78,7 +89,7 @@ static xcpt_t g_irq_sw1;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
#ifdef HAVE_IRQBUTTONS
|
||||||
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||||
xcpt_t irqhandler, xcpt_t *store)
|
xcpt_t irqhandler, xcpt_t *store)
|
||||||
{
|
{
|
||||||
@ -139,10 +150,18 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
|||||||
|
|
||||||
void board_button_initialize(void)
|
void board_button_initialize(void)
|
||||||
{
|
{
|
||||||
#warning Missing logic
|
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
|
/* PB12 is set up as a system flash ERASE pin when the firmware boots. To
|
||||||
* the MATRIX module. For more information see the SAM V71 datasheet.
|
* 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 V71 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_SW0);
|
||||||
(void)sam_configgpio(GPIO_SW1);
|
(void)sam_configgpio(GPIO_SW1);
|
||||||
@ -187,20 +206,32 @@ uint8_t board_buttons(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_IRQBUTTONS
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SAMV7_GPIOA_IRQ
|
||||||
case BUTTON_SW0:
|
case BUTTON_SW0:
|
||||||
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0);
|
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SAMV7_GPIOB_IRQ
|
||||||
case BUTTON_SW1:
|
case BUTTON_SW1:
|
||||||
return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, &g_irq_sw1);
|
return board_button_irqx(GPIO_SW1, IRQ_SW1, irqhandler, &g_irq_sw1);
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user