📄 fs10msgapi.c
字号:
{ /* Error unknown process -> Invalid Argument */ /* no Semaphore provided for calling process */ /* General Defense: send non blocking */ MC_DIN_ERROR(NO_BLOCKING,0x00); /* Free message space. No answer message expected by Sync Interface */ MC_FS_FREE_MEMORY( pl_MsgHeader ); } } else {#endif /* SYNCHRONOUS_FILE_SYSTEM_FTR */ /*** Asyncronous Message Interface ***/ /* Send _CNF message, if requested else release message */ if( ((t_FsMsgHeader *) pl_MsgHeader)->v_ErrNumber == FSS_OK ) { if( ((t_FsMsgHeader *)pl_MsgHeader)->v_Behavior == FSS_WITH_ACK ) { /* No error: set the OPtype to _CNF */ pl_MsgHeader->v_OperationType = MC_PCC_MESSAGE_CNF( pl_MsgHeader->v_OperationType ); /* Set acknowledge request */ vl_WithAck = 1; } } else /* Send _ERR message, if unexpected result of 'command run' */ { /* Error: set the Optype to _ERR */ pl_MsgHeader->v_OperationType = MC_PCC_MESSAGE_ERR( pl_MsgHeader->v_OperationType); /* Set acknowledge request */ vl_WithAck = 1; } /* Send answer message or release it */ if( vl_WithAck ) { /* We answer to the sender so set receiver to sender */ pl_MsgHeader->s_Receiver = pl_MsgHeader->s_Transmitter; /* Set sender to FSS ID */ ((t_ProcessIdentityFields*) &(pl_MsgHeader->s_Transmitter))->v_FsmInstance = 0; ((t_ProcessIdentityFields*) &(pl_MsgHeader->s_Transmitter))->v_ProcessName = v_FsProcessName; /* Send message */ MC_RTK_SEND_FMSG_TO_PROCESS( pl_MsgHeader ); } else { /* Free message space, if no anser message is send */ MC_FS_FREE_MEMORY(pl_MsgHeader); } /* End: Asyncronous Message Interface */#if defined(SYNCHRONOUS_FILE_SYSTEM_FTR) }#endif /* SYNCHRONOUS_FILE_SYSTEM_FTR */ } /* Note that no JOB is Running */ v_JobActive = 0;}/*P(**************************************************************************** Procedure name : Fs10_04SendCmdMessageToFs * Object : This function sends a command message to the FSS *-----------------------------------------------------------------------------* Input parameters : * ------------------- * u8 vp_Behaviour : If an acknoledge message is to send * void * pp_Msg: Pointer on message to finish to fill and to send * t_OperationType vp_OpType : Operation type of the message * * * Output parameters : * ------------------- * u32 : Identifier of the command * * Used variables : * ------------------- * * * Used procedures : * ------------------- * * *-----------------------------------------------------------------------------*-----------------------------------------------------------------------------* DESCRIPTION * * This function finish t fill a message corresponding to a FSS the * transmitter and the receiver and the operation type are filled * and the message is sent to FSS. * *-----------------------------------------------------------------------------***************************************************************************)P*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 4u32 Fs10_04SendCmdMessageToFs(u8 vp_Behaviour, void * pp_Msg, u16 vp_Cmd) { t_MsgHeader * pl_Msg = (t_MsgHeader *)pp_Msg; u32 vl_CommandID; /* Update transmitter ( this is knowed from the kernel ) */ MC_RTK_GET_CURRENT_PROCESS_IDENTITY( (t_ProcessIdentityFields*) &pl_Msg->s_Transmitter); /* Update receiver to FS */ ((t_ProcessIdentityFields*)&(pl_Msg->s_Receiver))->v_FsmInstance = 0; ((t_ProcessIdentityFields*)&(pl_Msg->s_Receiver))->v_ProcessName = v_FsProcessName; /* Update operation type - v_Interface contains process name shifted - vp_Cmd the command no shifted and ored with the type */ pl_Msg->v_OperationType = v_Interface | vp_Cmd; /* Update behavior */ ((t_FsMsgHeader *)pl_Msg )->v_Behavior = vp_Behaviour; /* Update command ID place it in message for CNF or ERR */ vl_CommandID = pp_TabCommandID[MC_RTK_CURRENT_TASK]++; ((t_FsMsgHeader *)pl_Msg )->v_CommandID = vl_CommandID; /* Send message */ MC_RTK_SEND_FMSG_TO_PROCESS(pl_Msg); /* return command ID */ return (vl_CommandID);}/*P(**************************************************************************** Procedure name : Fs10_05InitMsgApi * Object : This function determine the current active process *-----------------------------------------------------------------------------* Input parameters : * ------------------- * pp_Config * * * Output parameters : * ------------------- * u32 : Identifier of the command * * Used variables : * ------------------- * * * Used procedures : * ------------------- * * *-----------------------------------------------------------------------------*-----------------------------------------------------------------------------* DESCRIPTION * * This function determine the current active process and assign the* values in the global variables.* *-----------------------------------------------------------------------------***************************************************************************)P*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 5void Fs10_05InitMsgApi( t_FsConfiguration * pp_Config ){ pp_TabCommandID = (u32* ) MC_FS_GET_MEMORY( sizeof( u32 ) * pp_Config-> v_NbrKernelTasks ); v_FsProcessName = Fs02_01GetFsProcessName(); v_Interface = MC_PCC_PROCESS_OPERATION( v_FsProcessName, 0);}#ifdef SYNCHRONOUS_FILE_SYSTEM_FTR/*P(**************************************************************************** Procedure name : Fs10_06SendMsgToApp * Object : This function sends the IND message to Application to inform* Flash device ready for read/write operation*-----------------------------------------------------------------------------* Input parameters : * ------------------- * * * Output parameters : * ------------------- * * * Used variables : * ------------------- * * * Used procedures : * ------------------- * * *-----------------------------------------------------------------------------*-----------------------------------------------------------------------------* DESCRIPTION * * This function determines the process available in the process list* and send IND message to inform device is ready for read/write.* *-----------------------------------------------------------------------------***************************************************************************)P*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 6void Fs10_06SendMsgToApp( void ){ u8 i=0;/* Change declaration to get rid of Warning Message - tcmc_wbm */ t_FssDelayInd* pl_FssDelayInd = NULL; /* Check the value of v_FssNoDelay counter, if not zero then return */ if (v_FssNoDelay > 0) return; else if (v_FssNoDelay < 0) { /* General Defense: send non blocking */ MC_DIN_ERROR(NO_BLOCKING,0x00); return; } /* If a process id exist in the process list, send a notification for end of erase */ if( a_FsProcessNumber[i] != FSS_PROCESS_DUMMY ) { /* Reserve memory space */ pl_FssDelayInd = (t_FssDelayInd*) MC_FS_GET_MEMORY(sizeof(t_FssDelayInd)); /* Set status as 'Erase End'. This is the default value, as erase start IND is not needed by an applicaton */ pl_FssDelayInd->v_EraseStatus = FSS_ERASE_END; /* Send msg to application and remove the process id from the list */ MC_RTK_SEND_MSG_TO_PROCESS (PROCESS_FSS,0,a_FsProcessNumber[i],0,\ FSS_READ_WRITE_READY_IND,\ (t_MsgHeader *)pl_FssDelayInd ); a_FsProcessNumber[i] = FSS_PROCESS_DUMMY; } /* Search for any other entry in process list to be notified */ for( i=1; i < FSS_PRO_LST_MAX; i++ ) { if( a_FsProcessNumber[i] != FSS_PROCESS_DUMMY ) { /* Increment the memory for msg structure */ MC_RTK_LINK_MEMORY(pl_FssDelayInd); /* Send msg to application and remove the process id from the list */ MC_RTK_SEND_MSG_TO_PROCESS (PROCESS_FSS,0,a_FsProcessNumber[i],0,\ FSS_READ_WRITE_READY_IND,\ (t_MsgHeader *)pl_FssDelayInd ); a_FsProcessNumber[i] = FSS_PROCESS_DUMMY; } else break; } }#endif /* SYNCHRONOUS_FILE_SYSTEM_FTR */#endif /* FSS_FTR */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -