diff --git a/TODO b/TODO index a3db368f3a..1c868f9b1a 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated August 8, 2011) +NuttX TODO List (Last updated August 22, 2011) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ nuttx/ @@ -13,7 +13,7 @@ nuttx/ (16) Network (net/, drivers/net) (2) USB (drivers/usbdev, drivers/usbhost) (6) Libraries (lib/) - (10) File system/Generic drivers (fs/, drivers/) + (9) File system/Generic drivers (fs/, drivers/) (2) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) (1) Documentation (Documentation/) @@ -413,10 +413,6 @@ o File system / Generic drivers (fs/, drivers/) Status: Open Priority: Low - Description: The CAN driver is untested. Add a test for the CAN driver. - Status: Open - Priority: Medium - Description: At present, the CAN driver does not support the poll() method. Status: Open Priority: Low diff --git a/arch/arm/src/kinetis/kinetis_sdhc.c b/arch/arm/src/kinetis/kinetis_sdhc.c index 5c56062075..26d02feffd 100644 --- a/arch/arm/src/kinetis/kinetis_sdhc.c +++ b/arch/arm/src/kinetis/kinetis_sdhc.c @@ -1182,12 +1182,10 @@ static int kinetis_interrupt(int irq, void *context) } } - /* Handle data end events */ + /* Handle transfer complete events */ if ((pending & SDHC_INT_TC) != 0) { - /* Handle any data remaining the RX buffer */ - /* Was this transfer performed in DMA mode? */ #ifdef CONFIG_SDIO_DMA @@ -1924,10 +1922,9 @@ static int kinetis_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t ar putreg32(arg, KINETIS_SDHC_CMDARG); - /* Enable appropriate interrupts and write the SDHC CMD */ + /* Clear interrupt status and write the SDHC CMD */ putreg32(SDHC_RESPDONE_INTS, KINETIS_SDHC_IRQSTAT); - putreg32(SDHC_RESPDONE_INTS|SDHC_INT_CINT, KINETIS_SDHC_IRQSIGEN); putreg32(regval, KINETIS_SDHC_XFERTYP); return OK; } @@ -2262,9 +2259,11 @@ static int kinetis_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32 } } - /* Clear all pending message completion events and return the R1/R6 response */ + /* Return the R1/R1b/R6 response. These responses are returned in + * CDMRSP0. NOTE: This is not true for R1b (Auto CMD12 response) which + * is returned in CMDRSP3. + */ - putreg32(SDHC_RESPDONE_INTS, KINETIS_SDHC_IRQSTAT); *rshort = getreg32(KINETIS_SDHC_CMDRSP0); return ret; } @@ -2309,18 +2308,14 @@ static int kinetis_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t r } } - /* Disable interrupts and return the long response */ - - regval = getreg32(KINETIS_SDHC_IRQSIGEN); - regval &= ~SDHC_RESPDONE_INTS; - putreg32(regval, KINETIS_SDHC_IRQSIGEN); + /* Return the long response in CMDRSP3..0*/ if (rlong) { - rlong[0] = getreg32(KINETIS_SDHC_CMDRSP0); - rlong[1] = getreg32(KINETIS_SDHC_CMDRSP1); - rlong[2] = getreg32(KINETIS_SDHC_CMDRSP2); - rlong[3] = getreg32(KINETIS_SDHC_CMDRSP3); + rlong[0] = getreg32(KINETIS_SDHC_CMDRSP3); + rlong[1] = getreg32(KINETIS_SDHC_CMDRSP2); + rlong[2] = getreg32(KINETIS_SDHC_CMDRSP1); + rlong[3] = getreg32(KINETIS_SDHC_CMDRSP0); } return ret; } @@ -2361,20 +2356,15 @@ static int kinetis_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t fdbg("ERROR: Timeout IRQSTAT: %08x\n", regval); ret = -ETIMEDOUT; } - - /* Return the short response */ } - /* Disable interrupts and return the short response */ - - regval = getreg32(KINETIS_SDHC_IRQSIGEN); - regval &= ~SDHC_RESPDONE_INTS; - putreg32(regval, KINETIS_SDHC_IRQSIGEN); + /* Return the short response in CMDRSP0 */ if (rshort) { *rshort = getreg32(KINETIS_SDHC_CMDRSP0); } + return ret; } @@ -2384,11 +2374,7 @@ static int kinetis_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_ { uint32_t regval; - /* Disable interrupts and return an error */ - - regval = getreg32(KINETIS_SDHC_IRQSIGEN); - regval &= ~SDHC_RESPDONE_INTS; - putreg32(regval, KINETIS_SDHC_IRQSIGEN); + /* Just return an error */ return -ENOSYS; } @@ -2422,7 +2408,6 @@ static void kinetis_waitenable(FAR struct sdio_dev_s *dev, { struct kinetis_dev_s *priv = (struct kinetis_dev_s*)dev; uint32_t waitints; - uint32_t regval; DEBUGASSERT(priv != NULL); @@ -2447,10 +2432,6 @@ static void kinetis_waitenable(FAR struct sdio_dev_s *dev, /* Enable event-related interrupts */ - regval = getreg32(KINETIS_SDHC_IRQSIGEN); - regval &= ~(SDHC_WAITALL_INTS); - putreg32(regval, KINETIS_SDHC_IRQSIGEN); - kinetis_configwaitints(priv, waitints, eventset, 0); } @@ -2510,8 +2491,8 @@ static sdio_eventset_t kinetis_eventwait(FAR struct sdio_dev_s *dev, 1, (uint32_t)priv); if (ret != OK) { - fdbg("ERROR: wd_start failed: %d\n", ret); - } + fdbg("ERROR: wd_start failed: %d\n", ret); + } } /* Loop until the event (or the timeout occurs). Race conditions are avoided @@ -3059,6 +3040,7 @@ void sdhc_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect) { priv->cdstatus &= ~SDIO_STATUS_WRPROTECTED; } + fvdbg("cdstatus: %02x\n", priv->cdstatus); irqrestore(flags); } diff --git a/arch/arm/src/stm32/stm32_sdio.c b/arch/arm/src/stm32/stm32_sdio.c index 5bf1af0077..7e6c60868f 100644 --- a/arch/arm/src/stm32/stm32_sdio.c +++ b/arch/arm/src/stm32/stm32_sdio.c @@ -2054,8 +2054,6 @@ static int stm32_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *r fdbg("ERROR: Timeout STA: %08x\n", regval); ret = -ETIMEDOUT; } - - /* Return the short response */ } putreg32(SDIO_RESPDONE_ICR|SDIO_CMDDONE_ICR, STM32_SDIO_ICR); diff --git a/configs/twr-k60n512/src/up_nsh.c b/configs/twr-k60n512/src/up_nsh.c index 4feaed5064..2079f52a01 100644 --- a/configs/twr-k60n512/src/up_nsh.c +++ b/configs/twr-k60n512/src/up_nsh.c @@ -174,12 +174,13 @@ static void kinetis_mediachange(void) sdhc_mediachange(g_nsh.sdhc, inserted); /* If the card has been inserted, then check if it is write protected - * aw well. + * as well. The pin is pulled up, but apparently logic high means + * write protected. */ if (inserted) { - sdhc_wrprotect(g_nsh.sdhc, !kinetis_gpioread(GPIO_SD_WRPROTECT)); + sdhc_wrprotect(g_nsh.sdhc, kinetis_gpioread(GPIO_SD_WRPROTECT)); } } }