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

Changeset 8b54fe6 in mainline


Ignore:
Timestamp:
2011-09-15T15:05:38Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
db2cb04
Parents:
f58ef61
Message:

usb: Rename device_keeper ⇒ sub-device_manager to match the rest of the library

Location:
uspace
Files:
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hc.c

    rf58ef61 r8b54fe6  
    128128
    129129        const usb_address_t hub_address =
    130             device_keeper_get_free_address(
     130            usb_device_manager_get_free_address(
    131131                &instance->generic.dev_manager, USB_SPEED_FULL);
    132132        if (hub_address <= 0) {
     
    136136        }
    137137        instance->rh.address = hub_address;
    138         usb_device_keeper_bind(
     138        usb_device_manager_bind(
    139139            &instance->generic.dev_manager, hub_address, hub_fun->handle);
    140140
     
    144144        usb_endpoint_manager_unregister_ep( \
    145145            &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH);\
    146         usb_device_keeper_release( \
     146        usb_device_manager_release( \
    147147            &instance->generic.dev_manager, hub_address); \
    148148        return ret; \
  • uspace/drv/bus/usb/ohci/hc.h

    rf58ef61 r8b54fe6  
    4141
    4242#include <usb/usb.h>
    43 #include <usb/host/device_keeper.h>
    44 #include <usb/host/usb_endpoint_manager.h>
    4543#include <usb/host/hcd.h>
    4644
  • uspace/drv/bus/usb/ohci/ohci.c

    rf58ef61 r8b54fe6  
    8686{
    8787        assert(fun);
    88         usb_device_keeper_t *manager =
     88        usb_device_manager_t *manager =
    8989            &dev_to_ohci(fun->dev)->hc.generic.dev_manager;
    9090
    91         const usb_address_t addr = usb_device_keeper_find(manager, handle);
     91        const usb_address_t addr = usb_device_manager_find(manager, handle);
    9292        if (addr < 0) {
    9393                return addr;
  • uspace/drv/bus/usb/uhci/uhci.c

    rf58ef61 r8b54fe6  
    9999{
    100100        assert(fun);
    101         usb_device_keeper_t *manager = &dev_to_uhci(fun->dev)->hc.generic.dev_manager;
    102         usb_address_t addr = usb_device_keeper_find(manager, handle);
     101        usb_device_manager_t *manager =
     102            &dev_to_uhci(fun->dev)->hc.generic.dev_manager;
     103        const usb_address_t addr = usb_device_manager_find(manager, handle);
    103104
    104105        if (addr < 0) {
  • uspace/drv/bus/usb/vhc/connhost.c

    rf58ef61 r8b54fe6  
    6262        VHC_DATA(vhc, fun);
    6363
    64         usb_address_t addr = device_keeper_get_free_address(&vhc->dev_keeper,
    65             USB_SPEED_HIGH);
     64        usb_address_t addr = usb_device_manager_get_free_address(
     65            &vhc->dev_manager, USB_SPEED_HIGH);
    6666        if (addr < 0) {
    6767                return addr;
     
    8888        usb_log_debug("Binding handle %" PRIun " to address %d.\n",
    8989            handle, address);
    90         usb_device_keeper_bind(&vhc->dev_keeper, address, handle);
     90        usb_device_manager_bind(&vhc->dev_manager, address, handle);
    9191
    9292        return EOK;
     
    105105        VHC_DATA(vhc, fun);
    106106        bool found =
    107             usb_device_keeper_find_by_address(&vhc->dev_keeper, address, handle);
     107            usb_device_manager_find_by_address(&vhc->dev_manager, address, handle);
    108108        return found ? EOK : ENOENT;
    109109}
     
    119119        VHC_DATA(vhc, fun);
    120120        usb_log_debug("Releasing address %d...\n", address);
    121         usb_device_keeper_release(&vhc->dev_keeper, address);
     121        usb_device_manager_release(&vhc->dev_manager, address);
    122122
    123123        return ENOTSUP;
     
    514514
    515515        usb_log_debug("tell_address_rh(handle=%" PRIun ")\n", handle);
    516         usb_address_t addr = usb_device_keeper_find(&vhc->dev_keeper, handle);
     516        usb_address_t addr = usb_device_manager_find(&vhc->dev_manager, handle);
    517517        if (addr < 0) {
    518518                return addr;
  • uspace/drv/bus/usb/vhc/main.c

    rf58ef61 r8b54fe6  
    8080                return rc;
    8181        }
    82         usb_device_keeper_init(&data->dev_keeper);
     82        usb_device_manager_init(&data->dev_manager);
    8383
    8484        ddf_fun_t *hc = ddf_fun_create(dev, fun_exposed, "hc");
  • uspace/drv/bus/usb/vhc/vhcd.h

    rf58ef61 r8b54fe6  
    3939#include <usbvirt/device.h>
    4040#include <usb/host/usb_endpoint_manager.h>
    41 #include <usb/host/device_keeper.h>
     41#include <usb/host/usb_device_manager.h>
    4242#include <usbhc_iface.h>
    4343#include <async.h>
     
    6060        fibril_mutex_t guard;
    6161        usb_endpoint_manager_t ep_manager;
    62         usb_device_keeper_t dev_keeper;
     62        usb_device_manager_t dev_manager;
    6363        usbvirt_device_t *hub;
    6464        ddf_fun_t *hc_fun;
  • uspace/lib/usbhost/Makefile

    rf58ef61 r8b54fe6  
    3535
    3636SOURCES = \
    37         src/device_keeper.c \
    3837        src/endpoint.c \
    3938        src/iface.c \
     39        src/usb_device_manager.c \
    4040        src/usb_endpoint_manager.c \
    4141        src/usb_transfer_batch.c
  • uspace/lib/usbhost/include/usb/host/hcd.h

    rf58ef61 r8b54fe6  
    3737
    3838#include <assert.h>
    39 #include <usb/host/device_keeper.h>
     39#include <usb/host/usb_device_manager.h>
    4040#include <usb/host/usb_endpoint_manager.h>
    4141#include <usb/host/usb_transfer_batch.h>
     
    4545
    4646struct hcd {
    47         usb_device_keeper_t dev_manager;
     47        usb_device_manager_t dev_manager;
    4848        usb_endpoint_manager_t ep_manager;
    4949        void *private_data;
     
    5757{
    5858        assert(hcd);
    59         usb_device_keeper_init(&hcd->dev_manager);
     59        usb_device_manager_init(&hcd->dev_manager);
    6060        return usb_endpoint_manager_init(&hcd->ep_manager, bandwidth, bw_count);
    6161}
  • uspace/lib/usbhost/include/usb/host/usb_device_manager.h

    rf58ef61 r8b54fe6  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    2928/** @addtogroup libusbhost
    3029 * @{
    3130 */
    3231/** @file
    33  * Device keeper structure and functions.
     32 * Device manager structure and functions.
    3433 *
    3534 * Typical USB host controller needs to keep track of various settings for
     
    3837 * This structure shall simplify the management.
    3938 */
    40 #ifndef LIBUSBHOST_HOST_DEVICE_KEEPER_H
    41 #define LIBUSBHOST_HOST_DEVICE_KEEPER_H
     39#ifndef LIBUSBHOST_HOST_USB_DEVICE_MANAGER_H
     40#define LIBUSBHOST_HOST_USB_DEVICE_MANAGER_H
    4241
    4342#include <adt/list.h>
     
    5756};
    5857
    59 /** Host controller device keeper.
     58/** Host controller device manager.
    6059 * You shall not access members directly but only using functions below.
    6160 */
     
    6463        fibril_mutex_t guard;
    6564        usb_address_t last_address;
    66 } usb_device_keeper_t;
     65} usb_device_manager_t;
    6766
    68 void usb_device_keeper_init(usb_device_keeper_t *instance);
     67void usb_device_manager_init(usb_device_manager_t *instance);
    6968
    70 usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance,
    71     usb_speed_t speed);
     69usb_address_t usb_device_manager_get_free_address(
     70    usb_device_manager_t *instance, usb_speed_t speed);
    7271
    73 void usb_device_keeper_bind(usb_device_keeper_t *instance,
     72void usb_device_manager_bind(usb_device_manager_t *instance,
    7473    usb_address_t address, devman_handle_t handle);
    7574
    76 void usb_device_keeper_release(usb_device_keeper_t *instance,
     75void usb_device_manager_release(usb_device_manager_t *instance,
    7776    usb_address_t address);
    7877
    79 usb_address_t usb_device_keeper_find(usb_device_keeper_t *instance,
     78usb_address_t usb_device_manager_find(usb_device_manager_t *instance,
    8079    devman_handle_t handle);
    8180
    82 bool usb_device_keeper_find_by_address(usb_device_keeper_t *instance,
     81bool usb_device_manager_find_by_address(usb_device_manager_t *instance,
    8382    usb_address_t address, devman_handle_t *handle);
    8483
    85 usb_speed_t usb_device_keeper_get_speed(usb_device_keeper_t *instance,
     84usb_speed_t usb_device_manager_get_speed(usb_device_manager_t *instance,
    8685    usb_address_t address);
    8786#endif
  • uspace/lib/usbhost/src/iface.c

    rf58ef61 r8b54fe6  
    107107
    108108        usb_log_debug("Address request speed: %s.\n", usb_str_speed(speed));
    109         *address = device_keeper_get_free_address(&hcd->dev_manager, speed);
     109        *address =
     110            usb_device_manager_get_free_address(&hcd->dev_manager, speed);
    110111        usb_log_debug("Address request with result: %d.\n", *address);
    111112        if (*address <= 0)
     
    129130
    130131        usb_log_debug("Address bind %d-%" PRIun ".\n", address, handle);
    131         usb_device_keeper_bind(&hcd->dev_manager, address, handle);
     132        usb_device_manager_bind(&hcd->dev_manager, address, handle);
    132133        return EOK;
    133134}
     
    147148        assert(hcd);
    148149        const bool found =
    149             usb_device_keeper_find_by_address(&hcd->dev_manager, address, handle);
     150            usb_device_manager_find_by_address(&hcd->dev_manager, address, handle);
    150151        return found ? EOK : ENOENT;
    151152}
     
    163164        assert(hcd);
    164165        usb_log_debug("Address release %d.\n", address);
    165         usb_device_keeper_release(&hcd->dev_manager, address);
     166        usb_device_manager_release(&hcd->dev_manager, address);
    166167        return EOK;
    167168}
     
    180181         * thus it does not provide speed info. */
    181182        const usb_speed_t speed = (address == 0) ? ep_speed :
    182             usb_device_keeper_get_speed(&hcd->dev_manager, address);
     183            usb_device_manager_get_speed(&hcd->dev_manager, address);
    183184
    184185        usb_log_debug("Register endpoint %d:%d %s-%s %s %zuB %ums.\n",
  • uspace/lib/usbhost/src/usb_device_manager.c

    rf58ef61 r8b54fe6  
    3131 */
    3232/** @file
    33  * Device keeper structure and functions (implementation).
     33 * Device manager structure and functions (implementation).
    3434 */
    3535#include <assert.h>
    3636#include <errno.h>
    3737#include <usb/debug.h>
    38 #include <usb/host/device_keeper.h>
    39 
    40 /*----------------------------------------------------------------------------*/
    41 /** Initialize device keeper structure.
     38#include <usb/host/usb_device_manager.h>
     39
     40/*----------------------------------------------------------------------------*/
     41/** Initialize device manager structure.
    4242 *
    4343 * @param[in] instance Memory place to initialize.
     
    4545 * Set all values to false/0.
    4646 */
    47 void usb_device_keeper_init(usb_device_keeper_t *instance)
     47void usb_device_manager_init(usb_device_manager_t *instance)
    4848{
    4949        assert(instance);
     
    6363/** Get a free USB address
    6464 *
    65  * @param[in] instance Device keeper structure to use.
     65 * @param[in] instance Device manager structure to use.
    6666 * @param[in] speed Speed of the device requiring address.
    6767 * @return Free address, or error code.
    6868 */
    69 usb_address_t device_keeper_get_free_address(
    70     usb_device_keeper_t *instance, usb_speed_t speed)
     69usb_address_t usb_device_manager_get_free_address(
     70    usb_device_manager_t *instance, usb_speed_t speed)
    7171{
    7272        assert(instance);
     
    9797/** Bind USB address to devman handle.
    9898 *
    99  * @param[in] instance Device keeper structure to use.
     99 * @param[in] instance Device manager structure to use.
    100100 * @param[in] address Device address
    101101 * @param[in] handle Devman handle of the device.
    102102 */
    103 void usb_device_keeper_bind(usb_device_keeper_t *instance,
     103void usb_device_manager_bind(usb_device_manager_t *instance,
    104104    usb_address_t address, devman_handle_t handle)
    105105{
     
    117117/** Release used USB address.
    118118 *
    119  * @param[in] instance Device keeper structure to use.
     119 * @param[in] instance Device manager structure to use.
    120120 * @param[in] address Device address
    121121 */
    122 void usb_device_keeper_release(
    123     usb_device_keeper_t *instance, usb_address_t address)
     122void usb_device_manager_release(
     123    usb_device_manager_t *instance, usb_address_t address)
    124124{
    125125        assert(instance);
     
    136136/** Find USB address associated with the device
    137137 *
    138  * @param[in] instance Device keeper structure to use.
     138 * @param[in] instance Device manager structure to use.
    139139 * @param[in] handle Devman handle of the device seeking its address.
    140140 * @return USB Address, or error code.
    141141 */
    142 usb_address_t usb_device_keeper_find(
    143     usb_device_keeper_t *instance, devman_handle_t handle)
     142usb_address_t usb_device_manager_find(
     143    usb_device_manager_t *instance, devman_handle_t handle)
    144144{
    145145        assert(instance);
     
    161161 * Intentionally refuse to find handle of default address.
    162162 *
    163  * @param[in] instance Device keeper structure to use.
     163 * @param[in] instance Device manager structure to use.
    164164 * @param[in] address Address the caller wants to find.
    165165 * @param[out] handle Where to store found handle.
    166166 * @return Whether such address is currently occupied.
    167167 */
    168 bool usb_device_keeper_find_by_address(usb_device_keeper_t *instance,
     168bool usb_device_manager_find_by_address(usb_device_manager_t *instance,
    169169    usb_address_t address, devman_handle_t *handle)
    170170{
     
    191191/** Get speed associated with the address
    192192 *
    193  * @param[in] instance Device keeper structure to use.
     193 * @param[in] instance Device manager structure to use.
    194194 * @param[in] address Address of the device.
    195195 * @return USB speed.
    196196 */
    197 usb_speed_t usb_device_keeper_get_speed(
    198     usb_device_keeper_t *instance, usb_address_t address)
     197usb_speed_t usb_device_manager_get_speed(
     198    usb_device_manager_t *instance, usb_address_t address)
    199199{
    200200        assert(instance);
Note: See TracChangeset for help on using the changeset viewer.