- rlink interface support from Lou Deluxe <lou.openocd012@fixit.nospammail.net>
[openocd.git] / src / jtag / rlink / st7.h
1 /***************************************************************************
2 * Copyright (C) 2008 Lou Deluxe *
3 * lou.openocd012@fixit.nospammail.net *
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 ***************************************************************************/
20
21 #define ST7_FOSC (12 * 1000000)
22
23 /* This is not a complete enumeration of ST7 registers, but it is sufficient for this interface driver. */
24
25 #define ST7_PADR (0x0000)
26 #define ST7_PADDR (ST7_PADR + 1)
27 #define ST7_PAOR (ST7_PADR + 2)
28 #define ST7_PBDR (0x0003)
29 #define ST7_PBDDR (ST7_PBDR + 1)
30 #define ST7_PCDR (0x0006)
31 #define ST7_PCDDR (ST7_PCDR + 1)
32 #define ST7_PCOR (ST7_PCDR + 2)
33 #define ST7_PDDR (0x0009)
34 #define ST7_PDDDR (ST7_PDDR + 1)
35 #define ST7_PDOR (ST7_PDDR + 2)
36 #define ST7_PEDR (0x000c)
37 #define ST7_PEDDR (ST7_PEDR + 1)
38 #define ST7_PEOR (ST7_PEDR + 2)
39 #define ST7_PFDR (0x000f)
40 #define ST7_PFDDR (ST7_PFDR + 1)
41
42 #define ST7_ADCDR (0x0012)
43 #define ST7_ADCCSR (ST7_ADCDR + 1)
44
45 #define ST7_EP2TXR (0x003e)
46 #define ST7_EP2TXR_STAT_TX0 (1 << 0)
47 #define ST7_EP2TXR_STAT_TX1 (1 << 1)
48 #define ST7_EP2TXR_STAT_DISABLED (0)
49 #define ST7_EP2TXR_STAT_STALL (ST7_EP2TXR_STAT_TX0)
50 #define ST7_EP2TXR_STAT_VALID (ST7_EP2TXR_STAT_TX1 | ST7_EP2TXR_STAT_TX0)
51 #define ST7_EP2TXR_STAT_NAK (ST7_EP2TXR_STAT_TX1)
52 #define ST7_EP2TXR_DTOG_TX (1 << 2)
53 #define ST7_EP2TXR_CTR_TX (1 << 3)
54
55 #define ST7_USB_BUF_EP0OUT (0x1550)
56 #define ST7_USB_BUF_EP0IN (0x1560)
57 #define ST7_USB_BUF_EP1OUT (0x1570)
58 #define ST7_USB_BUF_EP1IN (0x1580)
59 #define ST7_USB_BUF_EP2UODI (0x1590)
60 #define ST7_USB_BUF_EP2UIDO (0x1650)
61
62 #define ST7_PA0 (1 << 0)
63 #define ST7_PA1 (1 << 1)
64 #define ST7_PA2 (1 << 2)
65 #define ST7_PA3 (1 << 3)
66 #define ST7_PA4 (1 << 4)
67 #define ST7_PA5 (1 << 5)
68 #define ST7_PA6 (1 << 6)
69 #define ST7_PA7 (1 << 7)
70
71 #define ST7_PB0 (1 << 0)
72 #define ST7_PB1 (1 << 1)
73 #define ST7_PB2 (1 << 2)
74 #define ST7_PB3 (1 << 3)
75 #define ST7_PB4 (1 << 4)
76 #define ST7_PB5 (1 << 5)
77 #define ST7_PB6 (1 << 6)
78 #define ST7_PB7 (1 << 7)
79
80 #define ST7_PC0 (1 << 0)
81 #define ST7_PC1 (1 << 1)
82 #define ST7_PC2 (1 << 2)
83 #define ST7_PC3 (1 << 3)
84 #define ST7_PC4 (1 << 4)
85 #define ST7_PC5 (1 << 5)
86 #define ST7_PC6 (1 << 6)
87 #define ST7_PC7 (1 << 7)
88
89 #define ST7_PD0 (1 << 0)
90 #define ST7_PD1 (1 << 1)
91 #define ST7_PD2 (1 << 2)
92 #define ST7_PD3 (1 << 3)
93 #define ST7_PD4 (1 << 4)
94 #define ST7_PD5 (1 << 5)
95 #define ST7_PD6 (1 << 6)
96 #define ST7_PD7 (1 << 7)
97
98 #define ST7_PE0 (1 << 0)
99 #define ST7_PE1 (1 << 1)
100 #define ST7_PE2 (1 << 2)
101 #define ST7_PE3 (1 << 3)
102 #define ST7_PE4 (1 << 4)
103 #define ST7_PE5 (1 << 5)
104 #define ST7_PE6 (1 << 6)
105 #define ST7_PE7 (1 << 7)
106
107 #define ST7_PF0 (1 << 0)
108 #define ST7_PF1 (1 << 1)
109 #define ST7_PF2 (1 << 2)
110 #define ST7_PF3 (1 << 3)
111 #define ST7_PF4 (1 << 4)
112 #define ST7_PF5 (1 << 5)
113 #define ST7_PF6 (1 << 6)
114 #define ST7_PF7 (1 << 7)