Changeset b0f00a9 in mainline for uspace/lib/c/generic/private/stdio.h


Ignore:
Timestamp:
2011-11-06T22:21:05Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
898e847
Parents:
2bdf8313 (diff), 7b5f4c9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/private/stdio.h

    r2bdf8313 rb0f00a9  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
    3  * Copyright (c) 2008 Martin Decky
     2 * Copyright (c) 2011 Martin Decky
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @defgroup msimfb MSIM text console
    31  * @brief HelenOS MSIM text console.
    32  * @ingroup fbs
     29/** @addtogroup libc
    3330 * @{
    3431 */
     
    3633 */
    3734
     35#ifndef LIBC_PRIVATE_STDIO_H_
     36#define LIBC_PRIVATE_STDIO_H_
     37
     38#include <adt/list.h>
     39#include <stdio.h>
    3840#include <async.h>
    39 #include <libc.h>
    40 #include <sysinfo.h>
    41 #include <as.h>
    42 #include <ddi.h>
    43 #include <errno.h>
    4441
    45 #include "serial_console.h"
    46 #include "msim.h"
     42struct _IO_FILE {
     43        /** Linked list pointer. */
     44        link_t link;
     45       
     46        /** Underlying file descriptor. */
     47        int fd;
     48       
     49        /** Error indicator. */
     50        int error;
     51       
     52        /** End-of-file indicator. */
     53        int eof;
     54       
     55        /** Klog indicator */
     56        int klog;
     57       
     58        /** Session to the file provider */
     59        async_sess_t *sess;
     60       
     61        /**
     62         * Non-zero if the stream needs sync on fflush(). XXX change
     63         * console semantics so that sync is not needed.
     64         */
     65        int need_sync;
     66       
     67        /** Buffering type */
     68        enum _buffer_type btype;
     69       
     70        /** Buffer */
     71        uint8_t *buf;
     72       
     73        /** Buffer size */
     74        size_t buf_size;
     75       
     76        /** Buffer state */
     77        enum _buffer_state buf_state;
     78       
     79        /** Buffer I/O pointer */
     80        uint8_t *buf_head;
     81       
     82        /** Points to end of occupied space when in read mode. */
     83        uint8_t *buf_tail;
     84};
    4785
    48 #define WIDTH 80
    49 #define HEIGHT 24
    50 
    51 static char *virt_addr;
    52 
    53 static void msim_putc(const char c)
    54 {
    55         *virt_addr = c;
    56 }
    57 
    58 int msim_init(void)
    59 {
    60         sysarg_t phys_addr;
    61         if (sysinfo_get_value("fb.address.physical", &phys_addr) != EOK)
    62                 return -1;
    63        
    64         virt_addr = (char *) as_get_mappable_page(1);
    65        
    66         if (physmem_map((void *) phys_addr, virt_addr, 1,
    67             AS_AREA_READ | AS_AREA_WRITE) != 0)
    68                 return -1;
    69        
    70         serial_console_init(msim_putc, WIDTH, HEIGHT);
    71        
    72         async_set_client_connection(serial_client_connection);
    73         return 0;
    74 }
     86#endif
    7587
    7688/** @}
Note: See TracChangeset for help on using the changeset viewer.