Changeset 8989f48f in mainline for uspace/lib/usb/include/usb/devpoll.h
- Timestamp:
- 2011-04-14T10:03:20Z (12 years ago)
- Branches:
- lfn, master, serial
- Children:
- 5e168be1
- Parents:
- 5e07e2b5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/devpoll.h
r5e07e2b5 r8989f48f 37 37 38 38 #include <usb/devdrv.h> 39 #include <time.h> 40 41 typedef struct { 42 /** Maximum number of consecutive errors before polling termination. */ 43 size_t max_failures; 44 /** Delay between poll requests in milliseconds. 45 * Set to negative value to use value from endpoint descriptor. 46 */ 47 int delay; 48 /** Whether to automatically try to clear the HALT feature after 49 * the endpoint stalls. 50 */ 51 bool auto_clear_halt; 52 /** Callback when data arrives. 53 * 54 * @param dev Device that was polled. 55 * @param data Data buffer (in USB endianness). 56 * @param data_size Size of the @p data buffer in bytes. 57 * @param arg Custom argument. 58 * @return Whether to continue in polling. 59 */ 60 bool (*on_data)(usb_device_t *dev, uint8_t *data, size_t data_size, 61 void *arg); 62 /** Callback when polling is terminated. 63 * 64 * @param dev Device where the polling was terminated. 65 * @param due_to_errors Whether polling stopped due to several failures. 66 * @param arg Custom argument. 67 */ 68 void (*on_polling_end)(usb_device_t *dev, bool due_to_errors, 69 void *arg); 70 /** Callback when error occurs. 71 * 72 * @param dev Device where error occurred. 73 * @param err_code Error code (as returned from usb_pipe_read). 74 * @param arg Custom argument. 75 * @return Whether to continue in polling. 76 */ 77 bool (*on_error)(usb_device_t *dev, int err_code, void *arg); 78 } usb_device_auto_polling_t; 79 80 int usb_device_auto_polling(usb_device_t *, size_t, usb_device_auto_polling_t *, 81 size_t, void *); 39 82 40 83 typedef bool (*usb_polling_callback_t)(usb_device_t *,
Note: See TracChangeset
for help on using the changeset viewer.