Changeset f300523 in mainline


Ignore:
Timestamp:
2017-11-29T18:43:10Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
39026d7c
Parents:
48b77ed
Message:

Eliminate uses of thread_usleep() in favor of async_usleep(). Obvious cases are in components that don't explicitly create threads.

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/sleep/sleep.c

    r48b77ed rf300523  
    2727 */
    2828
     29#include <async.h>
    2930#include <errno.h>
    3031#include <stdio.h>
    3132#include <stdlib.h>
    32 #include <thread.h>
    3333#include "config.h"
    3434#include "util.h"
     
    131131        }
    132132
    133         (void) thread_usleep(duration);
     133        async_usleep(duration);
    134134
    135135        return CMD_SUCCESS;
  • uspace/app/tester/hw/serial/serial1.c

    r48b77ed rf300523  
    4545#include <stddef.h>
    4646#include <str.h>
    47 #include <thread.h>
    4847#include "../../tester.h"
    4948
     
    162161                TPRINTF("Read %zd bytes\n", nread);
    163162               
    164                 if (nread == 0)
    165                         thread_usleep(DEFAULT_SLEEP);
    166                 else {
    167                         buf[nread] = 0;
    168                        
    169                         /*
    170                          * Write data back to the device to test the opposite
    171                          * direction of data transfer.
    172                          */
    173                         rc = chardev_write(chardev, buf, nread, &nwritten);
    174                         if (rc != EOK) {
    175                                 (void) serial_set_comm_props(serial, old_baud,
    176                                     old_par, old_word_size, old_stop);
    177                                
    178                                 free(buf);
    179                                 chardev_close(chardev);
    180                                 serial_close(serial);
    181                                 async_hangup(sess);
    182                                 return "Failed writing to serial device";
    183                         }
    184                        
    185                         if (nwritten != nread) {
    186                                 (void) serial_set_comm_props(serial, old_baud,
    187                                     old_par, old_word_size, old_stop);
    188                                
    189                                 free(buf);
    190                                 chardev_close(chardev);
    191                                 serial_close(serial);
    192                                 async_hangup(sess);
    193                                 return "Written less data than read from serial device";
    194                         }
    195                        
    196                         TPRINTF("Written %zd bytes\n", nwritten);
    197                 }
     163                buf[nread] = 0;
     164               
     165                /*
     166                 * Write data back to the device to test the opposite
     167                 * direction of data transfer.
     168                 */
     169                rc = chardev_write(chardev, buf, nread, &nwritten);
     170                if (rc != EOK) {
     171                        (void) serial_set_comm_props(serial, old_baud,
     172                            old_par, old_word_size, old_stop);
     173                       
     174                        free(buf);
     175                        chardev_close(chardev);
     176                        serial_close(serial);
     177                        async_hangup(sess);
     178                        return "Failed writing to serial device";
     179                }
     180               
     181                if (nwritten != nread) {
     182                        (void) serial_set_comm_props(serial, old_baud,
     183                            old_par, old_word_size, old_stop);
     184                       
     185                        free(buf);
     186                        chardev_close(chardev);
     187                        serial_close(serial);
     188                        async_hangup(sess);
     189                        return "Written less data than read from serial device";
     190                }
     191               
     192                TPRINTF("Written %zd bytes\n", nwritten);
    198193               
    199194                total += nread;
  • uspace/drv/nic/e1k/e1k.c

    r48b77ed rf300523  
    3333 */
    3434
     35#include <async.h>
    3536#include <assert.h>
    3637#include <stdio.h>
     
    3839#include <adt/list.h>
    3940#include <align.h>
    40 #include <thread.h>
    4141#include <byteorder.h>
    4242#include <as.h>
     
    372372                fibril_mutex_unlock(&e1000->ctrl_lock);
    373373               
    374                 thread_usleep(10);
     374                async_usleep(10);
    375375               
    376376                fibril_mutex_lock(&e1000->ctrl_lock);
     
    17241724       
    17251725        /* Wait for the reset */
    1726         thread_usleep(20);
     1726        async_usleep(20);
    17271727       
    17281728        /* check if RST_BIT cleared */
     
    18121812         * transfers to descriptors.
    18131813         */
    1814         thread_usleep(100);
     1814        async_usleep(100);
    18151815       
    18161816        return EOK;
     
    22382238        uint32_t eerd = E1000_REG_READ(e1000, E1000_EERD);
    22392239        while ((eerd & e1000->info.eerd_done) == 0) {
    2240                 thread_usleep(1);
     2240                async_usleep(1);
    22412241                eerd = E1000_REG_READ(e1000, E1000_EERD);
    22422242        }
  • uspace/drv/nic/ne2k/dp8390.c

    r48b77ed rf300523  
    5555
    5656#include <assert.h>
     57#include <async.h>
    5758#include <byteorder.h>
    5859#include <errno.h>
    5960#include <stdio.h>
    6061#include <ddi.h>
    61 #include <thread.h>
    6262#include "dp8390.h"
    6363
     
    172172        /* Reset the ethernet card */
    173173        uint8_t val = pio_read_8(ne2k->port + NE2K_RESET);
    174         thread_usleep(2000);
     174        async_usleep(2000);
    175175        pio_write_8(ne2k->port + NE2K_RESET, val);
    176         thread_usleep(2000);
     176        async_usleep(2000);
    177177       
    178178        /* Reset the DP8390 */
  • uspace/drv/nic/rtl8139/driver.c

    r48b77ed rf300523  
    2828
    2929#include <assert.h>
     30#include <async.h>
    3031#include <errno.h>
    3132#include <align.h>
    32 #include <thread.h>
    3333#include <byteorder.h>
    3434#include <libarch/barrier.h>
     
    435435        memory_barrier();
    436436        while(pio_read_8(io_base + CR) & CR_RST) {
    437                 thread_usleep(1);
     437                async_usleep(1);
    438438                read_barrier();
    439439        }
  • uspace/drv/nic/rtl8169/driver.c

    r48b77ed rf300523  
    2828
    2929#include <assert.h>
     30#include <async.h>
    3031#include <errno.h>
    3132#include <align.h>
     
    3435
    3536#include <as.h>
    36 #include <thread.h>
    3737#include <ddf/log.h>
    3838#include <ddf/interrupt.h>
     
    763763        memory_barrier();
    764764        while (pio_read_8(rtl8169->regs + CR) & CR_RST) {
    765                 thread_usleep(1);
     765                async_usleep(1);
    766766                read_barrier();
    767767        }
     
    11761176        do {
    11771177                phyar = pio_read_32(rtl8169->regs + PHYAR);
    1178                 thread_usleep(20);
     1178                async_usleep(20);
    11791179        } while ((phyar & PHYAR_RW_WRITE) == 0);
    11801180
     
    11941194        do {
    11951195                phyar = pio_read_32(rtl8169->regs + PHYAR);
    1196                 thread_usleep(20);
     1196                async_usleep(20);
    11971197        } while ((phyar & PHYAR_RW_WRITE) != 0);
    11981198
    1199         thread_usleep(20);
     1199        async_usleep(20);
    12001200}
    12011201
  • uspace/srv/hid/isdv4_tablet/isdv4.c

    r48b77ed rf300523  
    2727 */
    2828
     29#include <async.h>
    2930#include <errno.h>
    3031#include <io/chardev.h>
     
    3334#include <stdint.h>
    3435#include <stdlib.h>
    35 #include <thread.h>
    3636
    3737#include "isdv4.h"
     
    401401                return EIO;
    402402
    403         thread_usleep(250000); /* 250 ms */
     403        async_usleep(250000); /* 250 ms */
    404404
    405405        // FIXME: Read all possible garbage before sending commands
Note: See TracChangeset for help on using the changeset viewer.