Creating a Custom Module - 2023.1 English

Zynq UltraScale+ MPSoC Software Developer Guide (UG1137)

Document ID
UG1137
Release Date
2023-08-04
Version
2023.1 English
To create a custom module, add the following code to PMU firmware:
/* IPI Handler */
static void CustomIpiHandler(const XPfw_Module_t *ModPtr, u32 IpiNum, u32 SrcMask,
const u32* Payload, u8 Len)
{
 /**
* Code to handle the IPI message received
*/
}

/* CfgInit Handler */
static void CustomCfgInit(const XPfw_Module_t *ModPtr, const u32 *CfgData,
u32 Len)
{
 /**
* Code to configure the module, register for events or add scheduler tasks
*/
}

/* Event Handler */
static void CustomEventHandler(const XPfw_Module_t *ModPtr, u32 EventId)
{
 /**
* Code to handle the events received
*/
}

/*
* Create a Mod and assign the Handlers. We will call this function
* from XPfw_UserStartup()
*/
void ModCustomInit(void)
{
 const XPfw_Module_t *CustomModPtr = XPfw_CoreCreateMod();
 (void) XPfw_CoreSetCfgHandler(CustomModPtr, CustomCfgInit);
 (void) XPfw_CoreSetEventHandler(CustomModPtr, CustomEventHandler);
 (void) XPfw_CoreSetIpiHandler(CustomModPtr, CustomIpiHandler, (u16)IPI_ID);
}