1.1.1.4.22 DRV_PLC_PHY_EXCEPTION_CALLBACK Typedef
C
typedef void ( *DRV_PLC_PHY_EXCEPTION_CALLBACK )( DRV_PLC_PHY_EXCEPTION exception, uintptr_t context );
Summary
Pointer to a PLC Driver Exceptions Event handler function.
Description
This data type defines the required function signature for the PLC driver exceptions event handling callback function. A client must register a pointer using the callback register function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive transfer related event calls back from the driver.
Parameters
Param | Description |
---|---|
exception | Value (of type DRV_PLC_PHY_EXCEPTION Enum) identifying the exception code which occurs during SPI transfer |
context | Value identifying the context of the application that registered the event handling function |
Returns
None.
Example
void APP_MyExceptionEventHandler( DRV_PLC_PHY_EXCEPTION exception, uintptr_t context )
{
MY_APP_DATA_STRUCT* pAppData = (MY_APP_DATA_STRUCT*) context;
switch (exception)
{
case DRV_PLC_PHY_EXCEPTION_UNEXPECTED_KEY:
// SPI has detected an unexpected status, reset is recommended
break;
case DRV_PLC_PHY_EXCEPTION_CRITICAL_ERROR:
// SPI critical error in last transfer. Bootloader task has failured.
break;
case DRV_PLC_PHY_EXCEPTION_DEBUG:
// PLC transceiver has been reset by Debugging tool
break;
case DRV_PLC_PHY_EXCEPTION_RESET:
// PLC transceiver has been reset
break;
default:
// SPI has detected an unexpected status, reset is recommended
}
pAppData->plcException = true;
}
Remarks
The context parameter contains a handle to the client context, provided at the time the event handling function was registered using the DRV_PLC_PHY_ExceptionCallbackRegister function. This context handle value is passed back to the client as the context parameter. It can be any value necessary to identify the client context or instance (such as a pointer to the client's data) of the client that made the transfer add request.