Skip to content

Commit 7ce179d

Browse files
committed
dcd: sam3u: add sam3u from template
Signed-off-by: Rafael Silva <[email protected]>
1 parent ecb100a commit 7ce179d

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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_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
43+
void dcd_init (uint8_t rhport)
44+
{
45+
(void) rhport;
46+
}
47+
48+
// Enable device interrupt
49+
void dcd_int_enable (uint8_t rhport)
50+
{
51+
(void) rhport;
52+
}
53+
54+
// Disable device interrupt
55+
void dcd_int_disable (uint8_t rhport)
56+
{
57+
(void) rhport;
58+
}
59+
60+
// Receive Set Address request, mcu port must also include status IN response
61+
void dcd_set_address (uint8_t rhport, uint8_t dev_addr)
62+
{
63+
(void) rhport;
64+
(void) dev_addr;
65+
}
66+
67+
// Wake up host
68+
void dcd_remote_wakeup (uint8_t rhport)
69+
{
70+
(void) rhport;
71+
}
72+
73+
// Connect by enabling internal pull-up resistor on D+/D-
74+
void dcd_connect(uint8_t rhport)
75+
{
76+
(void) rhport;
77+
}
78+
79+
// Disconnect by disabling internal pull-up resistor on D+/D-
80+
void dcd_disconnect(uint8_t rhport)
81+
{
82+
(void) rhport;
83+
}
84+
85+
//--------------------------------------------------------------------+
86+
// Endpoint API
87+
//--------------------------------------------------------------------+
88+
89+
// Configure endpoint's registers according to descriptor
90+
bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * ep_desc)
91+
{
92+
(void) rhport;
93+
(void) ep_desc;
94+
return false;
95+
}
96+
97+
// Submit a transfer, When complete dcd_event_xfer_complete() is invoked to notify the stack
98+
bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
99+
{
100+
(void) rhport;
101+
(void) ep_addr;
102+
(void) buffer;
103+
(void) total_bytes;
104+
return false;
105+
}
106+
107+
// 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
108+
bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes)
109+
{
110+
(void) rhport;
111+
(void) ep_addr;
112+
(void) ff;
113+
(void) total_bytes;
114+
return false;
115+
}
116+
117+
// Stall endpoint
118+
void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr)
119+
{
120+
(void) rhport;
121+
(void) ep_addr;
122+
}
123+
124+
// clear stall, data toggle is also reset to DATA0
125+
void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr)
126+
{
127+
(void) rhport;
128+
(void) ep_addr;
129+
}
130+
131+
#endif

src/tusb_option.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#define OPT_MCU_SAMD11 204 ///< MicroChip SAMD11
6363
#define OPT_MCU_SAML22 205 ///< MicroChip SAML22
6464
#define OPT_MCU_SAML21 206 ///< MicroChip SAML21
65+
#define OPT_MCU_SAM3U 207 ///< MicroChip SAM3U
6566

6667
// STM32
6768
#define OPT_MCU_STM32F0 300 ///< ST STM32F0

0 commit comments

Comments
 (0)