User`s manual

168 digi.com File Systems
10.2.5.5 µC/OS-II and FAT Compatibility
Versions of the FAT file system prior to version 2.10 are compatible with µC/OS-II only if FAT API calls
are confined to one µC/OS-II task. To make the FAT API reentrant from multiple tasks, you must do the
following:
Use FAT version 2.10
#define FAT_USE_UCOS_MUTEX before #use'ing FAT.LIB
Call the function fat_InitUCOSMutex(priority) after calling OSInit() and before calling
FAT APIs or beginning multitasking; the parameter “priority” MUST be a higher priority than all tasks
using FAT APIs
Call only high-level fat APIs with names that begin with “fat_”
See the function description for fat_InitUCOSMutex() for more details, and the sample program
Samples/FileSystem/FAT_UCOS.C for a demonstration of using FAT with µC/OS-II.
10.2.5.6 SF1000 and FAT Compatibility
There are two macros that need to be defined for the FAT to work with the SF1000 Serial Flash Expansion
Board.
#define SF_SPI_DIVISOR 5
#define SF_SPI_INVERT_RX
10.2.5.7 Hot-Swapping an xD Card
Hot-swapping is currently supported on the RCM3365 and the RCM3375. FAT version 2.10 or later is
required. Two sample programs are provided in Samples/FileSystem to demonstrate this feature:
FAT_HOT_SWAP.C and FAT_HOT_SWAP_3365_75.C. The samples are mostly identical: they both
test for a keyboard hit to determine if the user wants to hot-swap the xD card, but, in addition, the sample
program FAT_HOT_SWAP_3365_75.C also checks for a switch press and indicates a ready-to-mount
condition with an LED.
After unmounting the xD card call _fat_config_init(). This disconnects drive and device struc-
tures from internal tables to work around a potential problem swapping from smaller to larger removable
devices.
As demonstrated in the sample programs, an xD card should only be removed after it has unmounted with
fat_UnmountDevice() and no operations are happening on the device.
Only fat_AutoMount() should be used to remount xD cards. In addition, the function
nf_XD_Detect() should be called to verify xD card presence before attempting to remount an xD card.
xD cards formatted with versions of the FAT prior to 2.10 did not have unique volume labels. If there is a
chance that two such cards may be swapped, call fat_autoMount() with the FDDF_NO_RECOVERY
flag set. This means that if there is a write cache entry to be written, it will not be written. The function
fat_UnmountDevice() flushes the cache (i.e., writes all cache entries to the device) before unmount-
ing, so this should not generally be a problem if the device was properly unmounted.