eclipse-threadx / usbx

Eclipse ThreadX - USBX is a high-performance USB host, device, and on-the-go (OTG) embedded stack, that is fully integrated with Eclipse ThreadX RTOS
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/usbx/index.md
MIT License
148 stars 88 forks source link

Watchdog for USB application thread #96

Closed MaJerle closed 3 months ago

MaJerle commented 1 year ago

Is your feature request related to a problem? Please describe. Use of RTOS commonly involved having software+hardware watchdog to ensure threads are working properly. When using CDC ACM class, application thread doing read/write operations blocks forever and does not provide a "keep-alive" option to implement watchdog.

Describe the solution you'd like I'd like to have an option to block read/write threads for max time and get error back if it failed to do the operation. I'd like to have an option for USB core thread to call custom macro (that can be implemented by user) to update "keep alive" status and reset software watchdog.

Describe alternatives you've considered A macro + option for thread timeouts

Additional context None

xiaocq2001 commented 1 year ago

Thanks for the feedback.

For host, the timeout macro is defined here.

For device, the timeout is changed through ioctl function, e.g.,

ux_device_class_cdc_acm_ioctl(cdc_acm, UX_SLAVE_CLASS_CDC_ACM_IOCTL_SET_READ_TIMEOUT, 30/* passed to semephore wait */);