Changeset e34e77a in mainline


Ignore:
Timestamp:
2011-03-21T14:33:50Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1387692
Parents:
68b5ed6e
Message:

Formatting and comments

No change in functionality

Location:
uspace/lib/usb
Files:
2 edited

Legend:

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

    r68b5ed6e re34e77a  
    3131 */
    3232/** @file
    33  * @brief UHCI driver
     33 * Device keeper structure and functions.
     34 *
     35 * Typical USB host controller needs to keep track of various settings for
     36 * each device that is connected to it.
     37 * State of toggle bit, device speed etc. etc.
     38 * This structure shall simplify the management.
    3439 */
    3540#ifndef LIBUSB_HOST_DEVICE_KEEPER_H
     
    3944#include <usb/usb.h>
    4045
     46/** Number of USB address for array dimensions. */
    4147#define USB_ADDRESS_COUNT (USB11_ADDRESS_MAX + 1)
    4248
     49/** Information about attached USB device. */
    4350struct usb_device_info {
    4451        usb_speed_t speed;
     
    4855};
    4956
     57/** Host controller device keeper.
     58 * You shall not access members directly but only using functions below.
     59 */
    5060typedef struct {
    5161        struct usb_device_info devices[USB_ADDRESS_COUNT];
     
    5767void usb_device_keeper_init(usb_device_keeper_t *instance);
    5868
    59 void usb_device_keeper_reserve_default_address(
    60     usb_device_keeper_t *instance, usb_speed_t speed);
     69void usb_device_keeper_reserve_default_address(usb_device_keeper_t *instance,
     70    usb_speed_t speed);
    6171
    6272void usb_device_keeper_release_default_address(usb_device_keeper_t *instance);
    6373
    64 void usb_device_keeper_reset_if_need(
    65     usb_device_keeper_t *instance, usb_target_t target,
    66     const unsigned char *setup_data);
     74void usb_device_keeper_reset_if_need(usb_device_keeper_t *instance,
     75    usb_target_t target,
     76    const uint8_t *setup_data);
    6777
    68 int usb_device_keeper_get_toggle(
    69     usb_device_keeper_t *instance, usb_target_t target, usb_direction_t direction);
     78int usb_device_keeper_get_toggle(usb_device_keeper_t *instance,
     79    usb_target_t target, usb_direction_t direction);
    7080
    7181int usb_device_keeper_set_toggle(usb_device_keeper_t *instance,
    7282    usb_target_t target, usb_direction_t direction, bool toggle);
    7383
    74 usb_address_t device_keeper_get_free_address(
    75     usb_device_keeper_t *instance, usb_speed_t speed);
     84usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance,
     85    usb_speed_t speed);
    7686
    77 void usb_device_keeper_bind(
    78     usb_device_keeper_t *instance, usb_address_t address, devman_handle_t handle);
     87void usb_device_keeper_bind(usb_device_keeper_t *instance,
     88    usb_address_t address, devman_handle_t handle);
    7989
    80 void usb_device_keeper_release(usb_device_keeper_t *instance, usb_address_t address);
     90void usb_device_keeper_release(usb_device_keeper_t *instance,
     91    usb_address_t address);
    8192
    82 usb_address_t usb_device_keeper_find(
    83     usb_device_keeper_t *instance, devman_handle_t handle);
     93usb_address_t usb_device_keeper_find(usb_device_keeper_t *instance,
     94    devman_handle_t handle);
    8495
    85 usb_speed_t usb_device_keeper_get_speed(
    86     usb_device_keeper_t *instance, usb_address_t address);
     96usb_speed_t usb_device_keeper_get_speed(usb_device_keeper_t *instance,
     97    usb_address_t address);
     98
    8799#endif
    88100/**
  • uspace/lib/usb/src/host/device_keeper.c

    r68b5ed6e re34e77a  
    3131 */
    3232/** @file
    33  * @brief UHCI driver
     33 * Device keeper structure and functions (implementation).
    3434 */
    3535#include <assert.h>
     
    6565 * @param[in] speed Speed of the device requesting default address.
    6666 */
    67 void usb_device_keeper_reserve_default_address(usb_device_keeper_t *instance, usb_speed_t speed)
     67void usb_device_keeper_reserve_default_address(usb_device_keeper_t *instance,
     68    usb_speed_t speed)
    6869{
    6970        assert(instance);
     
    100101 * Really ugly one.
    101102 */
    102 void usb_device_keeper_reset_if_need(
    103     usb_device_keeper_t *instance, usb_target_t target, const unsigned char *data)
     103void usb_device_keeper_reset_if_need(usb_device_keeper_t *instance,
     104    usb_target_t target, const uint8_t *data)
    104105{
    105106        assert(instance);
     
    144145 * @return Error code
    145146 */
    146 int usb_device_keeper_get_toggle(
    147     usb_device_keeper_t *instance, usb_target_t target, usb_direction_t direction)
     147int usb_device_keeper_get_toggle(usb_device_keeper_t *instance,
     148    usb_target_t target, usb_direction_t direction)
    148149{
    149150        assert(instance);
     
    207208 * @return Free address, or error code.
    208209 */
    209 usb_address_t device_keeper_get_free_address(
    210     usb_device_keeper_t *instance, usb_speed_t speed)
     210usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance,
     211    usb_speed_t speed)
    211212{
    212213        assert(instance);
     
    241242 * @param[in] handle Devman handle of the device.
    242243 */
    243 void usb_device_keeper_bind(
    244     usb_device_keeper_t *instance, usb_address_t address, devman_handle_t handle)
     244void usb_device_keeper_bind(usb_device_keeper_t *instance,
     245    usb_address_t address, devman_handle_t handle)
    245246{
    246247        assert(instance);
     
    258259 * @param[in] address Device address
    259260 */
    260 void usb_device_keeper_release(usb_device_keeper_t *instance, usb_address_t address)
     261void usb_device_keeper_release(usb_device_keeper_t *instance,
     262    usb_address_t address)
    261263{
    262264        assert(instance);
     
    276278 * @return USB Address, or error code.
    277279 */
    278 usb_address_t usb_device_keeper_find(
    279     usb_device_keeper_t *instance, devman_handle_t handle)
     280usb_address_t usb_device_keeper_find(usb_device_keeper_t *instance,
     281    devman_handle_t handle)
    280282{
    281283        assert(instance);
     
    299301 * @return USB speed.
    300302 */
    301 usb_speed_t usb_device_keeper_get_speed(
    302     usb_device_keeper_t *instance, usb_address_t address)
     303usb_speed_t usb_device_keeper_get_speed(usb_device_keeper_t *instance,
     304    usb_address_t address)
    303305{
    304306        assert(instance);
     
    307309        return instance->devices[address].speed;
    308310}
     311
    309312/**
    310313 * @}
Note: See TracChangeset for help on using the changeset viewer.