Changeset 253f35a1 in mainline


Ignore:
Timestamp:
2006-09-07T19:56:44Z (18 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.
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/Makefile.inc

    r801579fe r253f35a1  
    7777       
    7878        DEFS += -DKBD_ADDR_OVRD=0x1fff13083f8ULL
     79       
     80        DEFS += -DFB_INVERT_COLORS
    7981endif
    8082
  • kernel/arch/sparc64/include/drivers/z8530.h

    r801579fe r253f35a1  
    7272
    7373/* Write Register 0 */
     74#define WR0_TX_IP_RST   (0x5<<3)        /** Reset pending TX interrupt. */
    7475#define WR0_ERR_RST     (0x6<<3)
    7576
  • kernel/arch/sparc64/src/console.c

    r801579fe r253f35a1  
    9494}
    9595
     96/** Acquire console back for kernel
     97 *
     98 */
     99void arch_grab_console(void)
     100{
     101#ifdef CONFIG_Z8530
     102        z8530_grab();
     103#endif
     104}
     105
     106/** Return console to userspace
     107 *
     108 */
     109void arch_release_console(void)
     110{
     111#ifdef CONFIG_Z8530
     112        z8530_release();
     113#endif
     114}
    96115/** @}
    97116 */
  • kernel/arch/sparc64/src/drivers/fhc.c

    r801579fe r253f35a1  
    5858        fhc = (void *) hw_map(FHC_UART_ADDR, PAGE_SIZE);
    5959
    60         (void) fhc[FHC_UART_ICLR];
    6160        fhc[FHC_UART_ICLR] = 0;
    62         (void) fhc[FHC_UART_IMAP];
    63         fhc[FHC_UART_IMAP] = Z8530_INTRCV_DATA0;        /* hardcoded for Simics simulation */
    64         (void) fhc[FHC_UART_IMAP];
    65         fhc[FHC_UART_IMAP] = 0x80000000;                /* hardcoded for Simics simulation */
     61        fhc[FHC_UART_IMAP] = 0x80000000;
    6662}
    6763
    6864void fhc_uart_reset(void)
    6965{
    70         (void) fhc[FHC_UART_ICLR];
    7166        fhc[FHC_UART_ICLR] = 0;
    7267}
  • kernel/arch/sparc64/src/sparc64.c

    r801579fe r253f35a1  
    9494}
    9595
    96 /** Acquire console back for kernel
    97  *
    98  */
    99 void arch_grab_console(void)
    100 {
    101 }
    102 /** Return console to userspace
    103  *
    104  */
    105 void arch_release_console(void)
    106 {
    107 }
    108 
    10996/** Switch to userspace. */
    11097void userspace(uspace_arg_t *kernel_uarg)
  • kernel/arch/sparc64/src/trap/interrupt.c

    r801579fe r253f35a1  
    4343#include <arch/asm.h>
    4444#include <arch/barrier.h>
    45 
     45#include <print.h>
    4646#include <genarch/kbd/z8530.h>
    4747
     
    6262void irq_ipc_bind_arch(unative_t irq)
    6363{
    64         /* TODO */
     64#ifdef CONFIG_Z8530
     65        z8530_belongs_to_kernel = false;
     66#endif
    6567}
    6668
     
    8385                 * interrupt traps. Call the interrupt handler directly.
    8486                 */
     87
     88                if (z8530_belongs_to_kernel)
     89                        z8530_interrupt();
     90                else
     91                        ipc_irq_send_notif(0);
    8592                fhc_uart_reset();
    86                 z8530_interrupt();
    8793                break;
     94
    8895#endif
    8996        }
  • 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        /*
  • kernel/generic/src/ipc/irq.c

    r801579fe r253f35a1  
    5656#include <syscall/copy.h>
    5757#include <console/console.h>
     58#include <print.h>
    5859
    5960typedef struct {
     
    6869static int irq_conns_size;
    6970
    70 #include <print.h>
     71
    7172/* Execute code associated with IRQ notification */
    7273static void code_execute(call_t *call, irq_code_t *code)
  • kernel/generic/src/ipc/sysipc.c

    r801579fe r253f35a1  
    4848#include <security/cap.h>
    4949#include <mm/as.h>
     50#include <print.h>
    5051
    5152#define GET_CHECK_PHONE(phone,phoneid,err) { \
  • uspace/fb/fb.c

    r801579fe r253f35a1  
    7171
    7272struct {
    73         uint8_t *fbaddress ;
    74 
    75         unsigned int xres ;
    76         unsigned int yres ;
    77         unsigned int scanline ;
    78         unsigned int pixelbytes ;
     73        uint8_t *fbaddress;
     74
     75        unsigned int xres;
     76        unsigned int yres;
     77        unsigned int scanline;
     78        unsigned int pixelbytes;
     79        unsigned int invert_colors;
    7980
    8081        conv2scr_fn_t rgb2scr;
     
    141142#define POINTPOS(x, y)  ((y) * screen.scanline + (x) * screen.pixelbytes)
    142143
     144static inline int COLOR(int color)
     145{
     146        return screen.invert_colors ? ~color : color;
     147}
     148
    143149/* Conversion routines between different color representations */
    144150static void rgb_4byte(void *dst, int rgb)
     
    164170        scr[0] = BLUE(rgb, 8);
    165171#endif
    166 
    167 
    168172}
    169173
     
    218222
    219223        if (! (vport->paused && vport->dbdata))
    220                 (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)],color);
     224                (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)], COLOR(color));
    221225
    222226        if (vport->dbdata) {
    223227                int dline = (y + vport->dboffset) % vport->height;
    224228                int doffset = screen.pixelbytes * (dline * vport->width + x);
    225                 (*screen.rgb2scr)(&vport->dbdata[doffset],color);
     229                (*screen.rgb2scr)(&vport->dbdata[doffset], COLOR(color));
    226230        }
    227231}
     
    233237        int dy = vport->y + y;
    234238
    235         return (*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)]);
     239        return COLOR((*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)]));
    236240}
    237241
     
    239243                                int color)
    240244{
    241         (*screen.rgb2scr)(&mem[POINTPOS(x,y)],color);
     245        (*screen.rgb2scr)(&mem[POINTPOS(x,y)], COLOR(color));
    242246}
    243247
     
    455459 * @param scan Bytes per one scanline
    456460 * @param align Alignment for 24bpp mode.
     461 * @param invert_colors Inverted colors.
    457462 *
    458463 */
    459464static void
    460 screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan, int align)
     465screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan,
     466        int align, int invert_colors)
    461467{
    462468        switch (bpp) {
     
    491497        screen.yres = yres;
    492498        screen.scanline = scan;
     499        screen.invert_colors = invert_colors;
    493500       
    494501        /* Create first viewport */
     
    594601        int pos = (y * pmap->width + x) * screen.pixelbytes;
    595602
    596         (*screen.rgb2scr)(&pmap->data[pos],color);
     603        (*screen.rgb2scr)(&pmap->data[pos],COLOR(color));
    597604}
    598605
     
    12241231        unsigned int fb_bpp_align;
    12251232        unsigned int fb_scanline;
     1233        unsigned int fb_invert_colors;
    12261234        void *fb_addr;
    12271235        size_t asz;
     
    12351243        fb_bpp_align=sysinfo_value("fb.bpp-align");
    12361244        fb_scanline=sysinfo_value("fb.scanline");
     1245        fb_invert_colors=sysinfo_value("fb.invert-colors");
    12371246
    12381247        asz = fb_scanline*fb_height;
     
    12421251                    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    12431252       
    1244         screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline, fb_bpp_align);
     1253        screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline, fb_bpp_align, fb_invert_colors);
    12451254
    12461255        return 0;
Note: See TracChangeset for help on using the changeset viewer.