Changeset 0b99e40 in mainline for ns/ns.c


Ignore:
Timestamp:
2006-05-28T18:22:10Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2d1fde3b
Parents:
7f5b37a
Message:

Rough implementation of gettimeofday.
IPC_M_RECV_AS doesn't allow us to specify additional user parametrs. That
doesn't seem to be very configurable :-/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ns/ns.c

    r7f5b37a r0b99e40  
    4141#include <libadt/list.h>
    4242#include <libadt/hash_table.h>
     43#include <sysinfo.h>
     44#include <ddi.h>
     45#include <as.h>
    4346
    4447#define NAME    "NS"
     
    7376
    7477int static ping_phone;
     78
     79static 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}
    75100
    76101int main(int argc, char **argv)
     
    103128//                              printf("Failed answer: %d\n", retval);
    104129                        continue;
    105                         break;
     130                case IPC_M_AS_AREA_RECV:
     131                        get_realtime_as(callid, &call);
     132                        continue;
    106133                case IPC_M_INTERRUPT:
    107 //                      printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));
    108134                        break;
    109135                case IPC_M_PHONE_HUNGUP:
    110 //                      printf("Phone hung up.\n");
    111136                        retval = 0;
    112137                        break;
Note: See TracChangeset for help on using the changeset viewer.