Changes in / [9a422574:8f74140c] in mainline


Ignore:
Location:
uspace/drv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/pciintel/pci.c

    r9a422574 r8f74140c  
    9494  sysarg_t apic;
    9595  sysarg_t i8259;
    96 
    9796        int irc_phone = -1;
    9897        int irc_service = 0;
     
    104103        }
    105104
    106   if (irc_service == 0)
     105  if (irc_service) {
     106    while (irc_phone < 0)
     107      irc_phone = service_connect_blocking(irc_service, 0, 0);
     108  } else {
    107109                return false;
    108 
    109         irc_phone = service_connect_blocking(irc_service, 0, 0);
    110         if (irc_phone < 0)
    111                 return false;
     110        }
    112111
    113112        size_t i;
     
    115114                if (dev_data->hw_resources.resources[i].type == INTERRUPT) {
    116115                        int irq = dev_data->hw_resources.resources[i].res.interrupt.irq;
    117                         int rc = async_req_1_0(irc_phone, IRC_ENABLE_INTERRUPT, irq);
    118                         if (rc != EOK) {
    119                                 async_hangup(irc_phone);
    120                                 return false;
    121                         }
     116                        async_msg_1(irc_phone, IRC_ENABLE_INTERRUPT, irq);
    122117                }
    123118        }
  • uspace/drv/uhci-hcd/batch.c

    r9a422574 r8f74140c  
    3535#include <str_error.h>
    3636
    37 #include <usb/usb.h>
    3837#include <usb/debug.h>
    3938
     
    4746static int batch_schedule(batch_t *instance);
    4847
    49 static void batch_control(
    50     batch_t *instance, int data_stage, int status_stage);
    5148static void batch_call_in(batch_t *instance);
    5249static void batch_call_out(batch_t *instance);
     
    9693        instance->transport_buffer =
    9794           (size > 0) ? malloc32(transport_size) : NULL;
    98 
    9995        if ((size > 0) && (instance->transport_buffer == NULL)) {
    10096                usb_log_error("Failed to allocate device accessible buffer.\n");
     
    172168{
    173169        assert(instance);
     170
    174171        /* we are data out, we are supposed to provide data */
    175172        memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size);
    176         batch_control(instance, USB_PID_OUT, USB_PID_IN);
     173
     174        const bool low_speed = instance->speed == USB_SPEED_LOW;
     175        int toggle = 0;
     176        /* setup stage */
     177        transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
     178            instance->setup_size, toggle, false, low_speed,
     179            instance->target, USB_PID_SETUP, instance->setup_buffer,
     180            &instance->tds[1]);
     181
     182        /* data stage */
     183        size_t i = 1;
     184        for (;i < instance->packets - 1; ++i) {
     185                char *data =
     186                    instance->transport_buffer + ((i - 1) * instance->max_packet_size);
     187                toggle = 1 - toggle;
     188
     189                transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
     190                    instance->max_packet_size, toggle++, false, low_speed,
     191                    instance->target, USB_PID_OUT, data, &instance->tds[i + 1]);
     192        }
     193
     194        /* status stage */
     195        i = instance->packets - 1;
     196        transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
     197            0, 1, false, low_speed, instance->target, USB_PID_IN, NULL, NULL);
     198
     199        instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG;
     200        usb_log_debug2("Control write last TD status: %x.\n",
     201                instance->tds[i].status);
     202
    177203        instance->next_step = batch_call_out_and_dispose;
    178204        usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance);
     
    183209{
    184210        assert(instance);
    185         batch_control(instance, USB_PID_IN, USB_PID_OUT);
     211
     212        const bool low_speed = instance->speed == USB_SPEED_LOW;
     213        int toggle = 0;
     214        /* setup stage */
     215        transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
     216            instance->setup_size, toggle, false, low_speed, instance->target,
     217            USB_PID_SETUP, instance->setup_buffer, &instance->tds[1]);
     218
     219        /* data stage */
     220        size_t i = 1;
     221        for (;i < instance->packets - 1; ++i) {
     222                char *data =
     223                    instance->transport_buffer + ((i - 1) * instance->max_packet_size);
     224                toggle = 1 - toggle;
     225
     226                transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
     227                    instance->max_packet_size, toggle, false, low_speed,
     228                                instance->target, USB_PID_IN, data, &instance->tds[i + 1]);
     229        }
     230
     231        /* status stage */
     232        i = instance->packets - 1;
     233        transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
     234            0, 1, false, low_speed, instance->target, USB_PID_OUT, NULL, NULL);
     235
     236        instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG;
     237        usb_log_debug2("Control read last TD status: %x.\n",
     238                instance->tds[i].status);
     239
    186240        instance->next_step = batch_call_in_and_dispose;
    187241        usb_log_debug("Batch(%p) CONTROL READ initialized.\n", instance);
     
    218272{
    219273        assert(instance);
     274
    220275        memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size);
    221276
     
    242297}
    243298/*----------------------------------------------------------------------------*/
    244 static void batch_control(
    245     batch_t *instance, int data_stage, int status_stage)
    246 {
    247         assert(instance);
    248 
    249         const bool low_speed = instance->speed == USB_SPEED_LOW;
    250         int toggle = 0;
    251         /* setup stage */
    252         transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
    253             instance->setup_size, toggle, false, low_speed, instance->target,
    254             USB_PID_SETUP, instance->setup_buffer, &instance->tds[1]);
    255 
    256         /* data stage */
    257         size_t packet = 1;
    258         size_t remain_size = instance->buffer_size;
    259         while (remain_size > 0) {
    260                 char *data =
    261                     instance->transport_buffer + instance->buffer_size
    262                     - remain_size;
    263 
    264                 toggle = 1 - toggle;
    265 
    266                 const size_t packet_size =
    267                     (instance->max_packet_size > remain_size) ?
    268                     remain_size : instance->max_packet_size;
    269 
    270                 transfer_descriptor_init(&instance->tds[packet],
    271                     DEFAULT_ERROR_COUNT, packet_size, toggle, false, low_speed,
    272                     instance->target, data_stage, data,
    273                     &instance->tds[packet + 1]);
    274 
    275                 ++packet;
    276                 assert(packet < instance->packets);
    277                 assert(packet_size <= remain_size);
    278                 remain_size -= packet_size;
    279         }
    280 
    281         /* status stage */
    282         assert(packet == instance->packets - 1);
    283         transfer_descriptor_init(&instance->tds[packet], DEFAULT_ERROR_COUNT,
    284             0, 1, false, low_speed, instance->target, status_stage, NULL, NULL);
    285 
    286 
    287         instance->tds[packet].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG;
    288         usb_log_debug2("Control last TD status: %x.\n",
    289             instance->tds[packet].status);
    290 }
    291 /*----------------------------------------------------------------------------*/
    292299void batch_call_in(batch_t *instance)
    293300{
Note: See TracChangeset for help on using the changeset viewer.