Minimal changes to get a clean compilation of the SAMD20 Xplained configuration. Still a lot of missing logic

This commit is contained in:
Gregory Nutt 2014-02-13 09:14:03 -06:00
parent a0cb3588a5
commit f0c1cedab7
8 changed files with 73 additions and 73 deletions

View File

@ -480,7 +480,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
# CONFIG_C99_BOOL8 is not set
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_CXX_NEWLONG=y
# CONFIG_CXX_NEWLONG is not set
#
# uClibc++ Standard C++ Library

View File

@ -71,7 +71,7 @@
#include <arch/board/board.h>
#include "sam_gpio.h"
#include "sam_port.h"
#include "samd20-xplained.h"
#ifdef CONFIG_ARCH_LEDS
@ -110,7 +110,7 @@
void board_led_initialize(void)
{
(void)sam_configgpio(GPIO_STATUS_LED);
(void)sam_configport(PORT_STATUS_LED);
}
/****************************************************************************
@ -140,7 +140,7 @@ void board_led_on(int led)
break;
}
sam_gpiowrite(GPIO_STATUS_LED, ledstate);
sam_portwrite(PORT_STATUS_LED, ledstate);
}
/****************************************************************************
@ -169,7 +169,7 @@ void board_led_off(int led)
/* Turn STATUS LED off set driving the output high */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
sam_gpiowrite(GPIO_STATUS_LED, true);
sam_portwrite(PORT_STATUS_LED, true);
break;
}
}

View File

@ -47,7 +47,7 @@
#include <arch/irq.h>
#include <arch/board/board.h>
#include "sam_gpio.h"
#include "sam_port.h"
#include "samd20-xplained.h"
#ifdef CONFIG_ARCH_BUTTONS
@ -60,7 +60,7 @@
* Private Data
****************************************************************************/
#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
static xcpt_t g_irqsw0;
#endif
@ -85,7 +85,7 @@ static xcpt_t g_irqsw0;
void board_button_initialize(void)
{
(void)sam_configgpio(GPIO_SW0);
(void)sam_configport(PORT_SW0);
}
/************************************************************************************
@ -101,7 +101,7 @@ void board_button_initialize(void)
uint8_t board_buttons(void)
{
return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT;
return sam_portread(PORT_SW0) ? 0 : BUTTON_SW0_BIT;
}
/****************************************************************************
@ -114,15 +114,15 @@ uint8_t board_buttons(void)
* handler address isreturned (so that it may restored, if so desired).
*
* Configuration Notes:
* Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the
* overall GPIO IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or
* CONFIG_AVR32_GPIOIRQSETB must be enabled to select GPIOs to support
* Configuration CONFIG_AVR32_PORTIRQ must be selected to enable the
* overall PORT IRQ feature and CONFIG_AVR32_PORTIRQSETA and/or
* CONFIG_AVR32_PORTIRQSETB must be enabled to select PORTs to support
* interrupts on. For button support, bits 2 and 3 must be set in
* CONFIG_AVR32_GPIOIRQSETB (PB2 and PB3).
* CONFIG_AVR32_PORTIRQSETB (PB2 and PB3).
*
****************************************************************************/
#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
#if defined(CONFIG_PORTA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
xcpt_t oldhandler = NULL;
@ -144,9 +144,9 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
/* Configure the interrupt */
sam_gpioirq(IRQ_SW0);
sam_portirq(IRQ_SW0);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_gpioirqenable(IRQ_SW0);
sam_portirqenable(IRQ_SW0);
irqrestore(flags);
}

View File

