
#ifndef DREXCHAR_H
#define DREXCHAR_H

#include "drex.h"

#define DREXDMA_DMA_INIT             0
#define DREXDMA_DMA_CLEAR            1
#define DREXDMA_DMA_START            2
#define DREXDMA_DMA_STOP             3
#define DREXDMA_SET_NUM_BUFS         4
#define DREXDMA_SET_NUM_BYTES        5
#define DREXDMA_GET_NUM_BUFS         6
#define DREXDMA_GET_NUM_BYTES        7
#define DREXDMA_GET_FREE_BUFS        8


typedef struct {
   unsigned int cmd;
   unsigned int offset;
   unsigned int value;
} drexpcie_ioctl_t;  


struct drexpcie_device_priv {
	uint8_t chnum;
	struct drexpcie_driver_priv* driv_priv;
   
   uint32_t type;
   u8 __iomem *base_mem;

   // Parameters used to allocate dma buffers
   uint32_t num_bufs;
   uint32_t valid_bufs;
   uint32_t num_bytes;

   // Physical memory address returned by dma_alloc_coherent
   dma_addr_t *dmaPtr;
                    
   // Virtual memory address returned by dma_alloc_coherent
   void  **bufPtr;

};

int drexpcie_chardev_create(struct drexpcie_driver_priv *driv_priv);
int drexpcie_chardev_destroy(void);

#endif