AM261x MCU+ SDK: device_wrapper.h Source File

| AM261x MCU+ SDK 26.00.00 |

device_wrapper.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2024 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
33 #ifndef USB_WRAPPER_H_
34 #define USB_WRAPPER_H_
35
36 #include "device_usb_reg_offset.h"
37 #include "usb_drv.h"
38 #include "hardware.h"
39 #include <kernel/dpl/HwiP.h>
40 #include <kernel/dpl/CycleCounterP.h>
41 #include <cslr_soc.h>
42
43 /* Define 60s timeout value for usb connection to happen */
44 /* Define QT_SIM macro to test timeout in simulation platform */
45 /* This lowers the timeout value as QT simulation is slow */
46
47 #ifndef QT_SIM
48 #define BOOTPARAM_TIMEOUT_MS 60000U
49 #else
50 #define BOOTPARAM_TIMEOUT_MS 20U
51 #endif
52
70 typedef struct usb_handle_s {
72 uint32_t cfg_base;
74 dwc_usb3_device_t* dwc_usb3_dev;
76 HwiP_Params hwiParamsUsb;
78 HwiP_Object hwiObjUsb;
79 } usb_handle_t;
80
84 typedef enum UsbPhy_ret_t_
85 {
86 USB_PHY_OK = 0x01U ,
87 USB_PHY_ERR = 0x02U
88
89 }UsbPhy_ret_t ;
90
91
96 extern uint8_t ep_in_buf[DWC_MAX_EPS - 1U][DWC_MAX_PACKET_SIZE];
97
102 extern uint8_t ep_out_buf[DWC_MAX_EPS - 1U][DWC_MAX_PACKET_SIZE];
103
112 UsbPhy_ret_t usb_phy_power_sequence(void);
113
120 void USB_configureInterrupt(uint32_t intr);
121
128 void USB_disableInterrupt(uint32_t intr);
129
133 void USB_clearInterrupt(void);
134
135 #endif /* USB_WRAPPER_H_ */
136
usb_handle_t::hwiParamsUsb
HwiP_Params hwiParamsUsb
Definition: device_wrapper.h:76
UsbPhy_ret_t
UsbPhy_ret_t
This enumeration defines the return status for USB PHY.
Definition: device_wrapper.h:85
USB_disableInterrupt
void USB_disableInterrupt(uint32_t intr)
This function disables the interrupt.
HwiP_Params
Parameters passed during HwiP_construct.
Definition: HwiP.h:127
usb_handle_t::dwc_usb3_dev
dwc_usb3_device_t * dwc_usb3_dev
Definition: device_wrapper.h:74
USB_configureInterrupt
void USB_configureInterrupt(uint32_t intr)
This function configures the interrupt.
usb_handle_t::cfg_base
uint32_t cfg_base
Definition: device_wrapper.h:72
usb_phy_power_sequence
UsbPhy_ret_t usb_phy_power_sequence(void)
Performs the USB PHY power-on sequence.
usb_handle_t
Structure representing the USB device handle.
Definition: device_wrapper.h:70
dwc_usb3_device_t
Definition: dev.h:49
DWC_MAX_EPS
#define DWC_MAX_EPS
Maximum number of EPs, defined by USB spec.
Definition: pcd.h:83
HwiP.h
DWC_MAX_PACKET_SIZE
#define DWC_MAX_PACKET_SIZE
Maxpacket size for any EP, defined by USB3 spec.
Definition: pcd.h:93
ep_out_buf
uint8_t ep_out_buf[DWC_MAX_EPS - 1U][DWC_MAX_PACKET_SIZE]
Global buffers for USB OUT endpoints. These buffers are used for data reception from the host to the ...
USB_clearInterrupt
void USB_clearInterrupt(void)
This function clears the MAIN0 interrupt.
CycleCounterP.h
usb_handle_t::hwiObjUsb
HwiP_Object hwiObjUsb
Definition: device_wrapper.h:78
USB_PHY_OK
@ USB_PHY_OK
Definition: device_wrapper.h:86
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:142
ep_in_buf
uint8_t ep_in_buf[DWC_MAX_EPS - 1U][DWC_MAX_PACKET_SIZE]
Global buffers for USB IN endpoints. These buffers are used for data transmission from the device to ...
USB_PHY_ERR
@ USB_PHY_ERR
Definition: device_wrapper.h:87