📄 fs84lowlayer.c
字号:
#ifdef FSS_FTR#define ACCESS_RIGHTS_INTERNAL_FS#define FS84LOWLAYER_C#include "Fs.h"#undef FILE_NUMBER#define FILE_NUMBER 84 /****************************************************************************************//* *//* The function contained in this file is used by all layers to call a function *//* in a lower layer *//* *//****************************************************************************************//* Variable reservation *//*----------------------*/ /* Base structure of low layer management */t_LowLayerDataBaseStruct s_LowLayerDataBaseStruct;/* LOCAL DEBUG MACROS *//*--------------------*//* This macro verify if a function is implemented for the volume */ #ifdef DEBUG#define FS_TEST_FCT_EXIST( pp_FctLevel ) \ if ( pp_FctLevel->p_Fct == FS_FCT_NOT_EXIST ) MC_SYS_ERROR(FS_NO_LOW_LAYER_FCT)#else#define FS_TEST_FCT_EXIST(pp_FctCtx)#endif/* This macro is to use at return from a lower layer call to verify if all MUTEXes would released */#ifdef DEBUG#define FS_TEST_ALL_MUTEX_LEVEL_FREE(pp_LayerComm) \ if ( pp_LayerComm->a_Layer[pp_LayerComm->v_CurrentLayerLevel].v_NbrMutexLayer != 0 \ MC_SYS_ERROR(FS_MUTEX_NOT_FREED);#else#define FS_TEST_ALL_MUTEX_LEVEL_FREE(pp_LayerComm)#endif/**//*P(***************************************************************************//* Procedure name : Fs84_01LLInitLowLayer *//* Object : Initialize low layer management volume *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* t_FsConfiguration * pp_Config: Pointer on FS init structure *//* *//* Output parameters : *//* ------------------- *//* none *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* Initializes the low layer module *//* *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 1void Fs84_01LLInitLowLayer( t_FsConfiguration * pp_Config ){ s_LowLayerDataBaseStruct.v_NbrMaxLevelLayers = pp_Config->v_NbrMaxLevelLayers; s_LowLayerDataBaseStruct.v_NbrKernelTasks = pp_Config->v_NbrKernelTasks; s_LowLayerDataBaseStruct.p_TabLayerCommunication = (t_LayerCommunication ** ) MC_FS_GET_MEMORY( sizeof(t_LayerCommunication * ) * pp_Config-> v_NbrKernelTasks ); }/**//*P(***************************************************************************//* Procedure name : Fs84_02LLThreadComInit *//* Object : Initialize thread communication structure with lower layers *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* t_LayerCommunication * pp_LayerCom: Communication structure pointer *//* u8 vp_TypeOfThread: Type of thread ( internal/external/task ) *//* *//* Output parameters : *//* ------------------- *//* none *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* Initializes the communication structure of the thread *//* *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 2void Fs84_02LLThreadComInit( t_LayerCommunication * pp_LayerCom, u8 vp_TypeOfThread ){ /* Clear list of mutexes */ /* pp_LayerCom->p_MutexList = 0; */ /* communication stack is empty */ pp_LayerCom->v_NbrStackEntries = 0; /* Updates type of thread */ /* pp_LayerCom->v_TypeOfThread = vp_TypeOfThread; */#ifdef DEBUG /* pp_LayerCom->v_NbrMutexLayer = 0; */#endif /* Init pointer on interlayer comunication to nul ( no volume selected ) */ pp_LayerCom->p_CurrentInterLayer = 0; /* Place layer structure in layer communication table indexed by task ID */ s_LowLayerDataBaseStruct.p_TabLayerCommunication[MC_RTK_CURRENT_TASK] = pp_LayerCom; }/**//*P(***************************************************************************//* Procedure name : Fs84_03GetLayerContext *//* Object : Return the context of the layer *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* none *//* *//* Output parameters : *//* ------------------- *//* void * : Pointer of context *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* Returns the context of the current layer for the treated volume *//* *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 3void * Fs84_03GetLayerContext ( void ){ t_LayerCommunication * pl_LayerCom; /* Load layer communication structure pointer */ pl_LayerCom = s_LowLayerDataBaseStruct.p_TabLayerCommunication[MC_RTK_CURRENT_TASK]; /* Return context of layer */ return ( pl_LayerCom->p_CurrentInterLayer->p_LayerContext ); }/**//*P(***************************************************************************//* Procedure name : Fs84_04LLSetNewVolume *//* Object : Set a new volume for communication structure with lower layers *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* t_fsVolStruct * pp_Vol: Pointer on volume structure *//* *//* Output parameters : *//* ------------------- *//* none *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* Sets the interlayer communication structure on the new volume *//* for this updates the pointer on the layer's structure on the *//* structure of the highest level ( FS ) of the interlayer table *//* *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*//* To use by the FS layer to set a new volume , updates the pointer on the current layer to the highest of the volume */ #undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 4void Fs84_04LLSetNewVolume(t_fsVolStruct * pp_Vol){ t_LayerCommunication * pl_LayerCom; /* Load layer communication structure pointer */ pl_LayerCom = s_LowLayerDataBaseStruct.p_TabLayerCommunication[MC_RTK_CURRENT_TASK]; /* Update current interlayer in communication structure */ pl_LayerCom->p_CurrentInterLayer = (( t_InterLayer* )(pp_Vol->p_LayerCommunication)) + ( (( t_InterLayer* )(pp_Vol->p_LayerCommunication))->v_NbrLayers - 1 );}/**//*P(***************************************************************************//* Procedure name : Fs84_05GetCommunicationStructPtr() *//* Object : Gets the communication structure pointer *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* none *//* *//* Output parameters : *//* ------------------- *//* t_LayerCommunication *: pointer on the communication structure *//* of the thread *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* Gets the pointer on the communication structure of the thread *//* ( This function is only to use from the FS internal thread switch *//* because at internal thread switch the pointer must be saved before *//* to run the switch ) *//* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -