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

📄 fs87synchinterf.c

📁 我今天开始上传5份TI、NXP、MTK的手机开发全套资料。希望对大家有很大的帮助
💻 C
📖 第 1 页 / 共 5 页
字号:
/*S(*************************************************************************** * Semantic name : Fs87_13Fread() * Object :  Fread Synchronous POSIX API  * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters  : * ------------------- *    vp_ElementSize - size of one element *    vp_NumberOfElements - no. of elements *    pp_Stream - file handle     * * Output parameters : * ------------------- *    pp_Buff - contain the data read  *                       *                    * Used variables    : * ------------------- *    GLOBAL: * * * Used procedures   : * ------------------- *                  -MC_FS_MA_SEND_CMD_MSG_TO_FS *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                                    DESCRIPTION *                *        Synchronous function interface to FSS *           -Sends REQ message to FS *           -Returns number of elements read or an error code *   *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 13t_fss_size_t Fs87_13Fread(void *pp_Buff, t_fss_size_t vp_ElementSize,		 t_fss_size_t vp_NumberOfElements,t_fssFILE *pp_Stream){   s32   vl_return;   s32   vl_ErrCode;   u8    vl_SemName;   /* Reserve message space */   t_FsCmdFRead * pl_FRead =                  (t_FsCmdFRead*) MC_FS_GET_MEMORY( sizeof(t_FsCmdFRead) );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_CONSUME(FSS_SEM2);   /* Determine the calling process in order to determine what semaphore to      consume */   vl_SemName= Fs87_30DetermineSem();   if (vl_SemName == NIL)   {       MC_FS_STATUS( pl_FRead ) = FS_EINVAL;   }   else   {       MC_FS_STATUS( pl_FRead ) = FS_OK;   }      /* Send message to PROCESS_FSS */   if ( MC_FS_STATUS( pl_FRead ) == FS_OK )   {       /* Fill message with input parameters */       pl_FRead->p_Stream = pp_Stream;       pl_FRead->p_DestBuff = pp_Buff;       pl_FRead->v_ElementSize = vp_ElementSize;       pl_FRead->v_NumberOfElements = vp_NumberOfElements;       /* Send message by setting operation and return command identifier */       MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK,				    (void*)pl_FRead, FS_CMD_FREAD_REQ );       /* Consume Semaphore */       MC_RTK_SEM_CONSUME( vl_SemName );   }   /* Set the updated err/ok code to corresponding process' global variable */   vl_ErrCode = MC_FS_STATUS( pl_FRead );   Fs87_31SetErrorCode( vl_ErrCode );   /* if the operation is not successful, return an error  */   if ( MC_FS_STATUS( pl_FRead ) != FS_OK )   {       vl_return = FS_ERROR;   }   else   {       vl_return = pl_FRead->v_NumbOfElementsRead;   }   /* Free message space */   MC_FS_FREE_MEMORY( pl_FRead );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2);   return( vl_return );}   /*S(*************************************************************************** * Semantic name : Fs87_14Mkdir() * Object :  Mkdir Synchronous POSIX API  * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters  : * ------------------- *    pp_Path - directory path *    vp_Mode - mode of dir * * Output parameters : * ------------------- *    Return  *                        *                    * Used variables    : * ------------------- *    GLOBAL: * * * Used procedures   : * ------------------- *                  -MC_FS_MA_SEND_CMD_MSG_TO_FS *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                                    DESCRIPTION *                *        Synchronous function interface to FSS *           -Sends REQ message to FS *           -Returns FS_OK or an error code *   *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 14s32 Fs87_14Mkdir(const fssPath *pp_Path, t_fss_mod_t vp_Mode){   s32   vl_return;   s32   vl_ErrCode;   u8    vl_SemName;   /* Reserve message space */   t_FsCmdMkDir * pl_MkDir =                  (t_FsCmdMkDir*) MC_FS_GET_MEMORY( sizeof(t_FsCmdMkDir) );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_CONSUME(FSS_SEM2);   /* Determine the calling process in order to determine what semaphore to      consume */   vl_SemName= Fs87_30DetermineSem();   if (vl_SemName == NIL)   {       MC_FS_STATUS( pl_MkDir ) = FS_EINVAL;   }   else   {       MC_FS_STATUS( pl_MkDir ) = FS_OK;   }      /* Send message to PROCESS_FSS */   if ( MC_FS_STATUS( pl_MkDir ) == FS_OK )   {       /* Fill message with input parameters */       pl_MkDir->p_Path = pp_Path;       pl_MkDir->v_Mode = vp_Mode;       /* Send message by setting operation and return command identifier */       MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK,				    (void*)pl_MkDir, FS_CMD_MKDIR_REQ );       /* Consume Semaphore */       MC_RTK_SEM_CONSUME( vl_SemName );   }   /* Set the updated err/ok code to corresponding process' global variable */   vl_ErrCode = MC_FS_STATUS( pl_MkDir );   Fs87_31SetErrorCode( vl_ErrCode );   /* if the operation is not successful, return an error  */   if ( MC_FS_STATUS( pl_MkDir ) != FS_OK )   {       vl_return = FS_ERROR;   }   else   {       vl_return = FS_OK;   }   /* Free message space */   MC_FS_FREE_MEMORY( pl_MkDir );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2);   return( vl_return );}   /*S(*************************************************************************** * Semantic name : Fs87_15Rmdir() * Object :  Rmdir Synchronous POSIX API  * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters  : * ------------------- *    pp_Path - directory path * * Output parameters : * ------------------- *    Return  *                        *                    * Used variables    : * ------------------- *    GLOBAL: * * * Used procedures   : * ------------------- *                  -MC_FS_MA_SEND_CMD_MSG_TO_FS *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                                    DESCRIPTION *                *        Synchronous function interface to FSS *           -Sends REQ message to FS *           -Returns FS_OK or an error code *   *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 15s32 Fs87_15Rmdir(const fssPath *pp_Path){   s32   vl_return;   s32   vl_ErrCode;   u8    vl_SemName;   /* Reserve message space */   t_FsCmdRmDir * pl_RmDir =                  (t_FsCmdRmDir*) MC_FS_GET_MEMORY( sizeof(t_FsCmdRmDir) );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_CONSUME(FSS_SEM2);   /* Determine the calling process in order to determine what semaphore to      consume */   vl_SemName= Fs87_30DetermineSem();   if (vl_SemName == NIL)   {       MC_FS_STATUS( pl_RmDir ) = FS_EINVAL;   }   else   {       MC_FS_STATUS( pl_RmDir ) = FS_OK;   }      /* Send message to PROCESS_FSS */   if ( MC_FS_STATUS( pl_RmDir ) == FS_OK )   {       /* Fill message with input parameters */       pl_RmDir->p_Path = pp_Path;       /* Send message by setting operation and return command identifier */       MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK,				    (void*)pl_RmDir, FS_CMD_RMDIR_REQ );       /* Consume Semaphore */       MC_RTK_SEM_CONSUME( vl_SemName );   }   /* Set the updated err/ok code to corresponding process' global variable */   vl_ErrCode = MC_FS_STATUS( pl_RmDir );   Fs87_31SetErrorCode( vl_ErrCode );   /* if the operation is not successful, return an error  */   if ( MC_FS_STATUS( pl_RmDir ) != FS_OK )   {       vl_return = FS_ERROR;   }   else   {       vl_return = FS_OK;    }   /* Free message space */   MC_FS_FREE_MEMORY( pl_RmDir );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2);   return( vl_return );}   /*S(*************************************************************************** * Semantic name : Fs87_16Chdir() * Object :  Chdir Synchronous POSIX API  * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters  : * ------------------- *    pp_Path - directory path * * Output parameters : * ------------------- *    Return  *                        *                    * Used variables    : * ------------------- *    GLOBAL: * * * Used procedures   : * ------------------- *                  -MC_FS_MA_SEND_CMD_MSG_TO_FS *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                                    DESCRIPTION *                *        Synchronous function interface to FSS *           -Sends REQ message to FS *           -Returns FS_OK or an error code *   *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 16s32 Fs87_16Chdir(const fssPath *pp_Path){   s32   vl_return;   s32   vl_ErrCode;   u8    vl_SemName;   /* Reserve message space */   t_FsCmdChDir * pl_ChDir =                  (t_FsCmdChDir*) MC_FS_GET_MEMORY( sizeof(t_FsCmdChDir) );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_CONSUME(FSS_SEM2);   /* Determine the calling process in order to determine what semaphore to      consume */   vl_SemName= Fs87_30DetermineSem();   if (vl_SemName == NIL)   {       MC_FS_STATUS(pl_ChDir) = FS_EINVAL;   }   else   {       MC_FS_STATUS( pl_ChDir ) = FS_OK;   }      /* Send message to PROCESS_FSS */   if ( MC_FS_STATUS( pl_ChDir ) == FS_OK )   {       /* Fill message with input parameters */       pl_ChDir->p_Path = pp_Path;       /* Send message by setting operation and return command identifier */       MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK,				    (void*)pl_ChDir, FS_CMD_CHDIR_REQ );       /* Consume Semaphore */       MC_RTK_SEM_CONSUME( vl_SemName );   }   /* Set the updated err/ok code to corresponding process' global variable */   vl_ErrCode = MC_FS_STATUS(pl_ChDir);   Fs87_31SetErrorCode( vl_ErrCode );   /* if the operation is not successful, return an error  */   if ( MC_FS_STATUS( pl_ChDir ) != FS_OK )   {       vl_return = FS_ERROR;   }   else   {       vl_return = FS_OK;    }   /* Free message space */   MC_FS_FREE_MEMORY( pl_ChDir );   /* tcmc_BRC */    MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2);   return( vl_return );}   /*S(*************************************************************************** * Semantic name : Fs87_17Getcwd() * Object :  Getcwd Synchronous POSIX API  * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters  : * ------------------- *    vp_Size - size of the buffer passed * * * Output parameters : * ------------------- *   pp_Buff - contain the directory path  *                        *                    * Used variables    : * ------------------- *    GLOBAL: * * * Used procedures   : * ------------------- *                  -MC_FS_MA_SEND_CMD_MSG_TO_FS *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                                    DESCRIPTION *                *        Synchronous function interface to FSS *           -Sends REQ message to FS *           -Returns pointer to the directory or NULL *   *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 17

⌨️ 快捷键说明

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