Deluge Firmware 1.3.0
Build date: 2025.06.05
Loading...
Searching...
No Matches
usb_state.h
1/*
2 * Copyright © 2024 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#include "RZA1/usb/r_usb_basic/r_usb_basic_if.h"
19#include "definitions.h"
20
21#ifdef __cplusplus
22
23namespace deluge::io::usb {
24
28extern volatile bool usbLock;
29
31class USBAutoLock {
32public:
33 USBAutoLock() { usbLock = true; }
34 ~USBAutoLock() { usbLock = false; }
35
36 USBAutoLock(const USBAutoLock&) = delete;
37 USBAutoLock(USBAutoLock&&) = delete;
38 USBAutoLock& operator=(const USBAutoLock&) = delete;
39 USBAutoLock& operator=(USBAutoLock&&) = delete;
40};
41
43extern bool anythingInUSBOutputBuffer;
44
46extern uint8_t stopSendingAfterDeviceNum[USB_NUM_USBIP];
47
49extern uint8_t usbDeviceNumBeingSentToNow[USB_NUM_USBIP];
50
52extern uint8_t anyUSBSendingStillHappening[USB_NUM_USBIP];
53
55void usbSetup();
56
57} // namespace deluge::io::usb
58
59extern "C" {
60#endif
61
62// defined in r_usb_pdriver.c
63extern uint16_t g_usb_peri_connected;
64
65// defined in r_usb_cdataio.c
66extern usb_utr_t* g_p_usb_pipe[USB_MAX_PIPE_NO + 1u];
67
68extern usb_utr_t g_usb_midi_send_utr[USB_NUM_USBIP];
69extern usb_utr_t g_usb_midi_recv_utr[USB_NUM_USBIP][MAX_NUM_USB_MIDI_DEVICES];
70
71// defined in r_usb_hmidi_driver.c
72extern uint16_t g_usb_hmidi_tmp_ep_tbl[USB_NUM_USBIP][MAX_NUM_USB_MIDI_DEVICES][(USB_EPL * 2) + 1];
73
74// One without, and one with, interrupt endpoints
75extern uint8_t currentDeviceNumWithSendPipe[2];
76
77extern uint16_t g_usb_usbmode;
78
80extern uint32_t timeLastBRDY[USB_NUM_USBIP];
81
83void usb_receive_start_rohan_midi(uint16_t pipe);
84
85// Used when deluge is in host mode.
86//
87// Implemented in root_complex/usb_hosted.cpp
88void usbSendCompleteAsHost(int32_t ip);
89
90// Used when deluge is in peripheral mode.
91//
92// Implemented in root_complex/usb_peripheral.cpp
93void usbSendCompleteAsPeripheral(int32_t ip);
94
95#ifdef __cplusplus
96}
97#endif