OpenCores
URL https://opencores.org/ocsvn/xulalx25soc/xulalx25soc/trunk

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [usbi.h] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 dgisselq
#ifndef USBI_H
2
#define USBI_H
3
 
4
#include <libusb.h>
5
 
6
#define VENDOR_ID               0x04d8
7
#define PRODUCT_ID              0x0ff8c
8
#define XESS_INTERFACE          0
9
#define XESS_ENDPOINT_OUT       0x01
10
#define XESS_ENDPOINT_IN        0x81
11
#define XESS_ENDPOINT_IN        0x81
12
//
13
#define JTAG_CMD        0x4f
14
#define GET_TDO_MASK    0x01
15
#define PUT_TMS_MASK    0x02
16
#define TMS_VAL_MASK    0x04
17
#define PUT_TDI_MASK    0x08
18
#define TDI_VAL_MASK    0x10
19
//
20
// #define      USER1_INSTR     0x02    // a SIX bit two
21
#define USB_PKTLEN      32
22
#define RCV_BUFLEN      512
23
#define RCV_BUFMASK     (RCV_BUFLEN-1)
24
 
25
#include "llcomms.h"
26
 
27
class   USBI : public LLCOMMSI { // USB Interface
28
private:
29
        char    m_rbuf[RCV_BUFLEN];
30
        char    m_txbuf[2*USB_PKTLEN], m_rxbuf[2*USB_PKTLEN];
31
        int     m_rbeg, m_rend;
32
 
33
        libusb_context          *m_usb_context;
34
        libusb_device           **m_usb_dev_list;
35
        libusb_device_handle    *m_xula_usb_device;
36
 
37
        virtual int     pop_fifo(char *buf, int len);
38
        virtual void    push_fifo(char *buf, int len);
39
        virtual void    raw_read(int len, int timeout_ms);
40
        virtual void    flush_read(void);
41
 
42
public:
43
        USBI(void);
44
 
45
        virtual void    close(void);
46
        virtual int     read(char *buf, int len);
47
        virtual int     read(char *buf, int len, int timeout_ms);
48
        virtual void    write(char *buf, int len);
49
        virtual bool    poll(unsigned ms);
50
};
51
 
52
#endif // USBI_H
53
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.