Changeset 4cf5b8e0 in mainline for uspace/lib/usbhost/src/usb_bus.c


Ignore:
Timestamp:
2013-09-21T01:10:47Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce33c10
Parents:
9348862
Message:

libusbhost: Rename usb_endpoint_manager → usb_bus

It's shorter and more accurate.

File:
1 moved

Legend:

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

    r9348862 r4cf5b8e0  
    3939
    4040#include <usb/debug.h>
    41 #include <usb/host/usb_endpoint_manager.h>
     41#include <usb/host/usb_bus.h>
    4242
    4343/** Endpoint compare helper function.
     
    6464
    6565/** Get list that holds endpoints for given address.
    66  * @param instance usb_endpoint_manager structure, non-null.
     66 * @param instance usb_bus structure, non-null.
    6767 * @param addr USB address, must be >= 0.
    6868 * @return Pointer to the appropriate list.
    6969 */
    70 static list_t * get_list(usb_endpoint_manager_t *instance, usb_address_t addr)
     70static list_t * get_list(usb_bus_t *instance, usb_address_t addr)
    7171{
    7272        assert(instance);
     
    7676
    7777/** Internal search function, works on locked structure.
    78  * @param instance usb_endpoint_manager structure, non-null.
     78 * @param instance usb_bus structure, non-null.
    7979 * @param address USB address, must be valid.
    8080 * @param endpoint USB endpoint number.
     
    8484 * @note Assumes that the internal mutex is locked.
    8585 */
    86 static endpoint_t * find_locked(usb_endpoint_manager_t *instance,
     86static endpoint_t * find_locked(usb_bus_t *instance,
    8787    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction)
    8888{
     
    103103 * @return Free address, or error code.
    104104 */
    105 static usb_address_t usb_endpoint_manager_get_free_address(
    106     usb_endpoint_manager_t *instance)
     105static usb_address_t usb_bus_get_free_address(usb_bus_t *instance)
    107106{
    108107
     
    174173 * add_endpoint/remove_endpoint pair.
    175174 *
    176  * @param instance usb_endpoint_manager structure, non-null.
     175 * @param instance usb_bus structure, non-null.
    177176 * @param available_bandwidth Size of the bandwidth pool.
    178177 * @param bw_count function to use to calculate endpoint bw requirements.
    179178 * @return Error code.
    180179 */
    181 int usb_endpoint_manager_init(usb_endpoint_manager_t *instance,
     180int usb_bus_init(usb_bus_t *instance,
    182181    size_t available_bandwidth, bw_count_func_t bw_count, usb_speed_t max_speed)
    183182{
     
    198197/** Register endpoint structure.
    199198 * Checks for duplicates.
    200  * @param instance usb_endpoint_manager, non-null.
     199 * @param instance usb_bus, non-null.
    201200 * @param ep endpoint_t to register.
    202201 * @param data_size Size of data to transfer.
    203202 * @return Error code.
    204203 */
    205 int usb_endpoint_manager_register_ep(usb_endpoint_manager_t *instance,
    206     endpoint_t *ep, size_t data_size)
     204int usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size)
    207205{
    208206        assert(instance);
     
    233231/** Unregister endpoint structure.
    234232 * Checks for duplicates.
    235  * @param instance usb_endpoint_manager, non-null.
     233 * @param instance usb_bus, non-null.
    236234 * @param ep endpoint_t to unregister.
    237235 * @return Error code.
    238236 */
    239 int usb_endpoint_manager_unregister_ep(
    240     usb_endpoint_manager_t *instance, endpoint_t *ep)
     237int usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep)
    241238{
    242239        assert(instance);
     
    256253
    257254/** Find endpoint_t representing the given communication route.
    258  * @param instance usb_endpoint_manager, non-null.
     255 * @param instance usb_bus, non-null.
    259256 * @param address
    260257 */
    261 endpoint_t * usb_endpoint_manager_find_ep(usb_endpoint_manager_t *instance,
     258endpoint_t * usb_bus_find_ep(usb_bus_t *instance,
    262259    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction)
    263260{
     
    271268
    272269/** Create and register new endpoint_t structure.
    273  * @param instance usb_endpoint_manager structure, non-null.
     270 * @param instance usb_bus structure, non-null.
    274271 * @param address USB address.
    275272 * @param endpoint USB endpoint number.
     
    283280 * @return Error code.
    284281 */
    285 int usb_endpoint_manager_add_ep(usb_endpoint_manager_t *instance,
     282int usb_bus_add_ep(usb_bus_t *instance,
    286283    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    287284    usb_transfer_type_t type, size_t max_packet_size, size_t data_size,
     
    343340
    344341/** Unregister and destroy endpoint_t structure representing given route.
    345  * @param instance usb_endpoint_manager structure, non-null.
     342 * @param instance usb_bus structure, non-null.
    346343 * @param address USB address.
    347344 * @param endpoint USB endpoint number.
     
    351348 * @return Error code.
    352349 */
    353 int usb_endpoint_manager_remove_ep(usb_endpoint_manager_t *instance,
     350int usb_bus_remove_ep(usb_bus_t *instance,
    354351    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    355352    ep_remove_callback_t callback, void *arg)
     
    373370}
    374371
    375 int usb_endpoint_manager_reset_toggle(usb_endpoint_manager_t *instance,
    376     usb_target_t target, bool all)
     372int usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all)
    377373{
    378374        assert(instance);
     
    395391
    396392/** Unregister and destroy all endpoints using given address.
    397  * @param instance usb_endpoint_manager structure, non-null.
     393 * @param instance usb_bus structure, non-null.
    398394 * @param address USB address.
    399395 * @param endpoint USB endpoint number.
     
    403399 * @return Error code.
    404400 */
    405 int usb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance,
     401int usb_bus_remove_address(usb_bus_t *instance,
    406402    usb_address_t address, ep_remove_callback_t callback, void *arg)
    407403{
     
    437433 * @note Default address is only available in strict mode.
    438434 */
    439 int usb_endpoint_manager_request_address(usb_endpoint_manager_t *instance,
     435int usb_bus_request_address(usb_bus_t *instance,
    440436    usb_address_t *address, bool strict, usb_speed_t speed)
    441437{
     
    453449        /* Only grant default address to strict requests */
    454450        if ((addr == USB_ADDRESS_DEFAULT) && !strict) {
    455                 addr = usb_endpoint_manager_get_free_address(instance);
     451                addr = usb_bus_get_free_address(instance);
    456452        }
    457453
     
    461457                        return ENOENT;
    462458                }
    463                 addr = usb_endpoint_manager_get_free_address(instance);
     459                addr = usb_bus_get_free_address(instance);
    464460        }
    465461        if (usb_address_is_valid(addr)) {
     
    484480 * @return Error code.
    485481 */
    486 int usb_endpoint_manager_get_speed(usb_endpoint_manager_t *instance,
    487     usb_address_t address, usb_speed_t *speed)
     482int usb_bus_get_speed(usb_bus_t *instance, usb_address_t address,
     483    usb_speed_t *speed)
    488484{
    489485        assert(instance);
Note: See TracChangeset for help on using the changeset viewer.