Ignore:
Timestamp:
2011-01-29T11:36:41Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b6931a, 8add9ca5
Parents:
e26a4633 (diff), ffa2c8ef (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:

IPC/async: strictly isolate the use of low-level IPC methods (ipc_*) and async framework methods (async_*) in user code, do not allow a mixture of both in a single source file

Benefits for future plans

  • The async framework could use different communication style under the hood, but keeping the same high-level API
  • The async framework can be integrated more tightly with sessions without potential problems of intermixing session-aware async methods with session-unaware low-level methods in user code
  • The async_serialize_start()/_end() can be deprecated more easily
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/hw/serial/serial1.c

    re26a4633 r46b881c  
    3939#include <stdlib.h>
    4040#include <stdio.h>
    41 #include <ipc/ipc.h>
    4241#include <sys/types.h>
    4342#include <async.h>
     
    8887        char *buf = (char *) malloc(cnt + 1);
    8988        if (buf == NULL) {
    90                 ipc_hangup(phone);
     89                async_hangup(phone);
    9190                devman_hangup_phone(DEVMAN_CLIENT);
    9291                return "Failed to allocate input buffer";
     
    9897        sysarg_t old_word_size;
    9998       
    100         res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
     99        res = async_req_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
    101100            &old_par, &old_word_size, &old_stop);
    102101        if (res != EOK) {
    103102                free(buf);
    104                 ipc_hangup(phone);
     103                async_hangup(phone);
    105104                devman_hangup_phone(DEVMAN_CLIENT);
    106105                return "Failed to get old serial communication parameters";
    107106        }
    108107       
    109         res = ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, 1200,
     108        res = async_req_4_0(phone, SERIAL_SET_COM_PROPS, 1200,
    110109            SERIAL_NO_PARITY, 8, 1);
    111110        if (EOK != res) {
    112111                free(buf);
    113                 ipc_hangup(phone);
     112                async_hangup(phone);
    114113                devman_hangup_phone(DEVMAN_CLIENT);
    115114                return "Failed to set serial communication parameters";
     
    124123               
    125124                if (read < 0) {
    126                         ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     125                        async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    127126                            old_par, old_word_size, old_stop);
    128127                        free(buf);
    129                         ipc_hangup(phone);
     128                        async_hangup(phone);
    130129                        devman_hangup_phone(DEVMAN_CLIENT);
    131130                        return "Failed read from serial device";
     
    133132               
    134133                if ((size_t) read > cnt - total) {
    135                         ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     134                        async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    136135                            old_par, old_word_size, old_stop);
    137136                        free(buf);
    138                         ipc_hangup(phone);
     137                        async_hangup(phone);
    139138                        devman_hangup_phone(DEVMAN_CLIENT);
    140139                        return "Read more data than expected";
     
    155154                       
    156155                        if (written < 0) {
    157                                 ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     156                                async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    158157                                    old_par, old_word_size, old_stop);
    159158                                free(buf);
    160                                 ipc_hangup(phone);
     159                                async_hangup(phone);
    161160                                devman_hangup_phone(DEVMAN_CLIENT);
    162161                                return "Failed write to serial device";
     
    164163                       
    165164                        if (written != read) {
    166                                 ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     165                                async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    167166                                    old_par, old_word_size, old_stop);
    168167                                free(buf);
    169                                 ipc_hangup(phone);
     168                                async_hangup(phone);
    170169                                devman_hangup_phone(DEVMAN_CLIENT);
    171170                                return "Written less data than read from serial device";
     
    183182        ssize_t written = char_dev_write(phone, (void *) EOT, eot_size);
    184183       
    185         ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
     184        async_req_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
    186185            old_par, old_word_size, old_stop);
    187186        free(buf);
    188         ipc_hangup(phone);
     187        async_hangup(phone);
    189188        devman_hangup_phone(DEVMAN_CLIENT);
    190189       
Note: See TracChangeset for help on using the changeset viewer.