#ifndef _SIO_FPGA_H_
#define _SIO_FPGA_H_

#ifndef __KERNEL__
#include <sys/ioctl.h>
#endif

#define SIO_FPGA_DRIVER_NAME "sio_fpga_driver"
#define SIO_FPGA_DEVFILE "sio_fpga"

#define SIO_FPGA_DRIVER_VERSION "2.00_3"

#define SIO_FPGA_VID (0x104d)
#define SIO_FPGA_DID (0x0010)

#define SIO_FPGA_MAGIC (0x53)

#define SIO_FPGA_READ _IOR(SIO_FPGA_MAGIC, 1, struct sio_fpga_driver_opt)
#define SIO_FPGA_WRITE _IOW(SIO_FPGA_MAGIC, 1, struct sio_fpga_driver_opt)

#define SIO_FPGA_BAR0_SIZE (0x10000)
struct sio_fpga_driver_opt {
    uint32_t offset;
    uint32_t length;
    uint8_t* buff;
};

#ifdef __KERNEL__
struct fpga_ctrl_register {
    uint32_t type;
    uint32_t version;
    uint32_t timestamp;
    uint32_t temperature;
    uint32_t status1;
    uint32_t status2;
    uint32_t control1;
    uint32_t control2;
    uint32_t revision;
    uint32_t reserved;
};

struct sio_fpga_driver_data {
    struct pci_dev* pci_dev;
    void  __iomem*  bar_addr;
    size_t          bar_size;
    dev_t           cdevno;
    struct cdev     cdev;
    struct class*   class;
    uint8_t*        buffer;
    struct mutex    mutex;
};
#endif
#endif

