Changes in / [b670523:503e4e3] in mainline


Ignore:
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • boot/generic/src/version.c

    rb670523 r503e4e3  
    3232
    3333static const char *project = "HelenOS bootloader";
    34 static const char *copyright = "Copyright (c) 2001-2011 HelenOS project";
     34static const char *copyright = "Copyright (c) 2001-2010 HelenOS project";
    3535static const char *release = STRING(RELEASE);
    3636static const char *name = STRING(NAME);
  • kernel/generic/src/main/version.c

    rb670523 r503e4e3  
    3838
    3939static const char *project = "SPARTAN kernel";
    40 static const char *copyright = "Copyright (c) 2001-2011 HelenOS project";
     40static const char *copyright = "Copyright (c) 2001-2010 HelenOS project";
    4141static const char *release = STRING(RELEASE);
    4242static const char *name = STRING(NAME);
  • uspace/app/getterm/version.c

    rb670523 r503e4e3  
    6161        printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp);
    6262        printf("Running on %s (%s)\n", arch, term);
    63         printf("Copyright (c) 2001-2011 HelenOS project\n\n");
     63        printf("Copyright (c) 2001-2010 HelenOS project\n\n");
    6464}
    6565
  • uspace/drv/usbmouse/init.c

    rb670523 r503e4e3  
    4343#include <errno.h>
    4444
     45// FIXME: remove this header
     46#include <kernel/ipc/ipc_methods.h>
     47
    4548/** Mouse polling endpoint description for boot protocol subclass. */
    4649usb_endpoint_description_t poll_endpoint_description = {
     
    5356};
    5457
    55 /** Default handler for IPC methods not handled by DDF.
    56  *
    57  * @param fun     Device function handling the call.
    58  * @param icallid Call ID.
    59  * @param icall   Call data.
    60  *
    61  */
    62 static void default_connection_handler(ddf_fun_t *fun, ipc_callid_t icallid,
    63     ipc_call_t *icall)
    64 {
    65         usb_mouse_t *mouse = (usb_mouse_t *) fun->driver_data;
    66         assert(mouse != NULL);
    67        
    68         async_sess_t *callback =
    69             async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
    70        
    71         if (callback) {
    72                 if (mouse->console_sess == NULL) {
    73                         mouse->console_sess = callback;
    74                         async_answer_0(icallid, EOK);
    75                 } else
    76                         async_answer_0(icallid, ELIMIT);
    77         } else
    78                 async_answer_0(icallid, EINVAL);
    79 }
    80 
     58static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
    8159/** Device ops for USB mouse. */
    8260static ddf_dev_ops_t mouse_ops = {
    8361        .default_handler = default_connection_handler
    8462};
     63
     64/** Default handler for IPC methods not handled by DDF.
     65 *
     66 * @param fun Device function handling the call.
     67 * @param icallid Call id.
     68 * @param icall Call data.
     69 */
     70void default_connection_handler(ddf_fun_t *fun,
     71    ipc_callid_t icallid, ipc_call_t *icall)
     72{
     73        sysarg_t method = IPC_GET_IMETHOD(*icall);
     74
     75        usb_mouse_t *mouse = (usb_mouse_t *) fun->driver_data;
     76        assert(mouse != NULL);
     77
     78        if (method == IPC_M_CONNECT_TO_ME) {
     79                int callback = IPC_GET_ARG5(*icall);
     80
     81                if (mouse->console_phone != -1) {
     82                        async_answer_0(icallid, ELIMIT);
     83                        return;
     84                }
     85
     86                mouse->console_phone = callback;
     87                async_answer_0(icallid, EOK);
     88                return;
     89        }
     90
     91        async_answer_0(icallid, EINVAL);
     92}
    8593
    8694/** Create USB mouse device.
     
    94102{
    95103        usb_mouse_t *mouse = malloc(sizeof(usb_mouse_t));
    96         if (mouse == NULL)
     104        if (mouse == NULL) {
    97105                return ENOMEM;
    98        
     106        }
    99107        mouse->dev = dev;
    100         mouse->console_sess = NULL;
    101        
     108        mouse->console_phone = -1;
     109
    102110        int rc;
    103        
     111
    104112        /* Create DDF function. */
    105113        mouse->mouse_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "mouse");
     
    108116                goto leave;
    109117        }
    110        
     118
    111119        mouse->mouse_fun->ops = &mouse_ops;
    112        
     120
    113121        rc = ddf_fun_bind(mouse->mouse_fun);
    114         if (rc != EOK)
     122        if (rc != EOK) {
    115123                goto leave;
    116        
     124        }
     125
    117126        /* Add the function to mouse class. */
    118127        rc = ddf_fun_add_to_class(mouse->mouse_fun, "mouse");
    119         if (rc != EOK)
     128        if (rc != EOK) {
    120129                goto leave;
     130        }
    121131       
    122132        /* Set the boot protocol. */
    123133        rc = usbhid_req_set_protocol(&dev->ctrl_pipe, dev->interface_no,
    124134            USB_HID_PROTOCOL_BOOT);
    125         if (rc != EOK)
     135        if (rc != EOK) {
    126136                goto leave;
     137        }
    127138       
    128         /* Everything allright. */
     139        /* Everything all right. */
    129140        dev->driver_data = mouse;
    130141        mouse->mouse_fun->driver_data = mouse;
    131        
     142
    132143        return EOK;
    133        
     144
    134145leave:
    135146        free(mouse);
     147
    136148        return rc;
    137149}
  • uspace/drv/usbmouse/main.c

    rb670523 r503e4e3  
    3434 * Main routines of USB boot protocol mouse driver.
    3535 */
    36 
    3736#include "mouse.h"
    3837#include <usb/debug.h>
     
    4140#include <str_error.h>
    4241
    43 #define NAME  "usbmouse"
    44 
    4542/** Callback when new mouse device is attached and recognised by DDF.
    4643 *
    4744 * @param dev Representation of a generic DDF device.
    48  *
    4945 * @return Error code.
    50  *
    5146 */
    5247static int usbmouse_add_device(usb_device_t *dev)
     
    5853                return rc;
    5954        }
    60        
     55
    6156        usb_log_debug("Polling pipe at endpoint %d.\n",
    6257            dev->pipes[0].pipe->endpoint_no);
    63        
    64         rc = usb_device_auto_poll(dev, 0, usb_mouse_polling_callback,
    65             dev->pipes[0].pipe->max_packet_size,
     58
     59        rc = usb_device_auto_poll(dev, 0,
     60            usb_mouse_polling_callback, dev->pipes[0].pipe->max_packet_size,
    6661            usb_mouse_polling_ended_callback, dev->driver_data);
    67        
     62
    6863        if (rc != EOK) {
    6964                usb_log_error("Failed to start polling fibril: %s.\n",
     
    7166                return rc;
    7267        }
    73        
     68
    7469        usb_log_info("controlling new mouse (handle %" PRIun ").\n",
    7570            dev->ddf_dev->handle);
    76        
     71
    7772        return EOK;
    7873}
     
    9893{
    9994        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
     95
    10096        return usb_driver_main(&mouse_driver);
    10197}
  • uspace/drv/usbmouse/mouse.c

    rb670523 r503e4e3  
    4040#include <ipc/mouse.h>
    4141#include <async.h>
     42#include <async_obsolete.h>
    4243#include "mouse.h"
    4344
    4445/** Mouse polling callback.
    4546 *
    46  * @param dev    Device that is being polled.
     47 * @param dev Device that is being polled.
    4748 * @param buffer Data buffer.
    48  * @param size   Buffer size in bytes.
    49  * @param arg    Pointer to usb_mouse_t.
    50  *
     49 * @param buffer_size Buffer size in bytes.
     50 * @param arg Custom argument - points to usb_mouse_t.
    5151 * @return Always true.
    52  *
    5352 */
    54 bool usb_mouse_polling_callback(usb_device_t *dev, uint8_t *buffer,
    55     size_t size, void *arg)
     53bool usb_mouse_polling_callback(usb_device_t *dev,
     54    uint8_t *buffer, size_t buffer_size, void *arg)
    5655{
    5756        usb_mouse_t *mouse = (usb_mouse_t *) arg;
    58        
     57
    5958        usb_log_debug2("got buffer: %s.\n",
    60             usb_debug_str_buffer(buffer, size, 0));
    61        
     59            usb_debug_str_buffer(buffer, buffer_size, 0));
     60
    6261        uint8_t butt = buffer[0];
    6362        char str_buttons[4] = {
     
    6766                0
    6867        };
    69        
     68
    7069        int shift_x = ((int) buffer[1]) - 127;
    7170        int shift_y = ((int) buffer[2]) - 127;
    7271        int wheel = ((int) buffer[3]) - 127;
    73        
    74         if (buffer[1] == 0)
     72
     73        if (buffer[1] == 0) {
    7574                shift_x = 0;
    76        
    77         if (buffer[2] == 0)
     75        }
     76        if (buffer[2] == 0) {
    7877                shift_y = 0;
    79        
    80         if (buffer[3] == 0)
     78        }
     79        if (buffer[3] == 0) {
    8180                wheel = 0;
    82        
    83         if (mouse->console_sess) {
     81        }
     82
     83        if (mouse->console_phone >= 0) {
    8484                if ((shift_x != 0) || (shift_y != 0)) {
    85                         // FIXME: guessed for QEMU
    86                        
    87                         async_exch_t *exch = async_exchange_begin(mouse->console_sess);
    88                         async_req_2_0(exch, MEVENT_MOVE, -shift_x / 10, -shift_y / 10);
    89                         async_exchange_end(exch);
     85                        /* FIXME: guessed for QEMU */
     86                        async_obsolete_req_2_0(mouse->console_phone,
     87                            MEVENT_MOVE,
     88                            - shift_x / 10,  - shift_y / 10);
    9089                }
    9190                if (butt) {
    92                         // FIXME: proper button clicking
    93                        
    94                         async_exch_t *exch = async_exchange_begin(mouse->console_sess);
    95                         async_req_2_0(exch, MEVENT_BUTTON, 1, 1);
    96                         async_req_2_0(exch, MEVENT_BUTTON, 1, 0);
    97                         async_exchange_end(exch);
     91                        /* FIXME: proper button clicking. */
     92                        async_obsolete_req_2_0(mouse->console_phone,
     93                            MEVENT_BUTTON, 1, 1);
     94                        async_obsolete_req_2_0(mouse->console_phone,
     95                            MEVENT_BUTTON, 1, 0);
    9896                }
    9997        }
    100        
     98
    10199        usb_log_debug("buttons=%s  dX=%+3d  dY=%+3d  wheel=%+3d\n",
    102100            str_buttons, shift_x, shift_y, wheel);
    103        
     101
    104102        /* Guess. */
    105103        async_usleep(1000);
    106        
     104
    107105        return true;
    108106}
     
    110108/** Callback when polling is terminated.
    111109 *
    112  * @param dev              Device where the polling terminated.
     110 * @param dev Device where the polling terminated.
    113111 * @param recurring_errors Whether the polling was terminated due to
    114  *                         recurring errors.
    115  * @param arg              Pointer to usb_mouse_t.
    116  *
     112 *      recurring errors.
     113 * @param arg Custom argument - points to usb_mouse_t.
    117114 */
    118 void usb_mouse_polling_ended_callback(usb_device_t *dev, bool recurring_errors,
    119     void *arg)
     115void usb_mouse_polling_ended_callback(usb_device_t *dev,
     116    bool recurring_errors, void *arg)
    120117{
    121118        usb_mouse_t *mouse = (usb_mouse_t *) arg;
    122        
    123         async_hangup(mouse->console_sess);
    124         mouse->console_sess = NULL;
    125        
     119
     120        async_obsolete_hangup(mouse->console_phone);
     121        mouse->console_phone = -1;
     122
    126123        usb_device_destroy(dev);
    127124}
  • uspace/drv/usbmouse/mouse.h

    rb670523 r503e4e3  
    3434 * Common definitions for USB mouse driver.
    3535 */
    36 
    3736#ifndef USBMOUSE_MOUSE_H_
    3837#define USBMOUSE_MOUSE_H_
     
    4140#include <usb/dev/pipes.h>
    4241#include <time.h>
    43 #include <async.h>
    4442
    45 #define POLL_PIPE(dev) \
    46         ((dev)->pipes[0].pipe)
     43#define NAME "usbmouse"
    4744
    4845/** Container for USB mouse device. */
     
    5047        /** Generic device container. */
    5148        usb_device_t *dev;
    52        
    5349        /** Function representing the device. */
    5450        ddf_fun_t *mouse_fun;
    55        
    5651        /** Polling interval in microseconds. */
    5752        suseconds_t poll_interval_us;
    58        
    59         /** Callback session to console (consumer). */
    60         async_sess_t *console_sess;
     53        /** IPC phone to console (consumer). */
     54        int console_phone;
    6155} usb_mouse_t;
     56
     57#define POLL_PIPE(dev) ((dev)->pipes[0].pipe)
    6258
    6359extern usb_endpoint_description_t poll_endpoint_description;
    6460
    65 extern int usb_mouse_create(usb_device_t *);
    66 extern bool usb_mouse_polling_callback(usb_device_t *, uint8_t *, size_t,
    67     void *);
    68 extern void usb_mouse_polling_ended_callback(usb_device_t *, bool, void *);
     61int usb_mouse_create(usb_device_t *);
     62
     63bool usb_mouse_polling_callback(usb_device_t *, uint8_t *, size_t, void *);
     64void usb_mouse_polling_ended_callback(usb_device_t *, bool, void *);
    6965
    7066#endif
    71 
    7267/**
    7368 * @}
  • uspace/drv/vhc/conndev.c

    rb670523 r503e4e3  
    4545static fibril_local char plugged_device_name[PLUGGED_DEVICE_NAME_MAXLEN + 1] = "<unknown>";
    4646
     47#if 0
    4748/** Receive device name.
    4849 *
     
    8485        plugged_device_name[len] = 0;
    8586}
     87#endif
    8688
    8789/** Default handler for IPC methods not handled by DDF.
     
    9193 * @param icall Call data.
    9294 */
    93 void default_connection_handler(ddf_fun_t *fun, ipc_callid_t icallid,
    94     ipc_call_t *icall)
     95void default_connection_handler(ddf_fun_t *fun,
     96    ipc_callid_t icallid, ipc_call_t *icall)
    9597{
     98// FIXME:
     99// This code needs to be refactored since the async
     100// framework does not support automatic callback connections
     101// yet.
     102
     103#if 0
    96104        vhc_data_t *vhc = fun->dev->driver_data;
    97        
    98         async_sess_t *callback =
    99             async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
    100        
    101         if (callback) {
    102                 int rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);
     105        sysarg_t method = IPC_GET_IMETHOD(*icall);
     106
     107        if (method == IPC_M_CONNECT_TO_ME) {
     108                int callback = IPC_GET_ARG5(*icall);
     109                int rc = vhc_virtdev_plug(vhc, callback,
     110                    &plugged_device_handle);
    103111                if (rc != EOK) {
    104112                        async_answer_0(icallid, rc);
     
    106114                        return;
    107115                }
    108                
     116
    109117                async_answer_0(icallid, EOK);
    110                
     118
    111119                receive_device_name(callback);
    112                
     120
    113121                usb_log_info("New virtual device `%s' (id: %" PRIxn ").\n",
    114122                    plugged_device_name, plugged_device_handle);
    115         } else
    116                 async_answer_0(icallid, EINVAL);
     123
     124                return;
     125        }
     126#endif
     127
     128        async_answer_0(icallid, EINVAL);
    117129}
    118130
  • uspace/lib/c/generic/async.c

    rb670523 r503e4e3  
    23392339 * @param mgmt Exchange management style.
    23402340 *
    2341  * @return New async session.
    2342  * @return NULL on failure.
     2341 * @return New async session or NULL on failure.
    23432342 *
    23442343 */
     
    23782377}
    23792378
    2380 /** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls.
    2381  *
    2382  * If the call is IPC_M_CONNECT_TO_ME then a new
    2383  * async session is created. However, the phone is
    2384  * not accepted automatically.
    2385  *
    2386  * @param mgmt   Exchange management style.
    2387  * @param call   Call data.
    2388  *
    2389  * @return New async session.
    2390  * @return NULL on failure.
    2391  * @return NULL if the call is not IPC_M_CONNECT_TO_ME.
    2392  *
    2393  */
    2394 async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call)
    2395 {
    2396         int phone = (int) IPC_GET_ARG5(*call);
    2397        
    2398         if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) ||
    2399             (phone < 0))
    2400                 return NULL;
    2401        
    2402         async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));
    2403         if (sess == NULL)
    2404                 return NULL;
    2405        
    2406         sess->mgmt = mgmt;
    2407         sess->phone = phone;
    2408         sess->arg1 = 0;
    2409         sess->arg2 = 0;
    2410         sess->arg3 = 0;
    2411        
    2412         list_initialize(&sess->exch_list);
    2413         fibril_mutex_initialize(&sess->mutex);
    2414         atomic_set(&sess->refcnt, 0);
    2415        
    2416         return sess;
    2417 }
    2418 
    24192379/** @}
    24202380 */
  • uspace/lib/c/generic/devman.c

    rb670523 r503e4e3  
    231231        }
    232232       
     233        async_wait_for(req, &retval);
     234        if (retval != EOK) {
     235                devman_exchange_end(exch);
     236               
     237                if (funh != NULL)
     238                        *funh = -1;
     239               
     240                return retval;
     241        }
     242       
     243        if (funh != NULL)
     244                *funh = (int) IPC_GET_ARG1(answer);
     245       
    233246        link_t *link = match_ids->ids.next;
    234247        match_id_t *match_id = NULL;
     
    237250                match_id = list_get_instance(link, match_id_t, link);
    238251               
    239                 ipc_call_t answer2;
    240                 aid_t req2 = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
    241                     match_id->score, &answer2);
     252                ipc_call_t answer;
     253                aid_t req = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
     254                    match_id->score, &answer);
    242255                retval = async_data_write_start(exch, match_id->id,
    243256                    str_size(match_id->id));
    244                 if (retval != EOK) {
    245                         devman_exchange_end(exch);
    246                         async_wait_for(req2, NULL);
    247                         async_wait_for(req, NULL);
    248                         return retval;
    249                 }
    250                
    251                 async_wait_for(req2, &retval);
    252257                if (retval != EOK) {
    253258                        devman_exchange_end(exch);
     
    256261                }
    257262               
     263                async_wait_for(req, &retval);
     264                if (retval != EOK) {
     265                        devman_exchange_end(exch);
     266                        return retval;
     267                }
     268               
    258269                link = link->next;
    259270        }
    260271       
    261272        devman_exchange_end(exch);
    262        
    263         async_wait_for(req, &retval);
    264         if (retval == EOK) {
    265                 if (funh != NULL)
    266                         *funh = (int) IPC_GET_ARG1(answer);
    267         } else {
    268                 if (funh != NULL)
    269                         *funh = -1;
    270         }
    271        
    272         return retval;
     273        return EOK;
    273274}
    274275
  • uspace/lib/c/include/async.h

    rb670523 r503e4e3  
    464464extern async_sess_t *async_clone_receive(exch_mgmt_t);
    465465extern async_sess_t *async_callback_receive(exch_mgmt_t);
    466 extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    467466
    468467#endif
Note: See TracChangeset for help on using the changeset viewer.