📄 fs10msgapi.c
字号:
/***************************************************************************** ........................................................................ COPYRIGHT (c) Philips Semiconductors Nuremberg 2003 .. All rights are reserved. Reproduction in whole or in part is .. prohibited without the written consent of the copyright owner. . ......................................................................... File name : Fs10MsgApi.c.. Project : SSYOL3 WAP/MMS.. Module : OSFS.. %version: 1.1.1 %.. Compiler name and release:...............:........:..........:............:...............................* *----------------------------------------------------------------------------* * DESCRIPTION * Thus file contains the interface with the kernel, it waits * on objects recived through the kernel and calls the appropriate * treatement. * *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* * FUNCTIONS DEFINED IN THIS FILE *----------------------------------------------------------------------------* * Name | Object *----------------------------------------------------------------------------* * Fs10_00FileServer | * Fs10_01TestFsMbxTO | * Fs10_02InsertInJobs | * Fs10_03Schedule | * Fs10_04SendCmdMessageToFs | * Fs10_05InitMsgApi | * Fs10_06SendMsgToApp | *----------------------------------------------------------------------------* * EVOLUTION *----------------------------------------------------------------------------* * Date | Author | Description *----------------------------------------------------------------------------* * 31.03.03 | tcmc_sgp | addition of exception handle, file header, * function header and commments * 02.05.03 | tcmc_sgp | addition of function SendMsgToApp and a * mechanism to handle IND msg is added *----------------------------------------------------------------------------* *****************************************************************************/#define ACCESS_RIGHTS_INTERNAL_FS#define FS10MSGAPI_C#include "Fs.h"#define MODULE_NUMBER MODULE_OSFS#undef FILE_NUMBER#define FILE_NUMBER 10 #ifdef FSS_FTRu32 * pp_TabCommandID;/* This table contains adresses functions of FS commands *//*-------------------------------------------------------*/ void (*a_FsTabFct[])(void*) = { Fs20_01FOpen, Fs21_01FClose, Fs22_01Remove, Fs23_01Rename, Fs24_01SetVBuff, Fs25_01FTell, Fs26_01FSeek, Fs27_01Rewind, Fs28_01Stat, Fs29_01Flush, Fs30_01Feof, Fs31_01Fwrite, Fs32_01FRead, Fs39_01GetVolInfo, Fs41_01ClearAllVolObj, Fs44_01FreezeVolume, Fs45_01UnFreezeVolume, Fs46_01MakeDir, Fs47_01RmDir, Fs48_01ChDir, Fs49_01GetCwd, Fs50_01OpenDir, Fs51_01CloseDir, Fs52_01ReadDir, Fs53_01RewindDir, Fs54_01FormatVol, Fs55_01GetFileAddress, Fs56_01GarbageVolume, Fs57_01GetFilesAddrOfDir#if defined(SYNCHRONOUS_FILE_SYSTEM_FTR) , Fs58_01SetSize#endif /* SYNCHRONOUS_FILE_SYSTEM_FTR */ }; #endif /* FSS_FTR *//* Contains FSS kernel task number *//*---------------------------------*/u8 v_CurrentTask;#ifdef FSS_FTR/* Flag containing if a JOB is or not running *//*--------------------------------------------*/u8 v_JobActive = 0;/* Reservation of locals JOB queue *//*---------------------------------*/t_RtkQueue s_JobQueue;/* Command identifier returned to caller *//*---------------------------------------*/u32 v_CommandID = 0;/* Process name of FS and interface shifted *//*------------------------------------------*/u16 v_Interface;u8 v_FsProcessName;#endif /* FSS_FTR *//*P(**************************************************************************** Procedure name : Fs10_00FileServer * Object : Entry point for FSS *-----------------------------------------------------------------------------* Input parameters : * ------------------- * none * * Output parameters : * ------------------- * none * * Used variables : * -------------------** Used procedure** ------------------- * - MC_RTK_RECEIVE * *-----------------------------------------------------------------------------*-----------------------------------------------------------------------------* DESCRIPTION * * This function is a entry point for FSS. It runs in infinite loop to* call the message receive process and sehedular function to act upon. * *-----------------------------------------------------------------------------***************************************************************************)P*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 0void Fs10_00FileServer(void){ t_RtkObject sl_ReceivedObject; u8 vl_CurrentTask = MC_RTK_CURRENT_TASK;#ifdef FSS_FTR /* Creates communication structure */ t_LayerCommunication s_LayerCom; #endif /* FSS_FTR */ /* Store FS task number to allow the test of the mailbox made from the following function */ v_CurrentTask = vl_CurrentTask;#ifdef FSS_FTR /* Init thread on this communication structure */ MC_FS_LL_THREAD_COMM_INIT( &s_LayerCom, 0);#endif /* FSS_FTR */ /* Infinite loop of the task */ for (;;) { /* Receive timers or messages only */ MC_RTK_RECEIVE( v_CurrentTask, &sl_ReceivedObject);#ifdef FSS_FTR /* If an object is available insert it in job list ( creates threads ..... ) */ Fs10_02InsertInJobs(&sl_ReceivedObject); /* Schedule to run new object */ Fs10_03Schedule();#endif /* FSS_FTR */ }}#ifdef FSS_FTR/*P(**************************************************************************** Procedure name : Fs10_01TestFsMbxTO * Object : Test if objects are in FS mailbox and take they in account *-----------------------------------------------------------------------------* Input parameters : * ------------------- * none * * Output parameters : * ------------------- * none * * Used variables : * -------------------** Used procedure** ------------------- * - MC_RTK_CURRENT_TASK * - MC_RTK_TEST_RECEIVE**-----------------------------------------------------------------------------*-----------------------------------------------------------------------------* DESCRIPTION * * This function is to call periodically from all layers from FSS * to test if in new objects are in mailbox, take they in account * and if needed switch on this new treatement. * It is also possible to use this function to give hand back to * allow lower priority tasks to run * *-----------------------------------------------------------------------------***************************************************************************)P*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 1void Fs10_01TestFsMbxTO(void){ register u8 vl_CurrentTask = MC_RTK_CURRENT_TASK; /* If we are not in FS task so no internal thread switch can be made return */ if ( vl_CurrentTask != v_CurrentTask ) return; /* Extract objects from the mailbox and if possible create the new job(s) - If needed reschedule ( new jobs have a greather priority ) */ { t_RtkObject sl_ReceivedObject; register u8 vl_ReschedulingAsked = 0; for (;;) { /* If no objects break */ if ( MC_RTK_TEST_RECEIVE( vl_CurrentTask, &sl_ReceivedObject) == RTK_NO_MESSAGE ) break; /* If an object is available insert it in job list ( creates threads ..... ) */ else vl_ReschedulingAsked |= Fs10_02InsertInJobs(&sl_ReceivedObject); } /* If a work more prioritized to do reschedule */ if ( vl_ReschedulingAsked ) Fs10_03Schedule(); }}/*P(**************************************************************************** Procedure name : Fs10_02InsertInJobs * Object : Put the message received into pending job list *-----------------------------------------------------------------------------* Input parameters :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -