-
Notifications
You must be signed in to change notification settings - Fork 6
/
jtag_defs.h
56 lines (45 loc) · 1.54 KB
/
jtag_defs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __JTAG_DEFS_H__
#define __JTAG_DEFS_H__
//jtag i/o pins
#define JTAG_OUT PORTB
#define JTAG_IN PINB
#define JTAG_DIR DDRB
//output pins
#define JTAG_PIN_TDI 0
#define JTAG_PIN_TMS 1
#define JTAG_PIN_TRST 2
#define JTAG_PIN_SRST 3
#define JTAG_PIN_TCK 4
//input pins
#define JTAG_PIN_TDO 5
#define JTAG_PIN_EMU 6
#define JTAG_PIN_RTCK 7
//JTAG usb commands
//TODO: ADD commands to deal with RTCK ?
//TODO: maybe add commands to query some firmware info...
#define JTAG_CMD_TAP_OUTPUT 0x0
#define JTAG_CMD_SET_TRST 0x1
#define JTAG_CMD_SET_SRST 0x2
#define JTAG_CMD_READ_INPUT 0x3
#define JTAG_CMD_TAP_OUTPUT_EMU 0x4
#define JTAG_CMD_SET_DELAY 0x5
#define JTAG_CMD_SET_SRST_TRST 0x6
#define JTAG_CMD_READ_CONFIG 0x7
//JTAG usb command mask
#define JTAG_CMD_MASK 0x0f
#define JTAG_DATA_MASK 0xf0
//JTAG pins masks
#define JTAG_OUTPUT_MASK ((1<<JTAG_PIN_TDI)|(1<<JTAG_PIN_TMS)|(1<<JTAG_PIN_TRST)|(1<<JTAG_PIN_SRST)|(1<<JTAG_PIN_TCK))
#define JTAG_INPUT_MASK ((1<<JTAG_PIN_TDO)|(1<<JTAG_PIN_EMU)|(1<<JTAG_PIN_RTCK))
#define JTAG_SIGNAL_MASK ((1<<JTAG_PIN_TDI)|(1<<JTAG_PIN_TMS))
#define JTAG_CLK_LO ~(1<<JTAG_PIN_TCK)
#define JTAG_CLK_HI (1<<JTAG_PIN_TCK)
//additional delay to make clk hi and lo approximately the same length, not sure if this is really needed
#define JTAG_DELAY2 20
typedef struct {
uint8_t version_major;
uint8_t version_minor;
uint16_t max_tap_length;
} opendous_jtag_config_t;
#define OPENDOUS_USB_BUFFER_SIZE 360
#endif //__JTAG_DEFS_H__