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:
patacongo
2011-07-02 16:45:04 +00:00
parent 3af8169e0a
commit 65d6076e48
5 changed files with 28 additions and 23 deletions
+9 -6
View File
@@ -1834,7 +1834,7 @@
* 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
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
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
@@ -1843,9 +1843,12 @@
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
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.
* arch/avr/src/avr/up_romget.c: Used to access strings that lie in the first
64Kb of FLASH.
* arch/avr/src/avr/up_romget.c: Used to access strings that lie in the first
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.
+14 -12
View File
@@ -2745,14 +2745,6 @@ void up_usbinitialize(void)
{
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 */
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.epavail = AVR_ALL_EPS & ~(1 << AVR_EP0);
/* Reset the interface to force re-enumeration */
avr_usbreset();
/* Attach USB controller general interrupt handler */
if (irq_attach(AT90USB_IRQ_USBGEN, avr_geninterrupt) != 0)
@@ -2780,6 +2768,20 @@ void up_usbinitialize(void)
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 */
USBCON |= (1 << OTGPADE);
+1 -1
View File
@@ -183,7 +183,7 @@ Teensy SPI Connection
-- ---- -- ------------------------- -------
J2 NAME PIN NAME PAD
-- ---- -- ------------------------- -------
1 VIN -- Connected to USB +RV
1 VIN -- Connected to USB +5V
2 GND -- Connected to USB GND
3 3V3 -- Not used ---
4 NC -- Not used
+1 -1
View File
@@ -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 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
* grounded it a card is inserted or write protected.
+3 -3
View File
@@ -268,9 +268,9 @@ CONFIG_ARCH_LOWPUTC=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_INSTRUMENTATION=n
CONFIG_TASK_NAME_SIZE=0
CONFIG_START_YEAR=2010
CONFIG_START_MONTH=6
CONFIG_START_DAY=17
CONFIG_START_YEAR=2011
CONFIG_START_MONTH=7
CONFIG_START_DAY=2
CONFIG_GREGORIAN_TIME=n
CONFIG_JULIAN_TIME=n
CONFIG_DEV_CONSOLE=y