Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/hc.c

    rda2f1c9e r56fd7cf  
    2727 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828 */
     29
    2930/** @addtogroup libusb
    3031 * @{
     
    3334 * General communication with host controller driver (implementation).
    3435 */
     36
    3537#include <usb/debug.h>
    3638
     
    4446{
    4547        assert(connection);
     48       
    4649        fibril_mutex_lock(&connection->guard);
    4750        if (connection->ref_count == 0) {
     
    5558                }
    5659        }
     60       
    5761        ++connection->ref_count;
    5862        fibril_mutex_unlock(&connection->guard);
    5963        return EOK;
    6064}
    61 /*----------------------------------------------------------------------------*/
     65
    6266static int usb_hc_connection_del_ref(usb_hc_connection_t *connection)
    6367{
    6468        assert(connection);
     69       
    6570        fibril_mutex_lock(&connection->guard);
    6671        if (connection->ref_count == 0) {
    6772                /* Closing already closed connection... */
    68                 assert(connection->hc_sess = NULL);
     73                assert(connection->hc_sess == NULL);
    6974                fibril_mutex_unlock(&connection->guard);
    7075                return EOK;
    7176        }
     77       
    7278        --connection->ref_count;
    7379        int ret = EOK;
     
    109115 */
    110116int usb_hc_connection_initialize_from_device(usb_hc_connection_t *connection,
    111     const ddf_dev_t *device)
    112 {
    113         assert(connection);
    114 
    115         if (device == NULL) {
     117    ddf_dev_t *device)
     118{
     119        if (device == NULL)
    116120                return EBADMEM;
    117         }
    118121
    119122        devman_handle_t hc_handle;
    120         const int rc = usb_get_hc_by_handle(device->handle, &hc_handle);
     123        const int rc = usb_get_hc_by_handle(ddf_dev_get_handle(device), &hc_handle);
    121124        if (rc == EOK) {
    122125                usb_hc_connection_initialize(connection, hc_handle);
     
    125128        return rc;
    126129}
    127 /*----------------------------------------------------------------------------*/
     130
    128131void usb_hc_connection_deinitialize(usb_hc_connection_t *connection)
    129132{
     
    140143        fibril_mutex_unlock(&connection->guard);
    141144}
    142 /*----------------------------------------------------------------------------*/
     145
    143146/** Open connection to host controller.
    144147 *
     
    150153        return usb_hc_connection_add_ref(connection);
    151154}
    152 /*----------------------------------------------------------------------------*/
     155
    153156/** Close connection to the host controller.
    154157 *
     
    160163        return usb_hc_connection_del_ref(connection);
    161164}
    162 /*----------------------------------------------------------------------------*/
     165
    163166/** Ask host controller for free address assignment.
    164167 *
     
    182185        return ret == EOK ? address : ret;
    183186}
    184 /*----------------------------------------------------------------------------*/
     187
    185188int usb_hc_bind_address(usb_hc_connection_t * connection,
    186189    usb_address_t address, devman_handle_t handle)
     
    194197        return ret;
    195198}
    196 /*----------------------------------------------------------------------------*/
     199
    197200/** Get handle of USB device with given address.
    198201 *
     
    213216        return ret;
    214217}
    215 /*----------------------------------------------------------------------------*/
     218
    216219int usb_hc_release_address(usb_hc_connection_t *connection,
    217220    usb_address_t address)
     
    225228        return ret;
    226229}
    227 /*----------------------------------------------------------------------------*/
     230
    228231int usb_hc_register_endpoint(usb_hc_connection_t *connection,
    229232    usb_address_t address, usb_endpoint_t endpoint, usb_transfer_type_t type,
     
    239242        return ret;
    240243}
    241 /*----------------------------------------------------------------------------*/
     244
    242245int usb_hc_unregister_endpoint(usb_hc_connection_t *connection,
    243246    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction)
     
    252255        return ret;
    253256}
    254 /*----------------------------------------------------------------------------*/
     257
    255258int usb_hc_read(usb_hc_connection_t *connection, usb_address_t address,
    256259    usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size,
     
    266269        return ret;
    267270}
    268 /*----------------------------------------------------------------------------*/
     271
    269272int usb_hc_write(usb_hc_connection_t *connection, usb_address_t address,
    270273    usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
Note: See TracChangeset for help on using the changeset viewer.