@ -42,6 +42,7 @@
#include <stdio.h>
#include <debug.h>
#include "sam_config.h"
#include "samd20-xplained.h"
/****************************************************************************

View File

@ -46,7 +46,7 @@
#include <nuttx/spi/spi.h>
#include "sam_config.h"
#include "sam_gpio.h"
#include "sam_port.h"
#include "sam_spi.h"
#include "samd20-xplained.h"
@ -92,7 +92,7 @@
* Name: sam_spiinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the SAM3U10E-EVAL board.
* Called to configure SPI chip select PORT pins for the SAM3U10E-EVAL board.
*
************************************************************************************/
@ -105,13 +105,13 @@ void weak_function sam_spiinitialize(void)
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
/* TODO: enable interrupt on card detect */
sam_configgpio(GPIO_SD_CD); /* Card detect input */
sam_configgpio(GPIO_SD_CS); /* Chip select output */
sam_configport(PORT_SD_CD); /* Card detect input */
sam_configport(PORT_SD_CS); /* Chip select output */
#endif
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
sam_configgpio(GPIO_OLED_DATA); /* Command/data */
sam_configgpio(GPIO_OLED_CS); /* Card detect input */
sam_configport(PORT_OLED_DATA); /* Command/data */
sam_configport(PORT_OLED_CS); /* Card detect input */
#endif
}
@ -134,10 +134,10 @@ void weak_function sam_spiinitialize(void)
* pins.
* 2. Provide sam_spiselect() and sam_spistatus() functions in your board-
* specific logic. These functions will perform chip selection and
* status operations using GPIOs in the way your board is configured.
* status operations using PORTs in the way your board is configured.
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
* sam_spicmddata() functions in your board-specific logic. This
* function will perform cmd/data selection operations using GPIOs in
* function will perform cmd/data selection operations using PORTs in
* the way your board is configured.
* 3. Add a call to up_spiinitialize() in your low level application
* initialization logic
@ -159,9 +159,9 @@ void weak_function sam_spiinitialize(void)
* a stub.
*
* An alternative way to program the PIO chip select pins is as a normal
* GPIO output. In that case, the automatic control of the CS pins is
* PORT output. In that case, the automatic control of the CS pins is
* bypassed and this function must provide control of the chip select.
* NOTE: In this case, the GPIO output pin does *not* have to be the
* NOTE: In this case, the PORT output pin does *not* have to be the
* same as the NPCS pin normal associated with the chip select number.
*
* Input Parameters:
@ -182,7 +182,7 @@ void sam_spiselect(enum spi_dev_e devid, bool selected)
{
/* Active low */
sam_gpiowrite(GPIO_SD_CS, !selected);
sam_portwrite(PORT_SD_CS, !selected);
}
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
@ -197,7 +197,7 @@ void sam_spiselect(enum spi_dev_e devid, bool selected)
{
/* Active low */
sam_gpiowrite(GPIO_OLED_CS, !selected);
sam_portwrite(PORT_OLED_CS, !selected);
}
#endif
}
@ -227,7 +227,7 @@ uint8_t sam_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
/* Active low */
if (!sam_gpioread(GPIO_SD_CD))
if (!sam_portread(PORT_SD_CD))
{
ret |= SPI_STATUS_PRESENT;
}
@ -251,7 +251,7 @@ uint8_t sam_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
* may be configured to use 9-bit data transfers with the 9th bit
* indicating command or data. That same hardware may be configurable,
* instead, to use 8-bit data but to require an additional, board-
* specific GPIO control to distinguish command and data. This function
* specific PORT control to distinguish command and data. This function
* would be needed in that latter case.
*
* Input Parameters:
@ -276,7 +276,7 @@ int sam_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
* Low: the inputs are transferred to the command registers.
*/
(void)sam_gpiowrite(GPIO_OLED_DATA, !cmd);
(void)sam_portwrite(PORT_OLED_DATA, !cmd);
}
#endif
return OK;

View File

