Remove FSF address from GPL notices
[openocd.git] / src / jtag / drivers / versaloon / usbtoxxx / usbtoxxx_internal.h
blob6d8012ed92787d5bd9c0102d7689b7df8c98917e
1 /***************************************************************************
2 * Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 ***************************************************************************/
18 #ifndef __USBTOXXX_INTERNAL_H_INCLUDED__
19 #define __USBTOXXX_INTERNAL_H_INCLUDED__
21 /* USB_TO_XXX USB Commands */
22 /* Page0 */
23 #define USB_TO_USART (VERSALOON_USB_TO_XXX_CMD_START + 0x00)
24 #define USB_TO_SPI (VERSALOON_USB_TO_XXX_CMD_START + 0x01)
25 #define USB_TO_I2C (VERSALOON_USB_TO_XXX_CMD_START + 0x02)
26 #define USB_TO_GPIO (VERSALOON_USB_TO_XXX_CMD_START + 0x03)
27 #define USB_TO_CAN (VERSALOON_USB_TO_XXX_CMD_START + 0x04)
28 #define USB_TO_PWM (VERSALOON_USB_TO_XXX_CMD_START + 0x05)
29 #define USB_TO_ADC (VERSALOON_USB_TO_XXX_CMD_START + 0x06)
30 #define USB_TO_DAC (VERSALOON_USB_TO_XXX_CMD_START + 0x07)
31 #define USB_TO_MICROWIRE (VERSALOON_USB_TO_XXX_CMD_START + 0x08)
32 #define USB_TO_SWIM (VERSALOON_USB_TO_XXX_CMD_START + 0x09)
33 #define USB_TO_DUSI (VERSALOON_USB_TO_XXX_CMD_START + 0x0A)
34 /* Page1 */
35 #define USB_TO_JTAG_LL (VERSALOON_USB_TO_XXX_CMD_START + 0x20)
36 #define USB_TO_JTAG_HL (VERSALOON_USB_TO_XXX_CMD_START + 0x21)
37 #define USB_TO_ISSP (VERSALOON_USB_TO_XXX_CMD_START + 0x22)
38 #define USB_TO_C2 (VERSALOON_USB_TO_XXX_CMD_START + 0x23)
39 #define USB_TO_SBW (VERSALOON_USB_TO_XXX_CMD_START + 0x24)
40 #define USB_TO_LPCICP (VERSALOON_USB_TO_XXX_CMD_START + 0x25)
41 #define USB_TO_SWD (VERSALOON_USB_TO_XXX_CMD_START + 0x26)
42 #define USB_TO_JTAG_RAW (VERSALOON_USB_TO_XXX_CMD_START + 0x27)
43 #define USB_TO_BDM (VERSALOON_USB_TO_XXX_CMD_START + 0x28)
44 #define USB_TO_MSP430_JTAG (VERSALOON_USB_TO_XXX_CMD_START + 0x38)
45 /* Page2 */
46 #define USB_TO_POWER (VERSALOON_USB_TO_XXX_CMD_START + 0x40)
47 #define USB_TO_DELAY (VERSALOON_USB_TO_XXX_CMD_START + 0x41)
48 #define USB_TO_POLL (VERSALOON_USB_TO_XXX_CMD_START + 0x42)
49 #define USB_TO_INFO (VERSALOON_USB_TO_XXX_CMD_START + 0x5E)
50 #define USB_TO_ALL (VERSALOON_USB_TO_XXX_CMD_START + 0x5F)
52 /* USB_TO_XXX Masks */
53 #define USB_TO_XXX_CMDMASK 0xF8
54 #define USB_TO_XXX_CMDSHIFT 3
55 #define USB_TO_XXX_IDXMASK 0x07
56 /* USB_TO_XXX Sub Commands */
57 /* Common Sub Commands */
58 #define USB_TO_XXX_INIT (0x00 << USB_TO_XXX_CMDSHIFT)
59 #define USB_TO_XXX_FINI (0x01 << USB_TO_XXX_CMDSHIFT)
60 #define USB_TO_XXX_CONFIG (0x02 << USB_TO_XXX_CMDSHIFT)
61 #define USB_TO_XXX_GETHWINFO (0x03 << USB_TO_XXX_CMDSHIFT)
62 #define USB_TO_XXX_STATUS (0X04 << USB_TO_XXX_CMDSHIFT)
63 #define USB_TO_XXX_IN_OUT (0x05 << USB_TO_XXX_CMDSHIFT)
64 #define USB_TO_XXX_IN (0x06 << USB_TO_XXX_CMDSHIFT)
65 #define USB_TO_XXX_OUT (0x07 << USB_TO_XXX_CMDSHIFT)
66 #define USB_TO_XXX_POLL (0x08 << USB_TO_XXX_CMDSHIFT)
67 #define USB_TO_XXX_SPECIAL (0x09 << USB_TO_XXX_CMDSHIFT)
68 #define USB_TO_XXX_RESET (0x0A << USB_TO_XXX_CMDSHIFT)
69 #define USB_TO_XXX_SYNC (0x0B << USB_TO_XXX_CMDSHIFT)
70 #define USB_TO_XXX_ENABLE (0x0C << USB_TO_XXX_CMDSHIFT)
71 #define USB_TO_XXX_DISABLE (0x0D << USB_TO_XXX_CMDSHIFT)
72 /* USB_TO_POLL */
73 #define USB_TO_POLL_START 0x00
74 #define USB_TO_POLL_END 0x01
75 #define USB_TO_POLL_CHECKOK 0x02
76 #define USB_TO_POLL_CHECKFAIL 0x03
77 #define USB_TO_POLL_VERIFYBUFF 0x04
79 /* USB_TO_XXX Replys */
80 #define USB_TO_XXX_OK 0x00
81 #define USB_TO_XXX_FAILED 0x01
82 #define USB_TO_XXX_TIME_OUT 0x02
83 #define USB_TO_XXX_INVALID_INDEX 0x03
84 #define USB_TO_XXX_INVALID_PARA 0x04
85 #define USB_TO_XXX_INVALID_CMD 0x05
86 #define USB_TO_XXX_CMD_NOT_SUPPORT 0x06
88 /* USB_TO_XXX */
89 RESULT usbtoxxx_add_pending(uint8_t type, uint8_t cmd, uint16_t
90 actual_szie, uint16_t want_pos,
91 uint16_t want_size, uint8_t *buffer);
93 RESULT usbtoxxx_add_command(uint8_t type, uint8_t cmd, uint8_t *cmdbuf,
94 uint16_t cmdlen, uint16_t retlen,
95 uint8_t *wantbuf, uint16_t wantpos,
96 uint16_t wantlen, uint8_t collect);
98 #define usbtoxxx_init_command(type, port) \
99 usbtoxxx_add_command((type), (USB_TO_XXX_INIT | (port)), \
100 NULL, 0, 0, NULL, 0, 0, 0)
101 #define usbtoxxx_fini_command(type, port) \
102 usbtoxxx_add_command((type), (USB_TO_XXX_FINI | (port)), \
103 NULL, 0, 0, NULL, 0, 0, 0)
104 #define usbtoxxx_conf_command(type, port, cmdbuf, cmdlen) \
105 usbtoxxx_add_command((type), (USB_TO_XXX_CONFIG | (port)), \
106 (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0)
107 #define usbtoxxx_inout_command(type, port, cmdbuf, cmdlen, retlen, wantbuf, \
108 wantpos, wantlen, c) \
109 usbtoxxx_add_command((type), (USB_TO_XXX_IN_OUT | (port)), \
110 (cmdbuf), (cmdlen), (retlen), (wantbuf), \
111 (wantpos), (wantlen), (c))
112 #define usbtoxxx_in_command(type, port, cmdbuf, cmdlen, retlen, wantbuf, \
113 wantpos, wantlen, c) \
114 usbtoxxx_add_command((type), (USB_TO_XXX_IN | (port)), (cmdbuf), \
115 (cmdlen), (retlen), (wantbuf), (wantpos), \
116 (wantlen), (c))
117 #define usbtoxxx_out_command(type, port, cmdbuf, cmdlen, c) \
118 usbtoxxx_add_command((type), (USB_TO_XXX_OUT | (port)), (cmdbuf), \
119 (cmdlen), 0, NULL, 0, 0, (c))
120 #define usbtoxxx_poll_command(type, port, cmdbuf, cmdlen, retbuf, retlen) \
121 usbtoxxx_add_command((type), (USB_TO_XXX_POLL | (port)), (cmdbuf), \
122 (cmdlen), (retlen), (retbuf), 0, (retlen), 0)
123 #define usbtoxxx_status_command(type, port, retlen, wantbuf, wantpos, wantlen, c) \
124 usbtoxxx_add_command((type), (USB_TO_XXX_STATUS | (port)), \
125 NULL, 0, (retlen), (wantbuf), (wantpos), \
126 (wantlen), (c))
127 #define usbtoxxx_special_command(type, port, cmdbuf, cmdlen, retlen, wantbuf, \
128 wantpos, wantlen, c) \
129 usbtoxxx_add_command((type), (USB_TO_XXX_SPECIAL | (port)), \
130 (cmdbuf), (cmdlen), retlen, wantbuf, \
131 wantpos, wantlen, (c))
132 #define usbtoxxx_reset_command(type, port, cmdbuf, cmdlen) \
133 usbtoxxx_add_command((type), (USB_TO_XXX_RESET | (port)), \
134 (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0)
135 #define usbtoxxx_sync_command(type, port, cmdbuf, cmdlen, retlen, wantbuf) \
136 usbtoxxx_add_command((type), (USB_TO_XXX_SYNC | (port)), \
137 (cmdbuf), (cmdlen), (retlen), (wantbuf), 0, \
138 (retlen), 0)
139 #define usbtoxxx_enable_command(type, port, cmdbuf, cmdlen) \
140 usbtoxxx_add_command((type), (USB_TO_XXX_ENABLE | (port)), \
141 (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0)
142 #define usbtoxxx_disable_command(type, port, cmdbuf, cmdlen) \
143 usbtoxxx_add_command((type), (USB_TO_XXX_DISABLE | (port)), \
144 (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0)
146 /* USB_TO_SPI */
147 #define USB_TO_SPI_BAUDRATE_MSK 0x1F
148 #define USB_TO_SPI_CPOL_MSK 0x20
149 #define USB_TO_SPI_CPHA_MSK 0x40
150 #define USB_TO_SPI_MSB_FIRST 0x80
152 /* USB_TO_DUSI */
153 #define USB_TO_DUSI_BAUDRATE_MSK 0x1F
154 #define USB_TO_DUSI_CPOL_MSK 0x20
155 #define USB_TO_DUSI_CPHA_MSK 0x40
156 #define USB_TO_DUSI_MSB_FIRST 0x80
158 /* USB_TO_GPIO */
159 #define USB_TO_GPIO_DIR_MSK 0x01
161 #endif /* __USBTOXXX_INTERNAL_H_INCLUDED__ */