Changeset 83b1d61 in mainline


Ignore:
Timestamp:
2006-06-02T13:30:37Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb51e9a8
Parents:
bd929cfb
Message:

Added mmap, munmap calls.
Added possibility to access framebuffer using shared memory.

Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • fb/fb.c

    rbd929cfb r83b1d61  
    4141#include <kernel/errno.h>
    4242#include <async.h>
     43
    4344#include "font-8x16.h"
    4445#include "helenos.xbm"
    4546#include "fb.h"
     47#include "main.h"
     48#include "../console/screenbuffer.h"
    4649
    4750#define DEFAULT_BGCOLOR                0x000080
     
    459462}
    460463
     464static void draw_text_data(int vp, keyfield_t *data)
     465{
     466        viewport_t *vport = &viewports[vp];
     467        int i;
     468        char c;
     469
     470        clear_port(vp);
     471        for (i=0; i < vport->cols * vport->rows; i++) {
     472                if (data[i].character == ' ') /* TODO: && data[i].style==vport->style */
     473                        continue;
     474                draw_char(vp, data[i].character, i/vport->rows, i % vport->cols);
     475        }
     476        cursor_print(vp);
     477}
     478
     479
    461480/** Function for handling connections to FB
    462481 *
     
    470489        unsigned int row,col;
    471490        char c;
     491        keyfield_t *interbuffer = NULL;
     492        size_t intersize = 0;
    472493
    473494        int vp = 0;
     
    495516                        ipc_answer_fast(callid,0,0,0);
    496517                        return; /* Exit thread */
     518                case IPC_M_AS_AREA_SEND:
     519                        /* We accept one area for data interchange */
     520                        intersize = IPC_GET_ARG2(call);
     521                        receive_comm_area(callid,&call,(void **)&interbuffer,
     522                                          sizeof(*interbuffer)*viewports[0].cols*viewports[0].rows);
     523                        continue;
     524
     525                case FB_DRAW_TEXT_DATA:
     526                        if (!interbuffer) {
     527                                retval = EINVAL;
     528                                break;
     529                        }
     530                        if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) {
     531                                retval = EINVAL;
     532                                break;
     533                        }
     534                        draw_text_data(vp, interbuffer);
     535                        retval = 0;
     536                        break;
    497537                case FB_PUTCHAR:
    498538                        c = IPC_GET_ARG1(call);
  • fb/main.c

    rbd929cfb r83b1d61  
    3131#include <sysinfo.h>
    3232#include <async.h>
     33#include <as.h>
     34#include <align.h>
     35#include <errno.h>
    3336
    3437#include "fb.h"
    3538#include "sysio.h"
    3639#include "ega.h"
     40#include "main.h"
     41
     42void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area,
     43                       size_t maxsize)
     44{
     45        void *dest;
     46
     47        if (*area) {
     48                ipc_answer_fast(callid, ELIMIT, 0, 0);
     49                return;
     50        }
     51        if (IPC_GET_ARG2(*call) > ALIGN_UP(maxsize, PAGE_SIZE)) {
     52                ipc_answer_fast(callid, EINVAL, 0, 0);
     53                return;
     54        }
     55       
     56        dest = as_get_mappable_page(maxsize);
     57        if (ipc_answer_fast(callid, 0, (sysarg_t)dest, 0) == 0)
     58                *area = dest;
     59}
    3760
    3861int main(int argc, char *argv[])
  • libc/Makefile

    rbd929cfb r83b1d61  
    7272        generic/time.c \
    7373        generic/err.c \
    74         generic/stdlib.c
     74        generic/stdlib.c \
     75        generic/mmap.c
    7576
    7677ARCH_SOURCES += \
  • libc/arch/amd64/include/types.h

    rbd929cfb r83b1d61  
    3333typedef unsigned long size_t;
    3434typedef signed long ssize_t;
     35typedef ssize_t off_t;
    3536
    3637typedef char int8_t;
  • libc/arch/ia32/include/types.h

    rbd929cfb r83b1d61  
    3333typedef unsigned int size_t;
    3434typedef signed int ssize_t;
     35typedef ssize_t off_t;
    3536
    3637typedef char int8_t;
  • libc/arch/ia64/include/types.h

    rbd929cfb r83b1d61  
    3333typedef unsigned long size_t;
    3434typedef signed long ssize_t;
     35typedef ssize_t off_t;
    3536
    3637typedef char int8_t;
  • libc/arch/mips32/include/types.h

    rbd929cfb r83b1d61  
    3333typedef unsigned int size_t;
    3434typedef signed int ssize_t;
     35typedef ssize_t off_t;
    3536
    3637typedef char int8_t;
  • libc/arch/ppc32/include/types.h

    rbd929cfb r83b1d61  
    3333typedef unsigned int size_t;
    3434typedef signed int ssize_t;
     35typedef ssize_t off_t;
    3536
    3637typedef char int8_t;
  • libc/arch/ppc64/include/types.h

    rbd929cfb r83b1d61  
    3333typedef unsigned long size_t;
    3434typedef signed long ssize_t;
     35typedef ssize_t off_t;
    3536
    3637typedef char int8_t;
  • libc/generic/as.c

    rbd929cfb r83b1d61  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    29 #include <stdlib.h>
    30 #include <unistd.h>
    31 #include <string.h>
    32 #include <ddi.h>
    33 #include <sysinfo.h>
    34 #include <align.h>
    35 #include <as.h>
    36 #include <ipc/fb.h>
    37 #include <ipc/ipc.h>
    38 #include <ipc/ns.h>
    39 #include <ipc/services.h>
    40 #include <kernel/errno.h>
    41 
    4228
    4329#include <as.h>
     
    134120}
    135121
     122/* TODO: make this type defined somewhere else */
     123typedef sysarg_t __address;
     124
    136125/** Return pointer to some unmapped area, where fits new as_area
    137126 *
  • libc/include/ipc/fb.h

    rbd929cfb r83b1d61  
    1818#define FB_SET_STYLE         1034
    1919#define FB_GET_RESOLUTION    1035
     20#define FB_DRAW_TEXT_DATA    1036
    2021
    2122#endif
Note: See TracChangeset for help on using the changeset viewer.