Changeset b0f00a9 in mainline for uspace/lib/c/generic/private/stdio.h
- Timestamp:
- 2011-11-06T22:21:05Z (15 years ago)
- 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. - File:
-
- 1 moved
-
uspace/lib/c/generic/private/stdio.h (moved) (moved from uspace/srv/hid/fb/msim.c ) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/private/stdio.h
r2bdf8313 rb0f00a9 1 1 /* 2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2008 Martin Decky 2 * Copyright (c) 2011 Martin Decky 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @defgroup msimfb MSIM text console 31 * @brief HelenOS MSIM text console. 32 * @ingroup fbs 29 /** @addtogroup libc 33 30 * @{ 34 31 */ … … 36 33 */ 37 34 35 #ifndef LIBC_PRIVATE_STDIO_H_ 36 #define LIBC_PRIVATE_STDIO_H_ 37 38 #include <adt/list.h> 39 #include <stdio.h> 38 40 #include <async.h> 39 #include <libc.h>40 #include <sysinfo.h>41 #include <as.h>42 #include <ddi.h>43 #include <errno.h>44 41 45 #include "serial_console.h" 46 #include "msim.h" 42 struct _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 }; 47 85 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 75 87 76 88 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.
