Changeset 4dfc905 in mainline


Ignore:
Timestamp:
2011-10-29T14:46:52Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
549ff23
Parents:
5400606
Message:

libusbhost: Add doxygen commnets for generice host controller driver.

Fix structure initialization to set all pointers to NULL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r5400606 r4dfc905  
    3838#include <assert.h>
    3939#include <usbhc_iface.h>
     40
    4041#include <usb/host/usb_device_manager.h>
    4142#include <usb/host/usb_endpoint_manager.h>
     
    4445typedef struct hcd hcd_t;
    4546
     47/** Generic host controller driver structure. */
    4648struct hcd {
     49        /** Device manager storing handles and addresses. */
    4750        usb_device_manager_t dev_manager;
     51        /** Endpoint manager. */
    4852        usb_endpoint_manager_t ep_manager;
     53
     54        /** Device specific driver data. */
    4955        void *private_data;
    50 
     56        /** Transfer scheduling, implement in device driver. */
    5157        int (*schedule)(hcd_t *, usb_transfer_batch_t *);
     58        /** Hook called upon registering new endpoint. */
    5259        int (*ep_add_hook)(hcd_t *, endpoint_t *);
     60        /** Hook called upon removing of an endpoint. */
    5361        void (*ep_remove_hook)(hcd_t *, endpoint_t *);
    5462};
    5563/*----------------------------------------------------------------------------*/
     64/** Initialize hcd_t structure.
     65 * Initializes device and endpoint managers. Sets data nd hook pointer to NULL.
     66 * @param hcd hcd_t structure to initialize, non-null.
     67 * @param bandwidth Available bandwidth, passed to endpoint manager.
     68 * @param bw_count Bandwidth compute function, passed to endpoint manager.
     69 */
    5670static inline void hcd_init(hcd_t *hcd, size_t bandwidth,
    5771    size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t))
     
    6074        usb_device_manager_init(&hcd->dev_manager);
    6175        usb_endpoint_manager_init(&hcd->ep_manager, bandwidth, bw_count);
     76        hcd->private_data = NULL;
     77        hcd->schedule = NULL;
     78        hcd->ep_add_hook = NULL;
     79        hcd->ep_remove_hook = NULL;
    6280}
    6381/*----------------------------------------------------------------------------*/
    64 static inline void reset_ep_if_need(
    65     hcd_t *hcd, usb_target_t target, const char* setup_data)
     82/** Check registered endpoints and reset toggle bit if necessary.
     83 * @param hcd hcd_t structure, non-null.
     84 * @param target Control communication target.
     85 * @param setup_data Setup packet of the control communication.
     86 */
     87static inline void reset_ep_if_need(hcd_t *hcd, usb_target_t target,
     88    const char setup_data[8])
    6689{
    6790        assert(hcd);
     
    7093}
    7194/*----------------------------------------------------------------------------*/
     95/** Data retrieve wrapper.
     96 * @param fun ddf function, non-null.
     97 * @return pointer cast to hcd_t*.
     98 */
    7299static inline hcd_t * fun_to_hcd(ddf_fun_t *fun)
    73100{
Note: See TracChangeset for help on using the changeset viewer.