Changeset 965dc18 in mainline for uspace/srv/fb/msim.c


Ignore:
Timestamp:
2008-12-05T19:59:03Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
49093a4
Parents:
0258e67
Message:

Merge sparc branch to trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fb/msim.c

    r0258e67 r965dc18  
    5050#include <ddi.h>
    5151
     52#include "serial_console.h"
    5253#include "msim.h"
    5354
     
    6566{
    6667        *virt_addr = c;
    67 }
    68 
    69 static void msim_puts(char *str)
    70 {
    71         while (*str)
    72                 *virt_addr = *(str++);
    73 }
    74 
    75 static void msim_clrscr(void)
    76 {
    77         msim_puts("\033[2J");
    78 }
    79 
    80 static void msim_goto(const unsigned int row, const unsigned int col)
    81 {
    82         if ((row > HEIGHT) || (col > WIDTH))
    83                 return;
    84        
    85         char control[MAX_CONTROL];
    86         snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1);
    87         msim_puts(control);
    88 }
    89 
    90 static void msim_set_style(const unsigned int mode)
    91 {
    92         char control[MAX_CONTROL];
    93         snprintf(control, MAX_CONTROL, "\033[%um", mode);
    94         msim_puts(control);
    95 }
    96 
    97 static void msim_cursor_disable(void)
    98 {
    99         msim_puts("\033[?25l");
    100 }
    101 
    102 static void msim_cursor_enable(void)
    103 {
    104         msim_puts("\033[?25h");
    105 }
    106 
    107 static void msim_scroll(int i)
    108 {
    109         if (i > 0) {
    110                 msim_goto(HEIGHT - 1, 0);
    111                 while (i--)
    112                         msim_puts("\033D");
    113         } else if (i < 0) {
    114                 msim_goto(0, 0);
    115                 while (i++)
    116                         msim_puts("\033M");
    117         }
    11868}
    11969
     
    14292        /* Clear the terminal, set scrolling region
    14393           to 0 - 25 lines */
    144         msim_clrscr();
    145         msim_goto(0, 0);
    146         msim_puts("\033[0;25r");
     94        serial_clrscr();
     95        serial_goto(0, 0);
     96        serial_puts("\033[0;25r");
    14797       
    14898        while (true) {
     
    158108                        newcol = IPC_GET_ARG3(call);
    159109                        if ((lastcol != newcol) || (lastrow != newrow))
    160                                 msim_goto(newrow, newcol);
     110                                serial_goto(newrow, newcol);
    161111                        lastcol = newcol + 1;
    162112                        lastrow = newrow;
     
    167117                        newrow = IPC_GET_ARG1(call);
    168118                        newcol = IPC_GET_ARG2(call);
    169                         msim_goto(newrow, newcol);
     119                        serial_goto(newrow, newcol);
    170120                        lastrow = newrow;
    171121                        lastcol = newcol;
     
    176126                        continue;
    177127                case FB_CLEAR:
    178                         msim_clrscr();
     128                        serial_clrscr();
    179129                        retval = 0;
    180130                        break;
     
    183133                        bgcolor = IPC_GET_ARG2(call);
    184134                        if (fgcolor < bgcolor)
    185                                 msim_set_style(0);
     135                                serial_set_style(0);
    186136                        else
    187                                 msim_set_style(7);
     137                                serial_set_style(7);
    188138                        retval = 0;
    189139                        break;
     
    194144                                break;
    195145                        }
    196                         msim_scroll(i);
    197                         msim_goto(lastrow, lastcol);
     146                        serial_scroll(i);
     147                        serial_goto(lastrow, lastcol);
    198148                        retval = 0;
    199149                        break;
    200150                case FB_CURSOR_VISIBILITY:
    201151                        if(IPC_GET_ARG1(call))
    202                                 msim_cursor_enable();
     152                                serial_cursor_enable();
    203153                        else
    204                                 msim_cursor_disable();
     154                                serial_cursor_disable();
    205155                        retval = 0;
    206156                        break;
     
    219169        physmem_map(phys_addr, virt_addr, 1, AS_AREA_READ | AS_AREA_WRITE);
    220170       
     171        serial_console_init(msim_putc, WIDTH, HEIGHT);
     172       
    221173        async_set_client_connection(msim_client_connection);
    222174        return 0;
Note: See TracChangeset for help on using the changeset viewer.