Changeset be7950e8 in mainline


Ignore:
Timestamp:
2011-03-21T13:07:56Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2bf8f8c
Parents:
ff582d47
Message:

Implement interface, add stub batch functions

Location:
uspace/drv/ohci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/batch.c

    rff582d47 rbe7950e8  
    4141
    4242#define DEFAULT_ERROR_COUNT 3
    43 
     43batch_t * batch_get(
     44    ddf_fun_t *fun,
     45                usb_target_t target,
     46    usb_transfer_type_t transfer_type,
     47                size_t max_packet_size,
     48    usb_speed_t speed,
     49                char *buffer,
     50                size_t size,
     51                char *setup_buffer,
     52                size_t setup_size,
     53    usbhc_iface_transfer_in_callback_t func_in,
     54    usbhc_iface_transfer_out_callback_t func_out,
     55                void *arg,
     56                device_keeper_t *manager
     57                )
     58{
     59        return NULL;
     60}
     61/*----------------------------------------------------------------------------*/
     62void batch_dispose(batch_t *instance)
     63{
     64}
     65/*----------------------------------------------------------------------------*/
     66void batch_control_write(batch_t *instance)
     67{
     68}
     69/*----------------------------------------------------------------------------*/
     70void batch_control_read(batch_t *instance)
     71{
     72}
     73/*----------------------------------------------------------------------------*/
     74void batch_interrupt_in(batch_t *instance)
     75{
     76}
     77/*----------------------------------------------------------------------------*/
     78void batch_interrupt_out(batch_t *instance)
     79{
     80}
     81/*----------------------------------------------------------------------------*/
     82void batch_bulk_in(batch_t *instance)
     83{
     84}
     85/*----------------------------------------------------------------------------*/
     86void batch_bulk_out(batch_t *instance)
     87{
     88}
    4489/**
    4590 * @}
  • uspace/drv/ohci/iface.c

    rff582d47 rbe7950e8  
    176176        return ENOTSUP;
    177177}
    178 
     178/*----------------------------------------------------------------------------*/
    179179/** Schedule interrupt out transfer.
    180180 *
     
    198198    usbhc_iface_transfer_out_callback_t callback, void *arg)
    199199{
    200         UNSUPPORTED("interrupt_out");
    201 
    202         return ENOTSUP;
    203 }
    204 
     200  hc_t *hc = fun_to_hc(fun);
     201  assert(hc);
     202  usb_speed_t speed = device_keeper_speed(&hc->manager, target.address);
     203
     204  usb_log_debug("Interrupt OUT %d:%d %zu(%zu).\n",
     205      target.address, target.endpoint, size, max_packet_size);
     206
     207  batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,
     208      max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg,
     209      &hc->manager);
     210  if (!batch)
     211    return ENOMEM;
     212  batch_interrupt_out(batch);
     213  const int ret = hc_schedule(hc, batch);
     214  if (ret != EOK) {
     215    batch_dispose(batch);
     216    return ret;
     217  }
     218  return EOK;
     219}
     220/*----------------------------------------------------------------------------*/
    205221/** Schedule interrupt in transfer.
    206222 *
     
    224240    usbhc_iface_transfer_in_callback_t callback, void *arg)
    225241{
    226         UNSUPPORTED("interrupt_in");
    227 
    228         return ENOTSUP;
    229 }
    230 
     242  assert(fun);
     243  hc_t *hc = fun_to_hc(fun);
     244  assert(hc);
     245  usb_speed_t speed = device_keeper_speed(&hc->manager, target.address);
     246  usb_log_debug("Interrupt IN %d:%d %zu(%zu).\n",
     247      target.address, target.endpoint, size, max_packet_size);
     248
     249  batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,
     250      max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg,
     251      &hc->manager);
     252  if (!batch)
     253    return ENOMEM;
     254  batch_interrupt_in(batch);
     255  const int ret = hc_schedule(hc, batch);
     256  if (ret != EOK) {
     257    batch_dispose(batch);
     258    return ret;
     259  }
     260  return EOK;
     261}
     262/*----------------------------------------------------------------------------*/
    231263/** Schedule bulk out transfer.
    232264 *
     
    250282    usbhc_iface_transfer_out_callback_t callback, void *arg)
    251283{
    252         UNSUPPORTED("bulk_out");
    253 
    254         return ENOTSUP;
    255 }
    256 
     284  assert(fun);
     285  hc_t *hc = fun_to_hc(fun);
     286  assert(hc);
     287  usb_speed_t speed = device_keeper_speed(&hc->manager, target.address);
     288
     289  usb_log_debug("Bulk OUT %d:%d %zu(%zu).\n",
     290      target.address, target.endpoint, size, max_packet_size);
     291
     292  batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,
     293      max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg,
     294      &hc->manager);
     295  if (!batch)
     296    return ENOMEM;
     297  batch_bulk_out(batch);
     298  const int ret = hc_schedule(hc, batch);
     299  if (ret != EOK) {
     300    batch_dispose(batch);
     301    return ret;
     302  }
     303  return EOK;
     304
     305}
     306/*----------------------------------------------------------------------------*/
    257307/** Schedule bulk in transfer.
    258308 *
     
    276326    usbhc_iface_transfer_in_callback_t callback, void *arg)
    277327{
    278         UNSUPPORTED("bulk_in");
    279 
    280         return ENOTSUP;
    281 }
    282 
     328  assert(fun);
     329  hc_t *hc = fun_to_hc(fun);
     330  assert(hc);
     331  usb_speed_t speed = device_keeper_speed(&hc->manager, target.address);
     332  usb_log_debug("Bulk IN %d:%d %zu(%zu).\n",
     333      target.address, target.endpoint, size, max_packet_size);
     334
     335  batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,
     336      max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg,
     337      &hc->manager);
     338  if (!batch)
     339    return ENOMEM;
     340  batch_bulk_in(batch);
     341  const int ret = hc_schedule(hc, batch);
     342  if (ret != EOK) {
     343    batch_dispose(batch);
     344    return ret;
     345  }
     346  return EOK;
     347}
     348/*----------------------------------------------------------------------------*/
    283349/** Schedule control write transfer.
    284350 *
     
    303369static int control_write(ddf_fun_t *fun, usb_target_t target,
    304370    size_t max_packet_size,
    305     void *setup_packet, size_t setup_packet_size,
    306     void *data_buffer, size_t data_buffer_size,
     371    void *setup_data, size_t setup_size,
     372    void *data, size_t size,
    307373    usbhc_iface_transfer_out_callback_t callback, void *arg)
    308374{
    309         UNSUPPORTED("control_write");
    310 
    311         return ENOTSUP;
    312 }
    313 
     375  assert(fun);
     376  hc_t *hc = fun_to_hc(fun);
     377  assert(hc);
     378  usb_speed_t speed = device_keeper_speed(&hc->manager, target.address);
     379  usb_log_debug("Control WRITE (%d) %d:%d %zu(%zu).\n",
     380      speed, target.address, target.endpoint, size, max_packet_size);
     381
     382  if (setup_size != 8)
     383    return EINVAL;
     384
     385  batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
     386      max_packet_size, speed, data, size, setup_data, setup_size,
     387      NULL, callback, arg, &hc->manager);
     388  if (!batch)
     389    return ENOMEM;
     390  device_keeper_reset_if_need(&hc->manager, target, setup_data);
     391  batch_control_write(batch);
     392  const int ret = hc_schedule(hc, batch);
     393  if (ret != EOK) {
     394    batch_dispose(batch);
     395    return ret;
     396  }
     397  return EOK;
     398}
     399/*----------------------------------------------------------------------------*/
    314400/** Schedule control read transfer.
    315401 *
     
    334420static int control_read(ddf_fun_t *fun, usb_target_t target,
    335421    size_t max_packet_size,
    336     void *setup_packet, size_t setup_packet_size,
    337     void *data_buffer, size_t data_buffer_size,
     422    void *setup_data, size_t setup_size,
     423    void *data, size_t size,
    338424    usbhc_iface_transfer_in_callback_t callback, void *arg)
    339425{
    340         UNSUPPORTED("control_read");
    341 
    342         return ENOTSUP;
    343 }
    344 
     426  assert(fun);
     427  hc_t *hc = fun_to_hc(fun);
     428  assert(hc);
     429  usb_speed_t speed = device_keeper_speed(&hc->manager, target.address);
     430
     431  usb_log_debug("Control READ(%d) %d:%d %zu(%zu).\n",
     432      speed, target.address, target.endpoint, size, max_packet_size);
     433  batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
     434      max_packet_size, speed, data, size, setup_data, setup_size, callback,
     435      NULL, arg, &hc->manager);
     436  if (!batch)
     437    return ENOMEM;
     438  batch_control_read(batch);
     439  const int ret = hc_schedule(hc, batch);
     440  if (ret != EOK) {
     441    batch_dispose(batch);
     442    return ret;
     443  }
     444  return EOK;
     445}
     446/*----------------------------------------------------------------------------*/
    345447/** Host controller interface implementation for OHCI. */
    346448usbhc_iface_t hc_iface = {
Note: See TracChangeset for help on using the changeset viewer.