Open FFBoard
Open source force feedback firmware
musb_type.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2019 Ha Thach (tinyusb.org)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 *
24 * This file is part of the TinyUSB stack.
25 */
26
27/******************************************************************************
28*
29* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
30*
31* Redistribution and use in source and binary forms, with or without
32* modification, are permitted provided that the following conditions
33* are met:
34*
35* Redistributions of source code must retain the above copyright
36* notice, this list of conditions and the following disclaimer.
37*
38* Redistributions in binary form must reproduce the above copyright
39* notice, this list of conditions and the following disclaimer in the
40* documentation and/or other materials provided with the
41* distribution.
42*
43* Neither the name of Texas Instruments Incorporated nor the names of
44* its contributors may be used to endorse or promote products derived
45* from this software without specific prior written permission.
46*
47* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
48* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
49* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
50* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
51* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
53* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
55* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58*
59*******************************************************************************/
60
61#ifndef TUSB_MUSB_TYPE_H_
62#define TUSB_MUSB_TYPE_H_
63
64#include "stdint.h"
65
66#ifdef __cplusplus
67 extern "C" {
68#endif
69
70#ifndef __IO
71 #define __IO volatile
72#endif
73
74#ifndef __I
75 #define __I volatile const
76#endif
77
78#ifndef __O
79 #define __O volatile
80#endif
81
82#ifndef __R
83 #define __R volatile const
84#endif
85
86typedef struct TU_ATTR_PACKED {
87 __IO uint16_t maxp; // 0x00, 0x04: MAXP
88 __IO uint8_t csrl; // 0x02, 0x06: CSRL
89 __IO uint8_t csrh; // 0x03, 0x07: CSRH
90}musb_ep_maxp_csr_t;
91
92// 0: TX (device IN, host OUT)
93// 1: RX (device OUT, host IN)
94typedef struct TU_ATTR_PACKED {
95 union {
96 struct {
97 __IO uint16_t tx_maxp; // 0x00: TXMAXP
98 union {
99 __IO uint8_t csr0l; // 0x02: CSR0
100 __IO uint8_t tx_csrl; // 0x02: TX CSRL
101 };
102 union {
103 __IO uint8_t csr0h; // 0x03: CSR0H
104 __IO uint8_t tx_csrh; // 0x03: TX CSRH
105 };
106
107 __IO uint16_t rx_maxp; // 0x04: RX MAXP
108 __IO uint8_t rx_csrl; // 0x06: RX CSRL
109 __IO uint8_t rx_csrh; // 0x07: RX CSRH
110 };
111
112 musb_ep_maxp_csr_t maxp_csr[2];
113 };
114
115 union {
116 __IO uint16_t count0; // 0x08: COUNT0
117 __IO uint16_t rx_count; // 0x08: RX COUNT
118 };
119 union {
120 __IO uint8_t type0; // 0x0A: TYPE0 (host only)
121 __IO uint8_t tx_type; // 0x0A: TX TYPE
122 };
123 __IO uint8_t tx_interval; // 0x0B: TX INTERVAL
124 __IO uint8_t rx_type; // 0x0C: RX TYPE
125 __IO uint8_t rx_interval; // 0x0D: RX INTERVAL
126 __IO uint8_t reserved_0x0e; // 0x0E: Reserved
127 union {
128 __IO uint8_t config_data0; // 0x0F: CONFIG DATA
129 struct {
130 __IO uint8_t utmi_data_width : 1; // [0] UTMI Data Width
131 __IO uint8_t softconn_en : 1; // [1] Soft Connect Enable
132 __IO uint8_t dynamic_fifo : 1; // [2] Dynamic FIFO Sizing
133 __IO uint8_t hb_tx_en : 1; // [3] High Bandwidth TX ISO Enable
134 __IO uint8_t hb_rx_en : 1; // [4] High Bandwidth RX ISO Enable
135 __IO uint8_t big_endian : 1; // [5] Big Endian
136 __IO uint8_t mp_tx_en : 1; // [6] Auto splitting BULK TX Enable
137 __IO uint8_t mp_rx_en : 1; // [7] Auto amalgamation BULK RX Enable
139
140 __IO uint8_t fifo_size; // 0x0F: FIFO_SIZE
141 struct {
142 __IO uint8_t tx : 4; // [3:0] TX FIFO Size
143 __IO uint8_t rx : 4; // [7:4] RX FIFO Size
145 };
147
148TU_VERIFY_STATIC(sizeof(musb_ep_csr_t) == 16, "size is not correct");
149
150typedef struct TU_ATTR_PACKED {
151 //------------- Common -------------//
152 __IO uint8_t faddr; // 0x00: FADDR
153 union {
154 __IO uint8_t power; // 0x01: POWER
155 struct {
156 __IO uint8_t suspend_mode_en : 1; // [0] SUSPEND Mode Enable
157 __IO uint8_t suspend_mode : 1; // [1] SUSPEND Mode
158 __IO uint8_t resume_mode : 1; // [2] RESUME
159 __IO uint8_t reset : 1; // [3] RESET
160 __IO uint8_t highspeed_mode : 1; // [4] High Speed Mode
161 __IO uint8_t highspeed_en : 1; // [5] High Speed Enable
162 __IO uint8_t soft_conn : 1; // [6] Soft Connect/Disconnect
163 __IO uint8_t iso_update : 1; // [7] Isochronous Update
165 };
166
167 union {
168 struct {
169 __IO uint16_t intr_tx; // 0x02: INTR_TX
170 __IO uint16_t intr_rx; // 0x04: INTR_RX
171 };
172
173 __IO uint16_t intr_ep[2]; // 0x02-0x05: INTR_EP0-1
174 };
175
176 union {
177 struct {
178 __IO uint16_t intr_txen; // 0x06: INTR_TXEN
179 __IO uint16_t intr_rxen; // 0x08: INTR_RXEN
180 };
181
182 __IO uint16_t intren_ep[2]; // 0x06-0x09: INTREN_EP0-1
183 };
184
185 __IO uint8_t intr_usb; // 0x0A: INTRUSB
186 __IO uint8_t intr_usben; // 0x0B: INTRUSBEN
187
188 __IO uint16_t frame; // 0x0C: FRAME
189 __IO uint8_t index; // 0x0E: INDEX
190 __IO uint8_t testmode; // 0x0F: TESTMODE
191
192 //------------- Endpoint CSR (indexed) -------------//
193 musb_ep_csr_t indexed_csr; // 0x10-0x1F: Indexed CSR 0-15
194
195 //------------- FIFOs -------------//
196 __IO uint32_t fifo[16]; // 0x20-0x5C: FIFO 0-15
197
198 // Common (2)
199 __IO uint8_t devctl; // 0x60: DEVCTL
200 __IO uint8_t misc; // 0x61: MISC
201
202 //------------- Dynammic FIFO (indexed) -------------//
203 union {
204 struct {
205 __IO uint8_t txfifo_sz; // 0x62: TXFIFO_SZ
206 __IO uint8_t rxfifo_sz; // 0x63: RXFIFO_SZ
207 };
208 __IO uint8_t fifo_size[2];
209 };
210
211 union {
212 struct {
213 __IO uint16_t txfifo_addr; // 0x64: TXFIFO_ADDR
214 __IO uint16_t rxfifo_addr; // 0x66: RXFIFO_ADDR
215 };
217 };
218
219 //------------- Additional Control and Configuration -------------//
220 union {
221 __O uint32_t vcontrol; // 0x68: PHY VCONTROL
222 __IO uint32_t vstatus; // 0x68: PHY VSTATUS
223 };
224 union {
225 __IO uint16_t hwvers; // 0x6C: HWVERS
226 struct {
227 __IO uint16_t minor : 10; // [9:0] Minor
228 __IO uint16_t major : 5; // [14:10] Major
229 __IO uint16_t rc : 1; // [15] Release Candidate
231 };
232 __R uint16_t rsv_0x6e_0x77[5]; // 0x6E-0x77: Reserved
233
234 //------------- Additional Configuration -------------//
235 union {
236 __IO uint8_t epinfo; // 0x78: EPINFO
237 struct {
238 __IO uint8_t tx_ep_num : 4; // [3:0] TX Endpoints
239 __IO uint8_t rx_ep_num : 4; // [7:4] RX Endpoints
241 };
242 union {
243 __IO uint8_t raminfo; // 0x79: RAMINFO
244 struct {
245 __IO uint8_t ram_bits : 4; // [3:0] RAM Address Bus Width
246 __IO uint8_t dma_channel : 4; // [7:4] DMA Channels
248 };
249 union {
250 __IO uint8_t link_info; // 0x7A: LINK_INFO
251 __IO uint8_t adi_softreset; // 0x7A: AnalogDevice SOFTRESET
252 };
253 __IO uint8_t vplen; // 0x7B: VPLEN
254 __IO uint8_t hs_eof1; // 0x7C: HS_EOF1
255 __IO uint8_t fs_eof1; // 0x7D: FS_EOF1
256 __IO uint8_t ls_eof1; // 0x7E: LS_EOF1
257 __IO uint8_t soft_rst; // 0x7F: SOFT_RST
258
259 //------------- Target Endpoints (multipoint option) -------------//
260 __IO uint16_t ctuch; // 0x80: CTUCH
261 __IO uint16_t cthsrtn; // 0x82: CTHSRTN
262 __R uint32_t rsv_0x84_0xff[31]; // 0x84-0xFF: Reserved
263
264 //------------- Non-Indexed Endpoint CSRs -------------//
265 // TI tm4c can access this directly, but should use indexed_csr for portability
266 musb_ep_csr_t abs_csr[16]; // 0x100-0x1FF: EP0-15 CSR
267
268 //------------- DMA -------------//
269 __IO uint8_t dma_intr; // 0x200: DMA_INTR
270 __R uint8_t rsv_0x201_0x203[3]; // 0x201-0x203: Reserved
271 struct {
272 __IO uint16_t cntl; // 0x204: DMA_CNTL
273 __IO uint16_t rsv_0x206; // 0x206: Reserved
274 __IO uint32_t addr; // 0x208: DMA_ADDR
275 __IO uint32_t count; // 0x20C: DMA_COUNT
276 __IO uint32_t rsv_0x210; // 0x210: Reserved
277 }dma[8];
278 __R uint32_t rsv_0x284_0x2FF[31]; // 0x284-0x2FF: Reserved
279
280 //------------- Extended -------------//
281 __R uint32_t rsv_0x300; // 0x300: Reserved
282 struct {
283 __IO uint16_t count; // 0x304: REQ_PACKET_COUNT
284 __R uint16_t rsv_0x306; // 0x306: Reserved
286
287 __IO uint16_t rx_doulbe_packet_disable; // 0x340: RX_DOUBLE_PACKET_DISABLE
288 __IO uint16_t tx_double_packet_disable; // 0x342: TX_DOUBLE_PACKET_DISABLE
289
290 __IO uint16_t chirp_timeout; // 0x344: CHIRP_TIMEOUT
291 __IO uint16_t hs_to_utm; // 0x346: HS_TO_UTM delay
292 __IO uint16_t hs_timeout_adder; // 0x348: HS_TIMEOUT_ADDER
293
294 __R uint8_t rsv_34A_34f[6]; // 0x34A-0x34F: Reserved
296
297TU_VERIFY_STATIC(sizeof(musb_regs_t) == 0x350, "size is not correct");
298
299//--------------------------------------------------------------------+
300// Helper
301//--------------------------------------------------------------------+
302TU_ATTR_ALWAYS_INLINE static inline musb_ep_csr_t* get_ep_csr(musb_regs_t* musb_regs, unsigned epnum) {
303 musb_regs->index = epnum;
304 return &musb_regs->indexed_csr;
305}
306
307//--------------------------------------------------------------------+
308// Register Bit Field
309//--------------------------------------------------------------------+
310
311// 0x01: Power
312#define MUSB_POWER_ISOUP 0x0080 // Isochronous Update
313#define MUSB_POWER_SOFTCONN 0x0040 // Soft Connect/Disconnect
314#define MUSB_POWER_HSENAB 0x0020 // High Speed Enable
315#define MUSB_POWER_HSMODE 0x0010 // High Speed Enable
316#define MUSB_POWER_RESET 0x0008 // RESET Signaling
317#define MUSB_POWER_RESUME 0x0004 // RESUME Signaling
318#define MUSB_POWER_SUSPEND 0x0002 // SUSPEND Mode
319#define MUSB_POWER_PWRDNPHY 0x0001 // Power Down PHY
320
321// Interrupt TX/RX Status and Enable: each bit is for an endpoint
322
323// 0x6c: HWVERS
324#define MUSB_HWVERS_RC_SHIFT 15
325#define MUSB_HWVERS_RC_MASK 0x8000
326#define MUSB_HWVERS_MAJOR_SHIFT 10
327#define MUSB_HWVERS_MAJOR_MASK 0x7C00
328#define MUSB_HWVERS_MINOR_SHIFT 0
329#define MUSB_HWVERS_MINOR_MASK 0x03FF
330
331// 0x12, 0x16: TX/RX CSRL
332#define MUSB_CSRL_PACKET_READY(_rx) (1u << 0)
333#define MUSB_CSRL_FLUSH_FIFO(_rx) (1u << ((_rx) ? 4 : 3))
334#define MUSB_CSRL_SEND_STALL(_rx) (1u << ((_rx) ? 5 : 4))
335#define MUSB_CSRL_STALLED(_rx) (1u << ((_rx) ? 6 : 5))
336#define MUSB_CSRL_CLEAR_DATA_TOGGLE(_rx) (1u << ((_rx) ? 7 : 6))
337
338// 0x13, 0x17: TX/RX CSRH
339#define MUSB_CSRH_DISABLE_DOUBLE_PACKET(_rx) (1u << 1)
340#define MUSB_CSRH_TX_MODE (1u << 5) // 1 = TX, 0 = RX. only relevant for SHARED FIFO
341#define MUSB_CSRH_ISO (1u << 6)
342
343// 0x62, 0x63: TXFIFO_SZ, RXFIFO_SZ
344#define MUSB_FIFOSZ_DOUBLE_PACKET (1u << 4)
345
346
347//*****************************************************************************
348//
349// The following are defines for the bit fields in the MUSB_O_IS register.
350//
351//*****************************************************************************
352#define MUSB_IS_VBUSERR 0x0080 // VBUS Error (OTG only)
353#define MUSB_IS_SESREQ 0x0040 // SESSION REQUEST (OTG only)
354#define MUSB_IS_DISCON 0x0020 // Session Disconnect (OTG only)
355#define MUSB_IS_CONN 0x0010 // Session Connect
356#define MUSB_IS_SOF 0x0008 // Start of Frame
357#define MUSB_IS_BABBLE 0x0004 // Babble Detected
358#define MUSB_IS_RESET 0x0004 // RESET Signaling Detected
359#define MUSB_IS_RESUME 0x0002 // RESUME Signaling Detected
360#define MUSB_IS_SUSPEND 0x0001 // SUSPEND Signaling Detected
361
362//*****************************************************************************
363//
364// The following are defines for the bit fields in the MUSB_O_IE register.
365//
366//*****************************************************************************
367#define MUSB_IE_VBUSERR 0x0080 // Enable VBUS Error Interrupt (OTG only)
368#define MUSB_IE_SESREQ 0x0040 // Enable Session Request (OTG only)
369#define MUSB_IE_DISCON 0x0020 // Enable Disconnect Interrupt
370#define MUSB_IE_CONN 0x0010 // Enable Connect Interrupt
371#define MUSB_IE_SOF 0x0008 // Enable Start-of-Frame Interrupt
372#define MUSB_IE_BABBLE 0x0004 // Enable Babble Interrupt
373#define MUSB_IE_RESET 0x0004 // Enable RESET Interrupt
374#define MUSB_IE_RESUME 0x0002 // Enable RESUME Interrupt
375#define MUSB_IE_SUSPND 0x0001 // Enable SUSPEND Interrupt
376
377//*****************************************************************************
378//
379// The following are defines for the bit fields in the MUSB_O_FRAME register.
380//
381//*****************************************************************************
382#define MUSB_FRAME_M 0x07FF // Frame Number
383#define MUSB_FRAME_S 0
384
385//*****************************************************************************
386//
387// The following are defines for the bit fields in the MUSB_O_TEST register.
388//
389//*****************************************************************************
390#define MUSB_TEST_FORCEH 0x0080 // Force Host Mode
391#define MUSB_TEST_FIFOACC 0x0040 // FIFO Access
392#define MUSB_TEST_FORCEFS 0x0020 // Force Full-Speed Mode
393#define MUSB_TEST_FORCEHS 0x0010 // Force High-Speed Mode
394#define MUSB_TEST_TESTPKT 0x0008 // Test Packet Mode Enable
395#define MUSB_TEST_TESTK 0x0004 // Test_K Mode Enable
396#define MUSB_TEST_TESTJ 0x0002 // Test_J Mode Enable
397#define MUSB_TEST_TESTSE0NAK 0x0001 // Test_SE0_NAK Test Mode Enable
398
399//*****************************************************************************
400//
401// The following are defines for the bit fields in the MUSB_O_DEVCTL register.
402//
403//*****************************************************************************
404#define MUSB_DEVCTL_DEV 0x0080 // Device Mode (OTG only)
405#define MUSB_DEVCTL_FSDEV 0x0040 // Full-Speed Device Detected
406#define MUSB_DEVCTL_LSDEV 0x0020 // Low-Speed Device Detected
407#define MUSB_DEVCTL_VBUS_M 0x0018 // VBUS Level (OTG only)
408#define MUSB_DEVCTL_VBUS_NONE 0x0000 // Below SessionEnd
409#define MUSB_DEVCTL_VBUS_SEND 0x0008 // Above SessionEnd, below AValid
410#define MUSB_DEVCTL_VBUS_AVALID 0x0010 // Above AValid, below VBUSValid
411#define MUSB_DEVCTL_VBUS_VALID 0x0018 // Above VBUSValid
412#define MUSB_DEVCTL_HOST 0x0004 // Host Mode
413#define MUSB_DEVCTL_HOSTREQ 0x0002 // Host Request (OTG only)
414#define MUSB_DEVCTL_SESSION 0x0001 // Session Start/End (OTG only)
415
416//*****************************************************************************
417//
418// The following are defines for the bit fields in the MUSB_O_CCONF register.
419//
420//*****************************************************************************
421#define MUSB_CCONF_TXEDMA 0x0002 // TX Early DMA Enable
422#define MUSB_CCONF_RXEDMA 0x0001 // TX Early DMA Enable
423
424//*****************************************************************************
425//
426// The following are defines for the bit fields in the MUSB_O_ULPIVBUSCTL
427// register.
428//
429//*****************************************************************************
430#define MUSB_ULPIVBUSCTL_USEEXTVBUSIND 0x0002 // Use External VBUS Indicator
431#define MUSB_ULPIVBUSCTL_USEEXTVBUS 0x0001 // Use External VBUS
432
433//*****************************************************************************
434//
435// The following are defines for the bit fields in the MUSB_O_ULPIREGDATA
436// register.
437//
438//*****************************************************************************
439#define MUSB_ULPIREGDATA_REGDATA_M 0x00FF // Register Data
440#define MUSB_ULPIREGDATA_REGDATA_S 0
441//*****************************************************************************
442//
443// The following are defines for the bit fields in the MUSB_O_ULPIREGADDR
444// register.
445//
446//*****************************************************************************
447#define MUSB_ULPIREGADDR_ADDR_M 0x00FF // Register Address
448#define MUSB_ULPIREGADDR_ADDR_S 0
449
450//*****************************************************************************
451//
452// The following are defines for the bit fields in the MUSB_O_ULPIREGCTL
453// register.
454//
455//*****************************************************************************
456#define MUSB_ULPIREGCTL_RDWR 0x0004 // Read/Write Control
457#define MUSB_ULPIREGCTL_REGCMPLT 0x0002 // Register Access Complete
458#define MUSB_ULPIREGCTL_REGACC 0x0001 // Initiate Register Access
459
460//*****************************************************************************
461//
462// The following are defines for the bit fields in the MUSB_O_EPINFO register.
463//
464//*****************************************************************************
465#define MUSB_EPINFO_RXEP_M 0x00F0 // RX Endpoints
466#define MUSB_EPINFO_TXEP_M 0x000F // TX Endpoints
467#define MUSB_EPINFO_RXEP_S 4
468#define MUSB_EPINFO_TXEP_S 0
469
470//*****************************************************************************
471//
472// The following are defines for the bit fields in the MUSB_O_RAMINFO register.
473//
474//*****************************************************************************
475#define MUSB_RAMINFO_DMACHAN_M 0x00F0 // DMA Channels
476#define MUSB_RAMINFO_RAMBITS_M 0x000F // RAM Address Bus Width
477#define MUSB_RAMINFO_DMACHAN_S 4
478#define MUSB_RAMINFO_RAMBITS_S 0
479
480//*****************************************************************************
481//
482// The following are defines for the bit fields in the MUSB_O_CONTIM register.
483//
484//*****************************************************************************
485#define MUSB_CONTIM_WTCON_M 0x00F0 // Connect Wait
486#define MUSB_CONTIM_WTID_M 0x000F // Wait ID
487#define MUSB_CONTIM_WTCON_S 4
488#define MUSB_CONTIM_WTID_S 0
489
490//*****************************************************************************
491//
492// The following are defines for the bit fields in the MUSB_O_VPLEN register.
493//
494//*****************************************************************************
495#define MUSB_VPLEN_VPLEN_M 0x00FF // VBUS Pulse Length
496#define MUSB_VPLEN_VPLEN_S 0
497
498//*****************************************************************************
499//
500// The following are defines for the bit fields in the MUSB_O_HSEOF register.
501//
502//*****************************************************************************
503#define MUSB_HSEOF_HSEOFG_M 0x00FF // HIgh-Speed End-of-Frame Gap
504#define MUSB_HSEOF_HSEOFG_S 0
505
506//*****************************************************************************
507//
508// The following are defines for the bit fields in the MUSB_O_FSEOF register.
509//
510//*****************************************************************************
511#define MUSB_FSEOF_FSEOFG_M 0x00FF // Full-Speed End-of-Frame Gap
512#define MUSB_FSEOF_FSEOFG_S 0
513
514//*****************************************************************************
515//
516// The following are defines for the bit fields in the MUSB_O_LSEOF register.
517//
518//*****************************************************************************
519#define MUSB_LSEOF_LSEOFG_M 0x00FF // Low-Speed End-of-Frame Gap
520#define MUSB_LSEOF_LSEOFG_S 0
521
522//*****************************************************************************
523//
524// The following are defines for the bit fields in the MUSB_O_CSRL0 register.
525//
526//*****************************************************************************
527#define MUSB_CSRL0_NAKTO 0x0080 // NAK Timeout
528#define MUSB_CSRL0_SETENDC 0x0080 // Setup End Clear
529#define MUSB_CSRL0_STATUS 0x0040 // STATUS Packet
530#define MUSB_CSRL0_RXRDYC 0x0040 // RXRDY Clear
531#define MUSB_CSRL0_REQPKT 0x0020 // Request Packet
532#define MUSB_CSRL0_STALL 0x0020 // Send Stall
533#define MUSB_CSRL0_SETEND 0x0010 // Setup End
534#define MUSB_CSRL0_ERROR 0x0010 // Error
535#define MUSB_CSRL0_DATAEND 0x0008 // Data End
536#define MUSB_CSRL0_SETUP 0x0008 // Setup Packet
537#define MUSB_CSRL0_STALLED 0x0004 // Endpoint Stalled
538#define MUSB_CSRL0_TXRDY 0x0002 // Transmit Packet Ready
539#define MUSB_CSRL0_RXRDY 0x0001 // Receive Packet Ready
540
541//*****************************************************************************
542//
543// The following are defines for the bit fields in the MUSB_O_CSRH0 register.
544//
545//*****************************************************************************
546#define MUSB_CSRH0_DISPING 0x0008 // PING Disable
547#define MUSB_CSRH0_DTWE 0x0004 // Data Toggle Write Enable
548#define MUSB_CSRH0_DT 0x0002 // Data Toggle
549#define MUSB_CSRH0_FLUSH 0x0001 // Flush FIFO
550
551//*****************************************************************************
552//
553// The following are defines for the bit fields in the MUSB_O_TYPE0 register.
554//
555//*****************************************************************************
556#define MUSB_TYPE0_SPEED_M 0x00C0 // Operating Speed
557#define MUSB_TYPE0_SPEED_HIGH 0x0040 // High
558#define MUSB_TYPE0_SPEED_FULL 0x0080 // Full
559#define MUSB_TYPE0_SPEED_LOW 0x00C0 // Low
560
561//*****************************************************************************
562//
563// The following are defines for the bit fields in the MUSB_O_NAKLMT register.
564//
565//*****************************************************************************
566#define MUSB_NAKLMT_NAKLMT_M 0x001F // EP0 NAK Limit
567#define MUSB_NAKLMT_NAKLMT_S 0
568
569//*****************************************************************************
570//
571// The following are defines for the bit fields in the MUSB_O_TXCSRL1 register.
572//
573//*****************************************************************************
574#define MUSB_TXCSRL1_NAKTO 0x0080 // NAK Timeout
575#define MUSB_TXCSRL1_CLRDT 0x0040 // Clear Data Toggle
576#define MUSB_TXCSRL1_STALLED 0x0020 // Endpoint Stalled
577#define MUSB_TXCSRL1_STALL 0x0010 // Send STALL
578#define MUSB_TXCSRL1_SETUP 0x0010 // Setup Packet
579#define MUSB_TXCSRL1_FLUSH 0x0008 // Flush FIFO
580#define MUSB_TXCSRL1_ERROR 0x0004 // Error
581#define MUSB_TXCSRL1_UNDRN 0x0004 // Underrun
582#define MUSB_TXCSRL1_FIFONE 0x0002 // FIFO Not Empty
583#define MUSB_TXCSRL1_TXRDY 0x0001 // Transmit Packet Ready
584
585//*****************************************************************************
586//
587// The following are defines for the bit fields in the MUSB_O_TXCSRH1 register.
588//
589//*****************************************************************************
590#define MUSB_TXCSRH1_AUTOSET 0x0080 // Auto Set
591#define MUSB_TXCSRH1_ISO 0x0040 // Isochronous Transfers
592#define MUSB_TXCSRH1_MODE 0x0020 // Mode
593#define MUSB_TXCSRH1_DMAEN 0x0010 // DMA Request Enable
594#define MUSB_TXCSRH1_FDT 0x0008 // Force Data Toggle
595#define MUSB_TXCSRH1_DMAMOD 0x0004 // DMA Request Mode
596#define MUSB_TXCSRH1_DTWE 0x0002 // Data Toggle Write Enable
597#define MUSB_TXCSRH1_DT 0x0001 // Data Toggle
598
599//*****************************************************************************
600//
601// The following are defines for the bit fields in the MUSB_O_RXCSRL1 register.
602//
603//*****************************************************************************
604#define MUSB_RXCSRL1_CLRDT 0x0080 // Clear Data Toggle
605#define MUSB_RXCSRL1_STALLED 0x0040 // Endpoint Stalled
606#define MUSB_RXCSRL1_STALL 0x0020 // Send STALL
607#define MUSB_RXCSRL1_REQPKT 0x0020 // Request Packet
608#define MUSB_RXCSRL1_FLUSH 0x0010 // Flush FIFO
609#define MUSB_RXCSRL1_DATAERR 0x0008 // Data Error
610#define MUSB_RXCSRL1_NAKTO 0x0008 // NAK Timeout
611#define MUSB_RXCSRL1_OVER 0x0004 // Overrun
612#define MUSB_RXCSRL1_ERROR 0x0004 // Error
613#define MUSB_RXCSRL1_FULL 0x0002 // FIFO Full
614#define MUSB_RXCSRL1_RXRDY 0x0001 // Receive Packet Ready
615
616//*****************************************************************************
617//
618// The following are defines for the bit fields in the MUSB_O_RXCSRH1 register.
619//
620//*****************************************************************************
621#define MUSB_RXCSRH1_AUTOCL 0x0080 // Auto Clear
622#define MUSB_RXCSRH1_AUTORQ 0x0040 // Auto Request
623#define MUSB_RXCSRH1_ISO 0x0040 // Isochronous Transfers
624#define MUSB_RXCSRH1_DMAEN 0x0020 // DMA Request Enable
625#define MUSB_RXCSRH1_DISNYET 0x0010 // Disable NYET
626#define MUSB_RXCSRH1_PIDERR 0x0010 // PID Error
627#define MUSB_RXCSRH1_DMAMOD 0x0008 // DMA Request Mode
628#define MUSB_RXCSRH1_DTWE 0x0004 // Data Toggle Write Enable
629#define MUSB_RXCSRH1_DT 0x0002 // Data Toggle
630#define MUSB_RXCSRH1_INCOMPRX 0x0001 // Incomplete RX Transmission Status
631
632//*****************************************************************************
633//
634// The following are defines for the bit fields in the MUSB_O_TXTYPE1 register.
635//
636//*****************************************************************************
637#define MUSB_TXTYPE1_SPEED_M 0x00C0 // Operating Speed
638#define MUSB_TXTYPE1_SPEED_DFLT 0x0000 // Default
639#define MUSB_TXTYPE1_SPEED_HIGH 0x0040 // High
640#define MUSB_TXTYPE1_SPEED_FULL 0x0080 // Full
641#define MUSB_TXTYPE1_SPEED_LOW 0x00C0 // Low
642#define MUSB_TXTYPE1_PROTO_M 0x0030 // Protocol
643#define MUSB_TXTYPE1_PROTO_CTRL 0x0000 // Control
644#define MUSB_TXTYPE1_PROTO_ISOC 0x0010 // Isochronous
645#define MUSB_TXTYPE1_PROTO_BULK 0x0020 // Bulk
646#define MUSB_TXTYPE1_PROTO_INT 0x0030 // Interrupt
647#define MUSB_TXTYPE1_TEP_M 0x000F // Target Endpoint Number
648#define MUSB_TXTYPE1_TEP_S 0
649
650//*****************************************************************************
651//
652// The following are defines for the bit fields in the MUSB_O_TXINTERVAL1
653// register.
654//
655//*****************************************************************************
656#define MUSB_TXINTERVAL1_NAKLMT_M 0x00FF // NAK Limit
657#define MUSB_TXINTERVAL1_TXPOLL_M 0x00FF // TX Polling
658#define MUSB_TXINTERVAL1_TXPOLL_S 0
659#define MUSB_TXINTERVAL1_NAKLMT_S 0
660
661//*****************************************************************************
662//
663// The following are defines for the bit fields in the MUSB_O_RXTYPE1 register.
664//
665//*****************************************************************************
666#define MUSB_RXTYPE1_SPEED_M 0x00C0 // Operating Speed
667#define MUSB_RXTYPE1_SPEED_DFLT 0x0000 // Default
668#define MUSB_RXTYPE1_SPEED_HIGH 0x0040 // High
669#define MUSB_RXTYPE1_SPEED_FULL 0x0080 // Full
670#define MUSB_RXTYPE1_SPEED_LOW 0x00C0 // Low
671#define MUSB_RXTYPE1_PROTO_M 0x0030 // Protocol
672#define MUSB_RXTYPE1_PROTO_CTRL 0x0000 // Control
673#define MUSB_RXTYPE1_PROTO_ISOC 0x0010 // Isochronous
674#define MUSB_RXTYPE1_PROTO_BULK 0x0020 // Bulk
675#define MUSB_RXTYPE1_PROTO_INT 0x0030 // Interrupt
676#define MUSB_RXTYPE1_TEP_M 0x000F // Target Endpoint Number
677#define MUSB_RXTYPE1_TEP_S 0
678
679//*****************************************************************************
680//
681// The following are defines for the bit fields in the MUSB_O_RXINTERVAL1
682// register.
683//
684//*****************************************************************************
685#define MUSB_RXINTERVAL1_TXPOLL_M 0x00FF // RX Polling
686#define MUSB_RXINTERVAL1_NAKLMT_M 0x00FF // NAK Limit
687#define MUSB_RXINTERVAL1_TXPOLL_S 0
688#define MUSB_RXINTERVAL1_NAKLMT_S 0
689
690//*****************************************************************************
691//
692// The following are defines for the bit fields in the MUSB_O_DMACTL0 register.
693//
694//*****************************************************************************
695#define MUSB_DMACTL0_BRSTM_M 0x0600 // Burst Mode
696#define MUSB_DMACTL0_BRSTM_ANY 0x0000 // Bursts of unspecified length
697#define MUSB_DMACTL0_BRSTM_INC4 0x0200 // INCR4 or unspecified length
698#define MUSB_DMACTL0_BRSTM_INC8 0x0400 // INCR8, INCR4 or unspecified
699 // length
700#define MUSB_DMACTL0_BRSTM_INC16 0x0600 // INCR16, INCR8, INCR4 or
701 // unspecified length
702#define MUSB_DMACTL0_ERR 0x0100 // Bus Error Bit
703#define MUSB_DMACTL0_EP_M 0x00F0 // Endpoint number
704#define MUSB_DMACTL0_IE 0x0008 // DMA Interrupt Enable
705#define MUSB_DMACTL0_MODE 0x0004 // DMA Transfer Mode
706#define MUSB_DMACTL0_DIR 0x0002 // DMA Direction
707#define MUSB_DMACTL0_ENABLE 0x0001 // DMA Transfer Enable
708#define MUSB_DMACTL0_EP_S 4
709
710//*****************************************************************************
711//
712// The following are defines for the bit fields in the MUSB_O_DMAADDR0 register.
713//
714//*****************************************************************************
715#define MUSB_DMAADDR0_ADDR_M 0xFFFFFFFC // DMA Address
716#define MUSB_DMAADDR0_ADDR_S 2
717
718//*****************************************************************************
719//
720// The following are defines for the bit fields in the MUSB_O_DMACOUNT0
721// register.
722//
723//*****************************************************************************
724#define MUSB_DMACOUNT0_COUNT_M 0xFFFFFFFC // DMA Count
725#define MUSB_DMACOUNT0_COUNT_S 2
726
727//*****************************************************************************
728//
729// The following are defines for the bit fields in the MUSB_O_CTO register.
730//
731//*****************************************************************************
732#define MUSB_CTO_CCTV_M 0xFFFF // Configurable Chirp Timeout Value
733#define MUSB_CTO_CCTV_S 0
734
735//*****************************************************************************
736//
737// The following are defines for the bit fields in the MUSB_O_HHSRTN register.
738//
739//*****************************************************************************
740#define MUSB_HHSRTN_HHSRTN_M 0xFFFF // HIgh Speed to UTM Operating
741 // Delay
742#define MUSB_HHSRTN_HHSRTN_S 0
743
744//*****************************************************************************
745//
746// The following are defines for the bit fields in the MUSB_O_HSBT register.
747//
748//*****************************************************************************
749#define MUSB_HSBT_HSBT_M 0x000F // High Speed Timeout Adder
750#define MUSB_HSBT_HSBT_S 0
751
752#ifdef __cplusplus
753 }
754#endif
755
756#endif
TU_VERIFY_STATIC(sizeof(musb_ep_csr_t)==16, "size is not correct")
struct TU_ATTR_PACKED musb_ep_csr_t
struct TU_ATTR_PACKED musb_regs_t
static TU_ATTR_ALWAYS_INLINE musb_ep_csr_t * get_ep_csr(musb_regs_t *musb_regs, unsigned epnum)
Definition: musb_type.h:302
AUDIO Channel Cluster Descriptor (4.1)
Definition: audio.h:647
__IO uint8_t suspend_mode_en
Definition: musb_type.h:156
__IO uint32_t count
Definition: musb_type.h:275
musb_ep_maxp_csr_t maxp_csr[2]
Definition: musb_type.h:112
musb_ep_csr_t indexed_csr
Definition: musb_type.h:193
__IO uint8_t tx_type
Definition: musb_type.h:121
__IO uint8_t tx
Definition: musb_type.h:142
__IO uint16_t intr_txen
Definition: musb_type.h:178
__IO uint8_t adi_softreset
Definition: musb_type.h:251
__IO uint8_t mp_tx_en
Definition: musb_type.h:136
__R uint8_t rsv_0x201_0x203[3]
Definition: musb_type.h:270
__IO uint8_t intr_usben
Definition: musb_type.h:186
__IO uint16_t intr_ep[2]
Definition: musb_type.h:173
__IO uint16_t rx_maxp
Definition: musb_type.h:107
__IO uint8_t link_info
Definition: musb_type.h:250
__R uint32_t rsv_0x284_0x2FF[31]
Definition: musb_type.h:278
__IO uint8_t csr0h
Definition: musb_type.h:103
__IO uint16_t fifo_addr[2]
Definition: musb_type.h:216
__IO uint8_t hb_rx_en
Definition: musb_type.h:134
__IO uint8_t iso_update
Definition: musb_type.h:163
__IO uint16_t frame
Definition: musb_type.h:188
__IO uint16_t rx_doulbe_packet_disable
Definition: musb_type.h:287
__IO uint16_t count
Definition: musb_type.h:283
__IO uint16_t rc
Definition: musb_type.h:229
__IO uint8_t raminfo
Definition: musb_type.h:243
__IO uint8_t fifo_size
Definition: musb_type.h:140
__IO uint16_t tx_maxp
Definition: musb_type.h:97
struct TU_ATTR_PACKED::@190::@213 fifo_size_bit
__IO uint8_t big_endian
Definition: musb_type.h:135
__IO uint8_t misc
Definition: musb_type.h:200
__IO uint32_t rsv_0x210
Definition: musb_type.h:276
__IO uint8_t epinfo
Definition: musb_type.h:236
__IO uint8_t hb_tx_en
Definition: musb_type.h:133
__IO uint32_t vstatus
Definition: musb_type.h:222
__IO uint8_t faddr
Definition: musb_type.h:152
__IO uint8_t rx_type
Definition: musb_type.h:124
__IO uint16_t cntl
Definition: musb_type.h:272
__R uint32_t rsv_0x300
Definition: musb_type.h:281
__IO uint8_t rx
Definition: musb_type.h:143
__R uint8_t rsv_34A_34f[6]
Definition: musb_type.h:294
__IO uint16_t tx_double_packet_disable
Definition: musb_type.h:288
__IO uint8_t dynamic_fifo
Definition: musb_type.h:132
__IO uint16_t intren_ep[2]
Definition: musb_type.h:182
struct TU_ATTR_PACKED::@190::@209 config_data0_bit
__IO uint8_t dma_intr
Definition: musb_type.h:269
__IO uint8_t resume_mode
Definition: musb_type.h:158
__IO uint8_t index
Definition: musb_type.h:189
__IO uint8_t hs_eof1
Definition: musb_type.h:254
__IO uint16_t intr_tx
Definition: musb_type.h:169
__IO uint16_t rsv_0x206
Definition: musb_type.h:273
__IO uint8_t intr_usb
Definition: musb_type.h:185
__IO uint8_t rx_csrl
Definition: musb_type.h:108
__O uint32_t vcontrol
Definition: musb_type.h:221
__IO uint8_t suspend_mode
Definition: musb_type.h:157
__IO uint16_t hs_timeout_adder
Definition: musb_type.h:292
__IO uint8_t soft_conn
Definition: musb_type.h:162
__IO uint16_t minor
Definition: musb_type.h:227
volatile uint16_t
Definition: hcd_rusb2.c:58
__IO uint8_t highspeed_mode
Definition: musb_type.h:160
__IO uint8_t softconn_en
Definition: musb_type.h:131
struct TU_ATTR_PACKED::@243 dma[8]
__IO uint8_t config_data0
Definition: musb_type.h:128
__IO uint8_t type0
Definition: musb_type.h:120
__IO uint32_t addr
Definition: musb_type.h:274
__IO uint16_t count0
Definition: musb_type.h:116
__IO uint8_t testmode
Definition: musb_type.h:190
__IO uint32_t fifo[16]
Definition: musb_type.h:196
__IO uint8_t tx_interval
Definition: musb_type.h:123
__IO uint8_t rxfifo_sz
Definition: musb_type.h:206
__IO uint16_t chirp_timeout
Definition: musb_type.h:290
struct TU_ATTR_PACKED::@244 req_packet[15]
__IO uint8_t power
Definition: musb_type.h:154
__IO uint8_t utmi_data_width
Definition: musb_type.h:130
__IO uint16_t ctuch
Definition: musb_type.h:260
__R uint16_t rsv_0x6e_0x77[5]
Definition: musb_type.h:232
__IO uint8_t rx_interval
Definition: musb_type.h:125
__IO uint16_t hwvers
Definition: musb_type.h:225
__IO uint8_t fs_eof1
Definition: musb_type.h:255
__IO uint16_t cthsrtn
Definition: musb_type.h:261
__IO uint8_t tx_csrl
Definition: musb_type.h:100
struct TU_ATTR_PACKED::@235::@256 hwvers_bit
__R uint32_t rsv_0x84_0xff[31]
Definition: musb_type.h:262
__IO uint8_t soft_rst
Definition: musb_type.h:257
__IO uint16_t rxfifo_addr
Definition: musb_type.h:214
__IO uint8_t txfifo_sz
Definition: musb_type.h:205
__IO uint16_t rx_count
Definition: musb_type.h:117
struct TU_ATTR_PACKED::@237::@259 epinfo_bit
__IO uint8_t rx_ep_num
Definition: musb_type.h:239
__IO uint8_t mp_rx_en
Definition: musb_type.h:137
__IO uint8_t reserved_0x0e
Definition: musb_type.h:126
__IO uint8_t rx_csrh
Definition: musb_type.h:109
__IO uint8_t ram_bits
Definition: musb_type.h:245
__IO uint8_t dma_channel
Definition: musb_type.h:246
musb_ep_csr_t abs_csr[16]
Definition: musb_type.h:266
__IO uint16_t intr_rxen
Definition: musb_type.h:179
__IO uint8_t vplen
Definition: musb_type.h:253
__R uint16_t rsv_0x306
Definition: musb_type.h:284
struct TU_ATTR_PACKED::@217::@245 power_bit
__IO uint16_t major
Definition: musb_type.h:228
__IO uint16_t txfifo_addr
Definition: musb_type.h:213
__IO uint8_t tx_csrh
Definition: musb_type.h:104
struct TU_ATTR_PACKED::@239::@261 raminfo_bit
__IO uint8_t ls_eof1
Definition: musb_type.h:256
__IO uint16_t intr_rx
Definition: musb_type.h:170
__IO uint8_t tx_ep_num
Definition: musb_type.h:238
__IO uint8_t csr0l
Definition: musb_type.h:99
__IO uint8_t reset
Definition: musb_type.h:159
__IO uint8_t devctl
Definition: musb_type.h:199
__IO uint16_t hs_to_utm
Definition: musb_type.h:291
__IO uint8_t highspeed_en
Definition: musb_type.h:161