Open FFBoard
Open source force feedback firmware
rusb2_rx.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2020 Koji Kitayama
5 * Portions copyrighted (c) 2021 Roland Winistoerfer
6 * Copyright (c) 2022 Rafael Silva (@perigoso)
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 * This file is part of the TinyUSB stack.
27 */
28
29#ifndef _RUSB2_RX_H_
30#define _RUSB2_RX_H_
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include "iodefine.h"
37
38#define RUSB2_REG_BASE (0x000A0000)
39
40TU_ATTR_ALWAYS_INLINE static inline rusb2_reg_t* RUSB2_REG(uint8_t rhport) {
41 (void) rhport;
42 return (rusb2_reg_t *) RUSB2_REG_BASE;
43}
44
45
46#define rusb2_is_highspeed_rhport(_p) (false)
47#define rusb2_is_highspeed_reg(_reg) (false)
48
49//--------------------------------------------------------------------+
50//
51//--------------------------------------------------------------------+
52
53
54// Start/Stop MSTP TODO implement later
55TU_ATTR_ALWAYS_INLINE static inline void rusb2_module_start(uint8_t rhport, bool start) {
56 (void) rhport;
57 (void) start;
58}
59
60TU_ATTR_ALWAYS_INLINE static inline void rusb2_int_enable(uint8_t rhport)
61{
62 (void) rhport;
63#if (CFG_TUSB_MCU == OPT_MCU_RX72N)
64 IEN(PERIB, INTB185) = 1;
65#else
66 IEN(USB0, USBI0) = 1;
67#endif
68}
69
70TU_ATTR_ALWAYS_INLINE static inline void rusb2_int_disable(uint8_t rhport)
71{
72 (void) rhport;
73#if (CFG_TUSB_MCU == OPT_MCU_RX72N)
74 IEN(PERIB, INTB185) = 0;
75#else
76 IEN(USB0, USBI0) = 0;
77#endif
78}
79
80// MCU specific PHY init
81TU_ATTR_ALWAYS_INLINE static inline void rusb2_phy_init(void)
82{
83#if (CFG_TUSB_MCU == OPT_MCU_RX72N)
84 IR(PERIB, INTB185) = 0;
85#else
86 IR(USB0, USBI0) = 0;
87#endif
88}
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* _RUSB2_RX_H_ */
static TU_ATTR_ALWAYS_INLINE void rusb2_phy_init(void)
Definition: rusb2_rx.h:81
static TU_ATTR_ALWAYS_INLINE void rusb2_int_disable(uint8_t rhport)
Definition: rusb2_rx.h:70
static TU_ATTR_ALWAYS_INLINE void rusb2_module_start(uint8_t rhport, bool start)
Definition: rusb2_rx.h:55
static TU_ATTR_ALWAYS_INLINE rusb2_reg_t * RUSB2_REG(uint8_t rhport)
Definition: rusb2_rx.h:40
static TU_ATTR_ALWAYS_INLINE void rusb2_int_enable(uint8_t rhport)
Definition: rusb2_rx.h:60