Changeset afa6e74 in mainline


Ignore:
Timestamp:
2006-05-16T23:37:58Z (19 years ago)
Author:
Jakub Vana <jakub.vana@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04a73cdf
Parents:
6efe0ddf
Message:

Earliest version of Userspace Framebuffer driver, with stream support in libc.
Also Virtual framebuffers made as split on main fb and its usage by streams

(please test it and report)

Files:
9 added
10 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r6efe0ddf rafa6e74  
    3838        libadt \
    3939        init \
    40         ns
     40        ns \
     41        fb
    4142
    4243ifeq ($(ARCH), amd64)
  • init/init.c

    r6efe0ddf rafa6e74  
    4343#include <errno.h>
    4444#include <kbd.h>
     45#include <ipc/fb.h>
    4546
    4647int a;
     
    349350}
    350351
     352static void test_fb()
     353{
     354        int res;
     355        ipcarg_t result;
     356        int phoneid;
     357
     358//      printf("Test: Starting connect...\n");
     359
     360        phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0);
     361
     362        while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0)) < 0) {
     363                volatile int a;
     364                for(a=0;a<1048576;a++);
     365        };
     366       
     367//      printf("Test: Connected: %d\n", res);
     368//      printf("Test: pinging.\n");
     369        while (1) {
     370                res = ipc_call_sync(phoneid, FB_GET_VFB, 0xbeef,&result);
     371//              printf("Test: Retval: %d - received: %c\n", res, result);
     372//              printf("%c", result);
     373        }
     374       
     375//      printf("Test: Hangin up\n");
     376        ipc_hangup(phoneid);
     377}
     378
     379
    351380int main(int argc, char *argv[])
    352381{
     
    354383        int tid;
    355384       
    356         version_print();
     385//      version_print();
    357386
    358387//      test_printf();
     
    366395//      test_as_send();
    367396//      test_pci();
    368         test_kbd();
     397//      test_kbd();
     398//      test_fb();
     399
     400        printf("Hello\nThis is Init\n\nBye.");
     401       
    369402
    370403/*     
  • libc/Makefile

    r6efe0ddf rafa6e74  
    5353        generic/io/io.c \
    5454        generic/io/printf.c \
     55        generic/io/stream.c \
    5556        generic/io/sprintf.c \
    5657        generic/io/snprintf.c \
  • libc/Makefile.toolchain

    r6efe0ddf rafa6e74  
    2828
    2929DEFS = -DARCH=$(ARCH)
    30 CFLAGS = -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
     30CFLAGS = -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
    3131LFLAGS = -M -N $(SOFTINT_PREFIX)/softint.a
    3232AFLAGS =
    33 
     33#-Werror
    3434
    3535## Setup platform configuration
  • libc/generic/as.c

    r6efe0ddf rafa6e74  
    7070
    7171static size_t heapsize = 0;
     72static size_t maxheapsize = (size_t)(-1);
    7273/* Start of heap linker symbol */
    7374extern char _heap;
     
    9293        if (incr < 0 && incr+heapsize > heapsize)
    9394                return NULL;
     95        /* Check for user limit */
     96        if ((maxheapsize!=(size_t)(-1)) && (heapsize + incr)>maxheapsize) return NULL;
    9497
    9598        rc = as_area_resize(&_heap, heapsize + incr,0);
     
    104107        return res;
    105108}
     109
     110void *set_maxheapsize(size_t mhs)
     111{
     112        maxheapsize=mhs;
     113        /* Return pointer to area not managed by sbrk */
     114        return (void *)&_heap + maxheapsize;
     115
     116}
  • libc/generic/io/io.c

    r6efe0ddf rafa6e74  
    9393        return EOF;
    9494}
    95 
     95/*
    9696ssize_t write(int fd, const void * buf, size_t count)
    9797{
    9898        return (ssize_t) __SYSCALL3(SYS_IO, (sysarg_t) fd, (sysarg_t) buf, (sysarg_t) count);
    99 }
     99}*/
    100100
    101101
     102
     103
  • libc/generic/libc.c

    r6efe0ddf rafa6e74  
    3232#include <malloc.h>
    3333#include <psthread.h>
     34#include <io/stream.h>
     35
     36int __DONT_OPEN_STDIO__;
    3437
    3538/* We should probably merge libc and libipc together */
     
    4245void __main(void) {
    4346        tcb_t *tcb;
     47       
     48        if(!__DONT_OPEN_STDIO__)
     49        {
     50                open("stdin",0);
     51                open("stdout",0);
     52                open("stderr",0);
     53        }       
    4454       
    4555        tcb = __make_tls();
  • libc/include/as.h

    r6efe0ddf rafa6e74  
    3232#include <types.h>
    3333#include <task.h>
     34#include <kernel/arch/mm/as.h>
    3435#include <kernel/mm/as.h>
     36
     37#define USER_ADDRESS_SPACE_SIZE_ARCH (USER_ADDRESS_SPACE_END_ARCH-USER_ADDRESS_SPACE_START_ARCH+1)
    3538
    3639extern void *as_area_create(void *address, size_t size, int flags);
    3740extern int as_area_resize(void *address, size_t size, int flags);
    3841extern int as_area_destroy(void *address);
     42extern void *set_maxheapsize(size_t mhs);
    3943
    4044#endif
  • libc/include/ipc/services.h

    r6efe0ddf rafa6e74  
    3838#define SERVICE_FRAME_BUFFER    2
    3939#define SERVICE_KEYBOARD        3
     40#define SERVICE_VIDEO   4
    4041
    4142#endif
  • ns/ns.c

    r6efe0ddf rafa6e74  
    4646#define NS_HASH_TABLE_CHAINS    20
    4747
     48extern int __DONT_OPEN_STDIO__=1;
     49
    4850static int register_service(ipcarg_t service, ipcarg_t phone, ipc_call_t *call);
    4951static int connect_to_service(ipcarg_t service, ipc_call_t *call, ipc_callid_t callid);
     
    8284        ipcarg_t retval, arg1, arg2;
    8385
    84         printf("%s: Naming service started.\n", NAME);
     86//      printf("%s: Naming service started.\n", NAME);
    8587       
    8688        if (!hash_table_create(&ns_hash_table, NS_HASH_TABLE_CHAINS, 3, &ns_hash_table_ops)) {
    87                 printf("%s: cannot create hash table\n", NAME);
     89//              printf("%s: cannot create hash table\n", NAME);
    8890                return ENOMEM;
    8991        }
     
    9597                case IPC_M_AS_AREA_SEND:
    9698                        as_area = (char *)IPC_GET_ARG2(call);
    97                         printf("Received as_area: %P, size:%d\n", as_area, IPC_GET_ARG3(call));
     99//                      printf("Received as_area: %P, size:%d\n", as_area, IPC_GET_ARG3(call));
    98100                        retval = ipc_answer_fast(callid, 0,(sysarg_t)(1024*1024), 0);
    99101                        if (!retval) {
    100                                 printf("Reading shared memory...");
    101                                 printf("Text: %s", as_area);
     102//                              printf("Reading shared memory...");
     103//                              printf("Text: %s", as_area);
    102104                        } else
    103                                 printf("Failed answer: %d\n", retval);
     105//                              printf("Failed answer: %d\n", retval);
    104106                        continue;
    105107                        break;
    106108                case IPC_M_INTERRUPT:
    107                         printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));
     109//                      printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));
    108110                        break;
    109111                case IPC_M_PHONE_HUNGUP:
    110                         printf("Phone hung up.\n");
     112//                      printf("Phone hung up.\n");
    111113                        retval = 0;
    112114                        break;
     
    125127                        break;
    126128                case NS_HANGUP:
    127                         printf("Closing connection.\n");
     129//                      printf("Closing connection.\n");
    128130                        retval = EHANGUP;
    129131                        break;
    130132                case NS_PING:
    131                         printf("Ping...%P %P\n", IPC_GET_ARG1(call),
    132                                IPC_GET_ARG2(call));
     133//                      printf("Ping...%P %P\n", IPC_GET_ARG1(call),
     134//                             IPC_GET_ARG2(call));
    133135                        retval = 0;
    134136                        arg1 = 0xdead;
     
    136138                        break;
    137139                case NS_PING_SVC:
    138                         printf("NS:Pinging service %d\n", ping_phone);
     140//                      printf("NS:Pinging service %d\n", ping_phone);
    139141                        ipc_call_sync(ping_phone, NS_PING, 0xbeef, 0);
    140                         printf("NS:Got pong\n");
     142//                      printf("NS:Got pong\n");
    141143                        break;
    142144                default:
    143                         printf("Unknown method: %zd\n", IPC_GET_METHOD(call));
     145//                      printf("Unknown method: %zd\n", IPC_GET_METHOD(call));
    144146                        retval = ENOENT;
    145147                        break;
     
    165167        hashed_service_t *hs;
    166168                       
    167         printf("Registering service %d on phone %d...", service, phone);
     169//      printf("Registering service %d on phone %d...", service, phone);
    168170
    169171        if (hash_table_find(&ns_hash_table, keys)) {
    170                 printf("Service %d already registered.\n", service);
     172//              printf("Service %d already registered.\n", service);
    171173                return EEXISTS;
    172174        }
     
    174176        hs = (hashed_service_t *) malloc(sizeof(hashed_service_t));
    175177        if (!hs) {
    176                 printf("Failed to register service %d.\n", service);
     178//              printf("Failed to register service %d.\n", service);
    177179                return ENOMEM;
    178180        }
     
    207209        }
    208210        hs = hash_table_get_instance(hlp, hashed_service_t, link);
    209         printf("Connecting in_phone_hash=%lX to service at phone %d...", call->in_phone_hash, hs->phone);
     211//      printf("Connecting in_phone_hash=%lX to service at phone %d...", call->in_phone_hash, hs->phone);
    210212        return ipc_forward_fast(callid, hs->phone, 0, 0);
    211213}
Note: See TracChangeset for help on using the changeset viewer.