Changeset 46bd593f in mainline
- Timestamp:
- 2006-06-01T23:35:27Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- df688cd
- Parents:
- da0c91e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fb/sysio.c
rda0c91e7 r46bd593f 32 32 #include <libc.h> 33 33 #include <errno.h> 34 #include <string.h> 35 #include <libc.h> 36 #include <stdio.h> 34 37 35 38 #include "sysio.h" … … 38 41 static int client_connected = 0; 39 42 43 #define CLRSCR "\033[2J" 44 40 45 static void sysput(char c) 41 46 { 42 47 __SYSCALL3(SYS_IO, 1, (sysarg_t)&c, (sysarg_t) 1); 48 } 49 50 static void sysputs(char *s) 51 { 52 __SYSCALL3(SYS_IO, 1, (sysarg_t)s, strlen(s)); 53 } 54 55 static void curs_goto(unsigned int row, unsigned int col) 56 { 57 char control[20]; 58 59 if (row > 100 || col > 100) 60 return; 61 62 snprintf(control, 20, "\033[%d;%df",row, col); 63 sysputs(control); 43 64 } 44 65 … … 49 70 ipc_call_t call; 50 71 char c; 72 int lastcol=0; 73 int lastrow=0; 74 int newcol,newrow; 51 75 52 76 if (client_connected) { … … 65 89 case FB_PUTCHAR: 66 90 c = IPC_GET_ARG1(call); 91 newrow = IPC_GET_ARG2(call); 92 newcol = IPC_GET_ARG3(call); 93 if (lastcol != newcol || lastrow!=newrow) 94 curs_goto(newrow, newcol); 95 lastcol = newcol + 1; 96 lastrow = newrow; 67 97 sysput(c); 68 98 retval = 0; 99 break; 100 case FB_CURSOR_GOTO: 101 newrow = IPC_GET_ARG1(call); 102 newcol = IPC_GET_ARG2(call); 103 curs_goto(newrow, newcol); 69 104 break; 70 105 case FB_GET_CSIZE: 71 106 ipc_answer_fast(callid, 0, 25, 80); 72 107 continue; 108 case FB_CLEAR: 109 sysputs(CLRSCR); 110 retval = 0; 111 break; 73 112 default: 74 113 retval = ENOENT; … … 81 120 { 82 121 async_set_client_connection(sysio_client_connection); 122 sysputs(CLRSCR); 123 curs_goto(0,0); 83 124 }
Note:
See TracChangeset
for help on using the changeset viewer.