Changeset 0b99e40 in mainline
- Timestamp:
- 2006-05-28T18:22:10Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2d1fde3b
- Parents:
- 7f5b37a
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
init/init.c
r7f5b37a r0b99e40 45 45 #include <ipc/fb.h> 46 46 #include <async.h> 47 #include <time.h> 47 48 48 49 int a; … … 402 403 } 403 404 405 static void test_time(void) 406 { 407 int rc; 408 struct timeval tv; 409 struct timezone tz; 410 411 while (1) { 412 rc = gettimeofday(&tv, &tz); 413 printf("Rc: %d, Secs: %d, Usecs: %d\n", rc, tv.tv_sec, 414 tv.tv_usec); 415 } 416 } 404 417 405 418 int main(int argc, char *argv[]) … … 421 434 // test_pci(); 422 435 // test_kbd(); 423 test_async_kbd(); 436 test_time(); 437 // test_async_kbd(); 424 438 // test_fb(); 425 439 -
libc/Makefile
r7f5b37a r0b99e40 66 66 generic/async.c \ 67 67 generic/libadt/list.o \ 68 generic/libadt/hash_table.o 68 generic/libadt/hash_table.o \ 69 generic/time.c 69 70 70 71 ARCH_SOURCES += \ -
libc/generic/async.c
r7f5b37a r0b99e40 332 332 ipc_call_t call; 333 333 ipc_callid_t callid; 334 int timeout; 334 335 335 336 while (1) { … … 340 341 continue; 341 342 } 342 callid = ipc_wait_cycle(&call,SYNCH_NO_TIMEOUT,SYNCH_BLOCKING); 343 /* 344 if (expires) 345 timeout = .... ; 346 else 347 */ 348 timeout = SYNCH_NO_TIMEOUT; 349 callid = ipc_wait_cycle(&call, timeout, SYNCH_BLOCKING); 350 351 if (!callid) { 352 // handle_expired_timeouts.......; 353 continue; 354 } 343 355 344 356 if (callid & IPC_CALLID_ANSWERED) … … 405 417 if (msg->dataptr) 406 418 *msg->dataptr = *data; 407 419 420 /* TODO: memory barrier?? */ 408 421 msg->done = 1; 409 422 if (! msg->active) { … … 461 474 free(msg); 462 475 } 476 477 478 /* int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, int timeout) */ 479 /* { */ 480 /* amsg_t *msg = (amsg_t *) amsgid; */ 481 /* connection_t *conn; */ 482 483 /* futex_down(&async_futex); */ 484 /* if (msg->done) { */ 485 /* futex_up(&async_futex); */ 486 /* goto done; */ 487 /* } */ 488 489 /* msg->ptid = psthread_get_id(); */ 490 /* msg->active = 0; */ 491 /* msg->expires = gettime() + timeout; */ 492 /* setup_timeouts_etc...(); */ 493 494 /* /\* Leave locked async_futex when entering this function *\/ */ 495 /* psthread_schedule_next_adv(PS_TO_MANAGER); */ 496 /* /\* futex is up automatically after psthread_schedule_next...*\/ */ 497 498 /* if (!msg->done) */ 499 /* return casy-casy; */ 500 501 /* /\* TODO: When memory barrier in reply_received, we can skip this *\/ */ 502 /* futex_down(&async_futex); */ 503 /* futex_up(&async_futex); */ 504 /* done: */ 505 506 /* if (retval) */ 507 /* *retval = msg->retval; */ 508 /* free(msg); */ 509 /* } */ 510 -
libc/include/ipc/services.h
r7f5b37a r0b99e40 38 38 #define SERVICE_FRAME_BUFFER 2 39 39 #define SERVICE_KEYBOARD 3 40 #define SERVICE_VIDEO 4 40 #define SERVICE_VIDEO 4 41 42 /* Memory area to be received from NS */ 43 #define SERVICE_MEM_REALTIME 1 41 44 42 45 #endif -
ns/ns.c
r7f5b37a r0b99e40 41 41 #include <libadt/list.h> 42 42 #include <libadt/hash_table.h> 43 #include <sysinfo.h> 44 #include <ddi.h> 45 #include <as.h> 43 46 44 47 #define NAME "NS" … … 73 76 74 77 int static ping_phone; 78 79 static void get_realtime_as(ipc_callid_t callid, ipc_call_t *call) 80 { 81 static void *addr = NULL; 82 void *ph_addr; 83 84 if (IPC_GET_ARG3(*call) != (AS_AREA_READ | AS_AREA_CACHEABLE)) { 85 ipc_answer_fast(callid, EPERM, 0, 0); 86 return; 87 } 88 if (!addr) { 89 ph_addr = (void *)sysinfo_value("clock.faddr"); 90 if (!ph_addr) { 91 ipc_answer_fast(callid, ENOENT, 0, 0); 92 return; 93 } 94 addr = (void *)(200*1024*1024); /* TODO: intelligent freemem space */ 95 map_physmem(task_get_id(), ph_addr, addr, 1, 96 AS_AREA_READ | AS_AREA_CACHEABLE); 97 } 98 ipc_answer_fast(callid, 0, (ipcarg_t)addr, 0); 99 } 75 100 76 101 int main(int argc, char **argv) … … 103 128 // printf("Failed answer: %d\n", retval); 104 129 continue; 105 break; 130 case IPC_M_AS_AREA_RECV: 131 get_realtime_as(callid, &call); 132 continue; 106 133 case IPC_M_INTERRUPT: 107 // printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));108 134 break; 109 135 case IPC_M_PHONE_HUNGUP: 110 // printf("Phone hung up.\n");111 136 retval = 0; 112 137 break;
Note:
See TracChangeset
for help on using the changeset viewer.