/*BEGIN_FILE_HDR **************************************************************************************************** * NOTICE * This software is the property of HiRain Technologies. Any information contained in this doc * should not be reproduced, or used, or disclosed without the written authorization from HiRain * Technologies. **************************************************************************************************** * File Name: Os_Ioc.c **************************************************************************************************** * Project/Product: AUTOSAR OS PROJECT * Title: Os_Ioc.c * Author: Hirain **************************************************************************************************** * Description: * * A part of Ioc implement of OS. **************************************************************************************************** * Limitations: * * None. **************************************************************************************************** * **************************************************************************************************** * Revision History: * Reference to Core Os_Kernel.c File. **************************************************************************************************** *END_FILE_HDR*/ /*PRQA S 0857 EOF*/ /* * Number of macro definitions exceeds 1024 */ #include "Os_Internal.h" /*************************************************************************************************** * General QAC Suppression ***************************************************************************************************/ /*PRQA S 0862 EOF*/ /* * The code segment like: * * #define XXX * #include "Os_MemMap.h" * * is a part of AUTOSAR specification, but will be an error in PRQA. */ /*PRQA S 3432 EOF*/ /* * P2VAR and other macros in the Compiler conforms to AUTOSAR standard.There's no * need to revise. * OR * Parameters in macros or functions are useless for some hardware platforms, * but they can not be deleted according to the requirements of * AUTOSAR specification or compatibility. */ /*PRQA S 0862 EOF*/ /* * The code segment like: * * #define XXX * #include "Os_MemMap.h" * * is a part of AUTOSAR specification, but will be an error in PRQA. */ /*PRQA S 0553 EOF*/ /* * Some files are empty because user do not enable this function. */ #if(OS_IOC_NUMBER > 0) /*************************************************************************************************** * static variables define ***************************************************************************************************/ #define OS_START_SEC_CODE #include "Os_MemMap.h" /*************************************************************************************************** * OS private code ***************************************************************************************************/ /*************************************************************************************************** * OS internal code ***************************************************************************************************/ /* BEGIN_FUNCTION_HDR **************************************************************************************************** * Function Name: OsIoc_Check * * Description: Check the pre condition of IOC * * Inputs: CoreID, IocId, cfgAppId, ApiId * * Outputs: None * * Limitations: None **************************************************************************************************** END_FUNCTION_HDR*/ #if(OS_STATUS_LEVEL == OS_EXTENDED) FUNC(Std_ReturnType, OS_CODE) OsIoc_Check ( CoreIdType CoreID, Os_uint16 IocId, ApplicationType cfgAppId, /* This is sender or receiver's app id. */ OSServiceIdType ApiId ) { Std_ReturnType ret; ret = IOC_E_NOK; if ((CoreID >= (CoreIdType)OS_USED_CORE_NUMBER) || (Os_CoreState[CoreID] != OS_CORE_START)) { /* Can not record err in this state, as OS services can not be called. */ } else if ((Os_uint16)(Os_CurrentContext[CoreID] & Os_IocComMask) == (Os_uint16)0) { OsHook_ReportError(CoreID, E_OS_CALLEVEL, ApiId, OS_IE_NOMORE_INFO, (Os_uint32)IocId, \ (Os_uint32)cfgAppId, (Os_uint32)Os_CurrentContext[CoreID]); } /* SWS_Os_00093 Not need to check whether this API is called between interrupt processing APIs. */ else if (Os_CurrentApplicationId[CoreID] != cfgAppId) { OsHook_ReportError(CoreID, E_OS_ACCESS, ApiId, OS_IE_NO_ACCESS_RIGHT, (Os_uint32)IocId, \ (Os_uint32)Os_CurrentApplicationId[CoreID], OS_IE_NO_ERRPAR); } else if (IocId >= (Os_uint16)OS_IOC_NUMBER) { OsHook_ReportError(CoreID, E_OS_ID, ApiId, OS_IE_IOC_ID, (Os_uint32)IocId, \ OS_IE_NO_ERRPAR, OS_IE_NO_ERRPAR); } else { ret = IOC_E_OK; } return ret; } #endif /* (OS_STATUS_LEVEL == OS_EXTENDED) */ /*************************************************************************************************** * OS API code, no API for IOC, ioc API is generated by tool ***************************************************************************************************/ #define OS_STOP_SEC_CODE #include "Os_MemMap.h" #endif /* (OS_IOC_NUMBER > 0) */