/*
 * DMA.h
 *
 *  Created on: Feb 20, 2017
 *      Author: Kasun
 */

#ifndef SRC_DMA_H_
#define SRC_DMA_H_

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xaxidma.h"
#include "xparameters.h"
#include "xtime_l.h"

/*
 * Device hardware build related constants.
 */
// *** DMA parameters ****//
#define DMA_DEV_ID		XPAR_AXIDMA_0_DEVICE_ID

////#define MEM_BASE_ADDR		(XPAR_PS7_DDR_0_S_AXI_BASEADDR + 0x1000000)
#define MEM_BASE_ADDR		(XPAR_PS7_DDR_0_S_AXI_BASEADDR + 0x10000000)
//
//#define TX_BUFFER_BASE		(MEM_BASE_ADDR + 0x00100000)
#define RX_BUFFER_BASE		(MEM_BASE_ADDR + 0x00300000)

////#define RX_BUFFER_HIGH		(MEM_BASE_ADDR + 0x004FFFFF)


#define MAX_PKT_LEN_WORDS	1024*16					// 1020*2 //1024*32
#define MAX_PKT_LEN			MAX_PKT_LEN_WORDS*4			// actual mem locations each 8 bit

#define TEST_START_VALUE	0xC

#define NUMBER_OF_TRANSFERS	1

int n;

//**** tlast parameter ****//
#define PACKET_LENGTH_BASEADDR	XPAR_GPIO_0_BASEADDR

/************************** Function Prototypes ******************************/

int XAxiDma_SimplePollExample(u16 DeviceId);
static int CheckData(void);
int DMA_init(void);
int DMA_Transfer(u32 Intan_RX_BUF_BASE);

/************************** Variable Definitions *****************************/
/*
 * Device instance definitions
 */
static struct XAxiDma *AxiDma;
//XAxiDma AxiDma;
XTime tStart, tEnd;

#endif /* SRC_DMA_H_ */
