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

Subversion Repositories adv_debug_sys

[/] [adv_debug_sys/] [trunk/] [Software/] [adv_jtag_bridge/] [cable_ft2232.h] - Blame information for rev 55

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 nyawn
 
2
#ifndef _CABLE_FT2232_H_
3
#define _CABLE_FT2232_H_
4
 
5 55 nyawn
#include "cable_common.h"
6
 
7 21 nyawn
#ifndef min
8
#define min(X,Y) ((X) < (Y) ? (X) : (Y))
9
#endif
10
 
11
#define FTDX_MAXSEND 4096
12
#define FTDX_MAXSEND_MPSSE (64 * 1024)
13
#define FTDI_MAXRECV   ( 4 * 64)
14
 
15
#define BIT_CABLEID2_TCK        0 /* ADBUS0 */
16
#define BIT_CABLEID2_TDIDO      1 /* ADBUS1 */
17
#define BIT_CABLEID2_TDODI      2 /* ADBUS2 */
18
#define BIT_CABLEID2_TMS        3 /* ADBUS3 */
19
#define BITMASK_CABLEID2_TCK    (1 << BIT_CABLEID2_TCK) 
20
#define BITMASK_CABLEID2_TDIDO  (1 << BIT_CABLEID2_TDIDO)
21
#define BITMASK_CABLEID2_TDODI  (1 << BIT_CABLEID2_TDODI)
22
#define BITMASK_CABLEID2_TMS    (1 << BIT_CABLEID2_TMS)
23
 
24
#define BIT_CABLEID2_OE                 1 /* ACBUS1 */
25
#define BIT_CABLEID2_RXLED              2 /* ACBUS2 */
26
#define BIT_CABLEID2_TXLED              3 /* ACBUS3 */
27
#define BITMASK_CABLEID2_OE     (1 << BIT_CABLEID2_OE) 
28
#define BITMASK_CABLEID2_RXLED  (1 << BIT_CABLEID2_RXLED)
29
#define BITMASK_CABLEID2_TXLED  (1 << BIT_CABLEID2_TXLED)
30
 
31
typedef struct usbconn_t usbconn_t;
32
 
33
typedef struct {
34
        char *name;
35
        char *desc;
36
        char *driver;
37
        int32_t vid;
38
        int32_t pid;
39
} usbconn_cable_t;
40
 
41
typedef struct {
42
        const char *type;
43
        usbconn_t *(*connect)( const char **, int, usbconn_cable_t *);
44
        void (*free)( usbconn_t * );
45
        int (*open)( usbconn_t * );
46
        int (*close)( usbconn_t * );
47
        int (*read)( usbconn_t *, uint8_t *, int );
48
        int (*write)( usbconn_t *, uint8_t *, int, int );
49
} usbconn_driver_t;
50
 
51
struct  usbconn_t {
52
        usbconn_driver_t *driver;
53
        void *params;
54
        usbconn_cable_t *cable;
55
};
56
 
57
typedef struct {
58
  /* USB device information */
59
  unsigned int vid;
60
  unsigned int pid;
61
  struct ftdi_context *ftdic;
62
  char *serial;
63
  /* send and receive buffer handling */
64
  uint32_t  send_buf_len;
65
  uint32_t  send_buffered;
66
  uint8_t  *send_buf;
67
  uint32_t  recv_buf_len;
68
  uint32_t  to_recv;
69
  uint32_t  recv_write_idx;
70
  uint32_t  recv_read_idx;
71
  uint8_t  *recv_buf;
72
} ftdi_param_t;
73
 
74 55 nyawn
jtag_cable_t *cable_ftdi_get_driver(void);
75 21 nyawn
int cable_ftdi_init();
76
int cable_ftdi_write_bit(uint8_t packet);
77
int cable_ftdi_read_write_bit(uint8_t packet_out, uint8_t *bit_in);
78
int cable_ftdi_write_stream(uint32_t *stream, int len_bits, int set_last_bit);
79
int cable_ftdi_read_stream(uint32_t *outstream, uint32_t *instream, int len_bits, int set_last_bit);
80
int cable_ftdi_opt(int c, char *str);
81
int cable_ftdi_flush();
82
int cable_ftdi_close();
83
 
84
#endif
85
 
86
 

powered by: WebSVN 2.1.0

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