2dc692acf2640e6fa2907888a457adf48e830499
[openocd.git] / src / jtag / drivers / OpenULINK / include / io.h
blob2dc692acf2640e6fa2907888a457adf48e830499
1 /***************************************************************************
2 * Copyright (C) 2011 by Martin Schmoelzer *
3 * <martin.schmoelzer@student.tuwien.ac.at> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef __IO_H
22 #define __IO_H
24 #include "reg_ezusb.h"
26 /***************************************************************************
27 * JTAG Signals: *
28 ***************************************************************************
29 * TMS ....... Test Mode Select *
30 * TCK ....... Test Clock *
31 * TDI ....... Test Data Input (from device point of view, not JTAG *
32 * adapter point of view!) *
33 * TDO ....... Test Data Output (from device point of view, not JTAG *
34 * adapter point of view!) *
35 * TRST ...... Test Reset: Used to reset the TAP Finite State Machine *
36 * into the Test Logic Reset state *
37 * RTCK ...... Return Test Clock *
38 * OCDSE ..... Enable/Disable OCDS interface (Infineon specific) - shared *
39 * with /JEN *
40 * TRAP ...... Trap Condition (Infineon specific) - shared with TSTAT *
41 * BRKIN ..... Hardware Break-In (Infineon specific) *
42 * BRKOUT .... Hardware Break-Out (Infineon specific) *
43 * /JEN ...... JTAG-Enable (STMicroelectronics specific) - shared *
44 * with OCDSE *
45 * TSTAT ..... JTAG ISP Status (STMicroelectronics specific) - shared *
46 * with TRAP *
47 * RESET ..... Chip Reset (STMicroelectronics specific) *
48 * /TERR ..... JTAG ISP Error (STMicroelectronics specific) - shared *
49 * with BRKOUT *
50 ***************************************************************************/
52 /* PORT A */
53 #define PIN_U_OE OUTA0
54 /* PA1 Not Connected */
55 #define PIN_OE OUTA2
56 /* PA3 Not Connected */
57 #define PIN_RUN_LED OUTA4
58 #define PIN_TDO PINA5
59 #define PIN_BRKOUT PINA6
60 #define PIN_COM_LED OUTA7
62 /* PORT B */
63 #define PIN_TDI OUTB0
64 #define PIN_TMS OUTB1
65 #define PIN_TCK OUTB2
66 #define PIN_TRST OUTB3
67 #define PIN_BRKIN OUTB4
68 #define PIN_RESET OUTB5
69 #define PIN_OCDSE OUTB6
70 #define PIN_TRAP PINB7
72 /* JTAG Signals with direction 'OUT' on port B */
73 #define MASK_PORTB_DIRECTION_OUT (PIN_TDI | PIN_TMS | PIN_TCK | PIN_TRST | PIN_BRKIN | PIN_RESET | PIN_OCDSE)
75 /* PORT C */
76 #define PIN_RXD0 PINC0
77 #define PIN_TXD0 OUTC1
78 #define PIN_RESET_2 PINC2
79 /* PC3 Not Connecte */
80 /* PC4 Not Connected */
81 #define PIN_RTCK PINC5
82 #define PIN_WR OUTC6
83 /* PC7 Not Connected */
85 /* LED Macros */
86 #define SET_RUN_LED() (OUTA &= ~PIN_RUN_LED)
87 #define CLEAR_RUN_LED() (OUTA |= PIN_RUN_LED)
89 #define SET_COM_LED() (OUTA &= ~PIN_COM_LED)
90 #define CLEAR_COM_LED() (OUTA |= PIN_COM_LED)
92 /* JTAG Pin Macros */
93 #define GET_TMS() (PINSB & PIN_TMS)
94 #define GET_TCK() (PINSB & PIN_TCK)
96 #define GET_TDO() (PINSA & PIN_TDO)
97 #define GET_BRKOUT() (PINSA & PIN_BRKOUT)
98 #define GET_TRAP() (PINSB & PIN_TRAP)
99 #define GET_RTCK() (PINSC & PIN_RTCK)
101 #define SET_TMS_HIGH() (OUTB |= PIN_TMS)
102 #define SET_TMS_LOW() (OUTB &= ~PIN_TMS)
104 #define SET_TCK_HIGH() (OUTB |= PIN_TCK)
105 #define SET_TCK_LOW() (OUTB &= ~PIN_TCK)
107 #define SET_TDI_HIGH() (OUTB |= PIN_TDI)
108 #define SET_TDI_LOW() (OUTB &= ~PIN_TDI)
110 /* TRST and RESET are low-active and inverted by hardware. SET_HIGH de-asserts
111 * the signal (enabling reset), SET_LOW asserts the signal (disabling reset) */
112 #define SET_TRST_HIGH() (OUTB |= PIN_TRST)
113 #define SET_TRST_LOW() (OUTB &= ~PIN_TRST)
115 #define SET_RESET_HIGH() (OUTB |= PIN_RESET)
116 #define SET_RESET_LOW() (OUTB &= ~PIN_RESET)
118 #define SET_OCDSE_HIGH() (OUTB |= PIN_OCDSE)
119 #define SET_OCDSE_LOW() (OUTB &= ~PIN_OCDSE)
121 #define SET_BRKIN_HIGH() (OUTB |= PIN_BRKIN)
122 #define SET_BRKIN_LOW() (OUTB &= ~PIN_BRKIN)
124 #endif