Ignore:
File:
1 edited

Legend:

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

    r4e732f1a r9d58539  
    3333 */
    3434
    35 #include <usb/host/endpoint.h>
    36 
    3735#include <assert.h>
    3836#include <stdlib.h>
     37#include <errno.h>
     38#include <usb/host/endpoint.h>
    3939
    4040/** Allocate ad initialize endpoint_t structure.
     
    5050endpoint_t * endpoint_create(usb_address_t address, usb_endpoint_t endpoint,
    5151    usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed,
    52     size_t max_packet_size, unsigned packets, size_t bw,
    53     usb_address_t tt_address, unsigned tt_p)
     52    size_t max_packet_size, size_t bw)
    5453{
    5554        endpoint_t *instance = malloc(sizeof(endpoint_t));
     
    6160                instance->speed = speed;
    6261                instance->max_packet_size = max_packet_size;
    63                 instance->packets = packets;
    6462                instance->bandwidth = bw;
    6563                instance->toggle = 0;
    6664                instance->active = false;
    67                 instance->tt.address = tt_address;
    68                 instance->tt.port = tt_p;
    6965                instance->hc_data.data = NULL;
    7066                instance->hc_data.toggle_get = NULL;
     
    7672        return instance;
    7773}
    78 
     74/*----------------------------------------------------------------------------*/
    7975/** Properly dispose of endpoint_t structure.
    8076 * @param instance endpoint_t structure.
     
    8884        free(instance);
    8985}
    90 
     86/*----------------------------------------------------------------------------*/
    9187/** Set device specific data and hooks.
    9288 * @param instance endpoint_t structure.
     
    105101        fibril_mutex_unlock(&instance->guard);
    106102}
    107 
     103/*----------------------------------------------------------------------------*/
    108104/** Clear device specific data and hooks.
    109105 * @param instance endpoint_t structure.
     
    113109{
    114110        assert(instance);
    115         endpoint_set_hc_data(instance, NULL, NULL, NULL);
     111        fibril_mutex_lock(&instance->guard);
     112        instance->hc_data.data = NULL;
     113        instance->hc_data.toggle_get = NULL;
     114        instance->hc_data.toggle_set = NULL;
     115        fibril_mutex_unlock(&instance->guard);
    116116}
    117 
     117/*----------------------------------------------------------------------------*/
    118118/** Mark the endpoint as active and block access for further fibrils.
    119119 * @param instance endpoint_t structure.
     
    128128        fibril_mutex_unlock(&instance->guard);
    129129}
    130 
     130/*----------------------------------------------------------------------------*/
    131131/** Mark the endpoint as inactive and allow access for further fibrils.
    132132 * @param instance endpoint_t structure.
     
    140140        fibril_condvar_signal(&instance->avail);
    141141}
    142 
     142/*----------------------------------------------------------------------------*/
    143143/** Get the value of toggle bit.
    144144 * @param instance endpoint_t structure.
     
    156156        return ret;
    157157}
    158 
     158/*----------------------------------------------------------------------------*/
    159159/** Set the value of toggle bit.
    160160 * @param instance endpoint_t structure.
Note: See TracChangeset for help on using the changeset viewer.