/*!
 * \file    spi_common.h
 * \brief   common SPI defines
 *
 * This file defines the macros used to validate the SPI test cases.
 * And some common function prototypes and initializations.
 *
 * \version $Revision: 1.1 $
 * \author  Khushboo Gupta (b18246)
 */

#ifndef __DMA_COMMON_H__
#define __DMA_COMMON_H__

/* 
 * Misc. Defines
 */

#ifdef  SRAM_START_ADDR
#undef  SRAM_START_ADDR
#endif
#define SRAM_START_ADDR			0x00801000

#ifdef  SRAM_END_ADDR
#undef  SRAM_END_ADDR
#endif
#define SRAM_END_ADDR			0x00832767  //added 32 KB to initial address

#define DMA_DCR_SSIZE_BYTE		DMA_DCR_SSIZE(1)
#define DMA_DCR_SSIZE_WORD		DMA_DCR_SSIZE(2)
#define DMA_DCR_SSIZE_LONGWORD	DMA_DCR_SSIZE(0)

#define DMA_DCR_DSIZE_BYTE		DMA_DCR_DSIZE(1)
#define DMA_DCR_DSIZE_WORD		DMA_DCR_DSIZE(2)
#define DMA_DCR_DSIZE_LONGWORD	DMA_DCR_DSIZE(0)

/***** ISR Declaration *****/
void DMA0_ISR(void);
void DMA1_ISR(void);
void DMA2_ISR(void);
void DMA3_ISR(void);

/***** DMA structure *******/
struct dma_tcd {
	int channel_no;
	int link;
	uint32 saddr;
	uint32 daddr;
	uint32 nbytes;
	uint32 testdata32;
	uint16 testdata16;
	uint32 ctrl;
	//uint32 reqc;
};

/* Enumeration to declare different DMA functions */
enum COMMAND {
	CONFIG_BASIC_XFR,
	SOFT_START,
	WAIT_FOR_XFR,
	WAIT_FOR_INTR,
	MEM_FILL_BYTE_XFR,
	MEM_FILL_WORD_XFR,
	MEM_FILL_LONGWORD_XFR,
	CHECK_PRIORITY,
	MEM_CLR,
	MEM_CMP
};


/***** Common functions *****/
void dma_config(int COMMAND, struct dma_tcd *tcd_value);

#endif /* __DMA_COMMON_H__ */
