Exception in depth
The cortex a9 have 7 kinds of exception as follows:
- XIL_EXCEPTION_ID_RESET
- XIL_EXCEPTON_ID_UNDEFINED_INT
- XIL_EXCEPTION_ID_SWI_INT
- XIL_EXCEPTION_ID_PREFETCH_ABORT_INT
- XIL_EXCEPTION_ID_DATA_ABORT_INT
- XIL_EXCEPTION_ID_IRQ_INT
- XIL_EXCEPTION_ID_FIQ_INT
AS THE Exception handling and cortex a9 processsor is the part of arm , so refer to arm industry for detaild information. Refer to ARM Architecture reference manual ARMv7-a and ARMv-7R for more details.
Files:
Asm_vectors.S vectors.c vectors.h
Xil_exception.c xil_exception.h
The driver API source files and help documents locate in the standalone folder generate by libgen tools, you can build a project and SDK will generate driver api source automatically, as shown following:
As we known , the start code will build a vector table for the exception 0-6, and the POWER_ON_RESET actually means the XIL_EXCEPTION_ID_RESET , driver api source will keep the table in a well-designed ways. that's , if no valide exception handle is specified, driver api will create a blank handler to deal with the exception and the blank means do nothing.
We need to replace the blank handler with a valid function, use :
Xil_ExceptionRegisterHandler (ExceptionID, Handler, DataPtr)
ExceptionID specify the Exception you want to deal with and the Handler is a new XExceptionHandler , DataPtr will transform some parameters.
Typedef Void (* Xil_ExceptionHandler)(void* DataPtr)
Call for Xil_ExceptionRemoveHandler(ExceptionID) to remove the individual handler with a blank handler.
New list some anable and disable exception dirver api:
- Xil_ExceptionEnableEnable(void)
- Xil_ExceptionEnableMask(Msk)
- Xil_ExceptionDisable(void)
- Xil_ExceptionDisableMask(Mask)
Do not forget about call for Xil_ExceptionInit to generate a Exception table and generate some blank handler for left alone exceptions.
NOTICE: Xil_ExceptionEnable will deal with XIL_EXCEPTION_ID_IRQ_INT only , so call for Xil_ExceptionEnableMask to enable the XIL_EXCEPTIN_ID_FIQ_INT.