<< Previous | Next >>

fat_InitUCOSMutex

void fat_InitUCOSMutex( int mutexPriority );

Description

This function was introduced in FAT version 2.10. Prior versions of the FATfile system are compatible with µC/OS-II only if FAT API calls are confined to one µC/OS-II task. The FAT API is not reentrant from multiple tasks without the changes made in FAT version 2.10. If you wish to use the FAT file system from multiple µC/COS tasks, you must do the following:

  1. The statement #define FAT_USE_UCOS_MUTEX must come before the statement:

    #use FAT.LIB
  2. After calling OSInit() and before starting any tasks that use the FAT, call fat_InitUCOSMutex(mutexPriority). The parameter mutexPriority is a µC/OS-II task priority that must be higher than the priorities of all tasks that call FAT API functions.

  3. You must not call low-level, non-API FAT or write-back cache functions. Only call FAT functions appended with "fat_" and with public function descriptions.

  4. Run the FAT in blocking mode (#define FAT_BLOCK).

Mutex timeouts or other errors will cause a run-time error -ERR_FAT_MUTEX_ERROR.

µC/OS-II may raise the priority of tasks using mutexes to prevent priority inversion.

The default mutex time-out in seconds is given by FAT_MUTEX_TIMEOUT_SEC, which defaults to 5 seconds if not defined in the application before the statement #use FAT.LIB.

Parameters

mutexPriority
A µC/OS-II task priority that MUST be higher than the priorities of all tasks that call FAT API functions.

Return Value

None: success.
-ERR_FAT_MUTEX_ERROR: A run-time error causes an exception and the application will exit with this error code.

Library

FAT.LIB

See Also

fat_AutoMount, fat_Init


Dynamic C Functions << Previous | Next >> rabbit.com