API detailed

PxuSetCompatMode

void PxuSetCompatMode(void);

Description:

PxuSetCompatMode() clears the bits RM and SP in the COMPAT register to disable the TC-V1.3 compatible behavior. In this mode the fields PSW.RM of the PSW register are not restored on RET and the SYSCON registers of all cores are Safety Endinit protected. PxuSetCompatMode() is only executed on the _MASTER_CORE_.

This function is assigned to the table of functions executed before PxInit() is called. To execute these functions each main routine should call PxInitializeBeforePxInit() before PxInit() is called.

PxuSetCoreMode

PxError_t PxuSetCoreMode(unsigned int cpuIndex, Pxu_CoreMode_t mode, unsigned long programCounter);

Parameters:

  • cpuIndex — core ID where to set the mode

  • mode — the mode to set (RUN, IDLE)

  • programCounter — initial PC (Program Counter) for the core (only for HALT mode)

Error codes:

  • PXERR_REQUEST_ILLEGAL — unsupported mode (modes such as SLEEP and STBY are not handled at CPU level)

  • PXERR_GLOBAL_ILLEGAL_CORE — cpuIndex exceeds number of cores supported by current version of PXROS-HR

Description:

PxuSetCoreMode() sets the mode of the requested core to IDLE or RUN. If the requested core is in HALT state, the Program Counter of the core is initialized to the requested start address and the core is activated. In this function cpuIndex ranges from 0 to max core, i.e. CORE5 with core ID 6 is mapped to cpuIndex 5.

PxuStartMasterCore

PxError_t PxuStartMasterCore(PxInitSpecsArray_t InitSpecsArray, PxUInt_t cores);

Parameters:

  • InitSpecsArray — array of PXROS-HR initialization structures

  • cores — number of cores to initialize

Error codes:

  • PXERR_GLOBAL_ILLEGAL_CORE — _MASTER_CORE_ exceeds number of cores supported by current version of PXROS-HR or is not included in number of cores to initialize

Description:

PxuStartMasterCore() activates the _MASTER_CORE_. If _MASTER_CORE_ and UC_RESET_CORE are different the _MASTER_CORE_ is started. The UC_RESET_CORE enters IDLE state in order to be reactivated by the _MASTER_CORE_ after initialization. PxuStartMasterCore() shall only be executed on the UC_RESET_CORE.

This must be called in main on the UC_RESET_CORE before calling PxInit().

_PxInit_InitMpu

static PxError_t _PxInit_InitMpu(unsigned int cpuIndex, PxInitSpec_ct initspec);

Parameters:

  • cpuIndex — core ID of the core to initialize

  • initspec — initialization values

Error codes:

  • PXERR_GLOBAL_ILLEGAL_CORE — core is already running

Description:

If the SP-bit in the COMPAT-Register is cleared, _PxInit_InitMpu() initializes the MPU of the requested core from the specification in PxInitSpec. The SYSCON register of the core is set to:

  • PROTEN - Memory Protection enabled

  • U1_IED - User-1 instruction execution disable. The User-1 task’s ability to disable and enable interrupts is disabled.

This function is used by _PxInit_Start_Cores() to initialize the memory protection of the core to start.

_PxInit_Start_Cores

PxError_t _PxInit_Start_Cores(PxUChar_t cpuIndex, PxInitSpec_ct initspec);

Parameters:

  • cpuIndex — core ID to start

  • initspec — the PXROS-HR initialization specification for this core

Error codes:

  • PXERR_GLOBAL_ILLEGAL_CORE — unsupported core

Description:

If the SYSCON register is Safety Endinit protected, all other CPUs are started with protection enabled. Therefore, the function _PxInit_InitMpu() is called to initialize the MPU of the core to start. In this function cpuIndex ranges from 0 to max core, i.e. CORE5 with core ID 6 is mapped by cpuIndex 5.

This function is called from PxInit() on the startup core to activate all other cores.