mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
Add a general bit-bang SPI upper-half driver
This commit is contained in:
@@ -5096,4 +5096,7 @@
|
|||||||
SPI-related files. includes/nuttx/spi.h moved to include/nuttx/spi/.;
|
SPI-related files. includes/nuttx/spi.h moved to include/nuttx/spi/.;
|
||||||
SPI-related Kconfig info moved from drivers/Kconfig to drivers/spi/kconfig
|
SPI-related Kconfig info moved from drivers/Kconfig to drivers/spi/kconfig
|
||||||
(2013-7-1).
|
(2013-7-1).
|
||||||
|
* drivers/spi/spi_bitbang.c and include/nuttx/spi/spi_bitbang.h: Add
|
||||||
|
support for a generic bit-bang SPI driver. This checkout is the
|
||||||
|
common upper-half logic. Still missing the lower half (2013-7-1).
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,13 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
if ARCH_BOARD_ARDUINO_DUE
|
if ARCH_BOARD_ARDUINO_DUE
|
||||||
|
|
||||||
|
config ARDUINO_ITHEAD_TFT
|
||||||
|
bool "ITEAD 2.4 inch TFT w/Touch"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Select this option if you have the ITEAD 2.4" TFT module installed.
|
||||||
|
This will enable support for the peripherals on that module
|
||||||
|
including the SD card, TFT LCD, and touchscreen controller.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -122,19 +122,22 @@ ITEAD 2.4" TFT with Touch
|
|||||||
The Arduino 2.4" TFT Touch shield uses the S6D1121 controller , it
|
The Arduino 2.4" TFT Touch shield uses the S6D1121 controller , it
|
||||||
supports 8-bit data interface. The touch IC is TSC2046.
|
supports 8-bit data interface. The touch IC is TSC2046.
|
||||||
|
|
||||||
Arduino ATSAM3X Due ITHEAD
|
---------- --------------------------- ----------- ----- ---------- ------------------
|
||||||
Due PIN GPIO FUNCTION SIGNAL PIN SIGNAL NOTES
|
Arduino ATSAM3X Due ITHEAD
|
||||||
|
Due PIN GPIO FUNCTION SIGNAL PIN SIGNAL NOTES
|
||||||
|
---------- ---- ---------------------- ----------- ----- ---------- ------------------
|
||||||
PWMH
|
PWMH
|
||||||
10 SCL1 PA18 TWCK0/A20/WKUP9 SCL1 --- --- SCL not available
|
10 SCL1 PA18 TWCK0/A20/WKUP9 SCL1 --- --- SCL not available
|
||||||
9 SDA1 PA17 TWD0SPCK0 SDA1 --- --- SDA not available
|
9 SDA1 PA17 TWD0SPCK0 SDA1 --- --- SDA not available
|
||||||
8 Aref --- --- AREF Vref --- ---
|
8 Aref --- --- AREF Vref --- ---
|
||||||
7 GND --- --- GND GND --- ---
|
7 GND --- --- GND GND --- ---
|
||||||
6 PWM13 PB27 SPI0_SPCK/A20/WKUP10 PWM13 D13 SD_SCK SCK, also LED "L"
|
6 PWM13 PB27 SPI0_SPCK/A20/WKUP10 PWM13 D13 SD_SCK SCK, also LED "L", Pulled low on-board
|
||||||
5 PWM12 PD8 A21/NANDALE/TIOB8 PWM12 D12 SD_MISO MISO not available
|
5 PWM12 PD8 A21/NANDALE/TIOB8 PWM12 D12 SD_MISO MISO not available
|
||||||
4 PWM11 PD7 A17/BA1/TIOA8 PWM11 D11 SD_MOSI MOSI not available
|
4 PWM11 PD7 A17/BA1/TIOA8 PWM11 D11 SD_MOSI MOSI not available, Pulled low on-board
|
||||||
3 PWM10 ??? ??? SS0/PWM10 D10 SD_CS ???
|
3 PWM10 ??? ??? SS0/PWM10 D10 SD_CS Pulled low on-board
|
||||||
2 PWM9 PC21 A0/NBS0/PWML4 PWM9 D9 Touch_IRQ ---
|
2 PWM9 PC21 A0/NBS0/PWML4 PWM9 D9 Touch_Dout ---
|
||||||
1 PWM8 PC22 A1/PWML5 PWM8 D8 Touch_Dout ---
|
1 PWM8 PC22 A1/PWML5 PWM8 D8 Touch_IRQ ---
|
||||||
|
|
||||||
PWML
|
PWML
|
||||||
8 PWM7 PC23 A2/PWML6 PWM7 D7 DB15 ---
|
8 PWM7 PC23 A2/PWML6 PWM7 D7 DB15 ---
|
||||||
7 PWM6 PC24 A3/PWML7 PWM6 D6 DB14 ---
|
7 PWM6 PC24 A3/PWML7 PWM6 D6 DB14 ---
|
||||||
@@ -144,7 +147,7 @@ ITEAD 2.4" TFT with Touch
|
|||||||
3 PWM2 PB25 RTS0/TIOA0 PWM2 D2 DB10 ---
|
3 PWM2 PB25 RTS0/TIOA0 PWM2 D2 DB10 ---
|
||||||
2 PWM1 PA9 UTXD/PWMH3 TX D1 DB9 UART0 TX
|
2 PWM1 PA9 UTXD/PWMH3 TX D1 DB9 UART0 TX
|
||||||
1 PWM0 PA8 URXD/PWMH0/WKUP4 RX D0 DB8 UART0 RX
|
1 PWM0 PA8 URXD/PWMH0/WKUP4 RX D0 DB8 UART0 RX
|
||||||
|
---------- ---- ---------------------- ----------- ----- ---------- ------------------
|
||||||
POWER
|
POWER
|
||||||
1 --- --- --- --- --- --- ---
|
1 --- --- --- --- --- --- ---
|
||||||
2 IOref --- --- IOREF +3V3 --- --- ---
|
2 IOref --- --- IOREF +3V3 --- --- ---
|
||||||
@@ -163,14 +166,15 @@ ITEAD 2.4" TFT with Touch
|
|||||||
6 A5 PA4 TCLK1/NWAIT/AD2 AD5 A5 TFT_RS ---
|
6 A5 PA4 TCLK1/NWAIT/AD2 AD5 A5 TFT_RS ---
|
||||||
7 A6 PA3 TIOB1/PWMFI1/AD1/WKUP1 AD6 --- --- ---
|
7 A6 PA3 TIOB1/PWMFI1/AD1/WKUP1 AD6 --- --- ---
|
||||||
8 A7 PA2 TIOA1/NANDRDY/AD0 AD7 --- --- ---
|
8 A7 PA2 TIOA1/NANDRDY/AD0 AD7 --- --- ---
|
||||||
|
---------- ---- ---------------------- ----------- ----- ---------- ------------------
|
||||||
|
|
||||||
NOTE:
|
NOTES:
|
||||||
|
|
||||||
1. It is not possible to use any of the SPI devices on the Shield unless
|
1. It is not possible to use any of the SPI devices on the Shield unless
|
||||||
a bit-bang SPI interface is used. This includes the touch controller
|
a bit-bang SPI interface is used. This includes the touch controller
|
||||||
and the SD card.
|
and the SD card.
|
||||||
2. UART0 cannot be used
|
2. UART0 cannot be used. USARTs on the COMM connector should be available.
|
||||||
3. Parallel data is not contiguous in any PIO register
|
3. Parallel data is not contiguous in the PIO register
|
||||||
4. 3.3V and 5V are reversed.
|
4. 3.3V and 5V are reversed.
|
||||||
|
|
||||||
Development Environment
|
Development Environment
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ CONFIG_NSH_MMCSDMINOR=0
|
|||||||
#
|
#
|
||||||
# Board-Specific Options
|
# Board-Specific Options
|
||||||
#
|
#
|
||||||
|
# CONFIG_ARDUINO_ITHEAD_TFT is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# RTOS Features
|
# RTOS Features
|
||||||
|
|||||||
@@ -52,6 +52,23 @@ else
|
|||||||
CSRCS += sam_userleds.c
|
CSRCS += sam_userleds.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARDUINO_ITHEAD_TFT),y)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SPI_BITBANG),y)
|
||||||
|
ifeq ($(CONFIG_MMC_SPI),y)
|
||||||
|
CSRCS += sam_mmcsd.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_INPUT),y)
|
||||||
|
CSRCS += sam_touchscreen.c
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_LCD),y)
|
||||||
|
CSRCS += sam_lcd.c
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
SRCS = $(ASRCS) $(CSRCS)
|
SRCS = $(ASRCS) $(CSRCS)
|
||||||
|
|||||||
@@ -97,6 +97,163 @@
|
|||||||
#define GPIO_LED_TX (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
|
#define GPIO_LED_TX (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
|
||||||
GPIO_PORT_PIOA | GPIO_PIN21)
|
GPIO_PORT_PIOA | GPIO_PIN21)
|
||||||
|
|
||||||
|
/* ITEAD 2.4" TFT with Touch
|
||||||
|
*
|
||||||
|
* The Arduino 2.4" TFT Touch Shield is designed for all the Arduino
|
||||||
|
* compatible boards. It works in 3.3V voltage level. It can be directly
|
||||||
|
* plugged on the Arduino and other compatible boards. It will offer
|
||||||
|
* display, touch and storage functions for the Arduino board
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
*
|
||||||
|
* 1. Compatible with 3.3/5V operation voltage level
|
||||||
|
* 2. Compatible with UTFT library
|
||||||
|
* 3. With SD Card Socket
|
||||||
|
*
|
||||||
|
* The Arduino 2.4" TFT Touch shield uses the S6D1121 controller , it
|
||||||
|
* supports 8-bit data interface. The touch IC is TSC2046.
|
||||||
|
*
|
||||||
|
* ---------- --------------------------- ----------- ----- ---------- ------------------
|
||||||
|
* Arduino ATSAM3X Due ITHEAD
|
||||||
|
* Due PIN GPIO FUNCTION SIGNAL PIN SIGNAL NOTES
|
||||||
|
* ---------- ---- ---------------------- ----------- ----- ---------- ------------------
|
||||||
|
* PWMH
|
||||||
|
* 10 SCL1 PA18 TWCK0/A20/WKUP9 SCL1 --- --- SCL not available
|
||||||
|
* 9 SDA1 PA17 TWD0SPCK0 SDA1 --- --- SDA not available
|
||||||
|
* 8 Aref --- --- AREF Vref --- ---
|
||||||
|
* 7 GND --- --- GND GND --- ---
|
||||||
|
* 6 PWM13 PB27 SPI0_SPCK/A20/WKUP10 PWM13 D13 SD_SCK SCK, also LED "L", Pulled low on-board
|
||||||
|
* 5 PWM12 PD8 A21/NANDALE/TIOB8 PWM12 D12 SD_MISO MISO not available
|
||||||
|
* 4 PWM11 PD7 A17/BA1/TIOA8 PWM11 D11 SD_MOSI MOSI not available, Pulled low on-board
|
||||||
|
* 3 PWM10 ??? ??? SS0/PWM10 D10 SD_CS Pulled low on-board
|
||||||
|
* 2 PWM9 PC21 A0/NBS0/PWML4 PWM9 D9 Touch_Dout ---
|
||||||
|
* 1 PWM8 PC22 A1/PWML5 PWM8 D8 Touch_IRQ ---
|
||||||
|
* PWML
|
||||||
|
* 8 PWM7 PC23 A2/PWML6 PWM7 D7 DB15 ---
|
||||||
|
* 7 PWM6 PC24 A3/PWML7 PWM6 D6 DB14 ---
|
||||||
|
* 6 PWM5 PC25 A4/TIOA6 PWM5 D5 DB13 ---
|
||||||
|
* 5 PWM4 PC26 A5/TIOB6 SS1/PWM4 D4 DB12 ---
|
||||||
|
* 4 PWM3 PC28 A7/TIOA7 PWM3 D3 DB11 ---
|
||||||
|
* 3 PWM2 PB25 RTS0/TIOA0 PWM2 D2 DB10 ---
|
||||||
|
* 2 PWM1 PA9 UTXD/PWMH3 TX D1 DB9 UART0 TX
|
||||||
|
* 1 PWM0 PA8 URXD/PWMH0/WKUP4 RX D0 DB8 UART0 RX
|
||||||
|
* ---------- ---- ---------------------- ----------- ----- ---------- ------------------
|
||||||
|
* POWER
|
||||||
|
* 1 --- --- --- --- --- --- ---
|
||||||
|
* 2 IOref --- --- IOREF +3V3 --- --- ---
|
||||||
|
* 3 RESET --- --- MASTER_RESET RST --- ---
|
||||||
|
* 4 3.3V --- --- +3V3 5V --- ---
|
||||||
|
* 5 5V --- --- +5V 3.3V --- ---
|
||||||
|
* 6 GND --- --- GND GND --- ---
|
||||||
|
* 7 GND --- --- GND GND --- ---
|
||||||
|
* 8 Vin --- --- VIN Vin --- ---
|
||||||
|
* ADCL
|
||||||
|
* 1 A0 PA16 SPCK1/TD/AD7 AD0 A0 Touch_Din ---
|
||||||
|
* 2 A1 PA24 MCDA3/PCK1/AD6 AD1 A1 Touch_CLK ---
|
||||||
|
* 3 A2 PA23 MCDA2/TCLK4/AD5 AD2 A2 --- ---
|
||||||
|
* 4 A3 PA22 MCDA1/TCLK3/AD4 AD3 A3 TFT_CS ---
|
||||||
|
* 5 A4 PA6 TIOB2/NCS0/AD3 AD4 A4 TFT_WR ---
|
||||||
|
* 6 A5 PA4 TCLK1/NWAIT/AD2 AD5 A5 TFT_RS ---
|
||||||
|
* 7 A6 PA3 TIOB1/PWMFI1/AD1/WKUP1 AD6 --- --- ---
|
||||||
|
* 8 A7 PA2 TIOA1/NANDRDY/AD0 AD7 --- --- ---
|
||||||
|
* ---------- ---- ---------------------- ----------- ----- ---------- ------------------
|
||||||
|
*
|
||||||
|
* NOTES:
|
||||||
|
*
|
||||||
|
* 1. It is not possible to use any of the SPI devices on the Shield unless
|
||||||
|
* a bit-bang SPI interface is used. This includes the touch controller
|
||||||
|
* and the SD card.
|
||||||
|
* 2. UART0 cannot be used. USARTs on the COMM connector should be available.
|
||||||
|
* 3. Parallel data is not contiguous in the PIO register
|
||||||
|
* 4. 3.3V and 5V are reversed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARDUINO_ITHEAD_TFT
|
||||||
|
/* In order to use the SD card on the ITEAD shield, you must enable the
|
||||||
|
* SPI bit-bang driver as well as support for SPI-based MMC/SD cards.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if defined(CONFIG_SPI_BITBANG) && defined(CONFIG_MMC_SPI)
|
||||||
|
|
||||||
|
/* The SD slot shares the pin with LED "L" so LED support must be disabled
|
||||||
|
* to use the MMC/SD card on the ITEAD shield.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# ifdef CONFIG_ARCH_LEDs
|
||||||
|
# error LEDs may not be used with the ITEAD SD card
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define GPIO_SD_SCK (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOB | GPIO_PIN27)
|
||||||
|
# define GPIO_SD_MISO (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOD | GPIO_PIN8)
|
||||||
|
# define GPIO_SD_MOSI (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOD | GPIO_PIN7)
|
||||||
|
# define GPIO_SD_CS (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIO? | GPIO_PIN?)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* In order to use the touchscreen on the ITEAD shield, you must enable the
|
||||||
|
* SPI bit-bang driver and INPUT device support.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if defined(CONFIG_SPI_BITBANG) && defined(CONFIG_INPUT)
|
||||||
|
# define GPIO_TSC_SCK (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOA | GPIO_PIN24)
|
||||||
|
# define GPIO_TSC_MISO (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN21)
|
||||||
|
# define GPIO_TSC_MOSI (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOA | GPIO_PIN16)
|
||||||
|
# define GPIO_TSC_CS (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIO? | GPIO_PIN?)
|
||||||
|
# define GPIO_TSC_IRQ (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_INT_BOTHEDGES | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN22)
|
||||||
|
# define SAM_TCS_IRQ SAM_IRQ_PC21
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Only CONFIG_LCD is expected to enable the TFT LCD */
|
||||||
|
|
||||||
|
# ifdef CONFIG_LCD
|
||||||
|
|
||||||
|
/* UART0 cannot be used with the LCD because the UART0 pins are used
|
||||||
|
* by the LCD.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# ifdef CONFIG_SAM34_UART0
|
||||||
|
# error "UART0 cannot be used with the ITEAD LCD"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Data pins are initially configured but may be switched dynamically to
|
||||||
|
* either inputs or outputs as needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define GPIO_LCD_D0IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOA | GPIO_PIN8)
|
||||||
|
# define GPIO_LCD_D1IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOA | GPIO_PIN9)
|
||||||
|
# define GPIO_LCD_D2IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOB | GPIO_PIN25)
|
||||||
|
# define GPIO_LCD_D3IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN28)
|
||||||
|
# define GPIO_LCD_D4IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN26)
|
||||||
|
# define GPIO_LCD_D5IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN25)
|
||||||
|
# define GPIO_LCD_D6IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN24)
|
||||||
|
# define GPIO_LCD_D7IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN23)
|
||||||
|
# define GPIO_LCD_D7IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOC | GPIO_PIN23)
|
||||||
|
# define GPIO_LCD_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOA | GPIO_PIN22)
|
||||||
|
# define GPIO_LCD_WR (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOA | GPIO_PIN6)
|
||||||
|
# define GPIO_LCD_RS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLR | \
|
||||||
|
GPIO_PORT_PIOA | GPIO_PIN4)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# drivers/Makefile
|
# drivers/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@@ -62,6 +62,7 @@ include power$(DELIM)Make.defs
|
|||||||
include sensors$(DELIM)Make.defs
|
include sensors$(DELIM)Make.defs
|
||||||
include sercomm$(DELIM)Make.defs
|
include sercomm$(DELIM)Make.defs
|
||||||
include serial$(DELIM)Make.defs
|
include serial$(DELIM)Make.defs
|
||||||
|
include spi$(DELIM)Make.defs
|
||||||
include syslog$(DELIM)Make.defs
|
include syslog$(DELIM)Make.defs
|
||||||
include usbdev$(DELIM)Make.defs
|
include usbdev$(DELIM)Make.defs
|
||||||
include usbhost$(DELIM)Make.defs
|
include usbhost$(DELIM)Make.defs
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# Don't build anything if there is no NX support for input devices
|
# Don't build anything if there is no support for input devices
|
||||||
|
|
||||||
ifeq ($(CONFIG_INPUT),y)
|
ifeq ($(CONFIG_INPUT),y)
|
||||||
|
|
||||||
|
|||||||
+9
-10
@@ -3,22 +3,15 @@
|
|||||||
# see misc/tools/kconfig-language.txt.
|
# see misc/tools/kconfig-language.txt.
|
||||||
#
|
#
|
||||||
|
|
||||||
config SPI
|
|
||||||
bool "SPI Driver Support"
|
|
||||||
default n
|
|
||||||
---help---
|
|
||||||
This selection enables selection of common SPI options. This option
|
|
||||||
should be enabled by all platforms that support SPI interfaces.
|
|
||||||
See include/nuttx/spi/spi.h for further SPI driver information.
|
|
||||||
|
|
||||||
if SPI
|
if SPI
|
||||||
|
|
||||||
config SPI_OWNBUS
|
config SPI_OWNBUS
|
||||||
bool "SPI single device"
|
bool "SPI single device"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Set if there is only one active device on the SPI bus. No locking or
|
Set if there is only one active device on the SPI bus. No locking or
|
||||||
SPI configuration will be performed. It is not necessary for clients to
|
SPI configuration will be performed. It is not necessary for clients to
|
||||||
lock, re-configure, etc..
|
lock, re-configure, etc.
|
||||||
|
|
||||||
config SPI_EXCHANGE
|
config SPI_EXCHANGE
|
||||||
bool "SPI exchange"
|
bool "SPI exchange"
|
||||||
@@ -36,5 +29,11 @@ config SPI_CMDDATA
|
|||||||
either 9-bit SPI (yech) or 8-bit SPI and a GPIO output that selects
|
either 9-bit SPI (yech) or 8-bit SPI and a GPIO output that selects
|
||||||
between command and data.
|
between command and data.
|
||||||
|
|
||||||
endif
|
config SPI_BITBANG
|
||||||
|
bool "SPI bit-bang device"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable support for a generic SPI bit-bang device.
|
||||||
|
See include/nuttx/spi/spi_bitbang.h for further information.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|||||||
Executable
+544
File diff suppressed because it is too large
Load Diff
Executable
+176
@@ -0,0 +1,176 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/spi/spi_bitbang.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __INCLUDE_NUTTX_SPI_SPI_BITBANG_H
|
||||||
|
#define __INCLUDE_NUTTX_SPI_SPI_BITBANG_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <nuttx/spi/spi.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPI_BITBANG
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
#ifndef SPI_BITBANG_MODE <<< NOOOO.. Needs to be programmable
|
||||||
|
# define SPI_BITBANG_MODE SPI_MODE0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_SPI_BITBANG_FREQUENCY <<< NOOOO.. Needs to be programmable
|
||||||
|
# define CONFIG_SPI_BITBANG_FREQUENCY 1000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Debug ********************************************************************/
|
||||||
|
/* Check if SPI debut is enabled (non-standard.. no support in
|
||||||
|
* include/debug.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_DEBUG
|
||||||
|
# undef CONFIG_DEBUG_VERBOSE
|
||||||
|
# undef CONFIG_DEBUG_SPI
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_SPI
|
||||||
|
# define spidbg lldbg
|
||||||
|
# ifdef CONFIG_DEBUG_VERBOSE
|
||||||
|
# define spivdbg lldbg
|
||||||
|
# else
|
||||||
|
# define spivdbg(x...)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define spidbg(x...)
|
||||||
|
# define spivdbg(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/* These are the lower-half handlers that perform the level-level, platform-
|
||||||
|
* specific bit-bang operations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct spi_bitbang_s; /* Forward reference */
|
||||||
|
struct spi_bitbang_ops_s
|
||||||
|
{
|
||||||
|
/* Platform specific chip select logic */
|
||||||
|
|
||||||
|
void (*select)(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
|
||||||
|
bool selected);
|
||||||
|
|
||||||
|
/* Platform-specific, SPI mode function */
|
||||||
|
|
||||||
|
void (*setmode)(FAR struct spi_bitbang_s *priv, enum spi_mode_e mode);
|
||||||
|
|
||||||
|
/* Platform-specific word exchange function */
|
||||||
|
|
||||||
|
uint16_t (*exchange)(FAR struct spi_bitbang_s *priv, uint16_t dataout);
|
||||||
|
|
||||||
|
/* Platform-specific word exchange function */
|
||||||
|
|
||||||
|
uint8_t (*status)(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPI_CMDDATA
|
||||||
|
/* Platform-specific CMD/DATA function */
|
||||||
|
|
||||||
|
int (*cmddata)(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
|
||||||
|
bool cmd);
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This structure provides the state of the SPI bit-bang driver */
|
||||||
|
|
||||||
|
struct spi_bitbang_s
|
||||||
|
{
|
||||||
|
struct spi_dev_s dev; /* Publicly visible version of SPI driver */
|
||||||
|
FAR const struct spi_bitbang_ops_s *low; /* Low-level operations */
|
||||||
|
uint32_t hpnsec; /* Number of microseconds in a half cycle */
|
||||||
|
#ifndef CONFIG_SPI_OWNBUS
|
||||||
|
sem_t exclsem; /* Supports mutually exclusive access to SPI */
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SPI_BITBANG_VARWIDTH
|
||||||
|
uint8_t nbits; /* Number of bits in the transfer */
|
||||||
|
#endif
|
||||||
|
FAR void *priv; /* For use by the lower half driver */
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: spi_create_bitbang
|
||||||
|
*
|
||||||
|
* Descripton:
|
||||||
|
* Create an instance of the SPI bit-bang driver.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* low - Low-level, platform specific device operations.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* On success a non-NULL, initialized SPI driver instance is returned.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
FAR struct spi_dev_s *spi_create_bitbang(FAR const struct spi_bitbang_ops_s *low);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* CONFIG_SPI_BITBANG */
|
||||||
|
#endif /* __INCLUDE_NUTTX_SPI_SPI_BITBANG_H */
|
||||||
Reference in New Issue
Block a user