1 #ifndef __SYS_API_USB_CDC_H__ 2 #define __SYS_API_USB_CDC_H__ 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include "tool_msg.h" 9 #include "hal_trace.h" 10 #include "hal_timer.h" 11 12 #define TRACE_TIME(str, ...) TRACE("[%05u] " str, TICKS_TO_MS(hal_sys_timer_get()), ##__VA_ARGS__) 13 14 extern const unsigned int default_recv_timeout_short; 15 extern const unsigned int default_recv_timeout_idle; 16 extern const unsigned int default_recv_timeout_4k_data; 17 extern const unsigned int default_send_timeout; 18 19 void reset_transport(void); 20 21 void set_recv_timeout(unsigned int timeout); 22 void set_send_timeout(unsigned int timeout); 23 24 int send_data(const unsigned char *buf, size_t len); 25 int recv_data_ex(unsigned char *buf, size_t len, size_t expect, size_t *rlen); 26 int handle_error(void); 27 int cancel_input(void); 28 29 void system_reboot(void); 30 void system_shutdown(void); 31 void system_flash_boot(void); 32 void system_set_bootmode(unsigned int bootmode); 33 void system_clear_bootmode(unsigned int bootmode); 34 unsigned int system_get_bootmode(void); 35 36 #ifdef __cplusplus 37 } 38 #endif 39 40 #endif 41 42