Commit Graph

193 Commits

Author SHA1 Message Date
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt 4465916c5e drivers/mmcsd/mmcsd_sdio.c: Correct typo noted in Issue 180 2019-11-30 09:27:55 -06:00
Gregory Nutt 0002258f17 drivers/mmcsd/mmcsd_sdio.c: Commit 29612c40c5 slipped on by me: None of the common code may include ANY GCC dependencies. Fixed appropriately by adding a definition for the compiler dependency in include/nuttx/compiler.h. 2019-10-31 18:02:14 -06:00
David S. Alessio 29612c40c5 drivers/mmcsd/mmcsd_sdio.c: Align DMA buffer for MBURST size. 2019-10-31 07:18:47 -06:00
David Sidrane 5f65012449 drivers/mmcsd/mmcsd_sdio.c: Enter a removed card state On a failure. If we fail to read cardstatus in mmcsd_transferready consider this a hard error and set the card to removed. 2019-10-29 10:05:10 -06:00
David Sidrane b7073a366b drivers/mmcsd/mmcsd_sdio.c: Set wrbusy after success of all the operations. Any failure could leave wrbusy set when it should not be if the operation failed. 2019-10-29 10:03:18 -06:00
Gregory Nutt 6ddd4752b0 Eliminate new warnings found in build testing. 2019-08-21 13:45:31 -06:00
Gregory Nutt cc945b00e0 drivers/mmcsd/mmcsd_sdio.c: Correct a misplaced #endif. 2019-08-21 11:22:59 -06:00
Ivan Ucherdzhiev f2c6a3f108 drivers/mmcsd/mmcsd_sdio.c: Copy/paste error fix for MMC. 2019-08-21 09:26:54 -06:00
Ivan Ucherdzhiev 19c070e0d1 drivers/mmcsd: Added support for MMC(eMMC) bigger than 2 GB (Tested with IMXRT1050EVKB and samsung eMMC 16GB). arch/arm/src/imxrt: IMXRT uSDHC driver cmd line reset logic modified. 2019-08-21 09:23:29 -06:00
Anthony Merlino 5cd2a1ae68 Merged in antmerlino/nuttx/mmcsd-bugfix (pull request #893)
drivers/mmcsd: Fixes bug where thread gets deadlocked due to recursive call and addresses comment regarding events.

When initializing the MMCSD, if we are being told there is a card, but we fail to initialize it, we should not re-register for an insertion event as this will immediately cause us to call in again. Instead, we should register for a removal event and wait for the card to be removed and re-inserted.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-06-13 01:27:02 +00:00
Gregory Nutt 3e848fb893 Merged imxrt1020 into master 2019-04-30 16:08:46 -06:00
Bob Feretich c6851201c0 This commit adds a new function arch_invalidate_dcache_by_addr(). It takes the same parameters as arch_invalidate_dcache(), but performs invalidation of only the lines in cache that need to be invalidated. This new function could be used as a a direct replacement for arch_invalidate_dcache().
The user of this invalidation are mmcsd_sdio currently.  The mmcsd_sdio driver makes calls for dcache invalidation through the chip specific architecture function SDIO_DMARECVSETUP(). I changed the arch/arm/stm32f7 chips to use arch_invalidate_dcache_by_addr() instead of arch_invalidate_dcache().

This commit includes additional changes to mmcsd_sdio.c.  I created SDIO_DMADELYDINVLDT() (DMA delayed invalidate) to invalidate store-into mode dcaches after the DMA transfer.  I have been using SDIO_DMADELYDINVLDT() for several weeks now and it has fixed the problems that I previously reported regarding non-cache aligned buffer invalidation errors (for my store-through dcache). However, it does not permit use of unaligned DMA buffers for store-into mode dcaches.

SDIO_DMADELYDINVLDT() is a NoOp unless the chip specific Kconfig file selects CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT. I have modified all the stm32f7 chips to select it.
2018-11-20 14:03:42 -06:00
Gregory Nutt 31485356b8 Updates based on coding style review of PR 755 2018-11-09 07:51:43 -06:00
Petteri Aimonen 96da659c0b Merged in paimonen/nuttx/pullreq_FAT_improvements (pull request #755)
Pullreq FAT improvements

* NuttX: Add CONFIG_FAT_LFN_ALIAS_HASH to speed up creating long filenames.

    Long filenames on FAT filesystems have associated 8.3 character alias
    short filenames. The traditional form of these is FILENA~1.EXT with
    a running count of the number of similar names. However creating this
    unique count can take several seconds if there are many similarly named
    files in the directory. Enabling FAT_LFN_ALIAS_HASH uses an alternative
    format of FI0123~1.TXT where the four digits are a hash of the original
    filename. This method is similar to what is used by Windows 2000 and
    later.

* NuttX: Add CONFIG_FAT_LFN_ALIAS_TRAILCHARS alternative format for 8.3 filenames.

    Traditional format for long filename 8.3 aliases takes first 6
    characters of long filename. If this option is set to N > 0,
    NuttX will instead take first 6-N and last N characters to form
    the short name. This is useful for filenames like "datafile12.txt"
    where the first characters would always remain the same.

* NuttX: FAT32: Fix file date corruption in fat_truncate().

* NuttX: if SD card wait seems to be a long one, give time for other threads to run.

Approved-by: GregoryN <gnutt@nuttx.org>
2018-11-09 13:46:16 +00:00
Gregory Nutt 5c8831c886 drivers/mmcsd/Kconfig: Remove executable bit from file permissions. 2018-10-30 09:48:53 -06:00
Dave Marples d1c01e1135 With these changes the SDMMC card for LPC4330 is now working properly BUT it needs more testing, especially with different cards etc. This code should be applicable to all members of the lpc43xx family.
In addition to the problems that were previously identified there were a few other bits and pieces outstanding;

  * Timing was dependent on CPU speed rather than absolute time
  * End of transfer handling was a bit mixed up
  * It's possible for data to still be in the FIFO (i.e. not have reached
    the card) when a next write is requested, so we need to wait for that to
    complete
  * Interrupt Status could be carried over from one transfer episode to the
    next, corrupting progress
  * Multi-descriptor DMA writing simply wasn't implemented, but there were no
    indications ... it just failed silently
2018-10-24 18:06:38 -06:00
Gregory Nutt 4e5cf1229c drivers/mmcsd/Kconfig: three configuration settings were within ifdef/endif and led to warning: xxx selects xxxx which has unmet direct dependencies. Fix by moving settings to drivers/Kconfig and outside of the ifdef-endif. Also renamed CONFIG_SDIO_PREFLIGHT to CONFIG_ARCH_HAVE_SDIO_PREFLIGHT to follow naming of similar hidden architecture capability configurations. 2018-08-05 17:58:17 -06:00
Gregory Nutt 92890552f1 drivrs/mmcsd: Partial reversion of commit 17b6c7ba39. Backed out all block callback logic controlled CONFIG_SDIO_BLK_CALLBACK. Usage of this feature by applications is a blatant violation of the POSIX interface standard. 2018-07-20 10:08:01 -06:00
Bob Feretich 17b6c7ba39 drivers/mmcsd/mmcsd_sdio.c: Fix an error that was causing SDIO multiple block transfers from achieving full performance. Also adds a feature controlled by CONFIG_SDIO_BLK_CALLBACK that bypasses the normal mechanism for obtaining sector data for transfer. 2018-07-20 09:55:33 -06:00
Alan Carvalho de Assis 283b73edc5 Fix lots of typos in C comments and Kconfig help text 2018-07-08 18:24:45 -06:00
Gregory Nutt 8fdbb1e0a4 Elimate use of the non-standard type systime_t and replace it the equivalent, standard type clock_t
Squashed commit of the following:

    sched:  Rename all use of system_t to clock_t.
    syscall:  Rename all use of system_t to clock_t.
    net:  Rename all use of system_t to clock_t.
    libs:  Rename all use of system_t to clock_t.
    fs:  Rename all use of system_t to clock_t.
    drivers:  Rename all use of system_t to clock_t.
    arch:  Rename all use of system_t to clock_t.
    include:  Remove definition of systime_t; rename all use of system_t to clock_t.
2018-06-16 12:16:13 -06:00
Michał Łyszczek 8de51543a4 Fix a few compilation errors. 2018-04-20 15:55:16 -06:00
Evgeniy Bobkov 7d36a81806 Fixes two bugs in multi-block SD-card operations on the STM32F7 platform. arch/arm/src/stm32f7: DBLOCKSIZE must be the size of SD-card block, not the total amount of transferred bytes. drivers/mmcsd: respect SDIO_CAPS_DMABEFOREWRITE on CMD25. 2018-01-16 12:41:02 -06:00
Gregory Nutt eef12f1f91 arch/arm/src/lpc54xx: In SDMMC driver, add logic to transfer data when TXDR or RXDR interrupts occur. Also, add logic to set the RX watermark to 2 when receiving short, non-DMA data transfers. 2017-12-20 17:27:52 -06:00
Gregory Nutt c867d42018 arch/arm/src/lpc54xx: Add support for card detect and write protect to SDMMC driver. configs/lpcxpresso-lpc54628: Add logic to bring up SDMMC. 2017-12-20 10:52:05 -06:00
Gregory Nutt 9568600ab1 Squashed commit of the following:
This commit backs out most of commit b4747286b1.  That change was added because sem_wait() would sometimes cause cancellation points inappropriated.  But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.

    In the OS, all calls to sem_wait() changed to nxsem_wait().  nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.

    In all OS functions (not libraries), change sem_wait() to nxsem_wait().  This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.

    sched/semaphore:  Add the function nxsem_wait().  This is a new internal OS interface.  It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt 42a0796615 Squashed commit of the following:
sched/semaphore:  Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable.  Changed all references to sem_post in the OS to nxsem_post().

    sched/semaphore:  Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable.  Changed all references to sem_destroy() in the OS to nxsem_destroy().

    libc/semaphore and sched/semaphore:  Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable.  Changed all references to sem_setprotocol in the OS to nxsem_setprotocol().  sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Gregory Nutt 83cdb0c552 Squashed commit of the following:
libc/semaphore:  Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable.  Changed all references to sem_getvalue in the OS to nxsem_getvalue().

    sched/semaphore:  Rename all internal private functions from sem_xyz to nxsem_xyz.  The sem_ prefix is (will be) reserved only for the application semaphore interfaces.

    libc/semaphore:  Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable.  Changed all references to sem_init in the OS to nxsem_init().

    sched/semaphore:  Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.

    sched/semaphoate:  Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Gregory Nutt 28637e644d Eliminate warning of unused global variables in certain configurations. 2017-08-12 16:33:34 -06:00
Julien Lecoeur 165ee0027a Eliminate a warning with arm-none-eabi-gcc 7.1.0 2017-07-06 08:32:51 -06:00
Gregory Nutt e9a5477506 Add an instance argument to the SPIDEV definitions. 2017-04-29 12:26:52 -06:00
David Sidrane 11d1b2e636 Typo mmcsd/mmcsd_sdio.c 2017-02-13 13:24:47 -10:00
Marc Rechté d501ffc563 Kinetis SDHC driver fixes. 2017-02-09 11:28:30 -06:00
Alan Carvalho de Assis 248d5d3185 MMC/SD SDIO: Some drivers need to start DMA before sending CMD24 and some AFTER 2017-02-09 11:13:05 -06:00
Gregory Nutt 764f503150 Remove duplicate setting for SDIO_DMA from drivers/mmcsd/Kconfig 2017-02-06 13:16:52 -06:00
Gregory Nutt 3dbdb3bb31 CONFIG_SDIO_DMA: Was been defined in several low-level architecute Kconfig files, but used at the highest levels in the code. Both are bad and both are fixed with this commit 2017-01-31 11:52:00 -06:00
Gregory Nutt 2a4791f4ee Removed dmasupported() method from the SDIO interface. That is now a bit in the cpapability set. 2017-01-31 09:51:15 -06:00
Gregory Nutt 9ac00a355f Add capabilities() method to SDIO interface. Remove CONFIG_SDIO_WIDTH_D1_ONLY. That should not be a global propertie, but rather a capability/limitation of single slot when there may be multiple slots. 2017-01-31 09:16:01 -06:00
Alan Carvalho de Assis c482437325 MMCSD_SDIO: Only wait for card ejected if card detection is supported 2017-01-26 07:44:17 -06:00
Gregory Nutt 2d9668fbd2 Fix a typo in a comment 2017-01-12 16:24:41 -06:00
Gregory Nutt 4795d58e03 Back out most of 46dbbe837e. The order is correct -- or, rather, the order is the same as the order that response data is provided. Change the order will break all other drivers. 2016-12-15 07:16:24 -06:00
Gregory Nutt ca92ecafa7 MMC/SD: Format changed from %d to %lu. Must cast argument to unsigned long to avoid crash on 64-bit machine. 2016-12-14 17:44:12 -06:00
Gregory Nutt f4f32bc740 MMC/SD SDIO (again): This is really an endian-ness issue. Behavior should be different on big- vs little-endian machines. 2016-12-14 17:04:27 -06:00
Alan Carvalho de Assis 3c4a8d05b0 MMC/SD SDIO driver: Change the endianess order to read the return of long response command 2016-12-14 14:17:52 -06:00
Gregory Nutt 46dbbe837e rwbuffer.h moved from include/nuttx/ to include/nuttx/drivers. 2016-07-20 13:54:38 -06:00
Gregory Nutt 6fda036615 Eliminate a warning 2016-07-13 14:09:51 -06:00
Gregory Nutt 43eb04bb8f Without lowsyslog() *llinfo() is not useful. Eliminate and replace with *info(). 2016-06-20 11:59:15 -06:00
Gregory Nutt efb02f2ef1 drivers/: Change some nerr() ERRORS to nwarn() WARNINGS. Anomolous network evernts are not errors. 2016-06-12 08:31:22 -06:00
Gregory Nutt a1469a3e95 Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err() 2016-06-11 15:50:49 -06:00