首页 / AMD-FPGA / 帖子

z7芯片,我想给ch23,5640的例程中增加一个中断要怎么加?

作者 扒饭才是硬道理 2019-08-07 12277 次浏览 1 条回复 论坛存档
扒
扒饭才是硬道理
2019-08-07
楼主

I2C_config_init();

Xil_Out32((VDMA_BASEADDR + 0x030), 0x108B);// enable circular mode

Xil_Out32((VDMA_BASEADDR + 0x030), 0x108B);// enable circular mode

Xil_Out32((VDMA_BASEADDR + 0x0AC), VIDEO_BASEADDR0); // start address

Xil_Out32((VDMA_BASEADDR + 0x0B0), VIDEO_BASEADDR1); // start address

Xil_Out32((VDMA_BASEADDR + 0x0B4), VIDEO_BASEADDR2); // start address

Xil_Out32((VDMA_BASEADDR + 0x0A8), (H_STRIDE*3)); // h offset (H_STRIDE* 3) bytes

Xil_Out32((VDMA_BASEADDR + 0x0A4), (H_ACTIVE*3)); // h size (H_ACTIVE * 3) bytes

Xil_Out32((VDMA_BASEADDR + 0x0A0), V_ACTIVE); // v size (V_ACTIVE)

/*****************从DDR读数据设置**********************/

// Write to discretes register for the specified GPIO channel */

while(1){

/*Read state of discretes for the specified GPIO channnel.*/

Btn_val=XGpio_DiscreteRead(&Gpio, BTN_CHANNEL);

//检测 Btn_val值,如果按钮按下,灯全亮,否则灯全灭

if(Btn_val){

XGpio_DiscreteWrite(&Gpio, LED_CHANNEL, 0x1);

Xil_Out32((VDMA_BASEADDR + 0x000), 0x8B); // enable circular mode

Xil_Out32((VDMA_BASEADDR + 0x05c), VIDEO_BASEADDR0); // start address

Xil_Out32((VDMA_BASEADDR + 0x060), VIDEO_BASEADDR1); // start address

Xil_Out32((VDMA_BASEADDR + 0x064), VIDEO_BASEADDR2); // start address

Xil_Out32((VDMA_BASEADDR + 0x058), (H_STRIDE*3)); // h offset (H_STRIDE * 3) bytes

Xil_Out32((VDMA_BASEADDR + 0x054), (H_ACTIVE*3)); // h size (H_ACTIVE * 3) bytes

Xil_Out32((VDMA_BASEADDR + 0x050), V_ACTIVE); /

想通过按钮来实现视频输入的中断,按钮按下去之后,摄像头开始工作,松开按钮摄像头停止工作,如上增加了if语句之后,摄像头仍是正常工作的。应该把这个if增加到哪里?

观察到这些函数都是一样的?

uisrc
uisrc
2019-08-10
#1

中断模式建议采用park模式吧,我只做过,没出教程,只能大概提示你下。

这是论坛时期的原帖存档,只读。新的讨论请到 提问, 沉淀下来的内容会进 知识库 和 方案库。