Changeset 51dbadf3 in mainline


Ignore:
Timestamp:
2006-06-06T07:42:20Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1890e312
Parents:
e9073f2
Message:

Added basic klog.
Added ipc tester.
TODO add serializing functions to psthread, so that the lines in klog won't intermix.

Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    re9073f2 r51dbadf3  
    4040        fb \
    4141        console \
    42         tetris
     42        tetris \
     43        ipcc \
     44        klog
    4345
    4446ifeq ($(ARCH), amd64)
  • libc/generic/async.c

    re9073f2 r51dbadf3  
    139139
    140140static void default_client_connection(ipc_callid_t callid, ipc_call_t *call);
     141static void default_interrupt_received(ipc_callid_t callid, ipc_call_t *call);
    141142static async_client_conn_t client_connection = default_client_connection;
     143static async_client_conn_t interrupt_received = default_interrupt_received;
    142144
    143145/** Add microseconds to give timeval */
     
    342344        ipc_answer_fast(callid, ENOENT, 0, 0);
    343345}
    344 
    345 /** Function that gets called on interrupt receival
    346  *
    347  * This function is defined as a weak symbol - to be redefined in
    348  * user code.
    349  */
    350 void interrupt_received(ipc_call_t *call)
    351 {
    352 }
    353 
     346static void default_interrupt_received(ipc_callid_t callid, ipc_call_t *call)
     347{
     348}
    354349
    355350/** Wrapper for client connection thread
     
    441436        switch (IPC_GET_METHOD(*call)) {
    442437        case IPC_M_INTERRUPT:
    443                 interrupt_received(call);
     438                (*interrupt_received)(callid,call);
    444439                return;
    445440        case IPC_M_CONNECT_ME_TO:
     
    758753        client_connection = conn;
    759754}
     755void async_set_interrupt_received(async_client_conn_t conn)
     756{
     757        interrupt_received = conn;
     758}
  • libc/generic/time.c

    re9073f2 r51dbadf3  
    3535#include <atomic.h>
    3636#include <futex.h>
     37#include <ipc/services.h>
    3738
    3839#include <sysinfo.h>
     
    6869                /* Get the mapping of kernel clock */
    6970                res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV,
    70                                       mapping, PAGE_SIZE, 0,
     71                                      mapping, PAGE_SIZE, SERVICE_MEM_REALTIME,
    7172                                      NULL,&rights,NULL);
    7273                if (res) {
  • libc/include/async.h

    re9073f2 r51dbadf3  
    9999void async_destroy_manager(void);
    100100void async_set_client_connection(async_client_conn_t conn);
     101void async_set_interrupt_received(async_client_conn_t conn);
    101102int _async_init(void);
    102 
    103 /* Should be defined by application */
    104 void interrupt_received(ipc_call_t *call)  __attribute__((weak));
    105103
    106104
  • libc/include/ipc/services.h

    re9073f2 r51dbadf3  
    4242/* Memory area to be received from NS */
    4343#define SERVICE_MEM_REALTIME    1
     44#define SERVICE_MEM_KLOG        2
    4445
    4546#endif
  • ns/ns.c

    re9073f2 r51dbadf3  
    3434#include <ipc/ipc.h>
    3535#include <ipc/ns.h>
     36#include <ipc/services.h>
    3637#include <stdio.h>
    3738#include <unistd.h>
     
    7778int static ping_phone;
    7879
    79 static void get_realtime_as(ipc_callid_t callid, ipc_call_t *call)
    80 {
    81         static void *addr = NULL;
     80static void *clockaddr = NULL;
     81static void *klogaddr = NULL;
     82
     83static void get_as(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr)
     84{
    8285        void *ph_addr;
    8386
    84         if (!addr) {
    85                 ph_addr = (void *)sysinfo_value("clock.faddr");
     87        if (!*addr) {
     88                ph_addr = (void *)sysinfo_value(name);
    8689                if (!ph_addr) {
    8790                        ipc_answer_fast(callid, ENOENT, 0, 0);
    8891                        return;
    8992                }
    90                 addr = as_get_mappable_page(PAGE_SIZE);
    91                 map_physmem(ph_addr, addr, 1, AS_AREA_READ | AS_AREA_CACHEABLE);
    92         }
    93         ipc_answer_fast(callid, 0, (ipcarg_t)addr, AS_AREA_READ);
     93                *addr = as_get_mappable_page(PAGE_SIZE);
     94                map_physmem(ph_addr, *addr, 1, AS_AREA_READ | AS_AREA_CACHEABLE);
     95        }
     96        ipc_answer_fast(callid, 0, (ipcarg_t)*addr, AS_AREA_READ);
    9497}
    9598
     
    110113                switch (IPC_GET_METHOD(call)) {
    111114                case IPC_M_AS_AREA_RECV:
    112                         get_realtime_as(callid, &call);
     115                        switch (IPC_GET_ARG3(call)) {
     116                        case SERVICE_MEM_REALTIME:
     117                                get_as(callid, &call, "clock.faddr", &clockaddr);
     118                                break;
     119                        case SERVICE_MEM_KLOG:
     120                                get_as(callid, &call, "klog.faddr", &klogaddr);
     121                                break;
     122                        default:
     123                                ipc_answer_fast(callid, ENOENT, 0, 0);
     124                        }
    113125                        continue;
    114126                case IPC_M_PHONE_HUNGUP:
Note: See TracChangeset for help on using the changeset viewer.