Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset cbd568b in mainline


Ignore:
Timestamp:
2011-12-14T13:49:01Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
bdb23c63
Parents:
c59dbdd5
Message:

libsusbhost: Doxygen.

Location:
uspace/lib/usbhost/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/iface.c

    rc59dbdd5 rcbd568b  
    3939#include <usb/host/hcd.h>
    4040
     41/** Prepare generic usb_transfer_batch and schedule it.
     42 * @param fun DDF fun
     43 * @param target address and endpoint number.
     44 * @param setup_data Data to use in setup stage (Control communication type)
     45 * @param in Callback for device to host communication.
     46 * @param out Callback for host to device communication.
     47 * @param arg Callback parameter.
     48 * @param name Communication identifier (for nicer output).
     49 * @return Error code.
     50 */
    4151static inline int send_batch(
    4252    ddf_fun_t *fun, usb_target_t target, usb_direction_t direction,
     
    8999}
    90100/*----------------------------------------------------------------------------*/
     101/** Calls ep_add_hook upon endpoint registration.
     102 * @param ep Endpoint to be registered.
     103 * @param arg hcd_t in disguise.
     104 * @return Error code.
     105 */
    91106static int register_helper(endpoint_t *ep, void *arg)
    92107{
     
    99114}
    100115/*----------------------------------------------------------------------------*/
     116/** Calls ep_remove_hook upon endpoint removal.
     117 * @param ep Endpoint to be unregistered.
     118 * @param arg hcd_t in disguise.
     119 */
    101120static void unregister_helper(endpoint_t *ep, void *arg)
    102121{
     
    108127}
    109128/*----------------------------------------------------------------------------*/
     129/** Calls ep_remove_hook upon endpoint removal. Prints warning.
     130 * @param ep Endpoint to be unregistered.
     131 * @param arg hcd_t in disguise.
     132 */
    110133static void unregister_helper_warn(endpoint_t *ep, void *arg)
    111134{
     
    119142}
    120143/*----------------------------------------------------------------------------*/
    121 /** Request address interface function
     144/** Request address interface function.
    122145 *
    123146 * @param[in] fun DDF function that was called.
     147 * @param[in] address Pointer to preferred USB address.
     148 * @param[out] address Place to write a new address.
     149 * @param[in] strict Fail if the preferred address is not available.
    124150 * @param[in] speed Speed to associate with the new default address.
    125  * @param[out] address Place to write a new address.
    126151 * @return Error code.
    127152 */
     
    140165}
    141166/*----------------------------------------------------------------------------*/
    142 /** Bind address interface function
     167/** Bind address interface function.
    143168 *
    144169 * @param[in] fun DDF function that was called.
     
    148173 */
    149174static int bind_address(
    150   ddf_fun_t *fun, usb_address_t address, devman_handle_t handle)
     175    ddf_fun_t *fun, usb_address_t address, devman_handle_t handle)
    151176{
    152177        assert(fun);
     
    176201}
    177202/*----------------------------------------------------------------------------*/
    178 /** Release address interface function
     203/** Release address interface function.
    179204 *
    180205 * @param[in] fun DDF function that was called.
     
    194219}
    195220/*----------------------------------------------------------------------------*/
     221/** Register endpoint interface function.
     222 * @param fun DDF function.
     223 * @param address USB address of the device.
     224 * @param endpoint USB endpoint number to be registered.
     225 * @param transfer_type Endpoint's transfer type.
     226 * @param direction USB communication direction the endpoint is capable of.
     227 * @param max_packet_size Maximu size of packets the endpoint accepts.
     228 * @param interval Preferred timeout between communication.
     229 * @return Error code.
     230 */
    196231static int register_endpoint(
    197232    ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint,
    198233    usb_transfer_type_t transfer_type, usb_direction_t direction,
    199     size_t max_packet_size, unsigned int interval)
     234    size_t max_packet_size, unsigned interval)
    200235{
    201236        assert(fun);
     
    220255}
    221256/*----------------------------------------------------------------------------*/
     257/** Unregister endpoint interface function.
     258 * @param fun DDF function.
     259 * @param address USB address of the endpoint.
     260 * @param endpoint USB endpoint number.
     261 * @param direction Communication direction of the enpdoint to unregister.
     262 * @return Error code.
     263 */
    222264static int unregister_endpoint(
    223265    ddf_fun_t *fun, usb_address_t address,
     
    233275}
    234276/*----------------------------------------------------------------------------*/
     277/** Inbound communication interface function.
     278 * @param fun DDF function.
     279 * @param target Communication target.
     280 * @param setup_data Data to use in setup stage (control transfers).
     281 * @param data Pointer to data buffer.
     282 * @param size Size of the data buffer.
     283 * @param callback Function to call on communication end.
     284 * @param arg Argument passed to the callback function.
     285 * @return Error code.
     286 */
    235287static int usb_read(ddf_fun_t *fun, usb_target_t target, uint64_t setup_data,
    236288    uint8_t *data, size_t size, usbhc_iface_transfer_in_callback_t callback,
     
    241293}
    242294/*----------------------------------------------------------------------------*/
     295/** Outbound communication interface function.
     296 * @param fun DDF function.
     297 * @param target Communication target.
     298 * @param setup_data Data to use in setup stage (control transfers).
     299 * @param data Pointer to data buffer.
     300 * @param size Size of the data buffer.
     301 * @param callback Function to call on communication end.
     302 * @param arg Argument passed to the callback function.
     303 * @return Error code.
     304 */
    243305static int usb_write(ddf_fun_t *fun, usb_target_t target, uint64_t setup_data,
    244306    const uint8_t *data, size_t size,
     
    249311}
    250312/*----------------------------------------------------------------------------*/
     313/** usbhc Interface implementation using hcd_t from libusbhost library. */
    251314usbhc_iface_t hcd_iface = {
    252315        .request_address = request_address,
  • uspace/lib/usbhost/src/usb_device_manager.c

    rc59dbdd5 rcbd568b  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup libusbhost
    3029 * @{
     
    4140 *
    4241 * @param[in] instance Device manager structure to use.
    43  * @param[in] speed Speed of the device requiring address.
    4442 * @return Free address, or error code.
    4543 */
     
    133131 * @param[in] handle Devman handle of the device.
    134132 * @return Error code.
     133 * @note Won't accept binding for default address.
    135134 */
    136135int usb_device_manager_bind_address(usb_device_manager_t *instance,
     
    184183}
    185184/*----------------------------------------------------------------------------*/
    186 /** Find USB address associated with the device
     185/** Find USB address associated with the device.
    187186 *
    188187 * @param[in] instance Device manager structure to use.
     
    208207/*----------------------------------------------------------------------------*/
    209208/** Find devman handle and speed assigned to USB address.
    210  * Intentionally refuse to work on default address.
    211209 *
    212210 * @param[in] instance Device manager structure to use.
  • uspace/lib/usbhost/src/usb_endpoint_manager.c

    rc59dbdd5 rcbd568b  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28/**  @addtogroup libusbhost
     29 * @{
     30 */
     31/** @file
     32 * HC Endpoint management.
     33 */
    2834
    2935#include <bool.h>
     
    5662}
    5763/*----------------------------------------------------------------------------*/
    58 /** Get list that holds endpints for given address.
     64/** Get list that holds endpoints for given address.
    5965 * @param instance usb_endpoint_manager structure, non-null.
    6066 * @param addr USB address, must be >= 0.
     
    7581 * @return Pointer to endpoint_t structure representing given communication
    7682 * target, NULL if there is no such endpoint registered.
     83 * @note Assumes that the internal mutex is locked.
    7784 */
    7885static endpoint_t * find_locked(usb_endpoint_manager_t *instance,
     
    169176 *
    170177 * Really ugly one. Resets toggle bit on all endpoints that need it.
     178 * @TODO Use tools from libusbdev requests.h
    171179 */
    172180void usb_endpoint_manager_reset_eps_if_need(usb_endpoint_manager_t *instance,
     
    184192        case 0x01: /* Clear Feature -- resets only cleared ep */
    185193                /* Recipient is endpoint, value is zero (ENDPOINT_STALL) */
     194                // TODO Use macros in libusbdev requests.h
    186195                if (((data[0] & 0xf) == 1) && ((data[2] | data[3]) == 0)) {
    187196                        fibril_mutex_lock(&instance->guard);
     
    202211                /* Recipient must be device, this resets all endpoints,
    203212                 * In fact there should be no endpoints but EP 0 registered
    204                  * as different interfaces use different endpoints. */
     213                 * as different interfaces use different endpoints,
     214                 * unless you're changing configuration or alternative
     215                 * interface of an already setup device. */
    205216                if ((data[0] & 0xf) == 0) {
    206217                        fibril_mutex_lock(&instance->guard);
     
    385396}
    386397/*----------------------------------------------------------------------------*/
     398/** Unregister and destroy all endpoints using given address.
     399 * @param instance usb_endpoint_manager structure, non-null.
     400 * @param address USB address.
     401 * @param endpoint USB endpoint number.
     402 * @param direction Communication direction.
     403 * @param callback Function to call after unregister, before destruction.
     404 * @arg Argument to pass to the callback function.
     405 * @return Error code.
     406 */
    387407void usb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance,
    388408    usb_address_t address, void (*callback)(endpoint_t *, void *), void *arg)
     
    403423        fibril_mutex_unlock(&instance->guard);
    404424}
     425/**
     426 * @}
     427 */
  • uspace/lib/usbhost/src/usb_transfer_batch.c

    rc59dbdd5 rcbd568b  
    4848 * @param func_in callback on IN transfer completion.
    4949 * @param func_out callback on OUT transfer completion.
     50 * @param fun DDF function (passed to callback function).
    5051 * @param arg Argument to pass to the callback function.
    5152 * @param private_data driver specific per batch data.
Note: See TracChangeset for help on using the changeset viewer.