@ -47,9 +47,9 @@
* ----------------- ---------------------- ----------------------
* 4 BUTTON3 4 PB01 AIN[9] 4 PA11 AIN[19]
* ----------------- ---------------------- ----------------------
* 5 DATA_CMD_SEL 5 PB06 GPIO 5 PA20 GPIO
* 5 DATA_CMD_SEL 5 PB06 PORT 5 PA20 PORT
* ----------------- ---------------------- ----------------------
* 6 LED3 6 PB07 GPIO 6 PA21 GPIO
* 6 LED3 6 PB07 PORT 6 PA21 PORT
* ----------------- ---------------------- ----------------------
* 7 LED1 7 PB02 TC6/WO[0] 7 PA22 TC4/WO[0]
* ----------------- ---------------------- ----------------------
@ -57,7 +57,7 @@
* ----------------- ---------------------- ----------------------
* 9 BUTTON1 9 PB04 EXTINT[4] 9 PB14 EXTINT[14]
* ----------------- ---------------------- ----------------------
* 10 DISPLAY_RESET 10 PB05 GPIO 10 PB15 GPIO
* 10 DISPLAY_RESET 10 PB05 PORT 10 PB15 PORT
* ----------------- ---------------------- ----------------------
* 11 N/C 11 PA08 SERCOM2 PAD[0] 11 PA08 SERCOM2 PAD[0]
* I²C SDA I²C SDA
@ -114,7 +114,7 @@
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/ssd1306.h>
#include "sam_gpio.h"
#include "sam_port.h"
#include "samd20-xplained.h"
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
@ -168,16 +168,16 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
FAR struct spi_dev_s *spi;
FAR struct lcd_dev_s *dev;
/* Configure the OLED GPIOs. This initial configuration is RESET low,
/* Configure the OLED PORTs. This initial configuration is RESET low,
* putting the OLED into reset state.
*/
(void)sam_configgpio(GPIO_OLED_RST);
(void)sam_configport(PORT_OLED_RST);
/* Wait a bit then release the OLED from the reset state */
up_mdelay(20);
sam_gpiowrite(GPIO_OLED_RST, true);
sam_portwrite(PORT_OLED_RST, true);
/* Get the SPI1 port interface */

View File

