Skip to content

Commit 05969d2

Browse files
committed
rename typec driver
1 parent a88d7c7 commit 05969d2

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function(add_tinyusb TARGET)
3333
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/msc/msc_host.c
3434
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_host.c
3535
# typec
36-
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/typec/utcd.c
36+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/typec/usbc.c
3737
)
3838
target_include_directories(${TARGET} PUBLIC
3939
${CMAKE_CURRENT_FUNCTION_LIST_DIR}

src/tusb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
//------------- TypeC -------------//
4444
#if CFG_TUC_ENABLED
45-
#include "typec/utcd.h"
45+
#include "typec/usbc.h"
4646
#endif
4747

4848
//------------- HOST -------------//

src/typec/utcd.c renamed to src/typec/usbc.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@
2929
#if CFG_TUC_ENABLED
3030

3131
#include "tcd.h"
32-
#include "utcd.h"
32+
#include "usbc.h"
3333

3434
//--------------------------------------------------------------------+
3535
//
3636
//--------------------------------------------------------------------+
3737

3838
// Debug level of USBD
39-
#define UTCD_DEBUG 2
40-
#define TU_LOG_UTCD(...) TU_LOG(UTCD_DEBUG, __VA_ARGS__)
39+
#define USBC_DEBUG 2
40+
#define TU_LOG_USBC(...) TU_LOG(USBC_DEBUG, __VA_ARGS__)
4141

4242
// Event queue
43-
// utcd_int_set() is used as mutex in OS NONE config
44-
void utcd_int_set(bool enabled);
45-
OSAL_QUEUE_DEF(utcd_int_set, _utcd_qdef, CFG_TUC_TASK_QUEUE_SZ, tcd_event_t);
46-
tu_static osal_queue_t _utcd_q;
43+
// usbc_int_set() is used as mutex in OS NONE config
44+
void usbc_int_set(bool enabled);
45+
OSAL_QUEUE_DEF(usbc_int_set, _usbc_qdef, CFG_TUC_TASK_QUEUE_SZ, tcd_event_t);
46+
tu_static osal_queue_t _usbc_q;
4747

4848
// if stack is initialized
49-
static bool _utcd_inited = false;
49+
static bool _usbc_inited = false;
5050

5151
// if port is initialized
5252
static bool _port_inited[TUP_TYPEC_RHPORTS_NUM];
@@ -55,35 +55,35 @@ static bool _port_inited[TUP_TYPEC_RHPORTS_NUM];
5555
static uint8_t _rx_buf[64] TU_ATTR_ALIGNED(4);
5656
static uint8_t _tx_buf[64] TU_ATTR_ALIGNED(4);
5757

58-
bool utcd_msg_send(uint8_t rhport, pd_header_t const* header, void const* data);
58+
bool usbc_msg_send(uint8_t rhport, pd_header_t const* header, void const* data);
5959
bool parse_msg_data(uint8_t rhport, pd_header_t const* header, uint8_t const* dobj, uint8_t const* p_end);
6060
bool parse_msg_control(uint8_t rhport, pd_header_t const* header);
6161

6262
//--------------------------------------------------------------------+
6363
//
6464
//--------------------------------------------------------------------+
6565
bool tuc_inited(uint8_t rhport) {
66-
return _utcd_inited && _port_inited[rhport];
66+
return _usbc_inited && _port_inited[rhport];
6767
}
6868

6969
bool tuc_init(uint8_t rhport, uint32_t port_type) {
7070
// Initialize stack
71-
if (!_utcd_inited) {
71+
if (!_usbc_inited) {
7272
tu_memclr(_port_inited, sizeof(_port_inited));
7373

74-
_utcd_q = osal_queue_create(&_utcd_qdef);
75-
TU_ASSERT(_utcd_q != NULL);
74+
_usbc_q = osal_queue_create(&_usbc_qdef);
75+
TU_ASSERT(_usbc_q != NULL);
7676

77-
_utcd_inited = true;
77+
_usbc_inited = true;
7878
}
7979

8080
// skip if port already initialized
8181
if ( _port_inited[rhport] ) {
8282
return true;
8383
}
8484

85-
TU_LOG_UTCD("UTCD init on port %u\r\n", rhport);
86-
TU_LOG_INT(UTCD_DEBUG, sizeof(tcd_event_t));
85+
TU_LOG_USBC("USBC init on port %u\r\n", rhport);
86+
TU_LOG_INT(USBC_DEBUG, sizeof(tcd_event_t));
8787

8888
TU_ASSERT(tcd_init(rhport, port_type));
8989
tcd_int_enable(rhport);
@@ -96,12 +96,12 @@ void tuc_task_ext(uint32_t timeout_ms, bool in_isr) {
9696
(void) in_isr; // not implemented yet
9797

9898
// Skip if stack is not initialized
99-
if (!_utcd_inited) return;
99+
if (!_usbc_inited) return;
100100

101101
// Loop until there is no more events in the queue
102102
while (1) {
103103
tcd_event_t event;
104-
if (!osal_queue_receive(_utcd_q, &event, timeout_ms)) return;
104+
if (!osal_queue_receive(_usbc_q, &event, timeout_ms)) return;
105105

106106
switch (event.event_id) {
107107
case TCD_EVENT_CC_CHANGED:
@@ -155,7 +155,7 @@ bool parse_msg_control(uint8_t rhport, pd_header_t const* header) {
155155
//
156156
//--------------------------------------------------------------------+
157157

158-
bool utcd_msg_send(uint8_t rhport, pd_header_t const* header, void const* data) {
158+
bool usbc_msg_send(uint8_t rhport, pd_header_t const* header, void const* data) {
159159
// copy header
160160
memcpy(_tx_buf, header, sizeof(pd_header_t));
161161

@@ -179,7 +179,7 @@ bool tuc_msg_request(uint8_t rhport, void const* rdo) {
179179
.extended = 0,
180180
};
181181

182-
return utcd_msg_send(rhport, &header, rdo);
182+
return usbc_msg_send(rhport, &header, rdo);
183183
}
184184

185185
void tcd_event_handler(tcd_event_t const * event, bool in_isr) {
@@ -197,13 +197,13 @@ void tcd_event_handler(tcd_event_t const * event, bool in_isr) {
197197
default: break;
198198
}
199199

200-
osal_queue_send(_utcd_q, event, in_isr);
200+
osal_queue_send(_usbc_q, event, in_isr);
201201
}
202202

203203
//--------------------------------------------------------------------+
204204
//
205205
//--------------------------------------------------------------------+
206-
void utcd_int_set(bool enabled) {
206+
void usbc_int_set(bool enabled) {
207207
// Disable all controllers since they shared the same event queue
208208
for (uint8_t p = 0; p < TUP_TYPEC_RHPORTS_NUM; p++) {
209209
if ( _port_inited[p] ) {
File renamed without changes.

0 commit comments

Comments
 (0)