SAMA5D4: Add auto-mounter support for HSMCI0

This commit is contained in:
Gregory Nutt
2014-07-29 15:34:31 -06:00
parent 31d21640af
commit 7b1b915226
23 changed files with 686 additions and 64 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ config SAM4EEK_120MHZ
endchoice # CPU Frequency endchoice # CPU Frequency
config SAM4EEK_AT25_AUTOMOUNT config SAM4EEK_AT25_BLOCKMOUNT
bool "AT25 serial FLASH auto-mount" bool "AT25 serial FLASH auto-mount"
default n default n
depends on SAM34_SPI0 && MTD_AT25 depends on SAM34_SPI0 && MTD_AT25
@@ -27,7 +27,7 @@ config SAM4EEK_AT25_AUTOMOUNT
choice choice
prompt "AT25 serial FLASH configuration" prompt "AT25 serial FLASH configuration"
default SAM4EEK_AT25_FTL default SAM4EEK_AT25_FTL
depends on SAM4EEK_AT25_AUTOMOUNT depends on SAM4EEK_AT25_BLOCKMOUNT
config SAM4EEK_AT25_FTL config SAM4EEK_AT25_FTL
bool "Create AT25 Serial FLASH block driver" bool "Create AT25 Serial FLASH block driver"
+1 -1
View File
@@ -572,7 +572,7 @@ AT25 Serial FLASH
CONFIG_NSH_ARCHINIT=y : NSH board-initialization CONFIG_NSH_ARCHINIT=y : NSH board-initialization
Board Selection Board Selection
CONFIG_SAM4EEK_AT25_AUTOMOUNT=y : Mounts AT25 for NSH CONFIG_SAM4EEK_AT25_BLOCKMOUNT=y : Mounts AT25 for NSH
CONFIG_SAM4EEK_AT25_FTL=y : Create block driver for FAT CONFIG_SAM4EEK_AT25_FTL=y : Create block driver for FAT
You can then format the AT25 FLASH for a FAT file system and mount the You can then format the AT25 FLASH for a FAT file system and mount the
+1 -1
View File
@@ -331,7 +331,7 @@ CONFIG_NSH_MMCSDMINOR=0
# #
# CONFIG_SAM4EEK_96MHZ is not set # CONFIG_SAM4EEK_96MHZ is not set
CONFIG_SAM4EEK_120MHZ=y CONFIG_SAM4EEK_120MHZ=y
CONFIG_SAM4EEK_AT25_AUTOMOUNT=y CONFIG_SAM4EEK_AT25_BLOCKMOUNT=y
CONFIG_SAM4EEK_AT25_FTL=y CONFIG_SAM4EEK_AT25_FTL=y
# #
+1 -1
View File
@@ -92,7 +92,7 @@
* asked to mount the AT25 part * asked to mount the AT25 part
*/ */
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM4EEK_AT25_AUTOMOUNT) #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM4EEK_AT25_BLOCKMOUNT)
# undef HAVE_AT25 # undef HAVE_AT25
#endif #endif
+1 -1
View File
@@ -336,7 +336,7 @@ CONFIG_NSH_MMCSDMINOR=0
# #
# CONFIG_SAM4EEK_96MHZ is not set # CONFIG_SAM4EEK_96MHZ is not set
CONFIG_SAM4EEK_120MHZ=y CONFIG_SAM4EEK_120MHZ=y
CONFIG_SAM4EEK_AT25_AUTOMOUNT=y CONFIG_SAM4EEK_AT25_BLOCKMOUNT=y
CONFIG_SAM4EEK_AT25_FTL=y CONFIG_SAM4EEK_AT25_FTL=y
# #
+2 -2
View File
@@ -37,7 +37,7 @@ config SAMA5D3XPLAINED_MT47H64M16HR
endchoice # SAMA5D3-Xplained DRAM Type endchoice # SAMA5D3-Xplained DRAM Type
config SAMA5D3XPLAINED_NAND_AUTOMOUNT config SAMA5D3XPLAINED_NAND_BLOCKMOUNT
bool "NAND FLASH auto-mount" bool "NAND FLASH auto-mount"
default n default n
depends on NSH_ARCHINIT && SAMA5_EBICS3_NAND depends on NSH_ARCHINIT && SAMA5_EBICS3_NAND
@@ -47,7 +47,7 @@ config SAMA5D3XPLAINED_NAND_AUTOMOUNT
choice choice
prompt "NAND FLASH configuration" prompt "NAND FLASH configuration"
default SAMA5D3XPLAINED_NAND_NXFFS default SAMA5D3XPLAINED_NAND_NXFFS
depends on SAMA5D3XPLAINED_NAND_AUTOMOUNT depends on SAMA5D3XPLAINED_NAND_BLOCKMOUNT
config SAMA5D3XPLAINED_NAND_FTL config SAMA5D3XPLAINED_NAND_FTL
bool "Create NAND FLASH block driver" bool "Create NAND FLASH block driver"
+5 -5
View File
@@ -1636,8 +1636,8 @@ NAND Support
to enable SDRAM as described above. to enable SDRAM as described above.
Board Selection Board Selection
CONFIG_SAMA5D3XPLAINED_NAND_AUTOMOUNT=y : Enable FS support on NAND CONFIG_SAMA5D3XPLAINED_NAND_BLOCKMOUNT=y : Enable FS support on NAND
CONFIG_SAMA5D3XPLAINED_NAND_NXFFS=y : Use the NXFFS file system CONFIG_SAMA5D3XPLAINED_NAND_NXFFS=y : Use the NXFFS file system
Other file systems are not recommended because only NXFFS can handle Other file systems are not recommended because only NXFFS can handle
bad blocks and only NXFFS performs wear-levelling. bad blocks and only NXFFS performs wear-levelling.
@@ -1660,8 +1660,8 @@ NAND Support
Defaults for all other NXFFS settings should be okay. Defaults for all other NXFFS settings should be okay.
Board Selection Board Selection
CONFIG_SAMA5D3XPLAINED_NAND_AUTOMOUNT=y : Enable FS support on NAND CONFIG_SAMA5D3XPLAINED_NAND_BLOCKMOUNT=y : Enable FS support on NAND
CONFIG_SAMA5D3XPLAINED_NAND_FTL=y : Use an flash translation layer CONFIG_SAMA5D3XPLAINED_NAND_FTL=y : Use an flash translation layer
NOTE: FTL will require some significant buffering because of NOTE: FTL will require some significant buffering because of
the large size of the NAND flash blocks. You will also need the large size of the NAND flash blocks. You will also need
@@ -1678,7 +1678,7 @@ NAND Support
Using NAND with NXFFS Using NAND with NXFFS
--------------------- ---------------------
With the options CONFIG_SAMA5D3XPLAINED_NAND_AUTOMOUNT=y and With the options CONFIG_SAMA5D3XPLAINED_NAND_BLOCKMOUNT=y and
CONFIG_SAMA5D3XPLAINED_NAND_NXFFS=y, the NAND FLASH will be mounted in the NSH CONFIG_SAMA5D3XPLAINED_NAND_NXFFS=y, the NAND FLASH will be mounted in the NSH
start-up logic before the NSH prompt appears. There is no feedback as start-up logic before the NSH prompt appears. There is no feedback as
to whether or not the mount was successful. You can, however, see the to whether or not the mount was successful. You can, however, see the
@@ -95,7 +95,7 @@
* asked to mount the NAND part * asked to mount the NAND part
*/ */
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D3XPLAINED_NAND_AUTOMOUNT) #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D3XPLAINED_NAND_BLOCKMOUNT)
# undef HAVE_NAND # undef HAVE_NAND
#endif #endif
+6 -6
View File
@@ -68,7 +68,7 @@ config SAMA5D3xEK_NOR_START
option: If SAMA5D3xEK_NOR_START is defined, then it will not wait but option: If SAMA5D3xEK_NOR_START is defined, then it will not wait but
will, instead, immediately start the program in NOR FLASH. will, instead, immediately start the program in NOR FLASH.
config SAMA5_NAND_AUTOMOUNT config SAMA5D3XEK_NAND_BLOCKMOUNT
bool "NAND FLASH auto-mount" bool "NAND FLASH auto-mount"
default n default n
depends on NSH_ARCHINIT && SAMA5_EBICS3_NAND depends on NSH_ARCHINIT && SAMA5_EBICS3_NAND
@@ -78,7 +78,7 @@ config SAMA5_NAND_AUTOMOUNT
choice choice
prompt "NAND FLASH configuration" prompt "NAND FLASH configuration"
default SAMA5D3xEK_NAND_NXFFS default SAMA5D3xEK_NAND_NXFFS
depends on SAMA5_NAND_AUTOMOUNT depends on SAMA5D3XEK_NAND_BLOCKMOUNT
config SAMA5D3xEK_NAND_FTL config SAMA5D3xEK_NAND_FTL
bool "Create NAND FLASH block driver" bool "Create NAND FLASH block driver"
@@ -107,7 +107,7 @@ config SAMA5D3xEK_NAND_NXFFS
endchoice # NAND FLASH configuration endchoice # NAND FLASH configuration
config SAMA5D3xEK_AT25_AUTOMOUNT config SAMA5D3xEK_AT25_BLOCKMOUNT
bool "AT25 serial FLASH auto-mount" bool "AT25 serial FLASH auto-mount"
default n default n
depends on NSH_ARCHINIT && SAMA5_SPI0 && MTD_AT25 depends on NSH_ARCHINIT && SAMA5_SPI0 && MTD_AT25
@@ -117,7 +117,7 @@ config SAMA5D3xEK_AT25_AUTOMOUNT
choice choice
prompt "AT25 serial FLASH configuration" prompt "AT25 serial FLASH configuration"
default SAMA5D3xEK_AT25_FTL default SAMA5D3xEK_AT25_FTL
depends on SAMA5D3xEK_AT25_AUTOMOUNT depends on SAMA5D3xEK_AT25_BLOCKMOUNT
config SAMA5D3xEK_AT25_FTL config SAMA5D3xEK_AT25_FTL
bool "Create AT25 Serial FLASH block driver" bool "Create AT25 Serial FLASH block driver"
@@ -137,7 +137,7 @@ config SAMA5D3xEK_AT25_NXFFS
endchoice # AT25 serial FLASH configuration endchoice # AT25 serial FLASH configuration
config SAMA5D3xEK_AT24_AUTOMOUNT config SAMA5D3xEK_AT24_BLOCKMOUNT
bool "AT24 Serial EEPROM auto-mount" bool "AT24 Serial EEPROM auto-mount"
default n default n
depends on NSH_ARCHINIT && SAMA5_TWI0 && MTD_AT24XX depends on NSH_ARCHINIT && SAMA5_TWI0 && MTD_AT24XX
@@ -158,7 +158,7 @@ config SAMA5D3xEK_AT24_AUTOMOUNT
choice choice
prompt "AT24 serial EPPROM configuration" prompt "AT24 serial EPPROM configuration"
default SAMA5D3xEK_AT24_FTL default SAMA5D3xEK_AT24_FTL
depends on SAMA5D3xEK_AT24_AUTOMOUNT depends on SAMA5D3xEK_AT24_BLOCKMOUNT
config SAMA5D3xEK_AT24_FTL config SAMA5D3xEK_AT24_FTL
bool "Create AT24 block driver" bool "Create AT24 block driver"
+7 -7
View File
@@ -1115,7 +1115,7 @@ AT25 Serial FLASH
CONFIG_NSH_ARCHINIT=y : NSH board-initialization CONFIG_NSH_ARCHINIT=y : NSH board-initialization
Board Selection Board Selection
CONFIG_SAMA5D3xEK_AT25_AUTOMOUNT=y : Mounts AT25 for NSH CONFIG_SAMA5D3xEK_AT25_BLOCKMOUNT=y : Mounts AT25 for NSH
CONFIG_SAMA5D3xEK_AT25_FTL=y : Create block driver for FAT CONFIG_SAMA5D3xEK_AT25_FTL=y : Create block driver for FAT
NOTE that you must close JP1 on the Embest/Ronetix board in order to NOTE that you must close JP1 on the Embest/Ronetix board in order to
@@ -1832,8 +1832,8 @@ NAND Support
to enable SDRAM as described above. to enable SDRAM as described above.
Board Selection Board Selection
CONFIG_SAMA5_NAND_AUTOMOUNT=y : Enable FS support on NAND CONFIG_SAMA5D3XEK_NAND_BLOCKMOUNT=y : Enable FS support on NAND
CONFIG_SAMA5D3xEK_NAND_NXFFS=y : Use the NXFFS file system CONFIG_SAMA5D3xEK_NAND_NXFFS=y : Use the NXFFS file system
Other file systems are not recommended because only NXFFS can handle Other file systems are not recommended because only NXFFS can handle
bad blocks and only NXFFS performs wear-levelling. bad blocks and only NXFFS performs wear-levelling.
@@ -1856,8 +1856,8 @@ NAND Support
Defaults for all other NXFFS settings should be okay. Defaults for all other NXFFS settings should be okay.
Board Selection Board Selection
CONFIG_SAMA5_NAND_AUTOMOUNT=y : Enable FS support on NAND CONFIG_SAMA5D3XEK_NAND_BLOCKMOUNT=y : Enable FS support on NAND
CONFIG_SAMA5D3xEK_NAND_FTL=y : Use an flash translation layer CONFIG_SAMA5D3xEK_NAND_FTL=y : Use an flash translation layer
NOTE: FTL will require some significant buffering because of NOTE: FTL will require some significant buffering because of
the large size of the NAND flash blocks. You will also need the large size of the NAND flash blocks. You will also need
@@ -1874,7 +1874,7 @@ NAND Support
Using NAND with NXFFS Using NAND with NXFFS
--------------------- ---------------------
With the options CONFIG_SAMA5_NAND_AUTOMOUNT=y and With the options CONFIG_SAMA5D3XEK_NAND_BLOCKMOUNT=y and
CONFIG_SAMA5D3xEK_NAND_NXFFS=y, the NAND FLASH will be mounted in the NSH CONFIG_SAMA5D3xEK_NAND_NXFFS=y, the NAND FLASH will be mounted in the NSH
start-up logic before the NSH prompt appears. There is no feedback as start-up logic before the NSH prompt appears. There is no feedback as
to whether or not the mount was successful. You can, however, see the to whether or not the mount was successful. You can, however, see the
@@ -2097,7 +2097,7 @@ AT24 Serial EEPROM
: Other defaults are probably OK : Other defaults are probably OK
Board Selection Board Selection
CONFIG_SAMA5D3xEK_AT24_AUTOMOUNT=y : Mounts AT24 for NSH CONFIG_SAMA5D3xEK_AT24_BLOCKMOUNT=y : Mounts AT24 for NSH
CONFIG_SAMA5D3xEK_AT24_NXFFS=y : Mount the AT24 using NXFFS CONFIG_SAMA5D3xEK_AT24_NXFFS=y : Mount the AT24 using NXFFS
You can then format the AT24 EEPROM for a FAT file system and mount the You can then format the AT24 EEPROM for a FAT file system and mount the
+1 -1
View File
@@ -360,7 +360,7 @@ CONFIG_SAMA5D3xEK_396MHZ=y
CONFIG_SAMA5D3xEK_MT47H128M16RT=y CONFIG_SAMA5D3xEK_MT47H128M16RT=y
# CONFIG_SAMA5D3xEK_MT47H64M16HR is not set # CONFIG_SAMA5D3xEK_MT47H64M16HR is not set
# CONFIG_SAMA5D3xEK_NOREDLED is not set # CONFIG_SAMA5D3xEK_NOREDLED is not set
CONFIG_SAMA5D3xEK_AT25_AUTOMOUNT=y CONFIG_SAMA5D3xEK_AT25_BLOCKMOUNT=y
CONFIG_SAMA5D3xEK_AT25_FTL=y CONFIG_SAMA5D3xEK_AT25_FTL=y
# #
+3 -3
View File
@@ -97,7 +97,7 @@
* asked to mount the NAND part * asked to mount the NAND part
*/ */
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5_NAND_AUTOMOUNT) #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D3XEK_NAND_BLOCKMOUNT)
# undef HAVE_NAND # undef HAVE_NAND
#endif #endif
@@ -142,7 +142,7 @@
* asked to mount the AT25 part * asked to mount the AT25 part
*/ */
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D3xEK_AT25_AUTOMOUNT) #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D3xEK_AT25_BLOCKMOUNT)
# undef HAVE_AT25 # undef HAVE_AT25
#endif #endif
@@ -192,7 +192,7 @@
* asked to mount the AT25 part * asked to mount the AT25 part
*/ */
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D3xEK_AT24_AUTOMOUNT) #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D3xEK_AT24_BLOCKMOUNT)
# undef HAVE_AT24 # undef HAVE_AT24
#endif #endif
+65 -4
View File
@@ -106,7 +106,7 @@ config SAMA5D4EK_DRAM_BOOT
will simply origin your program at 0x2000:0000 as required by the will simply origin your program at 0x2000:0000 as required by the
sdram_main bootloader (vs. 0x2000:8000 as required by U-Boot). sdram_main bootloader (vs. 0x2000:8000 as required by U-Boot).
config SAMA5D4EK_NAND_AUTOMOUNT config SAMA5D4EK_NAND_BLOCKMOUNT
bool "NAND FLASH auto-mount" bool "NAND FLASH auto-mount"
default n default n
depends on NSH_ARCHINIT && SAMA5_EBICS3_NAND depends on NSH_ARCHINIT && SAMA5_EBICS3_NAND
@@ -116,7 +116,7 @@ config SAMA5D4EK_NAND_AUTOMOUNT
choice choice
prompt "NAND FLASH configuration" prompt "NAND FLASH configuration"
default SAMA5D4EK_NAND_NXFFS default SAMA5D4EK_NAND_NXFFS
depends on SAMA5D4EK_NAND_AUTOMOUNT depends on SAMA5D4EK_NAND_BLOCKMOUNT
config SAMA5D4EK_NAND_FTL config SAMA5D4EK_NAND_FTL
bool "Create NAND FLASH block driver" bool "Create NAND FLASH block driver"
@@ -145,7 +145,7 @@ config SAMA5D4EK_NAND_NXFFS
endchoice # NAND FLASH configuration endchoice # NAND FLASH configuration
config SAMA5D4EK_AT25_AUTOMOUNT config SAMA5D4EK_AT25_BLOCKMOUNT
bool "AT25 serial FLASH auto-mount" bool "AT25 serial FLASH auto-mount"
default n default n
depends on (NSH_ARCHINIT || SAMA5D4EK_AT25_MAIN) && SAMA5_SPI0 && MTD_AT25 depends on (NSH_ARCHINIT || SAMA5D4EK_AT25_MAIN) && SAMA5_SPI0 && MTD_AT25
@@ -155,7 +155,7 @@ config SAMA5D4EK_AT25_AUTOMOUNT
choice choice
prompt "AT25 serial FLASH configuration" prompt "AT25 serial FLASH configuration"
default SAMA5D4EK_AT25_FTL default SAMA5D4EK_AT25_FTL
depends on SAMA5D4EK_AT25_AUTOMOUNT depends on SAMA5D4EK_AT25_BLOCKMOUNT
config SAMA5D4EK_AT25_FTL config SAMA5D4EK_AT25_FTL
bool "Create AT25 Serial FLASH block driver" bool "Create AT25 Serial FLASH block driver"
@@ -183,6 +183,67 @@ config SAMA5D4EK_AT25_NXFFS
endchoice # AT25 serial FLASH configuration endchoice # AT25 serial FLASH configuration
if FS_AUTOMOUNTER
config SAMA5D4EK_HSMCI0_AUTOMOUNT
bool "HSMCI0 automounter"
default n
depends on SAMA5_HSMCI0
if SAMA5D4EK_HSMCI0_AUTOMOUNT
config SAMA5D4EK_HSMCI0_AUTOMOUNT_FSTYPE
string "HSMCI0 file system type"
default "vfat"
config SAMA5D4EK_HSMCI0_AUTOMOUNT_BLKDEV
string "HSMCI0 block device"
default "/dev/mmcds0"
config SAMA5D4EK_HSMCI0_AUTOMOUNT_MOUNTPOINT
string "HSMCI0 mount point"
default "/mnt/sdcard0"
config SAMA5D4EK_HSMCI0_AUTOMOUNT_DDELAY
int "HSMCI0 debounce delay (milliseconds)"
default 1000
config SAMA5D4EK_HSMCI0_AUTOMOUNT_UDELAY
int "HSMCI0 unmount retry delay (milliseconds)"
default 2000
endif # SAMA5D4EK_HSMCI0_AUTOMOUNT
config SAMA5D4EK_HSMCI1_AUTOMOUNT
bool "HSMCI1 automounter"
default n
depends on SAMA5_HSMCI1
if SAMA5D4EK_HSMCI1_AUTOMOUNT
config SAMA5D4EK_HSMCI1_AUTOMOUNT_FSTYPE
string "HSMCI1 file system type"
default "vfat"
config SAMA5D4EK_HSMCI1_AUTOMOUNT_BLKDEV
string "HSMCI1 block device"
default "/dev/mmcds0"
config SAMA5D4EK_HSMCI1_AUTOMOUNT_MOUNTPOINT
string "HSMCI1 mount point"
default "/mnt/sdcard0"
config SAMA5D4EK_HSMCI1_AUTOMOUNT_DDELAY
int "HSMCI1 debounce delay (milliseconds)"
default 1000
config SAMA5D4EK_HSMCI1_AUTOMOUNT_UDELAY
int "HSMCI1 unmount retry delay (milliseconds)"
default 2000
endif # SAMA5D4EK_HSMCI1_AUTOMOUNT
endif # FS_AUTOMOUNTER
if INPUT_MXT if INPUT_MXT
config SAMA5D4EK_MXT_I2CFREQUENCY config SAMA5D4EK_MXT_I2CFREQUENCY
+7 -7
View File
@@ -1434,8 +1434,8 @@ AT25 Serial FLASH
CONFIG_NSH_ARCHINIT=y : NSH board-initialization CONFIG_NSH_ARCHINIT=y : NSH board-initialization
Board Selection Board Selection
CONFIG_SAMA5D4EK_AT25_AUTOMOUNT=y : Mounts AT25 for NSH CONFIG_SAMA5D4EK_AT25_BLOCKMOUNT=y : Mounts AT25 for NSH
CONFIG_SAMA5D4EK_AT25_FTL=y : Create block driver for FAT CONFIG_SAMA5D4EK_AT25_FTL=y : Create block driver for FAT
NOTE: that you must close JP6 in order to enable the AT25 FLASH chip select. NOTE: that you must close JP6 in order to enable the AT25 FLASH chip select.
@@ -2119,8 +2119,8 @@ NAND Support
to enable SDRAM as described above. to enable SDRAM as described above.
Board Selection Board Selection
CONFIG_SAMA5D4EK_NAND_AUTOMOUNT=y : Enable FS support on NAND CONFIG_SAMA5D4EK_NAND_BLOCKMOUNT=y : Enable FS support on NAND
CONFIG_SAMA5D4EK_NAND_NXFFS=y : Use the NXFFS file system CONFIG_SAMA5D4EK_NAND_NXFFS=y : Use the NXFFS file system
Other file systems are not recommended because only NXFFS can handle Other file systems are not recommended because only NXFFS can handle
bad blocks and only NXFFS performs wear-levelling. bad blocks and only NXFFS performs wear-levelling.
@@ -2143,8 +2143,8 @@ NAND Support
Defaults for all other NXFFS settings should be okay. Defaults for all other NXFFS settings should be okay.
Board Selection Board Selection
CONFIG_SAMA5D4EK_NAND_AUTOMOUNT=y : Enable FS support on NAND CONFIG_SAMA5D4EK_NAND_BLOCKOMOUNT=y : Enable FS support on NAND
CONFIG_SAMA5D4EK_NAND_FTL=y : Use an flash translation layer CONFIG_SAMA5D4EK_NAND_FTL=y : Use an flash translation layer
NOTE: FTL will require some significant buffering because of NOTE: FTL will require some significant buffering because of
the large size of the NAND flash blocks. You will also need the large size of the NAND flash blocks. You will also need
@@ -2161,7 +2161,7 @@ NAND Support
Using NAND with NXFFS Using NAND with NXFFS
--------------------- ---------------------
With the options CONFIG_SAMA5D4EK_NAND_AUTOMOUNT=y and With the options CONFIG_SAMA5D4EK_NAND_BLOCKMOUNT=y and
CONFIG_SAMA5D4EK_NAND_NXFFS=y, the NAND FLASH will be mounted in the NSH CONFIG_SAMA5D4EK_NAND_NXFFS=y, the NAND FLASH will be mounted in the NSH
start-up logic before the NSH prompt appears. There is no feedback as start-up logic before the NSH prompt appears. There is no feedback as
to whether or not the mount was successful. You can, however, see the to whether or not the mount was successful. You can, however, see the
+1 -1
View File
@@ -322,7 +322,7 @@ CONFIG_SAMA5D4EK_MT47H128M16RT=y
# CONFIG_SAMA5D4EK_DRAM_MAIN is not set # CONFIG_SAMA5D4EK_DRAM_MAIN is not set
CONFIG_SAMA5D4EK_AT25_MAIN=y CONFIG_SAMA5D4EK_AT25_MAIN=y
CONFIG_SAMA5D4EK_AT25_PROGSIZE=131072 CONFIG_SAMA5D4EK_AT25_PROGSIZE=131072
CONFIG_SAMA5D4EK_AT25_AUTOMOUNT=y CONFIG_SAMA5D4EK_AT25_BLOCKMOUNT=y
# CONFIG_SAMA5D4EK_AT25_FTL is not set # CONFIG_SAMA5D4EK_AT25_FTL is not set
CONFIG_SAMA5D4EK_AT25_CHARDEV=y CONFIG_SAMA5D4EK_AT25_CHARDEV=y
+4
View File
@@ -76,6 +76,10 @@ CSRCS += sam_at25.c
endif endif
endif endif
ifeq ($(CONFIG_FS_AUTOMOUNTER),y)
CSRCS += sam_automount.c
endif
ifeq ($(CONFIG_AUDIO_WM8904),y) ifeq ($(CONFIG_AUDIO_WM8904),y)
ifeq ($(CONFIG_SAMA5_TWI0),y) ifeq ($(CONFIG_SAMA5_TWI0),y)
ifeq ($(CONFIG_SAMA5_SSC0),y) ifeq ($(CONFIG_SAMA5_SSC0),y)
+2 -2
View File
@@ -63,8 +63,8 @@
# error The AT25 Serial FLASH is not available # error The AT25 Serial FLASH is not available
#endif #endif
#ifndef CONFIG_SAMA5D4EK_AT25_AUTOMOUNT #ifndef CONFIG_SAMA5D4EK_AT25_BLOCKMOUNT
# error CONFIG_SAMA5D4EK_AT25_AUTOMOUNT must be selected # error CONFIG_SAMA5D4EK_AT25_BLOCKMOUNT must be selected
#endif #endif
#ifndef CONFIG_SAMA5D4EK_AT25_CHARDEV #ifndef CONFIG_SAMA5D4EK_AT25_CHARDEV
+390
View File
@@ -0,0 +1,390 @@
/************************************************************************************
* configs/sama5d4-ek/src/sam_automount.c
*
* Copyright (C) 2014 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#if defined(CONFIG_FS_AUTOMOUNTER_DEBUG) && !defined(CONFIG_DEBUG_FS)
# define CONFIG_DEBUG_FS 1
#endif
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/clock.h>
#include <nuttx/fs/automount.h>
#include "sama5d4-ek.h"
#ifdef HAVE_AUTOMOUNTER
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
#ifndef NULL
# define NULL (FAR void *)0
#endif
#ifndef OK
# define OK 0
#endif
/************************************************************************************
* Private Types
************************************************************************************/
/* This structure represents the changeable state of the automounter */
struct sam_automount_state_s
{
volatile automount_handler_t handler; /* Upper half handler */
FAR void *arg; /* Handler argument */
bool enable; /* Fake interrupt enable */
bool pending; /* Set if there an event while disabled */
};
/* This structure represents the static configuration of an automounter */
struct sam_automount_config_s
{
/* This must be first thing in structure so that we can simply cast from struct
* automount_lower_s to struct sam_automount_config_s
*/
struct automount_lower_s lower; /* Publicly visible part */
uint8_t hsmci; /* HSMCI0_SLOTNO or HSMCI1_SLOTNO */
FAR struct sam_automount_state_s *state; /* Changeable state */
};
/************************************************************************************
* Private Function Prototypes
************************************************************************************/
static int sam_attach(FAR const struct automount_lower_s *lower,
automount_handler_t isr, FAR void *arg);
static void sam_enable(FAR const struct automount_lower_s *lower, bool enable);
static bool sam_inserted(FAR const struct automount_lower_s *lower);
/************************************************************************************
* Private Data
************************************************************************************/
#ifdef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT
static struct sam_automount_state_s g_hsmci0state;
static const struct sam_automount_config_s g_hsmci0config =
{
.lower =
{
.fstype = CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_UDELAY),
.attach = sam_attach,
.enable = sam_enable,
.inserted = sam_inserted
},
.hsmci = HSMCI0_SLOTNO,
.state = &g_hsmci0state
};
#endif
#ifdef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT
static struct sam_automount_state_s g_hsmci1state;
static const struct sam_automount_config_s g_hsmci1config =
{
.lower =
{
.fstype = CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_UDELAY),
.attach = sam_attach,
.enable = sam_enable,
.inserted = sam_inserted
},
.hsmci = HSMCI1_SLOTNO,
.state = &g_hsmci1state
};
#endif
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Name: sam_automount_initialize
*
* Description:
* Configure auto-mounters for each enable and so configured HSMCI
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
************************************************************************************/
static int sam_attach(FAR const struct automount_lower_s *lower,
automount_handler_t isr, FAR void *arg)
{
FAR const struct sam_automount_config_s *config;
FAR struct sam_automount_state_s *state;
/* Recover references to our structure */
config = (FAR struct sam_automount_config_s *)lower;
DEBUGASSERT(config && config->state);
state = config->state;
/* Save the new handler info (clearing the handler first to eliminate race
* conditions.
*/
state->handler = NULL;
state->pending = false;
state->arg = arg;
state->handler = isr;
return OK;
}
/************************************************************************************
* Name: sam_automount_initialize
*
* Description:
* Configure auto-mounters for each enable and so configured HSMCI
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
************************************************************************************/
static void sam_enable(FAR const struct automount_lower_s *lower, bool enable)
{
FAR const struct sam_automount_config_s *config;
FAR struct sam_automount_state_s *state;
irqstate_t flags;
/* Recover references to our structure */
config = (FAR struct sam_automount_config_s *)lower;
DEBUGASSERT(config && config->state);
state = config->state;
/* Save the fake enable setting */
flags = irqsave();
state->enable = enable;
/* Did an interrupt occur while interrupts were disabled? */
if (enable && state->pending)
{
/* Yes.. perform the fake interrupt if the interrutp is attached */
if (state->handler)
{
bool inserted = sam_cardinserted(config->hsmci);
(void)state->handler(&config->lower, state->arg, inserted);
}
state->pending = false;
}
irqrestore(flags);
}
/************************************************************************************
* Name: sam_automount_initialize
*
* Description:
* Configure auto-mounters for each enable and so configured HSMCI
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
************************************************************************************/
static bool sam_inserted(FAR const struct automount_lower_s *lower)
{
FAR const struct sam_automount_config_s *config;
config = (FAR struct sam_automount_config_s *)lower;
DEBUGASSERT(config && config->state);
return sam_cardinserted(config->hsmci);
}
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_automount_initialize
*
* Description:
* Configure auto-mounters for each enable and so configured HSMCI
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
************************************************************************************/
void sam_automount_initialize(void)
{
FAR void *handle;
fvdbg("Initializing automounter(s)\n");
#ifdef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT
/* Initialize the HSMCI0 auto-mounter */
handle = automount_initialize(&g_hsmci0config.lower);
if (!handle)
{
fdbg("ERROR: Failed to initialize auto-mounter for HSMCI0\n");
}
#endif
#ifdef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT
/* Initialize the HSMCI1 auto-mounter */
handle = automount_initialize(&g_hsmci1config.lower);
if (!handle)
{
fdbg("ERROR: Failed to initialize auto-mounter for HSMCI1\n");
}
#endif
}
/************************************************************************************
* Name: sam_automount_event
*
* Description:
* The HSMCI card detection logic has detected an insertion or removal event. It
* has already scheduled the MMC/SD block driver operations. Now we need to
* schedule the auto-mount event which will occur with a substantial delay to make
* sure that everything has settle down.
*
* Input Parameters:
* slotno - Identifies the HSMCI0 slot: HSMCI0_SLOTNO or HSMCI1_SLOTNO. There is a
* terminology problem here: Each HSMCI supports two slots, slot A and slot B.
* Only slot A is used. So this is not a really a slot, but an HSCMI peripheral
* number.
* inserted - True if the card is inserted in the slot. False otherwise.
*
* Returned Value:
* None
*
* Assumptions:
* Interrupts are disabled.
*
************************************************************************************/
void sam_automount_event(int slotno, bool inserted)
{
FAR const struct sam_automount_config_s *config;
FAR struct sam_automount_state_s *state;
#ifdef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT
/* Is this a change in the HSMCI0 insertion state? */
if (slotno == HSMCI0_SLOTNO)
{
/* Yes.. Select the HSMCI0 automounter */
config = &g_hsmci0config;
state = &g_hsmci0state;
}
else
#endif
#ifdef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT
/* Is this a change in the HSMCI1 insertion state? */
if (slotno == HSMCI1_SLOTNO)
{
/* Yes.. Select the HSMCI1 automounter */
config = &g_hsmci1config;
state = &g_hsmci1state;
}
else
#endif
{
fdbg("ERROR: Unsupported HSCMI%d\n", slotno);
return;
}
/* Is the auto-mounter interrupt attached? */
if (state->handler)
{
/* Yes.. Have we been asked to hold off interrupts? */
if (!state->enable)
{
/* Yes.. just remember the there is a pending interrupt. We will
* deliver the interrupt when interrupts are "re-enabled."
*/
state->pending = true;
}
else
{
/* No.. forward the event to the handler */
(void)state->handler(&config->lower, state->arg, inserted);
}
}
}
#endif /* HAVE_AUTOMOUNTER */
+30 -2
View File
@@ -204,14 +204,42 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state)
#ifdef CONFIG_SAMA5_HSMCI0 #ifdef CONFIG_SAMA5_HSMCI0
static int sam_hsmci0_cardetect(int irq, void *regs) static int sam_hsmci0_cardetect(int irq, void *regs)
{ {
return sam_hsmci_cardetect(&g_hsmci0); int ret;
/* Handle the card detect interrupt. The interrupt level logic will
* kick of the driver-level operations to initialize the MMC/SD block
* device.
*/
ret = sam_hsmci_cardetect(&g_hsmci0);
#ifdef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT
/* Let the automounter know about the insertion event */
sam_automount_event(HSMCI0_SLOTNO, sam_cardinserted(HSMCI0_SLOTNO));
#endif
return ret;
} }
#endif #endif
#ifdef CONFIG_SAMA5_HSMCI1 #ifdef CONFIG_SAMA5_HSMCI1
static int sam_hsmci1_cardetect(int irq, void *regs) static int sam_hsmci1_cardetect(int irq, void *regs)
{ {
return sam_hsmci_cardetect(&g_hsmci1); int ret;
/* Handle the card detect interrupt. The interrupt level logic will
* kick of the driver-level operations to initialize the MMC/SD block
* device.
*/
ret = sam_hsmci_cardetect(&g_hsmci1);
#ifdef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT
/* Let the automounter know about the insertion event */
sam_automount_event(HSMCI1_SLOTNO, sam_cardinserted(HSMCI1_SLOTNO));
#endif
} }
#endif #endif
+6
View File
@@ -135,6 +135,12 @@ int nsh_archinitialize(void)
#endif #endif
#endif #endif
#ifdef HAVE_AUTOMOUNTER
/* Initialize the automounter */
sam_automount_initialize();
#endif
#ifdef HAVE_USBHOST #ifdef HAVE_USBHOST
/* Initialize USB host operation. sam_usbhost_initialize() starts a thread /* Initialize USB host operation. sam_usbhost_initialize() starts a thread
* will monitor for USB connection and disconnection events. * will monitor for USB connection and disconnection events.
+130 -14
View File
@@ -55,18 +55,19 @@
************************************************************************************/ ************************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
#define HAVE_HSMCI 1 #define HAVE_HSMCI 1
#define HAVE_AT25 1 #define HAVE_AT25 1
#define HAVE_NAND 1 #define HAVE_NAND 1
#define HAVE_USBHOST 1 #define HAVE_AUTOMOUNTER 1
#define HAVE_USBDEV 1 #define HAVE_USBHOST 1
#define HAVE_USBOVCUR 1 #define HAVE_USBDEV 1
#define HAVE_USBMONITOR 1 #define HAVE_USBOVCUR 1
#define HAVE_NETWORK 1 #define HAVE_USBMONITOR 1
#define HAVE_MAXTOUCH 1 #define HAVE_NETWORK 1
#define HAVE_WM8904 1 #define HAVE_MAXTOUCH 1
#define HAVE_AUDIO_NULL 1 #define HAVE_WM8904 1
#define HAVE_PMIC 1 #define HAVE_AUDIO_NULL 1
#define HAVE_PMIC 1
/* HSMCI */ /* HSMCI */
/* Can't support MMC/SD if the card interface(s) are not enable */ /* Can't support MMC/SD if the card interface(s) are not enable */
@@ -100,7 +101,7 @@
* asked to mount the NAND part * asked to mount the NAND part
*/ */
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D4EK_NAND_AUTOMOUNT) #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D4EK_NAND_BLOCKMOUNT)
# undef HAVE_NAND # undef HAVE_NAND
#endif #endif
@@ -145,7 +146,7 @@
* asked to mount the AT25 part * asked to mount the AT25 part
*/ */
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D4EK_AT25_AUTOMOUNT) #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAMA5D4EK_AT25_BLOCKMOUNT)
# undef HAVE_AT25 # undef HAVE_AT25
#endif #endif
@@ -220,6 +221,75 @@
#else #else
#endif #endif
/* Automounter. Currently only works with HSMCI. */
#if !defined(CONFIG_FS_AUTOMOUNTER) || !defined(HAVE_HSMCI)
# undef HAVE_AUTOMOUNTER
#endif
#ifndef CONFIG_SAMA5_HSMCI0
# undef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT
#endif
#ifndef CONFIG_SAMA5_HSMCI1
# undef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT
#endif
#if !defined(CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT) && \
!defined(CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT)
# undef HAVE_AUTOMOUNTER
#endif
#ifdef HAVE_AUTOMOUNTER
# ifdef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT
/* HSMCI0 Automounter defaults */
# ifndef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_FSTYPE
# define CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_FSTYPE "vfat"
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_BLKDEV
# define CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_BLKDEV "/dev/mmcds0"
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_MOUNTPOINT
# define CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_MOUNTPOINT "/mnt/sdcard0"
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_DDELAY
# define CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_DDELAY 1000
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_UDELAY
# define CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_UDELAY 2000
# endif
# endif
# ifdef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT
/* HSMCI1 Automounter defaults */
# ifndef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_FSTYPE
# define CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_FSTYPE "vfat"
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_BLKDEV
# define CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_BLKDEV "/dev/mmcds0"
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_MOUNTPOINT
# define CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_MOUNTPOINT "/mnt/sdcard0"
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_DDELAY
# define CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_DDELAY 1000
# endif
# ifndef CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_UDELAY
# define CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_UDELAY 2000
# endif
# endif
#endif
/* USB Host / USB Device */ /* USB Host / USB Device */
/* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, or there is /* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, or there is
* no USB of any kind. * no USB of any kind.
@@ -858,6 +928,52 @@ int sam_hsmci_initialize(int slotno, int minor);
bool sam_cardinserted(int slotno); bool sam_cardinserted(int slotno);
#endif #endif
/************************************************************************************
* Name: sam_automount_initialize
*
* Description:
* Configure auto-mounters for each enable and so configured HSMCI
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
************************************************************************************/
#ifdef HAVE_AUTOMOUNTER
void sam_automount_initialize(void);
#endif
/************************************************************************************
* Name: sam_automount_event
*
* Description:
* The HSMCI card detection logic has detected an insertion or removal event. It
* has already scheduled the MMC/SD block driver operations. Now we need to
* schedule the auto-mount event which will occur with a substantial delay to make
* sure that everything has settle down.
*
* Input Parameters:
* slotno - Identifies the HSMCI0 slot: HSMCI0 or HSMCI1_SLOTNO. There is a
* terminology problem here: Each HSMCI supports two slots, slot A and slot B.
* Only slot A is used. So this is not a really a slot, but an HSCMI peripheral
* number.
* inserted - True if the card is inserted in the slot. False otherwise.
*
* Returned Value:
* None
*
* Assumptions:
* Interrupts are disabled.
*
************************************************************************************/
#ifdef HAVE_AUTOMOUNTER
void sam_automount_event(int slotno, bool inserted);
#endif
/************************************************************************************ /************************************************************************************
* Name: sam_writeprotected * Name: sam_writeprotected
* *
+19 -2
View File
@@ -199,6 +199,8 @@ static void automount_mount(FAR struct automounter_state_s *priv)
FAR const struct automount_lower_s *lower = priv->lower; FAR const struct automount_lower_s *lower = priv->lower;
int ret; int ret;
fvdbg("Mounting %s\n", lower->mountpoint);
/* Check if the something is already mounted at the mountpoint. */ /* Check if the something is already mounted at the mountpoint. */
ret = automount_findinode(lower->mountpoint); ret = automount_findinode(lower->mountpoint);
@@ -274,6 +276,8 @@ static int automount_unmount(FAR struct automounter_state_s *priv)
FAR const struct automount_lower_s *lower = priv->lower; FAR const struct automount_lower_s *lower = priv->lower;
int ret; int ret;
fvdbg("Unmounting %s\n", lower->mountpoint);
/* Check if the something is already mounted at the mountpoint. */ /* Check if the something is already mounted at the mountpoint. */
ret = automount_findinode(lower->mountpoint); ret = automount_findinode(lower->mountpoint);
@@ -366,6 +370,7 @@ static void automount_timeout(int argc, uint32_t arg1, ...)
(FAR struct automounter_state_s *)((uintptr_t)arg1); (FAR struct automounter_state_s *)((uintptr_t)arg1);
int ret; int ret;
fllvdbg("Timeout!\n");
DEBUGASSERT(argc == 1 && priv); DEBUGASSERT(argc == 1 && priv);
/* Check the state of things. This timeout at the interrupt level and /* Check the state of things. This timeout at the interrupt level and
@@ -379,7 +384,7 @@ static void automount_timeout(int argc, uint32_t arg1, ...)
/* Queue work to occur immediately. */ /* Queue work to occur immediately. */
ret = work_queue(LPWORK, &priv->work, automount_worker, priv, 0); ret = work_queue(LPWORK, &priv->work, automount_worker, priv, 0);
if (ret < 0) if (ret < 0)
{ {
/* NOTE: Currently, work_cancel only returns success */ /* NOTE: Currently, work_cancel only returns success */
@@ -565,7 +570,19 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower)
/* Handle the initial state of the mount on the caller's thread */ /* Handle the initial state of the mount on the caller's thread */
priv->inserted = AUTOMOUNT_INSERTED(lower); priv->inserted = AUTOMOUNT_INSERTED(lower);
automount_worker(priv);
/* Set up the first action at a delay from the initialization time (to
* allow time for any extended block driver initialization to complete.
*/
ret = work_queue(LPWORK, &priv->work, automount_worker, priv,
priv->lower->ddelay);
if (ret < 0)
{
/* NOTE: Currently, work_cancel only returns success */
fdbg("ERROR: Failed to schedule work: %d\n", ret);
}
/* Attach and enable automounter interrupts */ /* Attach and enable automounter interrupts */
+1 -1
View File
@@ -107,7 +107,7 @@ struct automount_lower_s
uint32_t ddelay; uint32_t ddelay;
/* Unmount delay time in sysem clock ticks. If a volume has open /* Unmount delay time in system clock ticks. If a volume has open
* references at the time that the media is removed, then we will be * references at the time that the media is removed, then we will be
* unable to unmount it. In that case, hopefully, the clients of the * unable to unmount it. In that case, hopefully, the clients of the
* mount will eventually fail with file access errors and eventually close * mount will eventually fail with file access errors and eventually close