Changeset 5da7199 in mainline for uspace/srv
- Timestamp:
- 2011-09-09T17:18:06Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3781092, b7c33b0
- Parents:
- c69646f8
- Location:
- uspace/srv
- Files:
-
- 11 edited
-
hid/input/generic/input.c (modified) (9 diffs)
-
hid/input/include/input.h (modified) (2 diffs)
-
hid/input/port/ns16550.c (modified) (2 diffs)
-
hid/s3c24xx_ts/s3c24xx_ts.c (modified) (6 diffs)
-
hid/s3c24xx_ts/s3c24xx_ts.h (modified) (2 diffs)
-
hw/bus/cuda_adb/cuda_adb.c (modified) (6 diffs)
-
hw/bus/cuda_adb/cuda_adb.h (modified) (2 diffs)
-
hw/char/i8042/i8042.c (modified) (6 diffs)
-
hw/char/i8042/i8042.h (modified) (3 diffs)
-
hw/char/s3c24xx_uart/s3c24xx_uart.c (modified) (6 diffs)
-
hw/char/s3c24xx_uart/s3c24xx_uart.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/generic/input.c
rc69646f8 r5da7199 47 47 #include <stdio.h> 48 48 #include <ns.h> 49 #include <ns_obsolete.h>50 49 #include <async.h> 51 #include <async_obsolete.h>52 50 #include <errno.h> 53 51 #include <adt/fifo.h> … … 63 61 #include <mouse.h> 64 62 65 // FIXME: remove this header66 #include <abi/ipc/methods.h>67 68 63 #define NUM_LAYOUTS 3 69 64 … … 77 72 static void kbd_devs_reclaim(void); 78 73 79 int client_phone = -1;74 async_sess_t *client_sess = NULL; 80 75 81 76 /** List of keyboard devices */ … … 86 81 87 82 bool irc_service = false; 88 int irc_phone = -1;83 async_sess_t *irc_sess = NULL; 89 84 90 85 void kbd_push_data(kbd_dev_t *kdev, sysarg_t data) … … 170 165 171 166 ev.c = layout_parse_ev(kdev->active_layout, &ev); 172 async_obsolete_msg_4(client_phone, INPUT_EVENT_KEY, ev.type, ev.key, 173 ev.mods, ev.c); 167 168 async_exch_t *exch = async_exchange_begin(client_sess); 169 async_msg_4(exch, INPUT_EVENT_KEY, ev.type, ev.key, ev.mods, ev.c); 170 async_exchange_end(exch); 174 171 } 175 172 … … 177 174 void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy) 178 175 { 179 async_obsolete_msg_2(client_phone, INPUT_EVENT_MOVE, dx, dy); 176 async_exch_t *exch = async_exchange_begin(client_sess); 177 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy); 178 async_exchange_end(exch); 180 179 } 181 180 … … 183 182 void mouse_push_event_button(mouse_dev_t *mdev, int bnum, int press) 184 183 { 185 async_obsolete_msg_2(client_phone, INPUT_EVENT_BUTTON, bnum, press); 184 async_exch_t *exch = async_exchange_begin(client_sess); 185 async_msg_2(exch, INPUT_EVENT_BUTTON, bnum, press); 186 async_exchange_end(exch); 186 187 } 187 188 188 189 static void client_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 189 190 { 190 ipc_callid_t callid;191 ipc_call_t call;192 int retval;193 194 191 async_answer_0(iid, EOK); 195 192 196 193 while (true) { 197 callid = async_get_call(&call); 194 ipc_call_t call; 195 ipc_callid_t callid = async_get_call(&call); 198 196 199 197 if (!IPC_GET_IMETHOD(call)) { 200 if (client_ phone != -1) {201 async_ obsolete_hangup(client_phone);202 client_ phone = -1;198 if (client_sess != NULL) { 199 async_hangup(client_sess); 200 client_sess = NULL; 203 201 } 204 202 … … 207 205 } 208 206 209 switch (IPC_GET_IMETHOD(call)) { 210 case IPC_M_CONNECT_TO_ME: 211 if (client_phone != -1) { 212 retval = ELIMIT; 207 async_sess_t *sess = 208 async_callback_receive_start(EXCHANGE_SERIALIZE, &call); 209 if (sess != NULL) { 210 if (client_sess == NULL) { 211 client_sess = sess; 212 async_answer_0(callid, EOK); 213 } else 214 async_answer_0(callid, ELIMIT); 215 } else { 216 switch (IPC_GET_IMETHOD(call)) { 217 case INPUT_YIELD: 218 kbd_devs_yield(); 219 async_answer_0(callid, EOK); 213 220 break; 221 case INPUT_RECLAIM: 222 kbd_devs_reclaim(); 223 async_answer_0(callid, EOK); 224 break; 225 default: 226 async_answer_0(callid, EINVAL); 214 227 } 215 client_phone = IPC_GET_ARG5(call);216 retval = 0;217 break;218 case INPUT_YIELD:219 kbd_devs_yield();220 retval = 0;221 break;222 case INPUT_RECLAIM:223 kbd_devs_reclaim();224 retval = 0;225 break;226 default:227 retval = EINVAL;228 228 } 229 230 async_answer_0(callid, retval);231 229 } 232 230 } … … 648 646 649 647 if (irc_service) { 650 while (irc_phone < 0) 651 irc_phone = service_obsolete_connect_blocking(SERVICE_IRC, 0, 0); 648 while (irc_sess == NULL) 649 irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 650 SERVICE_IRC, 0, 0); 652 651 } 653 652 -
uspace/srv/hid/input/include/input.h
rc69646f8 r5da7199 40 40 41 41 #include <bool.h> 42 #include <async.h> 42 43 43 44 #define NAME "input" … … 45 46 46 47 extern bool irc_service; 47 extern int irc_phone;48 extern async_sess_t *irc_sess; 48 49 49 50 #endif -
uspace/srv/hid/input/port/ns16550.c
rc69646f8 r5da7199 38 38 #include <ipc/irc.h> 39 39 #include <async.h> 40 #include <async_obsolete.h>41 40 #include <sysinfo.h> 42 41 #include <input.h> … … 158 157 kbd_push_data(kbd_dev, IPC_GET_ARG2(*call)); 159 158 160 if (irc_service) 161 async_obsolete_msg_1(irc_phone, IRC_CLEAR_INTERRUPT, 162 IPC_GET_IMETHOD(*call)); 159 if (irc_service) { 160 async_exch_t *exch = async_exchange_begin(irc_sess); 161 async_msg_1(exch, IRC_CLEAR_INTERRUPT, IPC_GET_IMETHOD(*call)); 162 async_exchange_end(exch); 163 } 163 164 } 164 165 -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
rc69646f8 r5da7199 44 44 #include <ipc/mouseev.h> 45 45 #include <async.h> 46 #include <async_obsolete.h>47 46 #include <unistd.h> 48 47 #include <stdio.h> … … 53 52 #include "s3c24xx_ts.h" 54 53 55 // FIXME: remove this header 56 #include <abi/ipc/methods.h> 57 58 #define NAME "s3c24ser" 59 #define NAMESPACE "hid" 54 #define NAME "s3c24ser" 55 #define NAMESPACE "hid" 60 56 61 57 static irq_cmd_t ts_irq_cmds[] = { … … 134 130 135 131 ts->io = vaddr; 136 ts->client_ phone = -1;132 ts->client_sess = NULL; 137 133 ts->state = ts_wait_pendown; 138 134 ts->last_x = 0; … … 284 280 button = 1; 285 281 press = 0; 286 async_obsolete_msg_2(ts->client_phone, MOUSEEV_BUTTON_EVENT, button, press); 282 283 async_exch_t *exch = async_exchange_begin(ts->client_sess); 284 async_msg_2(exch, MOUSEEV_BUTTON_EVENT, button, press); 285 async_exchange_end(exch); 287 286 288 287 s3c24xx_ts_wait_for_int_mode(ts, updn_down); … … 325 324 326 325 /* Send notifications to client. */ 327 async_obsolete_msg_2(ts->client_phone, MOUSEEV_MOVE_EVENT, dx, dy); 328 async_obsolete_msg_2(ts->client_phone, MOUSEEV_BUTTON_EVENT, button, press); 326 async_exch_t *exch = async_exchange_begin(ts->client_sess); 327 async_msg_2(exch, MOUSEEV_MOVE_EVENT, dx, dy); 328 async_msg_2(exch, MOUSEEV_BUTTON_EVENT, button, press); 329 async_exchange_end(exch); 329 330 330 331 ts->last_x = x_pos; … … 377 378 void *arg) 378 379 { 379 ipc_callid_t callid;380 ipc_call_t call;381 int retval;382 383 380 async_answer_0(iid, EOK); 384 385 while (1) { 386 callid = async_get_call(&call); 381 382 while (true) { 383 ipc_call_t call; 384 ipc_callid_t callid = async_get_call(&call); 387 385 388 386 if (!IPC_GET_IMETHOD(call)) { 389 if (ts->client_ phone != -1) {390 async_ obsolete_hangup(ts->client_phone);391 ts->client_ phone = -1;387 if (ts->client_sess != NULL) { 388 async_hangup(ts->client_sess); 389 ts->client_sess = NULL; 392 390 } 393 391 394 392 async_answer_0(callid, EOK); 395 393 return; 396 394 } 397 395 398 switch (IPC_GET_IMETHOD(call)) { 399 case IPC_M_CONNECT_TO_ME: 400 if (ts->client_phone != -1) { 401 retval = ELIMIT; 402 break; 403 } 404 ts->client_phone = IPC_GET_ARG5(call); 405 retval = 0; 406 break; 407 default: 408 retval = EINVAL; 409 } 410 async_answer_0(callid, retval); 396 async_sess_t *sess = 397 async_callback_receive_start(EXCHANGE_SERIALIZE, &call); 398 if (sess != NULL) { 399 if (ts->client_sess == NULL) { 400 ts->client_sess = sess; 401 async_answer_0(callid, EOK); 402 } else 403 async_answer_0(callid, ELIMIT); 404 } else 405 async_answer_0(callid, EINVAL); 411 406 } 412 407 } -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.h
rc69646f8 r5da7199 39 39 40 40 #include <sys/types.h> 41 #include <async.h> 41 42 42 43 /** S3C24xx ADC and touch-screen I/O */ … … 121 122 s3c24xx_adc_io_t *io; 122 123 123 /** Callback phoneto the client */124 int client_phone;124 /** Callback session to the client */ 125 async_sess_t *client_sess; 125 126 126 127 /** Service ID */ -
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
rc69646f8 r5da7199 48 48 #include <ipc/adb.h> 49 49 #include <async.h> 50 #include <async_obsolete.h>51 50 #include <assert.h> 52 51 #include "cuda_adb.h" 53 52 54 // FIXME: remove this header 55 #include <abi/ipc/methods.h> 56 57 #define NAME "cuda_adb" 53 #define NAME "cuda_adb" 58 54 59 55 static void cuda_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 154 150 155 151 for (i = 0; i < ADB_MAX_ADDR; ++i) { 156 adb_dev[i].client_ phone = -1;152 adb_dev[i].client_sess = NULL; 157 153 adb_dev[i].service_id = 0; 158 154 } … … 199 195 sysarg_t method; 200 196 service_id_t dsid; 201 int retval;202 197 int dev_addr, i; 203 198 … … 220 215 async_answer_0(iid, EOK); 221 216 222 while ( 1) {217 while (true) { 223 218 callid = async_get_call(&call); 224 219 method = IPC_GET_IMETHOD(call); … … 230 225 } 231 226 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; 246 240 } 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); 255 247 } 256 248 } … … 483 475 reg_val = ((uint16_t) data[1] << 8) | (uint16_t) data[2]; 484 476 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); 489 484 } 490 485 -
uspace/srv/hw/bus/cuda_adb/cuda_adb.h
rc69646f8 r5da7199 38 38 39 39 #include <sys/types.h> 40 #include < ipc/loc.h>40 #include <async.h> 41 41 #include <fibril_synch.h> 42 42 … … 105 105 typedef struct { 106 106 service_id_t service_id; 107 int client_phone;107 async_sess_t *client_sess; 108 108 } adb_dev_t; 109 109 -
uspace/srv/hw/char/i8042/i8042.c
rc69646f8 r5da7199 32 32 * @ingroup kbd 33 33 * @{ 34 */ 34 */ 35 35 /** @file 36 36 * @brief i8042 PS/2 port driver. … … 41 41 #include <loc.h> 42 42 #include <async.h> 43 #include <async_obsolete.h>44 43 #include <unistd.h> 45 44 #include <sysinfo.h> … … 49 48 #include "i8042.h" 50 49 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" 56 52 57 53 /* Interesting bits for status register */ … … 145 141 146 142 for (i = 0; i < MAX_DEVS; i++) { 147 i8042_port[i].client_ phone = -1;143 i8042_port[i].client_sess = NULL; 148 144 149 145 snprintf(name, 16, "%s/ps2%c", NAMESPACE, dchar[i]); … … 257 253 } 258 254 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 263 262 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; 264 273 break; 265 274 } 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;278 275 } 276 279 277 async_answer_0(callid, retval); 280 278 } … … 305 303 } 306 304 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); 310 310 } 311 311 } -
uspace/srv/hw/char/i8042/i8042.h
rc69646f8 r5da7199 39 39 #define i8042_H_ 40 40 41 #include <sys/types.h> 41 42 #include <libarch/ddi.h> 42 #include < libarch/types.h>43 #include <async.h> 43 44 44 45 /** i8042 HW I/O interface */ … … 53 54 typedef struct { 54 55 service_id_t service_id; 55 int client_phone;56 async_sess_t *client_sess; 56 57 } i8042_port_t; 57 58 … … 60 61 /** 61 62 * @} 62 */ 63 */ -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
rc69646f8 r5da7199 42 42 #include <ipc/char.h> 43 43 #include <async.h> 44 #include <async_obsolete.h>45 44 #include <unistd.h> 46 45 #include <stdio.h> … … 51 50 #include "s3c24xx_uart.h" 52 51 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" 58 54 59 55 static irq_cmd_t uart_irq_cmds[] = { … … 117 113 void *arg) 118 114 { 119 ipc_callid_t callid;120 ipc_call_t call;121 sysarg_t method;122 int retval;123 124 115 /* Answer the IPC_M_CONNECT_ME_TO call. */ 125 116 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); 130 122 131 123 if (!method) { … … 135 127 } 136 128 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 } 152 148 } 153 async_answer_0(callid, retval);154 149 } 155 150 } … … 163 158 uint32_t status = pio_read_32(&uart->io->uerstat); 164 159 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); 168 164 } 169 165 … … 191 187 192 188 uart->io = vaddr; 193 uart->client_ phone = -1;189 uart->client_sess = NULL; 194 190 195 191 printf(NAME ": device at physical address %p, inr %" PRIun ".\n", -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.h
rc69646f8 r5da7199 39 39 40 40 #include <sys/types.h> 41 #include <async.h> 41 42 42 43 /** S3C24xx UART I/O */ … … 84 85 s3c24xx_uart_io_t *io; 85 86 86 /** Callback phoneto the client */87 int client_phone;87 /** Callback session to the client */ 88 async_sess_t *client_sess; 88 89 89 90 /** Service ID */
Note:
See TracChangeset
for help on using the changeset viewer.
