Changeset 965dc18 in mainline for uspace/srv


Ignore:
Timestamp:
2008-12-05T19:59:03Z (16 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.

Location:
uspace/srv
Files:
8 added
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/console/console.c

    r0258e67 r965dc18  
    328328                case KBD_PUSHCHAR:
    329329                        /* got key from keyboard driver */
    330                        
    331330                        retval = 0;
    332331                        c = IPC_GET_ARG1(call);
  • uspace/srv/fb/Makefile

    r0258e67 r965dc18  
    6666endif
    6767ifeq ($(ARCH), mips32)
    68         SOURCES += msim.c
     68        SOURCES += msim.c \
     69                   serial_console.c
    6970        CFLAGS += -DMSIM_ENABLED -DFB_INVERT_ENDIAN
     71endif
     72ifeq ($(ARCH), sparc64)
     73        SOURCES += sgcn.c \
     74                   serial_console.c
     75        CFLAGS += -DSGCN_ENABLED
    7076endif
    7177
  • uspace/srv/fb/main.c

    r0258e67 r965dc18  
    3939#include "ega.h"
    4040#include "msim.h"
     41#include "sgcn.h"
    4142#include "main.h"
    4243
     
    8081        }
    8182#endif
     83#ifdef SGCN_ENABLED
     84        if ((!initialized) && (sysinfo_value("fb.kind") == 4)) {
     85                if (sgcn_init() == 0)
     86                        initialized = true;
     87        }
     88#endif
    8289
    8390        if (!initialized)
  • 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;
  • uspace/srv/kbd/Makefile

    r0258e67 r965dc18  
    7979ifeq ($(ARCH), sparc64)
    8080        ARCH_SOURCES += \
    81                 arch/$(ARCH)/src/scanc.c
     81                arch/$(ARCH)/src/scanc.c \
     82                arch/$(ARCH)/src/sgcn.c
    8283        GENARCH_SOURCES = \
    83                 genarch/src/kbd.c
     84                genarch/src/kbd.c \
     85                genarch/src/nofb.c
    8486endif
    8587ifeq ($(ARCH), arm32)
     
    8789                arch/$(ARCH)/src/kbd_gxemul.c
    8890endif
    89 
     91ifeq ($(ARCH), mips32)
     92        GENARCH_SOURCES += \
     93            genarch/src/nofb.c
     94endif
    9095
    9196GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
  • uspace/srv/kbd/arch/mips32/src/kbd.c

    r0258e67 r965dc18  
    3535 */
    3636#include <arch/kbd.h>
     37#include <genarch/nofb.h>
    3738#include <ipc/ipc.h>
    3839#include <sysinfo.h>
     
    100101*/
    101102
    102 static int kbd_arch_process_no_fb(keybuffer_t *keybuffer, int scan_code)
    103 {
    104 
    105         static unsigned long buf = 0;
    106         static int count = 0;   
    107 
    108         /* Please preserve this code (it can be used to determine scancodes)
    109        
    110         keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf));
    111         keybuffer_push(keybuffer, to_hex(scan_code&0xf));
    112         keybuffer_push(keybuffer, ' ');
    113         keybuffer_push(keybuffer, ' ');
    114        
    115         return 1;
    116         */
    117        
    118         if(scan_code == 0x7e) {
    119                 switch (buf) {
    120                 case MSIM_KEY_F5:
    121                         keybuffer_push(keybuffer,FUNCTION_KEYS | 5);
    122                         buf = count = 0;
    123                         return 1;
    124                 case MSIM_KEY_F6:
    125                         keybuffer_push(keybuffer,FUNCTION_KEYS | 6);
    126                         buf = count = 0;
    127                         return 1;
    128                 case MSIM_KEY_F7:
    129                         keybuffer_push(keybuffer,FUNCTION_KEYS | 7);
    130                         buf = count = 0;
    131                         return 1;
    132                 case MSIM_KEY_F8:
    133                         keybuffer_push(keybuffer,FUNCTION_KEYS | 8);
    134                         buf = count = 0;
    135                         return 1;
    136                 case MSIM_KEY_F9:
    137                         keybuffer_push(keybuffer,FUNCTION_KEYS | 9);
    138                         buf = count = 0;
    139                         return 1;
    140                 case MSIM_KEY_F10:
    141                         keybuffer_push(keybuffer,FUNCTION_KEYS | 10);
    142                         buf = count = 0;
    143                         return 1;
    144                 case MSIM_KEY_F11:
    145                         keybuffer_push(keybuffer,FUNCTION_KEYS | 11);
    146                         buf = count = 0;
    147                         return 1;
    148                 case MSIM_KEY_F12:
    149                         keybuffer_push(keybuffer,FUNCTION_KEYS | 12);
    150                         buf = count = 0;
    151                         return 1;
    152                 default:
    153                         keybuffer_push(keybuffer, buf & 0xff);
    154                         keybuffer_push(keybuffer, (buf >> 8) &0xff);
    155                         keybuffer_push(keybuffer, (buf >> 16) &0xff);
    156                         keybuffer_push(keybuffer, (buf >> 24) &0xff);
    157                         keybuffer_push(keybuffer, scan_code);
    158                         buf = count = 0;
    159                         return 1;
    160                 }
    161         }
    162 
    163         buf |= ((unsigned long) scan_code)<<(8*(count++));
    164        
    165         if((buf & 0xff) != (MSIM_KEY_F1 & 0xff)) {
    166                 keybuffer_push(keybuffer, buf);
    167                 buf = count = 0;
    168                 return 1;
    169         }
    170 
    171         if (count <= 1)
    172                 return 1;
    173 
    174         if ((buf & 0xffff) != (MSIM_KEY_F1 & 0xffff)
    175                 && (buf & 0xffff) != (MSIM_KEY_F5 & 0xffff) ) {
    176 
    177                 keybuffer_push(keybuffer, buf & 0xff);
    178                 keybuffer_push(keybuffer, (buf >> 8) &0xff);
    179                 buf = count = 0;
    180                 return 1;
    181         }
    182 
    183         if (count <= 2)
    184                 return 1;
    185 
    186         switch (buf) {
    187         case MSIM_KEY_F1:
    188                 keybuffer_push(keybuffer,FUNCTION_KEYS | 1);
    189                 buf = count = 0;
    190                 return 1;
    191         case MSIM_KEY_F2:
    192                 keybuffer_push(keybuffer,FUNCTION_KEYS | 2);
    193                 buf = count = 0;
    194                 return 1;
    195         case MSIM_KEY_F3:
    196                 keybuffer_push(keybuffer,FUNCTION_KEYS | 3);
    197                 buf = count = 0;
    198                 return 1;
    199         case MSIM_KEY_F4:
    200                 keybuffer_push(keybuffer,FUNCTION_KEYS | 4);
    201                 buf = count = 0;
    202                 return 1;
    203         }
    204 
    205 
    206         if((buf & 0xffffff) != (MSIM_KEY_F5 & 0xffffff)
    207                 && (buf & 0xffffff) != (MSIM_KEY_F9 & 0xffffff)) {
    208 
    209                 keybuffer_push(keybuffer, buf & 0xff);
    210                 keybuffer_push(keybuffer, (buf >> 8) & 0xff);
    211                 keybuffer_push(keybuffer, (buf >> 16) & 0xff);
    212                 buf=count=0;
    213                 return 1;
    214         }
    215 
    216         if (count <= 3)
    217                 return 1;
    218        
    219         switch (buf) {
    220         case MSIM_KEY_F5:
    221         case MSIM_KEY_F6:
    222         case MSIM_KEY_F7:
    223         case MSIM_KEY_F8:
    224         case MSIM_KEY_F9:
    225         case MSIM_KEY_F10:
    226         case MSIM_KEY_F11:
    227         case MSIM_KEY_F12:
    228                 return 1;
    229         default:
    230                 keybuffer_push(keybuffer, buf & 0xff);
    231                 keybuffer_push(keybuffer, (buf >> 8) &0xff);
    232                 keybuffer_push(keybuffer, (buf >> 16) &0xff);
    233                 keybuffer_push(keybuffer, (buf >> 24) &0xff);
    234                 buf = count = 0;
    235                 return 1;
    236         }
    237         return 1;
    238 }
    239 
    240 
    241 
    242103static int kbd_arch_process_fb(keybuffer_t *keybuffer, int scan_code)
    243104{
     
    372233                return kbd_arch_process_fb(keybuffer, scan_code);
    373234
    374         return kbd_arch_process_no_fb(keybuffer, scan_code);
     235        return kbd_process_no_fb(keybuffer, scan_code);
    375236}
    376237/** @}
  • uspace/srv/kbd/arch/sparc64/src/kbd.c

    r0258e67 r965dc18  
    3636
    3737#include <arch/kbd.h>
     38#include <arch/sgcn.h>
    3839#include <ipc/ipc.h>
    3940#include <sysinfo.h>
     
    7980#define KBD_Z8530       1
    8081#define KBD_NS16550     2
     82#define KBD_SGCN        3
    8183
    8284int kbd_arch_init(void)
     
    9294                ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &ns16550_kbd);
    9395                break;
     96        case KBD_SGCN:
     97                sgcn_init();
     98                break;
    9499        default:
    95100                break;
     
    101106int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call)
    102107{
     108        if (sysinfo_value("kbd.type") == KBD_SGCN) {
     109                sgcn_key_pressed();
     110                return 1;
     111        }
     112       
    103113        int scan_code = IPC_GET_ARG1(*call);
    104114
Note: See TracChangeset for help on using the changeset viewer.