Changeset 253f35a1 in mainline for kernel/genarch


Ignore:
Timestamp:
2006-09-07T19:56:44Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab1ae2d9
Parents:
801579fe
Message:

sparc64 work.

  • Changes to enable userspace keyboard drivers.
  • Fix z8530 initialization (i.e. clear any pending Tx interrupts).
  • Experimental support for framebuffers with inverted colors.
Location:
kernel/genarch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/kbd/z8530.h

    r801579fe r253f35a1  
    3838#define KERN_Z8530_H_
    3939
     40#include <typedefs.h>
     41
    4042#define Z8530_INTRCV_DATA0      0x39    /* hardcoded for use in Simics */
     43
     44extern bool z8530_belongs_to_kernel;
    4145
    4246extern void z8530_init(void);
  • kernel/genarch/src/fb/fb.c

    r801579fe r253f35a1  
    6161static unsigned int bitspp = 0;
    6262static unsigned int pixelbytes = 0;
     63#ifdef FB_INVERT_COLORS
     64static bool invert_colors = true;
     65#else
     66static bool invert_colors = false;
     67#endif
    6368
    6469static unsigned int position = 0;
     
    6671static unsigned int rows = 0;
    6772
    68 
    6973#define COL_WIDTH       8
    7074#define ROW_BYTES       (scanline * FONT_SCANLINES)
     
    8589static void (*rgb2scr)(void *, int);
    8690static int (*scr2rgb)(void *);
     91
     92static inline int COLOR(int color)
     93{
     94        return invert_colors ? ~color : color;
     95}
    8796
    8897/* Conversion routines between different color representations */
     
    160169static void putpixel(unsigned int x, unsigned int y, int color)
    161170{
    162         (*rgb2scr)(&fbaddress[POINTPOS(x,y)],color);
     171        (*rgb2scr)(&fbaddress[POINTPOS(x,y)], COLOR(color));
    163172
    164173        if (dbbuffer) {
    165174                int dline = (y + dboffset) % yres;
    166                 (*rgb2scr)(&dbbuffer[POINTPOS(x,dline)],color);
     175                (*rgb2scr)(&dbbuffer[POINTPOS(x,dline)], COLOR(color));
    167176        }
    168177}
     
    173182        if (dbbuffer) {
    174183                int dline = (y + dboffset) % yres;
    175                 return (*scr2rgb)(&dbbuffer[POINTPOS(x,dline)]);
    176         }
    177         return (*scr2rgb)(&fbaddress[POINTPOS(x,y)]);
     184                return COLOR((*scr2rgb)(&dbbuffer[POINTPOS(x,dline)]));
     185        }
     186        return COLOR((*scr2rgb)(&fbaddress[POINTPOS(x,y)]));
    178187}
    179188
     
    275284                        byte >>= x % 8;
    276285                        if (byte & 1)
    277                                 putpixel(startx + x, starty + y, LOGOCOLOR);
     286                                putpixel(startx + x, starty + y, COLOR(LOGOCOLOR));
    278287                }
    279288}
     
    398407        sysinfo_set_item_val("fb.scanline", NULL, scan);
    399408        sysinfo_set_item_val("fb.address.physical", NULL, addr);
     409        sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
    400410
    401411        /* Allocate double buffer */
     
    417427        if (!blankline)
    418428                panic("Failed to allocate blank line for framebuffer.");
    419         for (y=0; y < FONT_SCANLINES; y++)
    420                 for (x=0; x < xres; x++)
    421                         (*rgb2scr)(&blankline[POINTPOS(x,y)],BGCOLOR);
     429        for (y=0; y < FONT_SCANLINES; y++) {
     430                for (x=0; x < xres; x++) {
     431                        (*rgb2scr)(&blankline[POINTPOS(x,y)], COLOR(BGCOLOR));
     432                }
     433        }
    422434
    423435        clear_screen();
  • kernel/genarch/src/kbd/key.c

    r801579fe r253f35a1  
    6868        spinlock_lock(&keylock);
    6969        switch (sc) {
    70             case SC_LSHIFT:
    71             case SC_RSHIFT:
     70        case SC_LSHIFT:
     71        case SC_RSHIFT:
    7272                keyflags &= ~PRESSED_SHIFT;
    7373                break;
    74             case SC_CAPSLOCK:
     74        case SC_CAPSLOCK:
    7575                keyflags &= ~PRESSED_CAPSLOCK;
    7676                if (lockflags & LOCKED_CAPSLOCK)
     
    7979                        lockflags |= LOCKED_CAPSLOCK;
    8080                break;
    81             default:
     81        default:
    8282                break;
    8383        }
  • kernel/genarch/src/kbd/z8530.c

    r801579fe r253f35a1  
    4242#include <arch/drivers/z8530.h>
    4343#include <arch/interrupt.h>
     44#include <arch/drivers/kbd.h>
    4445#include <cpu.h>
    4546#include <arch/asm.h>
     
    4950#include <console/console.h>
    5051#include <interrupt.h>
     52#include <sysinfo/sysinfo.h>
     53#include <print.h>
    5154
    5255/*
     
    5457 */
    5558#define IGNORE_CODE     0x7f            /* all keys up */
     59
     60bool z8530_belongs_to_kernel = true;
    5661
    5762static void z8530_suspend(chardev_t *);
     
    7075void z8530_grab(void)
    7176{
     77        z8530_belongs_to_kernel = true;
    7278}
    7379
     
    7581void z8530_release(void)
    7682{
     83        z8530_belongs_to_kernel = false;
    7784}
    7885
     
    8390        stdin = &kbrd;
    8491
     92        sysinfo_set_item_val("kbd", NULL, true);
     93        sysinfo_set_item_val("kbd.irq", NULL, 0);
     94        sysinfo_set_item_val("kbd.address.virtual", NULL, (uintptr_t) kbd_virt_address);
     95
    8596        (void) z8530_read_a(RR8);
    8697
    87         z8530_write_a(WR1, WR1_IARCSC); /* interrupt on all characters */
     98        /*
     99         * Clear any pending TX interrupts or we never manage
     100         * to set FHC UART interrupt state to idle.
     101         */
     102        z8530_write_a(WR0, WR0_TX_IP_RST);
     103
     104        z8530_write_a(WR1, WR1_IARCSC);         /* interrupt on all characters */
    88105
    89106        /* 8 bits per character and enable receiver */
    90107        z8530_write_a(WR3, WR3_RX8BITSCH | WR3_RX_ENABLE);
    91108       
    92         z8530_write_a(WR9, WR9_MIE);    /* Master Interrupt Enable. */
     109        z8530_write_a(WR9, WR9_MIE);            /* Master Interrupt Enable. */
    93110       
    94111        /*
Note: See TracChangeset for help on using the changeset viewer.