#ifndef WR_IOCTL_H
#define WR_IOCTL_H 

#include <asm/types.h>


#pragma pack(push,1)

typedef struct
{
    __u8                    Request;
    __u16                   Value;
    __u16                   Index;
    void                    *Buffer;
    __u16                   Size;
    int                     Timeout;
} USB_CONTROL_MSG;

typedef struct
{
    __u8                    EndPoint;
    __u8                    *Buffer;
    __u32                   BufferSize;
    __u32                   Transferred;
    __u32                   Timeout;
} USB_BULK_MESSAGE;

typedef struct
{
    __u8                    EndPoint;
    void                   *Buffer;
    __u32                   BufferSize;
    void                   *CompletionRoutine;
    void                   *Data;
} USB_ASYNC_MESSAGE;

typedef struct
{
    void                   *CompletionRoutine;
    void                   *Data;
    void                   *Buffer;
    __u32                   BufferSize;
    __u32                   Transferred;
    __s32                   Status;
} USB_COMPLETE_ASYNC_MESSAGE;


typedef struct
{
    __u8  Number;
    __u8  Address;
    __u16 MaxPacketSize;
} ENDPOINT_INFO;

typedef struct
{
    __u8            Count;
    ENDPOINT_INFO   EndPoint[16];
} ENDPOINTS;


#pragma pack(pop)

#define WRG5_MAGIC 0x8C


#define WRG5_IOCTL_IS_CONNECTED                         _IOR(WRG5_MAGIC,0x02,__u8)
#define WRG5_IOCTL_USB_CONTROL_MESSAGE_SEND             _IOW(WRG5_MAGIC,0x20,USB_CONTROL_MSG)
#define WRG5_IOCTL_USB_CONTROL_MESSAGE_RECEIVE          _IOWR(WRG5_MAGIC,0x21,USB_CONTROL_MSG)
#define WRG5_IOCTL_USB_CONTROL_MESSAGE                  _IOW(WRG5_MAGIC,0x22,USB_CONTROL_MSG)
#define WRG5_IOCTL_USB_BULK_MESSAGE_SEND                _IOWR(WRG5_MAGIC,0x23,USB_BULK_MESSAGE)
#define WRG5_IOCTL_USB_BULK_MESSAGE_SEND_ASYNC          _IOW(WRG5_MAGIC,0x24,USB_ASYNC_MESSAGE)
#define WRG5_IOCTL_USB_BULK_MESSAGE_RECEIVE             _IOWR(WRG5_MAGIC,0x25,USB_BULK_MESSAGE)
#define WRG5_IOCTL_USB_BULK_MESSAGE_RECEIVE_ASYNC       _IOW(WRG5_MAGIC,0x26,USB_ASYNC_MESSAGE)
#define WRG5_IOCTL_USB_GET_COMPLETE_ASYNC_MESSAGE       _IOR(WRG5_MAGIC,0x27,USB_COMPLETE_ASYNC_MESSAGE)
#define WRG5_IOCTL_USB_START_ASYNC_MESSAGES             _IO(WRG5_MAGIC,0x28)
#define WRG5_IOCTL_USB_STOP_ASYNC_MESSAGES              _IO(WRG5_MAGIC,0x29)
#define WRG5_IOCTL_USB_CONFIGURE                        _IOR(WRG5_MAGIC,0x2A,__u8)
#define WRG5_IOCTL_USB_GET_ENDPOINTINFO                 _IOR(WRG5_MAGIC,0x2B,ENDPOINTS)
#define WRG5_IOCTL_USB_ISOC_MESSAGE_RECEIVE_ASYNC       _IOW(WRG5_MAGIC,0x2C,USB_ASYNC_MESSAGE)



#endif
