Changeset d93ff502 in mainline for uspace/drv/uhci/uhci.c


Ignore:
Timestamp:
2011-01-28T14:59:50Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
10f479ae
Parents:
de0e6b3
Message:

Added toggle bit parameter.

Removed uhci_* specific functions, use uhci_transfer directly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/uhci.c

    rde0e6b3 rd93ff502  
    1111static int uhci_init_transfer_lists(transfer_list_t list[]);
    1212static int uhci_clean_finished(void *arg);
    13 static inline int uhci_add_transfer(
    14   device_t *dev,
    15   usb_target_t target,
    16   usb_transfer_type_t transfer_type,
    17   usb_packet_id pid,
    18   void *buffer, size_t size,
    19   usbhc_iface_transfer_out_callback_t callback_out,
    20   usbhc_iface_transfer_in_callback_t callback_in,
    21   void *arg );
    2213
    2314int uhci_init(device_t *device, void *regs)
     
    3627
    3728        /* create instance */
    38         uhci_t *instance = malloc( sizeof(uhci_t) );
     29        uhci_t *instance = malloc(sizeof(uhci_t));
    3930        int ret = instance ? EOK : ENOMEM;
    4031        CHECK_RET_FREE_INSTANCE("Failed to allocate uhci driver instance.\n");
     
    4435        /* init address keeper(libusb) */
    4536        usb_address_keeping_init(&instance->address_manager, USB11_ADDRESS_MAX);
     37        uhci_print_verbose("Initialized address manager.\n");
    4638
    4739        /* allow access to hc control registers */
     
    5042        CHECK_RET_FREE_INSTANCE("Failed to gain access to registers at %p.\n", io);
    5143        instance->registers = io;
     44        uhci_print_verbose("Device registers accessible.\n");
    5245
    5346        /* init transfer lists */
    5447        ret = uhci_init_transfer_lists(instance->transfers);
    5548        CHECK_RET_FREE_INSTANCE("Failed to initialize transfer lists.\n");
     49        uhci_print_verbose("Transfer lists initialized.\n");
    5650
    5751        /* init root hub */
     
    6054        CHECK_RET_FREE_INSTANCE("Failed to initialize root hub driver.\n");
    6155
     56        uhci_print_verbose("Initializing frame list.\n");
    6257        instance->frame_list =
    63           malloc32(sizeof(link_pointer_t) * UHCI_FRAME_LIST_COUNT);
     58          memallign32(sizeof(link_pointer_t) * UHCI_FRAME_LIST_COUNT, 4096);
    6459        if (instance->frame_list == NULL) {
    6560                uhci_print_error("Failed to allocate frame list pointer.\n");
     
    8782        device->driver_data = instance;
    8883        return EOK;
    89 }
    90 /*----------------------------------------------------------------------------*/
    91 int uhci_in(
    92   device_t *dev,
    93         usb_target_t target,
    94         usb_transfer_type_t transfer_type,
    95         void *buffer, size_t size,
    96         usbhc_iface_transfer_in_callback_t callback, void *arg
    97         )
    98 {
    99         uhci_print_info( "transfer IN [%d.%d (%s); %zu]\n",
    100             target.address, target.endpoint,
    101             usb_str_transfer_type(transfer_type),
    102             size);
    103         return uhci_add_transfer(
    104           dev, target, transfer_type, USB_PID_IN, buffer, size, NULL, callback, arg);
    105 }
    106 /*----------------------------------------------------------------------------*/
    107 int uhci_out(
    108   device_t *dev,
    109   usb_target_t target,
    110   usb_transfer_type_t transfer_type,
    111   void *buffer, size_t size,
    112         usbhc_iface_transfer_out_callback_t callback, void *arg
    113   )
    114 {
    115         uhci_print_info( "transfer OUT [%d.%d (%s); %zu]\n",
    116             target.address, target.endpoint,
    117             usb_str_transfer_type(transfer_type),
    118             size);
    119         return uhci_add_transfer(
    120           dev, target, transfer_type, USB_PID_OUT, buffer, size, callback, NULL, arg);
    121 }
    122 /*----------------------------------------------------------------------------*/
    123 int uhci_setup(
    124   device_t *dev,
    125   usb_target_t target,
    126   usb_transfer_type_t transfer_type,
    127   void *buffer, size_t size,
    128   usbhc_iface_transfer_out_callback_t callback, void *arg
    129   )
    130 {
    131         uhci_print_info( "transfer SETUP [%d.%d (%s); %zu]\n",
    132             target.address, target.endpoint,
    133             usb_str_transfer_type(transfer_type),
    134             size);
    135         uhci_print_info("Setup packet content: %x %x.\n", ((uint8_t*)buffer)[0],
    136           ((uint8_t*)buffer)[1]);
    137         return uhci_add_transfer( dev,
    138           target, transfer_type, USB_PID_SETUP, buffer, size, callback, NULL, arg);
    139 
    14084}
    14185/*----------------------------------------------------------------------------*/
     
    173117}
    174118/*----------------------------------------------------------------------------*/
    175 static inline int uhci_add_transfer(
     119int uhci_transfer(
    176120  device_t *dev,
    177121  usb_target_t target,
    178122  usb_transfer_type_t transfer_type,
     123        bool toggle,
    179124  usb_packet_id pid,
    180125  void *buffer, size_t size,
     
    248193                                instance->transfers[i].last = instance->transfers[i].first;
    249194                }
    250 
    251195                async_usleep(1000000);
    252196        }
Note: See TracChangeset for help on using the changeset viewer.