summaryrefslogtreecommitdiff
path: root/src/typec/utcd.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-06-12 16:42:27 +0700
committerhathach <[email protected]>2023-06-12 16:42:27 +0700
commit6941a5af81b53cd0df52632d403cccdb7d22cf30 (patch)
tree2ae2aa6214287c3b995f6f9bfebbc93680d29cd6 /src/typec/utcd.h
parentc28503060c0c3cb09d8e2ce63d1b0009affbdf72 (diff)
wrap up initial PD support for G4
Diffstat (limited to 'src/typec/utcd.h')
-rw-r--r--src/typec/utcd.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/typec/utcd.h b/src/typec/utcd.h
index 740e477ac..9fbff9bc6 100644
--- a/src/typec/utcd.h
+++ b/src/typec/utcd.h
@@ -52,6 +52,17 @@ bool tuc_init(uint8_t rhport, uint32_t port_type);
// Check if typec port is initialized
bool tuc_inited(uint8_t rhport);
+// Task function should be called in main/rtos loop, extended version of tud_task()
+// - timeout_ms: millisecond to wait, zero = no wait, 0xFFFFFFFF = wait forever
+// - in_isr: if function is called in ISR
+void tuc_task_ext(uint32_t timeout_ms, bool in_isr);
+
+// Task function should be called in main/rtos loop
+TU_ATTR_ALWAYS_INLINE static inline
+void tuc_task (void) {
+ tuc_task_ext(UINT32_MAX, false);
+}
+
#ifndef _TUSB_TCD_H_
extern void tcd_int_handler(uint8_t rhport);
#endif
@@ -60,9 +71,18 @@ extern void tcd_int_handler(uint8_t rhport);
#define tuc_int_handler tcd_int_handler
//--------------------------------------------------------------------+
+// Callbacks
+//--------------------------------------------------------------------+
+
+TU_ATTR_WEAK bool tuc_pd_data_received_cb(uint8_t rhport, pd_header_t const* header, uint8_t const* dobj, uint8_t const* p_end);
+TU_ATTR_WEAK bool tuc_pd_control_received_cb(uint8_t rhport, pd_header_t const* header);
+
+//--------------------------------------------------------------------+
//
//--------------------------------------------------------------------+
+bool tuc_msg_request(uint8_t rhport, void const* rdo);
+
#ifdef __cplusplus
}