⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fs82voldata.c

📁 我今天开始上传5份TI、NXP、MTK的手机开发全套资料。希望对大家有很大的帮助
💻 C
📖 第 1 页 / 共 3 页
字号:
#ifdef FSS_FTR#define ACCESS_RIGHTS_INTERNAL_FS#define FS82VOLDATA_C#include "Fs.h"#undef  FILE_NUMBER#define FILE_NUMBER 82 /* Local definitions */#define FS_VD_FREE	0#define FS_VD_RESERVED	0xffffffff/* Local data */t_VolDataBaseStruct s_VolDataBaseStruct;/**//*P(***************************************************************************//* Procedure name : Fs82_01VDInitVolumeData     	 	              *//* Object :    Initialize volume data					      *//*----------------------------------------------------------------------------*//* Input parameters  :                                                        *//* -------------------                                                        *//*	t_FsConfiguration * pp_Config: Pointer on FS configuration    	      *//*									      *//* Output parameters :                                                        *//* -------------------                                                        *//*		none							      *//*									      *//* Used variables    :                                                        *//* -------------------                                                        *//*   							                      *//*                                                                            *//* Used procedures   :                                                        *//* -------------------                                                        *//*                                                                            *//*                                                                            *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//*                                    DESCRIPTION                             *//*                                                                            *//*		Initialization of volume data management 	 	      *//*									      *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 1void Fs82_01VDInitVolumeData( t_FsConfiguration * pp_Config ){   t_fsVolStruct ** pl_VolStruct;    u16		    i;    /* Initialize volume data structure */    s_VolDataBaseStruct.v_NbrMaxVol = pp_Config->v_NbrMaxVolumes;    s_VolDataBaseStruct.v_NbrVolMounted = 0;    s_VolDataBaseStruct.v_BeginningIndex = 0;    /* Reserve table indexed by volume ID */    s_VolDataBaseStruct.p_VolTabIndexedByVolID = pl_VolStruct =			(t_fsVolStruct **) MC_FS_GET_MEMORY ( sizeof(t_fsVolStruct *) 									*						 		pp_Config->v_NbrMaxVolumes );    /* Initialize all the table to free */    for ( i = 0; i < pp_Config->v_NbrMaxVolumes; i++ )    {	* pl_VolStruct = FS_VD_FREE;	pl_VolStruct++;    }    /* Reserve the table indexed alphabeticaly */    s_VolDataBaseStruct.p_VolTabIndexedByAlpha = 			(t_fsVolStruct **) MC_FS_GET_MEMORY( sizeof(t_fsVolStruct *) 									*						 		pp_Config->v_NbrMaxVolumes );;}/**//*P(***************************************************************************//* Procedure name : Fs82_02VDGetNewVolumeID     	                      *//* Object :    Gets a new volume ID to mount a new volume		      *//*----------------------------------------------------------------------------*//* Input parameters  :                                                        *//* -------------------                                                        *//*		none				    			      *//*									      *//* Output parameters :                                                        *//* -------------------                                                        *//*	u16 : new volume ID						      *//*									      *//* Used variables    :                                                        *//* -------------------                                                        *//*   							                      *//*                                                                            *//* Used procedures   :                                                        *//* -------------------                                                        *//*                                                                            *//*                                                                            *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//*                                    DESCRIPTION                             *//*                                                                            *//*	A free volume ID is searched in volume data, this ID is to use        *//*				mount a new volume			      *//*									      *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 2u16 Fs82_02VDGetNewVolumeID(void){    register u16 vl_VolID;    /* Load address of table who is indexed by volume ID */    t_fsVolStruct ** pl_VolumePtr = s_VolDataBaseStruct.p_VolTabIndexedByVolID;    /* Search in this table a free volume ID */    for ( vl_VolID = 0; vl_VolID < s_VolDataBaseStruct.v_NbrMaxVol ; vl_VolID++ )    {	if ( *pl_VolumePtr == FS_VD_FREE )	{	    /* Reserve this ID */	    * pl_VolumePtr = (t_fsVolStruct *) FS_VD_RESERVED;	    /* return the found ID */	    return ( vl_VolID );	}	pl_VolumePtr++;    }    /* No free place found, too mutch volumes enter a defense */    FS_EXCPTHANDLER( FS_BLOCKED, FS_EXCPT_TOO_MUTCH_VOLUMES );   return(0);}/**//*P(***************************************************************************//* Procedure name : Fs82_03VDInsertNewVolume     	                      *//* Object :    Inserts a new volume in volume data			      *//*----------------------------------------------------------------------------*//* Input parameters  :                                                        *//* -------------------                                                        *//*   u16 vp_VolID	    : Identifier of the volume obtained 	      *//*					by GetNewVolID			      *//*   char * pp_VolName	    : Name of this new volume		      	      *//*   t_fsVolStruct * pp_Vol : Volume structure pre-update by lower layers     *//*						    			      *//*									      *//* Output parameters :                                                        *//* -------------------                                                        *//*	none								      *//*									      *//* Used variables    :                                                        *//* -------------------                                                        *//*   							                      *//*                                                                            *//* Used procedures   :                                                        *//* -------------------                                                        *//*                                                                            *//*                                                                            *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//*                                    DESCRIPTION                             *//*                                                                            *//*	The new volume is inserted in volume data, the received volume	      *//*		structure inserted in volumes' data and more filled	      *//*									      *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 3void Fs82_03VDInsertNewVolume( u16 vp_VolID, ascii * pp_VolName, t_fsVolStruct * pp_Vol ){   u16 vl_PathSize;    /* Load address of table who is indexed by volume ID */    t_fsVolStruct ** pl_VolumePtr = s_VolDataBaseStruct.p_VolTabIndexedByVolID;    /* Verify if vol ID was reserved */    if ( pl_VolumePtr[vp_VolID] != (t_fsVolStruct *) FS_VD_RESERVED ) 			FS_EXCPTHANDLER( FS_BLOCKED, FS_EXCPT_VOLUME_NOT_RESERVED );    /* Place volume structure address in table */    pl_VolumePtr[vp_VolID] = pp_Vol;    /* Get memory to save path and updates it */    vl_PathSize = strlen( pp_VolName );    /* If volume name empty enter an exception */    if ( vl_PathSize == 0 ) FS_EXCPTHANDLER( FS_BLOCKED, FS_EXCPT_NO_VOL_NAME );    pp_Vol->p_VolName = ( ascii *) MC_FS_GET_MEMORY( strlen( pp_VolName ) + 1 );    strcpy( pp_Vol->p_VolName, pp_VolName);    /* Updates length of name */    pp_Vol->v_VolNameLength = vl_PathSize;    /* No files or directories attached to volume */    pp_Vol->p_FileList = pp_Vol->p_DirList = NIL;    /* Clear freeze counter */    pp_Vol->v_FreezeCounter = 0;    /* Place volume ID in structure */    pp_Vol->v_VolID = vp_VolID;    /* Insert in volume table indexed in alphabetical order */    {      s32 vl_Resu;      u16 vl_IndexInTable;      	/* Load address of table who is indexed alphabetically */   	pl_VolumePtr = s_VolDataBaseStruct.p_VolTabIndexedByAlpha;   	for ( vl_IndexInTable = 0 ; vl_IndexInTable < s_VolDataBaseStruct.v_NbrVolMounted; 										vl_IndexInTable++)   	{	    vl_Resu = strcmp ( (*pl_VolumePtr)->p_VolName, pp_VolName);	    if ( vl_Resu >= 0 )	    {		/* If volume already exist enter an exception */	    	if ( vl_Resu == 0 ) FS_EXCPTHANDLER( FS_BLOCKED, FS_EXCPT_VOL_NAME_ALREADY_EXIST );				/* Insertion is not made at end of table so table is to shift */	        {		    t_fsVolStruct ** p_Srce;		    t_fsVolStruct ** p_Dst;       		    u16 vl_Size = s_VolDataBaseStruct.v_NbrVolMounted - vl_IndexInTable; 	   	    p_Dst = &s_VolDataBaseStruct.p_VolTabIndexedByAlpha[vl_IndexInTable + vl_Size];	  	    p_Srce = p_Dst - 1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -