MicroZed Chronicles リスト http://adiuvoengineering.com/?page_id=285
@ Adam Taylor blog
https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-38-Answering-a-question/ba-p/479978
In this example, I show how to use the private interrupt. However the general concept is the same regardless of interrupt used. For this example, I will be using an EMIO GPIO pin connected via the PL, looped back and connected to the processor’s interrupt pin. A simple software program can then demonstrate how an interrupt from the PL works.
Vivado上の作業
The first stage of this example is to enable the interrupts between the PL and PS and to enable the specific interrupt you wish to use.
blogの画像においては Re-customize IP > Interruptにて PL-PS Interrupt > Core0_nRQ にチェックをつけているようだ。
The second step is to enable a single-bit GPIO using the EMIO option.
Re-customize IP > MIO Configuration > GPIO > EMIO GPIO (Width) を1にしている。
XSDK上の作業
- Declare the following header files: Platform.h, xparameters.h, Xscugic.h, Xil_Exceptions.h and xgpio.h. These header files will provide functions and macros that enable us to generate the example.
- Define the generic interrupt controller and GPIO device ID and interrupt numbers along with the FPGA interrupt and pin numbers for the EMIO and push-button switch.
- Declare and write a number of required functions:
xgpio.hはないのでxgpiops.hを代わりにincludeする。
Interruptの設定
When setting up an interrupt in the Zynq we need to do the following things:
- Initialize the Interrupt controller.
- Connect the exception ID to the associated handler so that when an event occurs it can be run correctly.
- Connect the FPGA interrupt to the generic interrupt controller. This requires the pre-defined interrupt ID, the call-back handler (which is defined to identify the source of the interrupt), and the interrupt service routine to be run when the interrupt occurs.
- Enable the interrupt on the interrupt controller.
- Enable interrupts on the processor.
短いサンプルコードがあるようなので時間が確保できた時に実施してみよう。