Ignore:
Timestamp:
2011-09-16T21:13:57Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3a11f17
Parents:
c0e53ff (diff), fd07e526 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    rc0e53ff r432a269  
    4848#include <ipc/adb.h>
    4949#include <async.h>
    50 #include <async_obsolete.h>
    5150#include <assert.h>
    5251#include "cuda_adb.h"
    5352
    54 // FIXME: remove this header
    55 #include <abi/ipc/methods.h>
    56 
    57 #define NAME "cuda_adb"
     53#define NAME  "cuda_adb"
    5854
    5955static void cuda_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg);
     
    154150
    155151        for (i = 0; i < ADB_MAX_ADDR; ++i) {
    156                 adb_dev[i].client_phone = -1;
     152                adb_dev[i].client_sess = NULL;
    157153                adb_dev[i].service_id = 0;
    158154        }
     
    199195        sysarg_t method;
    200196        service_id_t dsid;
    201         int retval;
    202197        int dev_addr, i;
    203198
     
    220215        async_answer_0(iid, EOK);
    221216
    222         while (1) {
     217        while (true) {
    223218                callid = async_get_call(&call);
    224219                method = IPC_GET_IMETHOD(call);
     
    230225                }
    231226               
    232                 switch (method) {
    233                 case IPC_M_CONNECT_TO_ME:
    234                         if (adb_dev[dev_addr].client_phone != -1) {
    235                                 retval = ELIMIT;
    236                                 break;
    237                         }
    238                         adb_dev[dev_addr].client_phone = IPC_GET_ARG5(call);
    239                         /*
    240                          * A hack so that we send the data to the phone
    241                          * regardless of which address the device is on.
    242                          */
    243                         for (i = 0; i < ADB_MAX_ADDR; ++i) {
    244                                 if (adb_dev[i].service_id == dsid) {
    245                                         adb_dev[i].client_phone = IPC_GET_ARG5(call);
     227                async_sess_t *sess =
     228                    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
     229                if (sess != NULL) {
     230                        if (adb_dev[dev_addr].client_sess == NULL) {
     231                                adb_dev[dev_addr].client_sess = sess;
     232                               
     233                                /*
     234                                 * A hack so that we send the data to the session
     235                                 * regardless of which address the device is on.
     236                                 */
     237                                for (i = 0; i < ADB_MAX_ADDR; ++i) {
     238                                        if (adb_dev[i].service_id == dsid)
     239                                                adb_dev[i].client_sess = sess;
    246240                                }
    247                         }
    248                         retval = 0;
    249                         break;
    250                 default:
    251                         retval = EINVAL;
    252                         break;
    253                 }
    254                 async_answer_0(callid, retval);
     241                               
     242                                async_answer_0(callid, EOK);
     243                        } else
     244                                async_answer_0(callid, ELIMIT);
     245                } else
     246                        async_answer_0(callid, EINVAL);
    255247        }
    256248}
     
    483475        reg_val = ((uint16_t) data[1] << 8) | (uint16_t) data[2];
    484476
    485         if (adb_dev[dev_addr].client_phone == -1)
    486                 return;
    487 
    488         async_obsolete_msg_1(adb_dev[dev_addr].client_phone, ADB_REG_NOTIF, reg_val);
     477        if (adb_dev[dev_addr].client_sess == NULL)
     478                return;
     479
     480        async_exch_t *exch =
     481            async_exchange_begin(adb_dev[dev_addr].client_sess);
     482        async_msg_1(exch, ADB_REG_NOTIF, reg_val);
     483        async_exchange_end(exch);
    489484}
    490485
Note: See TracChangeset for help on using the changeset viewer.