Changeset 57265539 in mainline


Ignore:
Timestamp:
2014-12-16T21:59:57Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d8bb821
Parents:
e8b8b74
Message:

streamline the CUDA/ADB driver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/bus/cuda_adb/cuda_adb.c

    re8b8b74 r57265539  
    109109        {
    110110                .base = 0,
    111                 .size = sizeof(cuda_t) 
     111                .size = sizeof(cuda_t)
    112112        }
    113113};
     
    157157
    158158        printf(NAME ": VIA-CUDA Apple Desktop Bus driver\n");
     159       
     160        /*
     161         * Alleviate the virtual memory / page table pressure caused by
     162         * interrupt storms when the default large stacks are used.
     163         */
     164        async_set_notification_handler_stack_size(PAGE_SIZE);
    159165
    160166        for (i = 0; i < ADB_MAX_ADDR; ++i) {
     
    306312        fibril_mutex_lock(&instance->dev_lock);
    307313
     314        switch (instance->xstate) {
     315        case cx_listen:
     316                cuda_irq_listen();
     317                break;
     318        case cx_receive:
     319                cuda_irq_receive();
     320                break;
     321        case cx_rcv_end:
     322                cuda_irq_rcv_end(rbuf, &len);
     323                handle = true;
     324                break;
     325        case cx_send_start:
     326                cuda_irq_send_start();
     327                break;
     328        case cx_send:
     329                cuda_irq_send();
     330                break;
     331        }
     332       
    308333        /* Lower IFR.SR_INT so that CUDA can generate next int by raising it. */
    309334        pio_write_8(&instance->cuda->ifr, SR_INT);
    310 
    311         switch (instance->xstate) {
    312         case cx_listen: cuda_irq_listen(); break;
    313         case cx_receive: cuda_irq_receive(); break;
    314         case cx_rcv_end: cuda_irq_rcv_end(rbuf, &len);
    315             handle = true; break;
    316         case cx_send_start: cuda_irq_send_start(); break;
    317         case cx_send: cuda_irq_send(); break;
    318         }
    319335
    320336        fibril_mutex_unlock(&instance->dev_lock);
     
    331347static void cuda_irq_listen(void)
    332348{
    333         uint8_t b;
    334 
    335         b = pio_read_8(&dev->b);
    336 
     349        uint8_t b = pio_read_8(&dev->b);
     350       
    337351        if ((b & TREQ) != 0) {
    338352                printf("cuda_irq_listen: no TREQ?!\n");
    339353                return;
    340354        }
    341 
    342         pio_read_8(&dev->sr);
    343         pio_write_8(&dev->b, pio_read_8(&dev->b) & ~TIP);
     355       
     356        pio_write_8(&dev->b, b & ~TIP);
    344357        instance->xstate = cx_receive;
    345358}
     
    351364static void cuda_irq_receive(void)
    352365{
    353         uint8_t b, data;
    354 
    355         data = pio_read_8(&dev->sr);
     366        uint8_t data = pio_read_8(&dev->sr);
    356367        if (instance->bidx < CUDA_RCV_BUF_SIZE)
    357368                instance->rcv_buf[instance->bidx++] = data;
    358 
    359         b = pio_read_8(&dev->b);
    360 
     369       
     370        uint8_t b = pio_read_8(&dev->b);
     371       
    361372        if ((b & TREQ) == 0) {
    362373                pio_write_8(&dev->b, b ^ TACK);
     
    374385static void cuda_irq_rcv_end(void *buf, size_t *len)
    375386{
    376         uint8_t b;
    377        
    378         b = pio_read_8(&dev->b);
    379         pio_read_8(&dev->sr);
     387        uint8_t b = pio_read_8(&dev->b);
    380388       
    381389        if ((b & TREQ) == 0) {
     
    523531}
    524532
    525 
    526533/** @}
    527534 */
Note: See TracChangeset for help on using the changeset viewer.