drivers/jtag: rewrite usb_blaster driver
[openocd.git] / src / jtag / drivers / usb_blaster / ublast_access.h
1 /*
2 * Driver for USB-JTAG, Altera USB-Blaster and compatibles
3 *
4 * Inspired from original code from Kolja Waschk's USB-JTAG project
5 * (http://www.ixo.de/info/usb_jtag/), and from openocd project.
6 *
7 * Copyright (C) 2012 Robert Jarzmik robert.jarzmik@free.fr
8 * Copyright (C) 2011 Ali Lown ali@lown.me.uk
9 * Copyright (C) 2009 Catalin Patulea cat@vv.carleton.ca
10 * Copyright (C) 2006 Kolja Waschk usbjtag@ixo.de
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 */
23
24 struct ublast_lowlevel {
25 uint16_t ublast_vid;
26 uint16_t ublast_pid;
27 char *ublast_device_desc;
28
29 int (*write)(struct ublast_lowlevel *low, uint8_t *buf, int size,
30 uint32_t *bytes_written);
31 int (*read)(struct ublast_lowlevel *low, uint8_t *buf, unsigned size,
32 uint32_t *bytes_read);
33 int (*open)(struct ublast_lowlevel *low);
34 int (*close)(struct ublast_lowlevel *low);
35 int (*speed)(struct ublast_lowlevel *low, int speed);
36
37 void *priv;
38 };
39
40 /**
41 * ublast_register_ftdi - get a lowlevel USB Blaster driver
42 * ublast_register_ftd2xx - get a lowlevel USB Blaster driver
43 *
44 * Get a lowlevel USB-Blaster driver. In the current implementation, there are 2
45 * possible lowlevel drivers :
46 * - one based on libftdi from ftdichip.com
47 * - one based on libftdxx, the free alternative
48 *
49 * Returns the lowlevel driver structure.
50 */
51 extern struct ublast_lowlevel *ublast_register_ftdi(void);
52 extern struct ublast_lowlevel *ublast_register_ftd2xx(void);