Open FFBoard
Open source force feedback firmware
hcd_template.c
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2023 Ha Thach (tinyusb.org)
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#include "tusb_option.h"
28
29#if CFG_TUH_ENABLED && CFG_TUSB_MCU == OPT_MCU_NONE
30
31#include "host/hcd.h"
32
33//--------------------------------------------------------------------+
34// Controller API
35//--------------------------------------------------------------------+
36
37// optional hcd configuration, called by tuh_configure()
38bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param) {
39 (void) rhport;
40 (void) cfg_id;
41 (void) cfg_param;
42
43 return false;
44}
45
46// Initialize controller to host mode
47bool hcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
48 (void) rhport;
49 (void) rh_init;
50 return false;
51}
52
53// Interrupt Handler
54void hcd_int_handler(uint8_t rhport, bool in_isr) {
55 (void) rhport;
56 (void) in_isr;
57}
58
59// Enable USB interrupt
60void hcd_int_enable (uint8_t rhport) {
61 (void) rhport;
62}
63
64// Disable USB interrupt
65void hcd_int_disable(uint8_t rhport) {
66 (void) rhport;
67}
68
69// Get frame number (1ms)
70uint32_t hcd_frame_number(uint8_t rhport) {
71 (void) rhport;
72
73 return 0;
74}
75
76//--------------------------------------------------------------------+
77// Port API
78//--------------------------------------------------------------------+
79
80// Get the current connect status of roothub port
81bool hcd_port_connect_status(uint8_t rhport) {
82 (void) rhport;
83
84 return false;
85}
86
87// Reset USB bus on the port. Return immediately, bus reset sequence may not be complete.
88// Some port would require hcd_port_reset_end() to be invoked after 10ms to complete the reset sequence.
89void hcd_port_reset(uint8_t rhport) {
90 (void) rhport;
91}
92
93// Complete bus reset sequence, may be required by some controllers
94void hcd_port_reset_end(uint8_t rhport) {
95 (void) rhport;
96}
97
98// Get port link speed
100 (void) rhport;
101
102 return TUSB_SPEED_FULL;
103}
104
105// HCD closes all opened endpoints belong to this device
106void hcd_device_close(uint8_t rhport, uint8_t dev_addr) {
107 (void) rhport;
108 (void) dev_addr;
109}
110
111//--------------------------------------------------------------------+
112// Endpoints API
113//--------------------------------------------------------------------+
114
115// Open an endpoint
116bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * ep_desc) {
117 (void) rhport;
118 (void) dev_addr;
119 (void) ep_desc;
120
121 return false;
122}
123
124// Submit a transfer, when complete hcd_event_xfer_complete() must be invoked
125bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen) {
126 (void) rhport;
127 (void) dev_addr;
128 (void) ep_addr;
129 (void) buffer;
130 (void) buflen;
131
132 return false;
133}
134
135// Abort a queued transfer. Note: it can only abort transfer that has not been started
136// Return true if a queued transfer is aborted, false if there is no transfer to abort
137bool hcd_edpt_abort_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr) {
138 (void) rhport;
139 (void) dev_addr;
140 (void) ep_addr;
141
142 return false;
143}
144
145// Submit a special transfer to send 8-byte Setup Packet, when complete hcd_event_xfer_complete() must be invoked
146bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet[8]) {
147 (void) rhport;
148 (void) dev_addr;
149 (void) setup_packet;
150
151 return false;
152}
153
154// clear stall, data toggle is also reset to DATA0
155bool hcd_edpt_clear_stall(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr) {
156 (void) rhport;
157 (void) dev_addr;
158 (void) ep_addr;
159
160 return false;
161}
162
163#endif
static bool in_isr
uint8_t dev_addr
Definition: dcd_pic32mz.c:81
bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet[8])
Definition: hcd_template.c:146
void hcd_int_disable(uint8_t rhport)
Definition: hcd_template.c:65
bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void *cfg_param)
Definition: hcd_template.c:38
bool hcd_edpt_clear_stall(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr)
Definition: hcd_template.c:155
void hcd_int_enable(uint8_t rhport)
Definition: hcd_template.c:60
bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t *buffer, uint16_t buflen)
Definition: hcd_template.c:125
void hcd_device_close(uint8_t rhport, uint8_t dev_addr)
Definition: hcd_template.c:106
bool hcd_edpt_abort_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr)
Definition: hcd_template.c:137
void hcd_port_reset_end(uint8_t rhport)
Definition: hcd_template.c:94
void hcd_port_reset(uint8_t rhport)
Definition: hcd_template.c:89
bool hcd_port_connect_status(uint8_t rhport)
Definition: hcd_template.c:81
uint32_t hcd_frame_number(uint8_t rhport)
Definition: hcd_template.c:70
tusb_speed_t hcd_port_speed_get(uint8_t rhport)
Definition: hcd_template.c:99
void hcd_int_handler(uint8_t rhport, bool in_isr)
Definition: hcd_template.c:54
bool hcd_init(uint8_t rhport, const tusb_rhport_init_t *rh_init)
Definition: hcd_template.c:47
bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const *ep_desc)
Definition: hcd_template.c:116
uint8_t const * buffer
Definition: midi_device.h:100
AUDIO Channel Cluster Descriptor (4.1)
Definition: audio.h:647
tusb_speed_t
defined base on EHCI specs value for Endpoint Speed
Definition: tusb_types.h:49
@ TUSB_SPEED_FULL
Definition: tusb_types.h:50