@ -57,7 +57,7 @@
#include <arch/board/board.h>
#include "sam_gpio.h"
#include "sam_port.h"
#include "samd20-xplained.h"
#ifndef CONFIG_ARCH_LEDS
@ -102,7 +102,7 @@
void sam_ledinit(void)
{
(void)sam_configgpio(GPIO_STATUS_LED);
(void)sam_configport(PORT_STATUS_LED);
}
/****************************************************************************
@ -119,7 +119,7 @@ void sam_setled(int led, bool ledon)
{
if (led == BOARD_STATUS_LED)
{
sam_gpiowrite(GPIO_STATUS_LED, !ledon);
sam_portwrite(PORT_STATUS_LED, !ledon);
}
}

View File

@ -81,8 +81,8 @@
* 2Hz, then a fatal error has been detected and the system has halted.
*/
#define GPIO_STATUS_LED (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \
GPIO_PORTA | GPIO_PIN14)
#define PORT_STATUS_LED (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
PORT_PORTA | PORT_PIN14)
/* Mechanical buttons:
*
@ -93,14 +93,13 @@
* PA15 SW0
*/
#define GPIO_SW0 (GPIO_INTERRUPT | GPIO_PULL_UP | GPIO_GLITCH_FILTER | \
GPIO_PORTA | GPIO_PIN15)
#define PORT_SW0 (PORT_INTERRUPT | PORT_PULL_UP | PORT_PORTA | PORT_PIN15)
#define IRQ_SW0 SAM_IRQ_PA15
/* I/O1
*
* Support for the microSD card slot on the I/O1 module. The I/O1 requires
* SPI support and two GPIOs. These the GPIOs will vary if the I/O1
* SPI support and two PORTs. These the PORTs will vary if the I/O1
* is installed on the EXT1 or EXT2 connector:
*
* --- ------------------ ---------------------- -------------------------------
@ -109,7 +108,7 @@
* 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select OUTPUT,
* SPI SS SPI SS pulled high on board.
* --- ------------------ ---------------------- -------------------------------
* 10 PB05 GPIO 10 PB15 GPIO Active low card detect INPUT,
* 10 PB05 PORT 10 PB15 PORT Active low card detect INPUT,
* must use internal pull-up.
* --- ------------------ ---------------------- -------------------------------
*/
@ -127,12 +126,12 @@
# error I/O1 and OLED1 modules cannot both reside in EXT1
# endif
# define GPIO_SD_CD (GPIO_INTERRUPT | GPIO_INT_CHANGE | GPIO_PULL_UP | \
GPIO_GLITCH_FILTER | GPIO_PORTF | GPIO_PIN5)
# define PORT_SD_CD (PORT_INTERRUPT | PORT_INT_CHANGE | PORT_PULL_UP | \
PORT_PORTF | PORT_PIN5)
# define IRQ_SD_CD SAM_IRQ_PB5
# define GPIO_SD_CS (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \
GPIO_PORTA | GPIO_PIN5)
# define PORT_SD_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
PORT_PORTA | PORT_PIN5)
# define SD_CSNO 0
# elif defined(CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2)
@ -142,12 +141,12 @@
# error I/O1 and OLED1 modules cannot both reside in EXT2
# endif
# define GPIO_CD (GPIO_INTERRUPT | GPIO_INT_CHANGE | GPIO_PULL_UP | \
GPIO_GLITCH_FILTER | GPIO_PORTB | GPIO_PIN15)
# define PORT_CD (PORT_INTERRUPT | PORT_INT_CHANGE | PORT_PULL_UP | \
PORT_PORTB | PORT_PIN15)
# define IRQ_CD SAM_IRQ_PB15
# define GPIO_SD_CS (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \
GPIO_PORTA | GPIO_PIN17)
# define PORT_SD_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
PORT_PORTA | PORT_PIN17)
# define SD_CSNO 2
# else
@ -158,14 +157,14 @@
/* OLED1
*
* Support for the microSD card slot on the I/O1 module. The I/O1 requires
* SPI support and three output GPIOs. These the GPIOs will vary if the OLED1
* SPI support and three output PORTs. These the PORTs will vary if the OLED1
* is installed on the EXT1 or EXT2 connector:
*
*
* PIN EXT1 EXT2 Description
* --- ------------------- -------------------- -------------------------------------
* 5 PB06 GPIO PA20 GPIO DATA_CMD_SEL
* 10 PB05 GPIO PB15 GPIO DISPLAY_RESET. Active low.
* 5 PB06 PORT PA20 PORT DATA_CMD_SEL
* 10 PB05 PORT PB15 PORT DISPLAY_RESET. Active low.
* 15 PA05 SERCOM0 PAD[1] PA17 SERCOM1 PAD[1] DISPLAY_SS. Active low.
* SPI SS SPI SS
*/
@ -195,12 +194,12 @@
# error OLED1 and I/O1 modules cannot both reside in EXT1
# endif
# define GPIO_OLED_DATA (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_CLEAR | \
GPIO_PORTB | GPIO_PIN6)
# define GPIO_OLED_RST (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_CLEAR | \
GPIO_PORTB | GPIO_PIN5)
# define GPIO_OLED_CS (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \
GPIO_PORTA | GPIO_PIN5)
# define PORT_OLED_DATA (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
PORT_PORTB | PORT_PIN6)
# define PORT_OLED_RST (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
PORT_PORTB | PORT_PIN5)
# define PORT_OLED_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
PORT_PORTA | PORT_PIN5)
# define OLED_CSNO 0
# elif defined(CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT2)
@ -210,12 +209,12 @@
# error OLED1 and I/O1 modules cannot both reside in EXT2
# endif
# define GPIO_OLED_DATA (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_CLEAR | \
GPIO_PORTA | GPIO_PIN20)
# define GPIO_OLED_RST (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_CLEAR | \
GPIO_PORTB | GPIO_PIN15)
# define GPIO_OLED_CS (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \
GPIO_PORTA | GPIO_PIN17)
# define PORT_OLED_DATA (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
PORT_PORTA | PORT_PIN20)
# define PORT_OLED_RST (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \
PORT_PORTB | PORT_PIN15)
# define PORT_OLED_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
PORT_PORTA | PORT_PIN17)
# define OLED_CSNO 2
# else
@ -224,8 +223,8 @@
#endif
#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
# define GPIO_SD_CS (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \
GPIO_PORTB | GPIO_PIN11) /* REVISIT */
# define PORT_SD_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \
PORT_PORTB | PORT_PIN11) /* REVISIT */
#endif
/************************************************************************************
@ -246,7 +245,7 @@
* Name: sam_spiinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the SAM3U-EK board.
* Called to configure SPI chip select PORT pins for the SAM3U-EK board.
*
************************************************************************************/