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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [usbi.h] - Rev 5

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

#ifndef	USBI_H
#define	USBI_H
 
#include <libusb.h>
 
#define	VENDOR_ID		0x04d8
#define	PRODUCT_ID		0x0ff8c
#define	XESS_INTERFACE		0
#define	XESS_ENDPOINT_OUT	0x01
#define	XESS_ENDPOINT_IN	0x81
#define	XESS_ENDPOINT_IN	0x81
//
#define	JTAG_CMD	0x4f
#define	GET_TDO_MASK	0x01
#define	PUT_TMS_MASK	0x02
#define	TMS_VAL_MASK	0x04
#define	PUT_TDI_MASK	0x08
#define	TDI_VAL_MASK	0x10
//
// #define	USER1_INSTR	0x02	// a SIX bit two
#define	USB_PKTLEN	32
#define	RCV_BUFLEN	512
#define	RCV_BUFMASK	(RCV_BUFLEN-1)
 
#include "llcomms.h"
 
class	USBI : public LLCOMMSI { // USB Interface
private:
	char	m_rbuf[RCV_BUFLEN];
	char	m_txbuf[2*USB_PKTLEN], m_rxbuf[2*USB_PKTLEN];
	int	m_rbeg, m_rend;
 
	libusb_context		*m_usb_context;
	libusb_device		**m_usb_dev_list;
	libusb_device_handle	*m_xula_usb_device;
 
	virtual	int	pop_fifo(char *buf, int len);
	virtual	void	push_fifo(char *buf, int len);
	virtual	void	raw_read(int len, int timeout_ms);
	virtual	void	flush_read(void);
 
public:
	USBI(void);
 
	virtual	void	close(void);
	virtual	int	read(char *buf, int len);
	virtual	int	read(char *buf, int len, int timeout_ms);
	virtual	void	write(char *buf, int len);
	virtual	bool	poll(unsigned ms);
};
 
#endif // USBI_H
 
 

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

powered by: WebSVN 2.1.0

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