Open FFBoard
Open source force feedback firmware
dcd_template.c
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2018, hathach (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_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_NONE
30
31#include "device/dcd.h"
32
33//--------------------------------------------------------------------+
34// MACRO TYPEDEF CONSTANT ENUM DECLARATION
35//--------------------------------------------------------------------+
36
37
38/*------------------------------------------------------------------*/
39/* Device API
40 *------------------------------------------------------------------*/
41
42// Initialize controller to device mode
43bool dcd_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
44 (void) rhport; (void) rh_init;
45 return true;
46}
47
48// Enable device interrupt
49void dcd_int_enable (uint8_t rhport) {
50 (void) rhport;
51}
52
53// Disable device interrupt
54void dcd_int_disable (uint8_t rhport) {
55 (void) rhport;
56}
57
58// Receive Set Address request, mcu port must also include status IN response
59void dcd_set_address (uint8_t rhport, uint8_t dev_addr) {
60 (void) rhport;
61 (void) dev_addr;
62}
63
64// Wake up host
65void dcd_remote_wakeup (uint8_t rhport) {
66 (void) rhport;
67}
68
69// Connect by enabling internal pull-up resistor on D+/D-
70void dcd_connect(uint8_t rhport) {
71 (void) rhport;
72}
73
74// Disconnect by disabling internal pull-up resistor on D+/D-
75void dcd_disconnect(uint8_t rhport) {
76 (void) rhport;
77}
78
79void dcd_sof_enable(uint8_t rhport, bool en) {
80 (void) rhport;
81 (void) en;
82}
83
84//--------------------------------------------------------------------+
85// Endpoint API
86//--------------------------------------------------------------------+
87
88// Configure endpoint's registers according to descriptor
89bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * ep_desc) {
90 (void) rhport;
91 (void) ep_desc;
92 return false;
93}
94
95// Allocate packet buffer used by ISO endpoints
96// Some MCU need manual packet buffer allocation, we allocate the largest size to avoid clustering
97bool dcd_edpt_iso_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t largest_packet_size) {
98 (void) rhport;
99 (void) ep_addr;
100 (void) largest_packet_size;
101 return false;
102}
103
104// Configure and enable an ISO endpoint according to descriptor
105bool dcd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const * desc_ep) {
106 (void) rhport;
107 (void) desc_ep;
108 return false;
109}
110
111void dcd_edpt_close_all (uint8_t rhport) {
112 (void) rhport;
113}
114
115// Submit a transfer, When complete dcd_event_xfer_complete() is invoked to notify the stack
116bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes) {
117 (void) rhport;
118 (void) ep_addr;
119 (void) buffer;
120 (void) total_bytes;
121 return false;
122}
123
124// Submit a transfer where is managed by FIFO, When complete dcd_event_xfer_complete() is invoked to notify the stack - optional, however, must be listed in usbd.c
125bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) {
126 (void) rhport;
127 (void) ep_addr;
128 (void) ff;
129 (void) total_bytes;
130 return false;
131}
132
133// Stall endpoint
134void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr) {
135 (void) rhport;
136 (void) ep_addr;
137}
138
139// clear stall, data toggle is also reset to DATA0
140void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) {
141 (void) rhport;
142 (void) ep_addr;
143}
144
145#endif
uint16_t total_bytes
Definition: dcd_nuc505.c:113
uint8_t dev_addr
Definition: dcd_pic32mz.c:81
bool dcd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const *desc_ep)
Definition: dcd_template.c:105
bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t *ff, uint16_t total_bytes)
Definition: dcd_template.c:125
void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr)
Definition: dcd_template.c:134
void dcd_disconnect(uint8_t rhport)
Definition: dcd_template.c:75
void dcd_edpt_close_all(uint8_t rhport)
Definition: dcd_template.c:111
void dcd_int_disable(uint8_t rhport)
Definition: dcd_template.c:54
bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *ep_desc)
Definition: dcd_template.c:89
void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr)
Definition: dcd_template.c:140
void dcd_connect(uint8_t rhport)
Definition: dcd_template.c:70
bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t total_bytes)
Definition: dcd_template.c:116
void dcd_set_address(uint8_t rhport, uint8_t dev_addr)
Definition: dcd_template.c:59
bool dcd_init(uint8_t rhport, const tusb_rhport_init_t *rh_init)
Definition: dcd_template.c:43
bool dcd_edpt_iso_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t largest_packet_size)
Definition: dcd_template.c:97
void dcd_int_enable(uint8_t rhport)
Definition: dcd_template.c:49
void dcd_remote_wakeup(uint8_t rhport)
Definition: dcd_template.c:65
void dcd_sof_enable(uint8_t rhport, bool en)
Definition: dcd_template.c:79
uint8_t const * buffer
Definition: midi_device.h:100
AUDIO Channel Cluster Descriptor (4.1)
Definition: audio.h:647