Ignore:
Timestamp:
2018-01-13T20:47:58Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8a0c52a
Parents:
7dddd7b
git-author:
Petr Manek <petr.manek@…> (2018-01-13 20:44:08)
git-committer:
Petr Manek <petr.manek@…> (2018-01-13 20:47:58)
Message:

usbdev: refactor polling data structs

Symbols related to USB device endpoint polling have been moved around
and renamed in this commit.

usb_device_auto_polling_t, which has the semantics of a configuration
parameter struct, has been renamed to usb_device_polling_config_t.

usb_device_auto_polling() is now called usb_device_poll().

A new data structure, usb_device_polling_t, has been introduced to
serve as a user handle to the active polling process (WIP).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/include/usb/dev/poll.h

    r7dddd7b r71f211f  
    4444#include <stdint.h>
    4545
     46/** Automated polling instance. */
     47typedef struct usb_device_polling usb_device_polling_t;
     48
    4649/** Parameters and callbacks for automated polling. */
    47 typedef struct {
     50typedef struct usb_device_polling_config {
    4851        /** Level of debugging messages from auto polling.
    4952         * 0 - nothing
     
    5255         */
    5356        int debug;
     57
    5458        /** Maximum number of consecutive errors before polling termination. */
    5559        size_t max_failures;
     60
    5661        /** Delay between poll requests in milliseconds.
    5762         * Set to negative value to use value from endpoint descriptor.
    5863         */
    5964        int delay;
     65
    6066        /** Whether to automatically try to clear the HALT feature after
    6167         * the endpoint stalls.
    6268         */
    6369        bool auto_clear_halt;
     70
    6471        /** Callback when data arrives.
    6572         *
     
    7279        bool (*on_data)(usb_device_t *dev, uint8_t *data, size_t data_size,
    7380            void *arg);
     81
    7482        /** Callback when polling is terminated.
    7583         *
     
    8088        void (*on_polling_end)(usb_device_t *dev, bool due_to_errors,
    8189            void *arg);
     90
    8291        /** Callback when error occurs.
    8392         *
     
    8897         */
    8998        bool (*on_error)(usb_device_t *dev, int err_code, void *arg);
     99
    90100        /** Argument to pass to callbacks. */
    91101        void *arg;
    92 } usb_device_auto_polling_t;
     102} usb_device_polling_config_t;
    93103
    94 typedef bool (*usb_polling_callback_t)(usb_device_t *, uint8_t *, size_t, void *);
    95 typedef bool (*usb_polling_error_callback_t)(usb_device_t *, int, void *);
    96 typedef void (*usb_polling_terminted_callback_t)(usb_device_t *, bool, void *);
    97 
    98 extern int usb_device_auto_polling(usb_device_t *, usb_endpoint_mapping_t *,
    99     const usb_device_auto_polling_t *, size_t);
     104extern int usb_device_poll(usb_device_t *, usb_endpoint_mapping_t *,
     105    const usb_device_polling_config_t *, size_t, usb_device_polling_t **);
    100106
    101107#endif
Note: See TracChangeset for help on using the changeset viewer.