Ignore:
File:
1 edited

Legend:

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

    r56fd7cf rda2f1c9e  
    2727 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828 */
    29 
    3029/** @addtogroup libusb
    3130 * @{
     
    3433 * General communication with host controller driver (implementation).
    3534 */
    36 
    3735#include <usb/debug.h>
    3836
     
    4644{
    4745        assert(connection);
    48        
    4946        fibril_mutex_lock(&connection->guard);
    5047        if (connection->ref_count == 0) {
     
    5855                }
    5956        }
    60        
    6157        ++connection->ref_count;
    6258        fibril_mutex_unlock(&connection->guard);
    6359        return EOK;
    6460}
    65 
     61/*----------------------------------------------------------------------------*/
    6662static int usb_hc_connection_del_ref(usb_hc_connection_t *connection)
    6763{
    6864        assert(connection);
    69        
    7065        fibril_mutex_lock(&connection->guard);
    7166        if (connection->ref_count == 0) {
    7267                /* Closing already closed connection... */
    73                 assert(connection->hc_sess == NULL);
     68                assert(connection->hc_sess = NULL);
    7469                fibril_mutex_unlock(&connection->guard);
    7570                return EOK;
    7671        }
    77        
    7872        --connection->ref_count;
    7973        int ret = EOK;
     
    115109 */
    116110int usb_hc_connection_initialize_from_device(usb_hc_connection_t *connection,
    117     ddf_dev_t *device)
    118 {
    119         if (device == NULL)
     111    const ddf_dev_t *device)
     112{
     113        assert(connection);
     114
     115        if (device == NULL) {
    120116                return EBADMEM;
     117        }
    121118
    122119        devman_handle_t hc_handle;
    123         const int rc = usb_get_hc_by_handle(ddf_dev_get_handle(device), &hc_handle);
     120        const int rc = usb_get_hc_by_handle(device->handle, &hc_handle);
    124121        if (rc == EOK) {
    125122                usb_hc_connection_initialize(connection, hc_handle);
     
    128125        return rc;
    129126}
    130 
     127/*----------------------------------------------------------------------------*/
    131128void usb_hc_connection_deinitialize(usb_hc_connection_t *connection)
    132129{
     
    143140        fibril_mutex_unlock(&connection->guard);
    144141}
    145 
     142/*----------------------------------------------------------------------------*/
    146143/** Open connection to host controller.
    147144 *
     
    153150        return usb_hc_connection_add_ref(connection);
    154151}
    155 
     152/*----------------------------------------------------------------------------*/
    156153/** Close connection to the host controller.
    157154 *
     
    163160        return usb_hc_connection_del_ref(connection);
    164161}
    165 
     162/*----------------------------------------------------------------------------*/
    166163/** Ask host controller for free address assignment.
    167164 *
     
    185182        return ret == EOK ? address : ret;
    186183}
    187 
     184/*----------------------------------------------------------------------------*/
    188185int usb_hc_bind_address(usb_hc_connection_t * connection,
    189186    usb_address_t address, devman_handle_t handle)
     
    197194        return ret;
    198195}
    199 
     196/*----------------------------------------------------------------------------*/
    200197/** Get handle of USB device with given address.
    201198 *
     
    216213        return ret;
    217214}
    218 
     215/*----------------------------------------------------------------------------*/
    219216int usb_hc_release_address(usb_hc_connection_t *connection,
    220217    usb_address_t address)
     
    228225        return ret;
    229226}
    230 
     227/*----------------------------------------------------------------------------*/
    231228int usb_hc_register_endpoint(usb_hc_connection_t *connection,
    232229    usb_address_t address, usb_endpoint_t endpoint, usb_transfer_type_t type,
     
    242239        return ret;
    243240}
    244 
     241/*----------------------------------------------------------------------------*/
    245242int usb_hc_unregister_endpoint(usb_hc_connection_t *connection,
    246243    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction)
     
    255252        return ret;
    256253}
    257 
     254/*----------------------------------------------------------------------------*/
    258255int usb_hc_read(usb_hc_connection_t *connection, usb_address_t address,
    259256    usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size,
     
    269266        return ret;
    270267}
    271 
     268/*----------------------------------------------------------------------------*/
    272269int usb_hc_write(usb_hc_connection_t *connection, usb_address_t address,
    273270    usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
Note: See TracChangeset for help on using the changeset viewer.