PxInit()
PXROS initialization.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxError_t PxInit (PxInitSpecsArray_t _initspecs, PxUInt_t noOfCores); - ARGUMENTS
|
|
|
- RETURN VALUES
-
-
PXROS error code
-
- ERROR CODES
-
PXERR_PROT_ILL_REGIONillegal protection region definition
PXERR_INIT_SCHEDULE_FAILEDthe scheduling of the init task failed
PXERR_INIT_ILLALIGNinvalid memory block or size alignment in initialization
PXERR_INIT_ILLMCTYPEtype for PXMcSystemdefault is different from PXMcVarsized, PXMcVarsizedAdjusted and PXMcVarsizedAligned
PXERR_MC_ILLALIGNincorrectly aligned memory for PXMcSystemdefault
PXERR_MC_ILLSIZEsize for PXMcSystemdefault is too small
PXERR_INIT_NOMEMnot enough memory for initialization
PXERR_OBJECT_SHORTAGEnot enough objects given in initstruct
PXERR_GLOBAL_ILLEGAL_COREnumber of cores not supported
PXERR_ILL_NULLPOINTER_PARAMETERInvalid system stack specification
PXERR_PROT_PERMISSIONMemory protection unit cannot be activated
PXERR_ILLEGAL_ACCESSIncorrect access permission for _initspecs elements
PXERR_GLOBAL_OBJLIST_INCONSISTENCYInconsistency between global and local init
PXERR_INIT_SEGBOUNDARYblock crosses segment boundary
PXERR_MC_ILLMCmc is not a valid memory class
PXERR_MC_SEGBOUNDARYBlock crosses segment boundary
PXERR_TASK_TCBMEMInsufficient memory to allocate the task control block
PXERR_OPOOL_ILLOPOOLThe passed object pool handle is not valid
PXERR_OBJ_ABORTEDThe request was aborted by an event
PXERR_OBJ_NOOBJNo free object is available
PXERR_OBJ_ILLOBJThe passed object handle is not valid
PXERR_TASK_SCHEDEXT_NOT_CONFIGUREDTask extensions not configured in this PXROS version
PXERR_TASK_STKMEMInsufficient memory to allocate task stack
PXERR_TASK_STACKUNKNOWNUnknown Stack
PXERR_TASK_STACK_ILLALIGNInvalid task stack alignment
PXERR_TASK_STACK_SEGBOUNDARYTask stack crosses segment boundary
PXERR_TASK_ILLSTACKSPECTYPEError in stack specification
PXERR_TASK_ILLPRIVIllegal privilege for tasks
PXERR_INTERNAL_INCONSISTENCYInconsistency of internal structures
- DESCRIPTION
-
PxInit initializes a PXROS application system according to the specification array _initspecs for given number of cores (noOfCores). PxInit creates PXMcSystemdefault, and PXOpoolSystemdefault creates generic PXROS objects, puts them into the PXOpoolSystemdefault object pool, and creates and activates the initialization task.
One element of the specification array is of type PxInitSpec_T.
This data structure specifies the initial properties of a PXROS application system. Current specification items include:
-
A description of the system memory class and first initial block
-
A description of the memory for the generic PXROS objects
-
The number of PXROS objects and the maximum size of their names
-
The number of objects which should be defined for intercore communication
-
A specification of the initialization tasks priorities
The four initial parameters specify the system memory class properties and the initial block. This block must be large enough to allocate all task control blocks. The size of a task control block is defined by PXTASK_SIZE.
The memory block for the PXROS objects must be large enough to hold all generic PXROS objects and their names. The size of an object is defined by PXOBJ_SIZE.
The parameter is_obj_number specifies the total number of generic PXROS objects (tasks, messages, mailboxes, delay jobs, etc.) existing at any given moment. The parameter is_obj_namelength determines an additional memory area (following immediately the object memory) which can be used for naming individual objects. PXROS requires a certain amount of objects for internal purposes like e.g.:
-
The default system memory class PXMcSystemdefault
-
the default object pool PXOpoolSystemdefault
During initialization, all PXROS objects are created and stored in the object pool PXOpoolSystemdefault. From this object pool, these objects may be requested and placed into other object pools or transformed into special PXROS objects.
The parameter is_global_obj_number specifies the amount of available objects for the communication across cores. These objects are stored in the global object pool PXOpoolGlobalSystemdefault. If is_global_obj_number is 0, all objects are treated as global objects.
Memory Protection initialization:
The Memory Protection Unit provides a certain amount (depending on architecture version) of data protection register pairs and code protection register pairs which are defined through a lower and upper bound address and the protection rights. These protection register pairs are divided between system and application.
{'TC23': ['// the code protection register definition for the PXROS system', 'const PxCodeProtectSet_T *is_sys_code;', '// the data protection register definition for the PXROS system', 'const PxDataProtectSetInit_T *is_sys_data;', '// the code protection register definition for the application', 'const PxCodeProtectSet_T *is_task_code;'], 'ARM-CMX': ['// the protection register definition for code and read only data', 'PxProtectRegion_T is_sys_ro_protection[1];', '// the protection register definition for system memory', 'PxProtectRegion_T is_sys_memory_protection[1];']} -
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
initspecshas to be a valid PXROS-HR initialization structure. (V) -
noOfCoresmust not exceed the number of available cores. (V)
-
- After call
-
-
On success
PxInitnever returns. If the call fails, the reason is given as return value of typePxError_t. (C)
-
- Best Practice
-
-
PxInitinitializes PXROS-HR and must be called once only.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxError_t error = PxInit(InitSpecsArray, CORE_COUNT); if (error != PXERR_NOERROR) { // Report error PxPanic(); }