From 7b78a5a287827db9e9b16286f3604aef69b37c5c Mon Sep 17 00:00:00 2001 From: Leo C Date: Mon, 17 Nov 2014 14:47:05 +0100 Subject: Import fatfs R0.10c --- fatfs/src/option/syscall.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'fatfs/src/option/syscall.c') diff --git a/fatfs/src/option/syscall.c b/fatfs/src/option/syscall.c index ccfd47e..2036cb7 100644 --- a/fatfs/src/option/syscall.c +++ b/fatfs/src/option/syscall.c @@ -1,10 +1,8 @@ /*------------------------------------------------------------------------*/ /* Sample code of OS dependent controls for FatFs */ -/* (C)ChaN, 2012 */ +/* (C)ChaN, 2014 */ /*------------------------------------------------------------------------*/ -#include /* ANSI memory controls */ -#include /* ANSI memory controls */ #include "../ff.h" @@ -13,14 +11,14 @@ /*------------------------------------------------------------------------*/ /* Create a Synchronization Object /*------------------------------------------------------------------------*/ -/* This function is called by f_mount() function to create a new -/ synchronization object, such as semaphore and mutex. When a 0 is -/ returned, the f_mount() function fails with FR_INT_ERR. +/* This function is called in f_mount() function to create a new +/ synchronization object, such as semaphore and mutex. When a 0 is returned, +/ the f_mount() function fails with FR_INT_ERR. */ -int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create due to any error */ +int ff_cre_syncobj ( /* !=0:Function succeeded, ==0:Could not create due to any error */ BYTE vol, /* Corresponding logical drive being processed */ - _SYNC_t* sobj /* Pointer to return the created sync object */ + _SYNC_t *sobj /* Pointer to return the created sync object */ ) { int ret; @@ -29,13 +27,13 @@ int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create due to any erro *sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */ ret = (int)(*sobj != INVALID_HANDLE_VALUE); -// *sobj = SyncObjects[vol]; /* uITRON (give a static created semaphore) */ -// ret = 1; +// *sobj = SyncObjects[vol]; /* uITRON (give a static created sync object) */ +// ret = 1; /* The initial value of the semaphore must be 1. */ -// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ +// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ // ret = (int)(err == OS_NO_ERR); -// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */ +// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */ // ret = (int)(*sobj != NULL); return ret; @@ -47,11 +45,11 @@ int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create due to any erro /* Delete a Synchronization Object */ /*------------------------------------------------------------------------*/ /* This function is called in f_mount() function to delete a synchronization -/ object that created with ff_cre_syncobj() function. When a 0 is -/ returned, the f_mount() function fails with FR_INT_ERR. +/ object that created with ff_cre_syncobj function. When a 0 is returned, +/ the f_mount() function fails with FR_INT_ERR. */ -int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */ +int ff_del_syncobj ( /* !=0:Function succeeded, ==0:Could not delete due to any error */ _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ ) { @@ -65,7 +63,7 @@ int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any erro // OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */ // ret = (int)(err == OS_NO_ERR); -// xSemaphoreDelete(sobj); /* FreeRTOS */ +// vSemaphoreDelete(sobj); /* FreeRTOS */ // ret = 1; return ret; @@ -77,10 +75,10 @@ int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any erro /* Request Grant to Access the Volume */ /*------------------------------------------------------------------------*/ /* This function is called on entering file functions to lock the volume. -/ When a FALSE is returned, the file function fails with FR_TIMEOUT. +/ When a 0 is returned, the file function fails with FR_TIMEOUT. */ -int ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get a grant */ +int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */ _SYNC_t sobj /* Sync object to wait */ ) { @@ -135,7 +133,7 @@ void* ff_memalloc ( /* Returns pointer to the allocated memory block */ UINT msize /* Number of bytes to allocate */ ) { - return malloc(msize); + return malloc(msize); /* Allocate a new memory block with POSIX API */ } @@ -147,7 +145,7 @@ void ff_memfree ( void* mblock /* Pointer to the memory block to free */ ) { - free(mblock); + free(mblock); /* Discard the memory block with POSIX API */ } #endif -- cgit v1.2.3