📄 fs87synchinterf.c
字号:
char* Fs87_17Getcwd(fssPath *pp_Buff, t_fss_size_t vp_Size){ char* vl_return; s32 vl_ErrCode; u8 vl_SemName; /* Reserve message space */ t_FsCmdGetCwd * pl_GetCwd = (t_FsCmdGetCwd*) MC_FS_GET_MEMORY( sizeof(t_FsCmdGetCwd) ); /* 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_GetCwd ) = FS_EINVAL; } else { MC_FS_STATUS( pl_GetCwd ) = FS_OK; } /* Send message to PROCESS_FSS */ if ( MC_FS_STATUS( pl_GetCwd ) == FS_OK ) { /* Fill message with input parameters */ pl_GetCwd->p_Buff = pp_Buff; pl_GetCwd->v_Size = vp_Size; /* Send message by setting operation and return command identifier */ MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK, (void*)pl_GetCwd, FS_CMD_GETCWD_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_GetCwd ); Fs87_31SetErrorCode( vl_ErrCode ); /* if the operation is not successful, return an error */ if ( MC_FS_STATUS( pl_GetCwd ) != FS_OK ) { vl_return = NULL; } else { vl_return = pl_GetCwd->p_Buff; } /* Free message space */ MC_FS_FREE_MEMORY( pl_GetCwd ); /* tcmc_BRC */ MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2); return( vl_return );} /*S(*************************************************************************** * Semantic name : Fs87_18Opendir() * Object : Opendir Synchronous POSIX API * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters : * ------------------- * pp_DirName - 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 pointer to the directory or NULL * *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 18t_fssDIR* Fs87_18Opendir(const fssPath *pp_DirName){ t_fssDIR* vl_return; s32 vl_ErrCode; u8 vl_SemName; /* Reserve message space */ t_FsCmdOpenDir * pl_OpenDir = (t_FsCmdOpenDir*) MC_FS_GET_MEMORY( sizeof(t_FsCmdOpenDir) ); /* 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_OpenDir ) = FS_EINVAL; } else { MC_FS_STATUS( pl_OpenDir ) = FS_OK; } /* Send message to PROCESS_FSS */ if ( MC_FS_STATUS( pl_OpenDir ) == FS_OK ) { /* Fill message with input parameters */ pl_OpenDir->p_DirName = pp_DirName; /* Send message by setting operation and return command identifier */ MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK, (void*)pl_OpenDir, FS_CMD_OPENDIR_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_OpenDir ); Fs87_31SetErrorCode( vl_ErrCode ); /* if the operation is not successful, return an error */ if ( MC_FS_STATUS( pl_OpenDir ) != FS_OK ) { vl_return = NULL; } else { vl_return = pl_OpenDir->p_DirPtr; } /* Free message space */ MC_FS_FREE_MEMORY( pl_OpenDir ); /* tcmc_BRC */ MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2); return( vl_return );} /*S(*************************************************************************** * Semantic name : Fs87_19Closedir() * Object : Closedir Synchronous POSIX API * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters : * ------------------- * pp_DirPtr - dir handle * * 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 19s32 Fs87_19Closedir(t_fssDIR *pp_DirPtr){ s32 vl_return; s32 vl_ErrCode; u8 vl_SemName; /* Reserve message space */ t_FsCmdCloseDir * pl_CloseDir = (t_FsCmdCloseDir *) MC_FS_GET_MEMORY( sizeof(t_FsCmdCloseDir) ); /* 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_CloseDir ) = FS_EINVAL; } else { MC_FS_STATUS( pl_CloseDir ) = FS_OK; } /* Send message to PROCESS_FSS */ if ( MC_FS_STATUS( pl_CloseDir ) == FS_OK ) { /* Fill message with input parameters */ pl_CloseDir->p_DirPtr = pp_DirPtr; /* Send message by setting operation and return command identifier */ MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK, (void*)pl_CloseDir, FS_CMD_CLOSEDIR_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_CloseDir ); Fs87_31SetErrorCode( vl_ErrCode ); /* if the operation is not successful, return an error */ if ( MC_FS_STATUS( pl_CloseDir ) != FS_OK ) { vl_return = FS_ERROR; } else { vl_return = FS_OK; } /* Free message space */ MC_FS_FREE_MEMORY( pl_CloseDir ); /* tcmc_BRC */ MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2); return( vl_return );}/*S(*************************************************************************** * Semantic name : Fs87_20Readdir() * Object : Readdir Synchronous POSIX API * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters : * ------------------- * pp_DirPtr - dir handle * * 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 the directory entry name or NULL * *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 20t_fss_dirent* Fs87_20Readdir(t_fssDIR *pp_DirPtr){ t_fss_dirent* vl_return; s32 vl_ErrCode; u8 vl_SemName; /* Reserve space for message + space for dirent struct which is placed in message */ t_FsCmdReadDir * pl_ReadDir = (t_FsCmdReadDir*) MC_FS_GET_MEMORY(sizeof(t_FsCmdReadDir)); /* 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_ReadDir ) = FS_EINVAL; } else { MC_FS_STATUS( pl_ReadDir ) = FS_OK; } /* Send message to PROCESS_FSS */ if ( MC_FS_STATUS( pl_ReadDir ) == FS_OK ) { /* Fill message with input parameters */ pl_ReadDir->p_DirPtr = pp_DirPtr; /* Updates directory entry pointer on in message structure */ /* ( if p_DirectoryEntry is different of NIL dirent data is placed */ /* at this address else in t_FsDir structure (function interface)) */ pl_ReadDir->p_DirectoryEntry = &(pp_DirPtr->s_DirectoryEntry); /* Send message by setting operation and return command identifier */ MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK, (void*)pl_ReadDir, FS_CMD_READDIR_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_ReadDir ); Fs87_31SetErrorCode( vl_ErrCode ); /* if the operation is not successful, return an error */ if ( MC_FS_STATUS( pl_ReadDir ) != FS_OK ) { vl_return = NULL; } else { /* changed for LMSdv91502 / LMSdv96411 / LMSqa05108 / LMSqa13788 */ vl_return = pl_ReadDir->p_DirectoryEntry; } /* Free message space */ MC_FS_FREE_MEMORY( pl_ReadDir ); /* tcmc_BRC */ MC_FSS_FLASH_SEM_PRODUCE(FSS_SEM2); return( vl_return );}/*S(*************************************************************************** * Semantic name : Fs87_21Rewinddir() * Object : Rewinddir Synchronous POSIX API * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters : * ------------------- * pp_DirPtr - dir handle * * 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 error code *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 21s32 Fs87_21Rewinddir(t_fssDIR *pp_DirPtr){ s32 vl_return; s32 vl_ErrCode; u8 vl_SemName; /* Reserve message space */ t_FsCmdRewindDir * pl_RewindDir = (t_FsCmdRewindDir*) MC_FS_GET_MEMORY( sizeof(t_FsCmdRewindDir) ); /* 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_RewindDir ) = FS_EINVAL; } else { MC_FS_STATUS( pl_RewindDir ) = FS_OK; } /* Send message to PROCESS_FSS */ if ( MC_FS_STATUS( pl_RewindDir ) == FS_OK ) { /* Fill message with input parameters */ pl_RewindDir->p_DirPtr = pp_DirPtr; /* Send message by setting operation and return command identifier */ MC_FS_MA_SEND_CMD_MSG_TO_FS( FS_NO_ACK,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -