Changeset 5da7199 in mainline for uspace/srv/hw/char


Ignore:
Timestamp:
2011-09-09T17:18:06Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3781092, b7c33b0
Parents:
c69646f8
Message:

remove the obsolete async API

Location:
uspace/srv/hw/char
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/char/i8042/i8042.c

    rc69646f8 r5da7199  
    3232 * @ingroup kbd
    3333 * @{
    34  */ 
     34 */
    3535/** @file
    3636 * @brief i8042 PS/2 port driver.
     
    4141#include <loc.h>
    4242#include <async.h>
    43 #include <async_obsolete.h>
    4443#include <unistd.h>
    4544#include <sysinfo.h>
     
    4948#include "i8042.h"
    5049
    51 // FIXME: remove this header
    52 #include <abi/ipc/methods.h>
    53 
    54 #define NAME "i8042"
    55 #define NAMESPACE "char"
     50#define NAME       "i8042"
     51#define NAMESPACE  "char"
    5652
    5753/* Interesting bits for status register */
     
    145141
    146142        for (i = 0; i < MAX_DEVS; i++) {
    147                 i8042_port[i].client_phone = -1;
     143                i8042_port[i].client_sess = NULL;
    148144
    149145                snprintf(name, 16, "%s/ps2%c", NAMESPACE, dchar[i]);
     
    257253                }
    258254               
    259                 switch (method) {
    260                 case IPC_M_CONNECT_TO_ME:
    261                         printf(NAME ": creating callback connection\n");
    262                         if (i8042_port[dev_id].client_phone != -1) {
     255                async_sess_t *sess =
     256                    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
     257                if (sess != NULL) {
     258                        if (i8042_port[dev_id].client_sess == NULL) {
     259                                i8042_port[dev_id].client_sess = sess;
     260                                retval = EOK;
     261                        } else
    263262                                retval = ELIMIT;
     263                } else {
     264                        switch (method) {
     265                        case IPC_FIRST_USER_METHOD:
     266                                printf(NAME ": write %" PRIun " to devid %d\n",
     267                                    IPC_GET_ARG1(call), dev_id);
     268                                i8042_port_write(dev_id, IPC_GET_ARG1(call));
     269                                retval = 0;
     270                                break;
     271                        default:
     272                                retval = EINVAL;
    264273                                break;
    265274                        }
    266                         i8042_port[dev_id].client_phone = IPC_GET_ARG5(call);
    267                         retval = 0;
    268                         break;
    269                 case IPC_FIRST_USER_METHOD:
    270                         printf(NAME ": write %" PRIun " to devid %d\n",
    271                             IPC_GET_ARG1(call), dev_id);
    272                         i8042_port_write(dev_id, IPC_GET_ARG1(call));
    273                         retval = 0;
    274                         break;
    275                 default:
    276                         retval = EINVAL;
    277                         break;
    278275                }
     276               
    279277                async_answer_0(callid, retval);
    280278        }
     
    305303        }
    306304
    307         if (i8042_port[devid].client_phone != -1) {
    308                 async_obsolete_msg_1(i8042_port[devid].client_phone,
    309                     IPC_FIRST_USER_METHOD, data);
     305        if (i8042_port[devid].client_sess != NULL) {
     306                async_exch_t *exch =
     307                    async_exchange_begin(i8042_port[devid].client_sess);
     308                async_msg_1(exch, IPC_FIRST_USER_METHOD, data);
     309                async_exchange_end(exch);
    310310        }
    311311}
  • uspace/srv/hw/char/i8042/i8042.h

    rc69646f8 r5da7199  
    3939#define i8042_H_
    4040
     41#include <sys/types.h>
    4142#include <libarch/ddi.h>
    42 #include <libarch/types.h>
     43#include <async.h>
    4344
    4445/** i8042 HW I/O interface */
     
    5354typedef struct {
    5455        service_id_t service_id;
    55         int client_phone;
     56        async_sess_t *client_sess;
    5657} i8042_port_t;
    5758
     
    6061/**
    6162 * @}
    62  */ 
     63 */
  • uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c

    rc69646f8 r5da7199  
    4242#include <ipc/char.h>
    4343#include <async.h>
    44 #include <async_obsolete.h>
    4544#include <unistd.h>
    4645#include <stdio.h>
     
    5150#include "s3c24xx_uart.h"
    5251
    53 // FIXME: remove this header
    54 #include <abi/ipc/methods.h>
    55 
    56 #define NAME "s3c24ser"
    57 #define NAMESPACE "char"
     52#define NAME       "s3c24ser"
     53#define NAMESPACE  "char"
    5854
    5955static irq_cmd_t uart_irq_cmds[] = {
     
    117113    void *arg)
    118114{
    119         ipc_callid_t callid;
    120         ipc_call_t call;
    121         sysarg_t method;
    122         int retval;
    123 
    124115        /* Answer the IPC_M_CONNECT_ME_TO call. */
    125116        async_answer_0(iid, EOK);
    126 
    127         while (1) {
    128                 callid = async_get_call(&call);
    129                 method = IPC_GET_IMETHOD(call);
     117       
     118        while (true) {
     119                ipc_call_t call;
     120                ipc_callid_t callid = async_get_call(&call);
     121                sysarg_t method = IPC_GET_IMETHOD(call);
    130122               
    131123                if (!method) {
     
    135127                }
    136128               
    137                 switch (method) {
    138                 case IPC_M_CONNECT_TO_ME:
    139                         printf(NAME ": creating callback connection\n");
    140                         uart->client_phone = IPC_GET_ARG5(call);
    141                         retval = 0;
    142                         break;
    143                 case CHAR_WRITE_BYTE:
    144                         printf(NAME ": write %" PRIun " to device\n",
    145                             IPC_GET_ARG1(call));
    146                         s3c24xx_uart_sendb(uart, (uint8_t) IPC_GET_ARG1(call));
    147                         retval = 0;
    148                         break;
    149                 default:
    150                         retval = EINVAL;
    151                         break;
     129                async_sess_t *sess =
     130                    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
     131                if (sess != NULL) {
     132                        if (uart->client_sess == NULL) {
     133                                uart->client_sess = sess;
     134                                async_answer_0(callid, EOK);
     135                        } else
     136                                async_answer_0(callid, ELIMIT);
     137                } else {
     138                        switch (method) {
     139                        case CHAR_WRITE_BYTE:
     140                                printf(NAME ": write %" PRIun " to device\n",
     141                                    IPC_GET_ARG1(call));
     142                                s3c24xx_uart_sendb(uart, (uint8_t) IPC_GET_ARG1(call));
     143                                async_answer_0(callid, EOK);
     144                                break;
     145                        default:
     146                                async_answer_0(callid, EINVAL);
     147                        }
    152148                }
    153                 async_answer_0(callid, retval);
    154149        }
    155150}
     
    163158                uint32_t status = pio_read_32(&uart->io->uerstat);
    164159
    165                 if (uart->client_phone != -1) {
    166                         async_obsolete_msg_1(uart->client_phone, CHAR_NOTIF_BYTE,
    167                             data);
     160                if (uart->client_sess != NULL) {
     161                        async_exch_t *exch = async_exchange_begin(uart->client_sess);
     162                        async_msg_1(exch, CHAR_NOTIF_BYTE, data);
     163                        async_exchange_end(exch);
    168164                }
    169165
     
    191187
    192188        uart->io = vaddr;
    193         uart->client_phone = -1;
     189        uart->client_sess = NULL;
    194190
    195191        printf(NAME ": device at physical address %p, inr %" PRIun ".\n",
  • uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.h

    rc69646f8 r5da7199  
    3939
    4040#include <sys/types.h>
     41#include <async.h>
    4142
    4243/** S3C24xx UART I/O */
     
    8485        s3c24xx_uart_io_t *io;
    8586
    86         /** Callback phone to the client */
    87         int client_phone;
     87        /** Callback session to the client */
     88        async_sess_t *client_sess;
    8889
    8990        /** Service ID */
Note: See TracChangeset for help on using the changeset viewer.