/*
 * Author: Harold Hall (haroldhhall@gmail.com)
 * creation date: 12/7/2017
 */
#include "tasksing.h"
#include <xv_frmbufwr.h>
#include <xv_frmbufrd.h>

#include <xparameters.h>


#include "platform.h"

XV_frmbufwr myBuf;
XV_frmbufrd youBuf;
void main_ours()
{
	init_platform();
	//XV_frmbufwr myBuf;
	XV_frmbufwr_Initialize(&myBuf,XPAR_V_FRMBUF_WR_0_DEVICE_ID);

	XV_frmbufwr_Set_HwReg_width(&myBuf,640);	//width in pixels
	XV_frmbufwr_Set_HwReg_height(&myBuf, 480);	//height in pixels
	XV_frmbufwr_Set_HwReg_stride(&myBuf, 1920);	//width * bytes per pixel
	XV_frmbufwr_Set_HwReg_video_format(&myBuf, 20);	//RGB8
	XV_frmbufwr_Set_HwReg_frm_buffer_V(&myBuf, XPAR_PS7_DDR_0_S_AXI_BASEADDR+0x60000);	//some random address hopefully free
	XV_frmbufwr_EnableAutoRestart(&myBuf);
	XV_frmbufwr_Start(&myBuf);



	//XV_frmbufrd youBuf;
	XV_frmbufrd_Initialize(&youBuf,XPAR_V_FRMBUF_RD_0_DEVICE_ID);

	XV_frmbufrd_Set_HwReg_width(&youBuf,640);
	XV_frmbufrd_Set_HwReg_height(&youBuf, 480);
	XV_frmbufrd_Set_HwReg_stride(&youBuf, 1920);
	XV_frmbufrd_Set_HwReg_video_format(&youBuf, 20);
	XV_frmbufrd_Set_HwReg_frm_buffer_V(&youBuf, XPAR_PS7_DDR_0_S_AXI_BASEADDR+0x60000);
	XV_frmbufrd_EnableAutoRestart(&youBuf);
	XV_frmbufrd_Start(&youBuf);


	main_tasksing();
	//return 0;
}
