mikroSDK Reference Manual
ci_hs_type.h
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2021, 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#ifndef CI_HS_TYPE_H_
28#define CI_HS_TYPE_H_
29
30#ifdef __cplusplus
31 extern "C" {
32#endif
33
34// DCCPARAMS
35enum {
36 DCCPARAMS_DEN_MASK = 0x1Fu,
37};
38
39// USBCMD
40enum {
41 USBCMD_RUN_STOP = TU_BIT(0),
42 USBCMD_RESET = TU_BIT(1),
43 USBCMD_SETUP_TRIPWIRE = TU_BIT(13),
44 USBCMD_ADD_QTD_TRIPWIRE = TU_BIT(14), // This bit is used as a semaphore to ensure the to proper addition of a
45 // new dTD to an active (primed) endpoint’s linked list. This bit is set and
46 // cleared by software during the process of adding a new dTD
47
48 USBCMD_INTR_THRESHOLD_MASK = 0x00FF0000u, // Interrupt Threshold bit 23:16
49};
50
51// PORTSC1
52#define PORTSC1_PORT_SPEED_POS 26
53
54enum {
55 PORTSC1_CURRENT_CONNECT_STATUS = TU_BIT(0),
56 PORTSC1_FORCE_PORT_RESUME = TU_BIT(6),
57 PORTSC1_SUSPEND = TU_BIT(7),
58 PORTSC1_FORCE_FULL_SPEED = TU_BIT(24),
59 PORTSC1_PORT_SPEED = TU_BIT(26) | TU_BIT(27)
60};
61
62// OTGSC
63enum {
64 OTGSC_VBUS_DISCHARGE = TU_BIT(0),
65 OTGSC_VBUS_CHARGE = TU_BIT(1),
66// OTGSC_HWASSIST_AUTORESET = TU_BIT(2),
67 OTGSC_OTG_TERMINATION = TU_BIT(3),
68 OTGSC_DATA_PULSING = TU_BIT(4),
69 OTGSC_ID_PULLUP = TU_BIT(5),
70// OTGSC_HWASSIT_DATA_PULSE = TU_BIT(6),
71// OTGSC_HWASSIT_BDIS_ACONN = TU_BIT(7),
72 OTGSC_ID = TU_BIT(8),
73 OTGSC_A_VBUS_VALID = TU_BIT(9),
74 OTGSC_A_SESSION_VALID = TU_BIT(10),
75 OTGSC_B_SESSION_VALID = TU_BIT(11),
76 OTGSC_B_SESSION_END = TU_BIT(12),
77 OTGSC_1MS_TOGGLE = TU_BIT(13),
78 OTGSC_DATA_BUS_PULSING_STATUS = TU_BIT(14),
79};
80
81// USBMode
82enum {
83 USBMOD_CM_MASK = TU_BIT(0) | TU_BIT(1),
84 USBMODE_CM_DEVICE = 2,
85 USBMODE_CM_HOST = 3,
86
87 USBMODE_SLOM = TU_BIT(3),
88 USBMODE_SDIS = TU_BIT(4),
89
90 USBMODE_VBUS_POWER_SELECT = TU_BIT(5), // Need to be enabled for LPC18XX/43XX in host mode
91};
92
93// Device Registers
94typedef struct
95{
96 //------------- ID + HW Parameter Registers-------------//
97 volatile uint32_t TU_RESERVED[64];
98
99 //------------- Capability Registers-------------//
100 volatile uint8_t CAPLENGTH;
101 volatile uint8_t TU_RESERVED[1];
102 volatile uint16_t HCIVERSION;
103
104 volatile uint32_t HCSPARAMS;
105 volatile uint32_t HCCPARAMS;
106 volatile uint32_t TU_RESERVED[5];
107
108 volatile uint16_t DCIVERSION;
109 volatile uint8_t TU_RESERVED[2];
110
111 volatile uint32_t DCCPARAMS;
112 volatile uint32_t TU_RESERVED[6];
113
114 //------------- Operational Registers -------------//
115 volatile uint32_t USBCMD;
116 volatile uint32_t USBSTS;
117 volatile uint32_t USBINTR;
118 volatile uint32_t FRINDEX;
119 volatile uint32_t TU_RESERVED;
120 volatile uint32_t DEVICEADDR;
121 volatile uint32_t ENDPTLISTADDR;
122 volatile uint32_t TU_RESERVED;
123 volatile uint32_t BURSTSIZE;
124 volatile uint32_t TXFILLTUNING;
125 uint32_t TU_RESERVED[4];
126 volatile uint32_t ENDPTNAK;
127 volatile uint32_t ENDPTNAKEN;
128 volatile uint32_t TU_RESERVED;
129 volatile uint32_t PORTSC1;
130 volatile uint32_t TU_RESERVED[7];
131 volatile uint32_t OTGSC;
132 volatile uint32_t USBMODE;
133 volatile uint32_t ENDPTSETUPSTAT;
134 volatile uint32_t ENDPTPRIME;
135 volatile uint32_t ENDPTFLUSH;
136 volatile uint32_t ENDPTSTAT;
137 volatile uint32_t ENDPTCOMPLETE;
138 volatile uint32_t ENDPTCTRL[8];
140
141
142typedef struct
143{
144 uint32_t reg_base;
145 uint32_t irqnum;
147
148#ifdef __cplusplus
149 }
150#endif
151
152#endif /* CI_HS_TYPE_H_ */
Definition ci_hs_type.h:143
Definition ci_hs_type.h:95
volatile uint32_t PORTSC1
Port Status & Control.
Definition ci_hs_type.h:129
volatile uint32_t USBINTR
Interrupt Enable Register.
Definition ci_hs_type.h:117
volatile uint32_t OTGSC
On-The-Go Status & control.
Definition ci_hs_type.h:131
volatile uint32_t ENDPTNAKEN
Endpoint NAK Enable.
Definition ci_hs_type.h:127
volatile uint32_t FRINDEX
USB Frame Index.
Definition ci_hs_type.h:118
volatile uint16_t DCIVERSION
Device Controller Interface Version.
Definition ci_hs_type.h:108
volatile uint32_t USBSTS
USB Status Register.
Definition ci_hs_type.h:116
volatile uint32_t ENDPTLISTADDR
Endpoint List Address.
Definition ci_hs_type.h:121
volatile uint32_t ENDPTCOMPLETE
Endpoint Complete.
Definition ci_hs_type.h:137
volatile uint32_t ENDPTNAK
Endpoint NAK.
Definition ci_hs_type.h:126
volatile uint8_t CAPLENGTH
Capability Registers Length.
Definition ci_hs_type.h:100
volatile uint32_t HCCPARAMS
Host Controller Capability Parameters.
Definition ci_hs_type.h:105
volatile uint32_t HCSPARAMS
Host Controller Structural Parameters.
Definition ci_hs_type.h:104
volatile uint32_t DCCPARAMS
Device Controller Capability Parameters.
Definition ci_hs_type.h:111
volatile uint32_t ENDPTFLUSH
Endpoint Flush.
Definition ci_hs_type.h:135
volatile uint32_t ENDPTSETUPSTAT
Endpoint Setup Status.
Definition ci_hs_type.h:133
volatile uint32_t TXFILLTUNING
TX FIFO Fill Tuning.
Definition ci_hs_type.h:124
volatile uint32_t ENDPTSTAT
Endpoint Status.
Definition ci_hs_type.h:136
volatile uint32_t ENDPTPRIME
Endpoint Prime.
Definition ci_hs_type.h:134
volatile uint32_t USBCMD
USB Command Register.
Definition ci_hs_type.h:115
volatile uint32_t BURSTSIZE
Programmable Burst Size.
Definition ci_hs_type.h:123
volatile uint16_t HCIVERSION
Host Controller Interface Version.
Definition ci_hs_type.h:102
volatile uint32_t USBMODE
USB Device Mode.
Definition ci_hs_type.h:132
volatile uint32_t DEVICEADDR
Device Address.
Definition ci_hs_type.h:120