mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
Fix SPI SD card detect logic; Fix AVR USB device interrupt initialization
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3740 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1834,7 +1834,7 @@
|
|||||||
* drivers/mtd/ramtron.c, net/net_checksd.c, fs/fs_fdopen.c, and include/nuttx/mii.h:
|
* drivers/mtd/ramtron.c, net/net_checksd.c, fs/fs_fdopen.c, and include/nuttx/mii.h:
|
||||||
Several structural changes made to get a clean compile under the ez80 ZDS-II
|
Several structural changes made to get a clean compile under the ez80 ZDS-II
|
||||||
toolchain (no design changes).
|
toolchain (no design changes).
|
||||||
* drivers/usbhost/usbhost_storage.c: Incorpated bugfixes reported by Sheref H.
|
* drivers/usbhost/usbhost_storage.c: Incorpated bugfixes reported by Sheref H.
|
||||||
Younan: (1) Read capacity logic read largest block, not the number of blocks
|
Younan: (1) Read capacity logic read largest block, not the number of blocks
|
||||||
and was, therefore, off by one, and (2) Some devices stall of get Max LUN request
|
and was, therefore, off by one, and (2) Some devices stall of get Max LUN request
|
||||||
if they support only a single LUN. Logic now assumes a single LUN if the get
|
if they support only a single LUN. Logic now assumes a single LUN if the get
|
||||||
@@ -1843,9 +1843,12 @@
|
|||||||
a new configuration option to support extracting strings from FLASH or EEPROM
|
a new configuration option to support extracting strings from FLASH or EEPROM
|
||||||
or other memories where the string data cannot be accessed by simply de-referencing
|
or other memories where the string data cannot be accessed by simply de-referencing
|
||||||
a string pointer.
|
a string pointer.
|
||||||
* arch/sim/src/up_romgetc.c: Used to test the basic logic to access strings
|
* arch/sim/src/up_romgetc.c: Used to test the basic logic to access strings
|
||||||
without directly de-referencing a string pointer.
|
without directly de-referencing a string pointer.
|
||||||
* arch/avr/src/avr/up_romget.c: Used to access strings that lie in the first
|
* arch/avr/src/avr/up_romget.c: Used to access strings that lie in the first
|
||||||
64Kb of FLASH.
|
64Kb of FLASH (But I still haven't figured out how to get strings to reside in
|
||||||
|
FLASH without using the PROGMEM attribute).
|
||||||
|
* configs/teensy/src/up_spi.c: Correct reading of SD CD and WP pins (was reading
|
||||||
|
the wrong register. AVR SPI now appears to be functional.
|
||||||
|
* arch/avr/src/at90usb/at90usb_usbdev.c: Correct USB initialization. Interrupts
|
||||||
|
were being enabled BEFORE the interrupt handler was attached.
|
||||||
|
|||||||
@@ -2745,14 +2745,6 @@ void up_usbinitialize(void)
|
|||||||
{
|
{
|
||||||
usbtrace(TRACE_DEVINIT, 0);
|
usbtrace(TRACE_DEVINIT, 0);
|
||||||
|
|
||||||
/* Shutdown the USB interface to put it in a known initial state */
|
|
||||||
|
|
||||||
avr_usbshutdown();
|
|
||||||
|
|
||||||
/* Select USB device mode */
|
|
||||||
|
|
||||||
UHWCON |= (1 << UIMOD);
|
|
||||||
|
|
||||||
/* Initialize the device state structure */
|
/* Initialize the device state structure */
|
||||||
|
|
||||||
memset(&g_usbdev, 0, sizeof(struct avr_usbdev_s));
|
memset(&g_usbdev, 0, sizeof(struct avr_usbdev_s));
|
||||||
@@ -2760,10 +2752,6 @@ void up_usbinitialize(void)
|
|||||||
g_usbdev.usbdev.ep0 = &g_usbdev.eplist[AVR_EP0].ep;
|
g_usbdev.usbdev.ep0 = &g_usbdev.eplist[AVR_EP0].ep;
|
||||||
g_usbdev.epavail = AVR_ALL_EPS & ~(1 << AVR_EP0);
|
g_usbdev.epavail = AVR_ALL_EPS & ~(1 << AVR_EP0);
|
||||||
|
|
||||||
/* Reset the interface to force re-enumeration */
|
|
||||||
|
|
||||||
avr_usbreset();
|
|
||||||
|
|
||||||
/* Attach USB controller general interrupt handler */
|
/* Attach USB controller general interrupt handler */
|
||||||
|
|
||||||
if (irq_attach(AT90USB_IRQ_USBGEN, avr_geninterrupt) != 0)
|
if (irq_attach(AT90USB_IRQ_USBGEN, avr_geninterrupt) != 0)
|
||||||
@@ -2780,6 +2768,20 @@ void up_usbinitialize(void)
|
|||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Shutdown the USB interface to put it in a known initial state */
|
||||||
|
|
||||||
|
avr_usbshutdown();
|
||||||
|
|
||||||
|
/* Select USB device mode */
|
||||||
|
|
||||||
|
UHWCON |= (1 << UIMOD);
|
||||||
|
|
||||||
|
/* Reset the interface to force re-enumeration (the reset operation
|
||||||
|
* enables interrupts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
avr_usbreset();
|
||||||
|
|
||||||
/* Set the VBUS pad */
|
/* Set the VBUS pad */
|
||||||
|
|
||||||
USBCON |= (1 << OTGPADE);
|
USBCON |= (1 << OTGPADE);
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ Teensy SPI Connection
|
|||||||
-- ---- -- ------------------------- -------
|
-- ---- -- ------------------------- -------
|
||||||
J2 NAME PIN NAME PAD
|
J2 NAME PIN NAME PAD
|
||||||
-- ---- -- ------------------------- -------
|
-- ---- -- ------------------------- -------
|
||||||
1 VIN -- Connected to USB +RV
|
1 VIN -- Connected to USB +5V
|
||||||
2 GND -- Connected to USB GND
|
2 GND -- Connected to USB GND
|
||||||
3 3V3 -- Not used ---
|
3 3V3 -- Not used ---
|
||||||
4 NC -- Not used
|
4 NC -- Not used
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void avr_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool select
|
|||||||
uint8_t avr_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
uint8_t avr_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
{
|
{
|
||||||
uint8_t ret = 0;
|
uint8_t ret = 0;
|
||||||
uint8_t regval = PORTB;
|
uint8_t regval = PINB;
|
||||||
|
|
||||||
/* Both the CD and WP pins are pull high by the AT90USB and will be
|
/* Both the CD and WP pins are pull high by the AT90USB and will be
|
||||||
* grounded it a card is inserted or write protected.
|
* grounded it a card is inserted or write protected.
|
||||||
|
|||||||
@@ -268,9 +268,9 @@ CONFIG_ARCH_LOWPUTC=y
|
|||||||
CONFIG_RR_INTERVAL=200
|
CONFIG_RR_INTERVAL=200
|
||||||
CONFIG_SCHED_INSTRUMENTATION=n
|
CONFIG_SCHED_INSTRUMENTATION=n
|
||||||
CONFIG_TASK_NAME_SIZE=0
|
CONFIG_TASK_NAME_SIZE=0
|
||||||
CONFIG_START_YEAR=2010
|
CONFIG_START_YEAR=2011
|
||||||
CONFIG_START_MONTH=6
|
CONFIG_START_MONTH=7
|
||||||
CONFIG_START_DAY=17
|
CONFIG_START_DAY=2
|
||||||
CONFIG_GREGORIAN_TIME=n
|
CONFIG_GREGORIAN_TIME=n
|
||||||
CONFIG_JULIAN_TIME=n
|
CONFIG_JULIAN_TIME=n
|
||||||
CONFIG_DEV_CONSOLE=y
|
CONFIG_DEV_CONSOLE=y
|
||||||
|
|||||||
Reference in New Issue
Block a user