Open FFBoard
Open source force feedback firmware
musb_ti.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2024, Brent Kowal (Analog Devices, Inc)
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 TUSB_MUSB_TI_H_
28#define TUSB_MUSB_TI_H_
29
30#ifdef __cplusplus
31 extern "C" {
32#endif
33
34#if CFG_TUSB_MCU == OPT_MCU_TM4C123
35 #include "TM4C123.h"
36 #define FIFO0_WORD FIFO0
37 #define FIFO1_WORD FIFO1
38//#elif CFG_TUSB_MCU == OPT_MCU_TM4C129
39#elif CFG_TUSB_MCU == OPT_MCU_MSP432E4
40 #include "msp.h"
41#else
42 #error "Unsupported MCUs"
43#endif
44
45#define MUSB_CFG_SHARED_FIFO 0
46#define MUSB_CFG_DYNAMIC_FIFO 1
47#define MUSB_CFG_DYNAMIC_FIFO_SIZE 4096
48
49const uintptr_t MUSB_BASES[] = { USB0_BASE };
50
51// Header supports both device and host modes. Only include what's necessary
52#if CFG_TUD_ENABLED
53
54// Mapping of IRQ numbers to port. Currently just 1.
55static const IRQn_Type musb_irqs[] = {
56 USB0_IRQn
57};
58
59static inline void musb_dcd_phy_init(uint8_t rhport){
60 (void)rhport;
61 //Nothing to do for this part
62}
63
64TU_ATTR_ALWAYS_INLINE static inline void musb_dcd_int_enable(uint8_t rhport) {
65 NVIC_EnableIRQ(musb_irqs[rhport]);
66}
67
68TU_ATTR_ALWAYS_INLINE static inline void musb_dcd_int_disable(uint8_t rhport) {
69 NVIC_DisableIRQ(musb_irqs[rhport]);
70}
71
72TU_ATTR_ALWAYS_INLINE static inline unsigned musb_dcd_get_int_enable(uint8_t rhport) {
73 return NVIC_GetEnableIRQ(musb_irqs[rhport]);
74}
75
76TU_ATTR_ALWAYS_INLINE static inline void musb_dcd_int_clear(uint8_t rhport) {
77 NVIC_ClearPendingIRQ(musb_irqs[rhport]);
78}
79
80static inline void musb_dcd_int_handler_enter(uint8_t rhport) {
81 (void)rhport;
82 //Nothing to do for this part
83}
84
85#endif // CFG_TUD_ENABLED
86
87#ifdef __cplusplus
88 }
89#endif
90
91#endif // TUSB_MUSB_TI_H_
const uintptr_t MUSB_BASES[]
Definition: musb_max32.h:40
static TU_ATTR_ALWAYS_INLINE void musb_dcd_int_disable(uint8_t rhport)
Definition: musb_ti.h:68
static void musb_dcd_phy_init(uint8_t rhport)
Definition: musb_ti.h:59
static void musb_dcd_int_handler_enter(uint8_t rhport)
Definition: musb_ti.h:80
static const IRQn_Type musb_irqs[]
Definition: musb_ti.h:55
static TU_ATTR_ALWAYS_INLINE void musb_dcd_int_clear(uint8_t rhport)
Definition: musb_ti.h:76
static TU_ATTR_ALWAYS_INLINE void musb_dcd_int_enable(uint8_t rhport)
Definition: musb_ti.h:64
static TU_ATTR_ALWAYS_INLINE unsigned musb_dcd_get_int_enable(uint8_t rhport)
Definition: musb_ti.h:72