使用vivado HLS生成的IP核,在vivado中实现两幅图像处理,使用VDMA进行图像的收发工作,SDK中VDMA的处理如下
使用这段程序无噪点和顶部噪点问题,完全适合
void VDMA1_setting(unsigned int width, unsigned int height,
unsigned int s2mm_addr, unsigned int mm2s_addr) {
//S2MM
Xil_Out32(VDMA1 + 0x30, 0x3); //reset S2MM VDMA Control Register
usleep(10);
Xil_Out32(VDMA1 + 0x30, 0x8); //genlock
//Xil_Out32(VDMA1 + 0x30, 0x0); //S2MM VDMA Control Register
Xil_Out32(VDMA1 + 0xAC, s2mm_addr); //S2MM Start Addresses
Xil_Out32(VDMA1 + 0xAC + 4, s2mm_addr);
Xil_Out32(VDMA1 + 0xAC + 8, s2mm_addr);
Xil_Out32(VDMA1 + 0xA4, width * 4); //S2MM Horizontal Size
Xil_Out32(VDMA1 + 0xA8, width * 4); //S2MM Frame Delay and Stride
Xil_Out32(VDMA1 + 0x30, 0x3); //S2MM VDMA Control Register
Xil_Out32(VDMA1 + 0xA0, height); //S2MM Vertical Size start an S2M
Xil_DCacheFlush();
//MM2S
//Xil_Out32(VDMA1 + 0x00, 0x00034083); // enable circular mode
Xil_Out32(VDMA1 + 0x00, 0x00000003); // enable circular mode
Xil_Out32(VDMA1 + 0x5c, mm2s_addr); // start address
Xil_Out32(VDMA1 + 0x60, mm2s_addr); // start address
Xil_Out32(VDMA1 + 0x64, mm2s_addr); // start address
Xil_Out32(VDMA1 + 0x58, (width * 4)); // h offset
Xil_Out32(VDMA1 + 0x54, (width * 4)); // h size
Xil_Out32(VDMA1 + 0x50, height); // v size
Xil_DCacheFlush();
}
void VDMA2_setting(unsigned int width, unsigned int height,
unsigned int mm2s_addr) {
Xil_Out32(VDMA2 + 0x00, 0x00000003); // enable circular mode
//Xil_Out32(VDMA2 + 0x00, 0x00034083); // enable circular mode
//0x00034083
Xil_Out32(VDMA2 + 0x5c, mm2s_addr); // start address
Xil_Out32(VDMA2 + 0x60, mm2s_addr); // start address
Xil_Out32(VDMA2 + 0x64, mm2s_addr); // start address
Xil_Out32(VDMA2 + 0x58, (width * 4)); // h offset
Xil_Out32(VDMA2 + 0x54, (width * 4)); // h size
Xil_Out32(VDMA2 + 0x50, height); // v size
//Xil_Out32(VDMA1 + 0x50, height); // v size
//
Xil_DCacheFlush();
}