www.pudn.com > uCOS-uCGUI-FATFs.rar > syscall.c, change:2010-04-14,size:4859b


/*------------------------------------------------------------------------*/ 
/* Sample code of OS dependent controls for FatFs R0.08                   */ 
/* (C)ChaN, 2010                                                          */ 
/*------------------------------------------------------------------------*/ 
 
#include <stdlib.h>		/* ANSI memory controls */ 
#include <malloc.h>		/* ANSI memory controls */ 
 
#include "../ff.h" 
 
 
#if _FS_REENTRANT 
/*------------------------------------------------------------------------*/ 
/* Create a Synchronization Object 
/*------------------------------------------------------------------------*/ 
/* This function is called in f_mount function to create a new 
/  synchronization object, such as semaphore and mutex. When a FALSE is 
/  returned, the f_mount function fails with FR_INT_ERR. 
*/ 
 
BOOL ff_cre_syncobj (	/* TRUE:Function succeeded, FALSE:Could not create due to any error */ 
	BYTE vol,			/* Corresponding logical drive being processed */ 
	_SYNC_t *sobj		/* Pointer to return the created sync object */ 
) 
{ 
	BOOL ret; 
 
	*sobj = CreateMutex(NULL, FALSE, NULL);					/* Win32 */ 
	ret = (*sobj != INVALID_HANDLE_VALUE) ? TRUE : FALSE; 
 
//	*sobj = SyncObjects[vol];	/* uITRON (give a static created sync object) */ 
//	ret = TRUE;					/* The initial value of the semaphore must be 1. */ 
 
//	*sobj = OSMutexCreate(0, &err);				/* uC/OS-II */ 
//	ret = (err == OS_NO_ERR) ? TRUE : FALSE; 
 
//	*sobj = xSemaphoreCreateMutex();			/* FreeRTOS */ 
//	ret = (*sobj != NULL) ? TRUE : FALSE; 
 
	return ret; 
} 
 
 
 
/*------------------------------------------------------------------------*/ 
/* 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 FALSE is 
/  returned, the f_mount function fails with FR_INT_ERR. 
*/ 
 
BOOL ff_del_syncobj (	/* TRUE:Function succeeded, FALSE:Could not delete due to any er