Changeset c1d2c9d in mainline for console/console.c


Ignore:
Timestamp:
2006-06-01T21:51:35Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
da0c91e7
Parents:
3993b3d
Message:

Added integration of console & fb.
Added ipc_call_async_3 call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • console/console.c

    r3993b3d rc1d2c9d  
    4141#include <screenbuffer.h>
    4242
    43 static void sysput(char c)
    44 {
    45         __SYSCALL3(SYS_IO, 1, &c, 1);
    46 }
    47 
    48 //#define CONSOLE_COUNT VFB_CONNECTIONS
    4943#define CONSOLE_COUNT 8
    5044#define MAX_KEYREQUESTS_BUFFERED 32
     
    10397        int retval;
    10498        int i, j;
    105         char c;
     99        char c,d;
     100        connection_t *conn;
    106101
    107102        /* Ignore parameters, the connection is alread opened */
     
    118113                        retval = 0;
    119114                        c = IPC_GET_ARG1(call);
    120 //                      ipc_call_sync_2(connections[3].vfb_phone, FB_PUTCHAR, 0, c,NULL,NULL);
    121                
    122115                        /* switch to another virtual console */
    123116                       
     117                        conn = &connections[active_console];
    124118                        if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) {
    125119                                /*FIXME: draw another console content from buffer */
    126120
    127121                                active_console = c - KBD_KEY_F1;
     122                                conn = &connections[active_console];
     123
     124                                ipc_call_async(fb_info.phone, FB_CURSOR_VISIBILITY, 0, NULL, NULL);
    128125                                ipc_call_async_2(fb_info.phone, FB_CLEAR, 0, 0, NULL, NULL);
    129                                 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, 'a', 0, 0,NULL,NULL, NULL);
    130                                
    131                                 for (i = 0; i < connections[active_console].screenbuffer.size_x; i++)
    132                                         for (j = 0; j < connections[active_console].screenbuffer.size_y; j++) {
    133                                        
    134                                         ipc_call_async_3(fb_info.phone, FB_PUTCHAR, get_field_at(&(connections[active_console].screenbuffer),\
    135                                                                 i, j)->character, j, i, NULL, NULL, NULL);
    136                                 }
     126                                for (i = 0; i < conn->screenbuffer.size_x; i++)
     127                                        for (j = 0; j < conn->screenbuffer.size_y; j++) {
     128                                                d = get_field_at(&(conn->screenbuffer),i, j)->character;
     129                                                if (d && d != ' ')
     130                                                        ipc_call_async_3(fb_info.phone, FB_PUTCHAR, d, j, i, NULL, NULL);
     131                                        }
     132                                ipc_call_async_2(fb_info.phone, FB_CURSOR_GOTO, conn->screenbuffer.position_y, conn->screenbuffer.position_x, NULL, NULL);
     133                                ipc_call_async(fb_info.phone, FB_CURSOR_VISIBILITY, 1, NULL, NULL);
    137134
    138135                                break;
     
    140137                       
    141138                        /* if client is awaiting key, send it */
    142                         if (connections[active_console].keyrequest_counter > 0) {               
    143                                 connections[active_console].keyrequest_counter--;
    144                                 ipc_answer_fast(fifo_pop(connections[active_console].keyrequests), 0, c, 0);
     139                        if (conn->keyrequest_counter > 0) {             
     140                                conn->keyrequest_counter--;
     141                                ipc_answer_fast(fifo_pop(conn->keyrequests), 0, c, 0);
    145142                                break;
    146143                        }
    147144                       
    148145                        /*FIXME: else store key to its buffer */
    149                         keybuffer_push(&(connections[active_console].keybuffer), c);
    150                        
    151                         /* Send it to first FB, DEBUG */
    152 //                      ipc_call_async_2(connections[0].vfb_phone, FB_PUTCHAR, 0, IPC_GET_ARG1(call),NULL,NULL);
    153 //                      ipc_call_sync_2(connections[4].vfb_phone, FB_PUTCHAR, 0, c,NULL,NULL);
    154 
     146                        keybuffer_push(&conn->keybuffer, c);
     147                       
    155148                        break;
    156149                default:
     
    192185                        /* Send message to fb */
    193186                        if (consnum == active_console) {
    194                                 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, IPC_GET_ARG2(call), connections[consnum].screenbuffer.position_y, \
    195                                                 connections[consnum].screenbuffer.position_x, NULL, NULL, NULL);
     187                                ipc_call_async_3(fb_info.phone, FB_PUTCHAR, IPC_GET_ARG2(call), connections[consnum].screenbuffer.position_y, \
     188                                                connections[consnum].screenbuffer.position_x, NULL, NULL);
    196189                        }
    197190                       
     
    226219                        };
    227220                        keybuffer_pop(&(connections[consnum].keybuffer), (char *)&arg1);
    228 //                      ipc_call_sync_2(connections[6].vfb_phone, FB_PUTCHAR, 0, arg1,NULL,NULL);
    229221                       
    230222                        break;
     
    258250        }
    259251       
    260         ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '1', 0, 0,NULL,NULL, NULL);
    261252        ipc_call_sync_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols));
     253        ipc_call_sync(fb_info.phone, FB_CURSOR_VISIBILITY, 1, NULL);
    262254       
    263255        /* Init virtual consoles */
    264256        for (i = 0; i < CONSOLE_COUNT; i++) {
    265                 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '$', 2*i, 1,NULL,NULL, NULL);
    266257                connections[i].used = 0;
    267258                keybuffer_init(&(connections[i].keybuffer));
    268                 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '>', 2*i+1, 1,NULL,NULL, NULL);
    269259               
    270260                connections[i].keyrequests.head = connections[i].keyrequests.tail = 0;
     
    272262                connections[i].keyrequest_counter = 0;
    273263               
    274                 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '?', 2*i+1, 1,NULL,NULL, NULL);
    275264                if (screenbuffer_init(&(connections[i].screenbuffer), fb_info.cols, fb_info.rows ) == NULL) {
    276265                        /*FIXME: handle error */
     
    283272        };
    284273       
    285         ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, 'M', 3, 3,NULL,NULL, NULL);
    286274        async_manager();
    287275
Note: See TracChangeset for help on using the changeset viewer.