AM64x MCU+ SDK  10.00.00
usb_init.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
47 #ifndef INCLUDE_USB_INIT_PARAMS_H_
48 #define INCLUDE_USB_INIT_PARAMS_H_
49 
50 /* ========================================================================== */
51 /* Include Files */
52 /* ========================================================================== */
53 #include <stdint.h>
54 #include "cdn_print.h"
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /* ========================================================================== */
61 /* Macros & Typedefs */
62 /* ========================================================================== */
63 
70 #define USB_INSTANCE_0 (0x00U)
71 
79 #define USB_CLK_SEL_HFOSC0_CLKOUT (0x00U)
80 
81 #define USB_CLK_SEL_HFOSC1_CLKOUT (0x01U)
82 
83 #define USB_MAIN_PLL3_HSDIV4_CLKOUT (0x02U)
84 
85 #define USB_MAIN_PLL2_HSDIV4_CLKOUT (0x03U)
86 
94 #define USB_PLL_REF_CLK_9P6MHZ (0x00)
95 
96 #define USB_PLL_REF_CLK_10MHZ (0x01)
97 
98 #define USB_PLL_REF_CLK_12MHZ (0x02)
99 
100 #define USB_PLL_REF_CLK_19P2MHZ (0x03)
101 
102 #define USB_PLL_REF_CLK_20MHZ (0x04)
103 
104 #define USB_PLL_REF_CLK_24MHZ (0x05)
105 
106 #define USB_PLL_REF_CLK_25MHZ (0x06)
107 
108 #define USB_PLL_REF_CLK_26MHZ (0x07)
109 
110 #define USB_PLL_REF_CLK_38P4MHZ (0x08)
111 
112 #define USB_PLL_REF_CLK_40MHZ (0x09)
113 
114 #define USB_PLL_REF_CLK_48MHZ (0x0A)
115 
116 #define USB_PLL_REF_CLK_50MHZ (0x0B)
117 
118 #define USB_PLL_REF_CLK_52MHZ (0x0C)
119 
127 #define USB_MODE_3P0 (0x0)
128 
129 #define USB_MODE_2P0 (0x1)
130 
138 #define USB_PIPE_RX_INVERT_POLARITY_DISABLED (0x0)
139 
140 #define USB_PIPE_RX_INVERT_POLARITY_ENABLED (0x1)
141 
149 #define USB_VBUS_EXT_DIV3_INACTIVE (0x0)
150 
151 #define USB_VBUS_EXT_DIV3_ACTIVE (0x1)
152 
160 #define USB_HOST_MODE_DISABLED (0x0)
161 
162 #define USB_HOST_MODE_ENABLED (0x1)
163 
165 /* ========================================================================== */
166 /* Structures and Enums */
167 /* ========================================================================== */
168 
170 typedef struct usb_init_param_s {
171  uint32_t instanceNum;
173  uint32_t clkSrcSel;
175  uint32_t pllRefSel;
177  uint32_t usb2Enable;
179  uint32_t invertPolarity;
181  uint32_t vbusSel;
183  uint32_t isHostMode;
186 
187 /* ========================================================================== */
188 /* Function Declarations */
189 /* ========================================================================== */
190 
202 void usb_init(usb_init_param_t *usbInitParamPtr);
203 
204 
205 /*
206  * \brief Task to handle triggered interrupt in NON interrupt CPU mode.
207  * Wait for signal from cusbd_isr (from interrupt context)
208  * - check interrupt type (device, EP or invalid etc)
209  * - invoke handler in user context.
210  **/
211 void cusbd_dsr(void ) __attribute__((weak));
212 
213 #ifdef __cplusplus
214 }
215 #endif /* __cplusplus */
216 
217 #endif /* INCLUDE_USB_INIT_PARAMS_H_ */
218 
usb_init_param_t::usb2Enable
uint32_t usb2Enable
Definition: usb_init.h:177
usb_init_param_t::vbusSel
uint32_t vbusSel
Definition: usb_init.h:181
usb_init_param_t::clkSrcSel
uint32_t clkSrcSel
Definition: usb_init.h:173
usb_init
void usb_init(usb_init_param_t *usbInitParamPtr)
USB Initialization function.
cusbd_dsr
void cusbd_dsr(void) __attribute__((weak))
__attribute__
struct tisci_boardcfg_sa2ul_cfg __attribute__
UInteger224 (802.1AS, 10.3.4 time-synchronization spanning tree priority vectors )
usb_init_param_t
USB intialization parameter block.
Definition: usb_init.h:170
usb_init_param_t::isHostMode
uint32_t isHostMode
Definition: usb_init.h:183
cdn_print.h
usb_init_param_t::instanceNum
uint32_t instanceNum
Definition: usb_init.h:171
usb_init_param_t::pllRefSel
uint32_t pllRefSel
Definition: usb_init.h:175
usb_init_param_t::invertPolarity
uint32_t invertPolarity
Definition: usb_init.h:179