/branches/dynload/kernel/genarch/src/kbd/ns16550.c |
---|
39,9 → 39,6 |
#include <genarch/kbd/scanc.h> |
#include <genarch/kbd/scanc_sun.h> |
#include <arch/drivers/kbd.h> |
#ifndef ia64 |
#include <arch/drivers/ns16550.h> |
#endif |
#include <ddi/irq.h> |
#include <ipc/irq.h> |
#include <cpu.h> |
130,11 → 127,9 |
ns16550_irq.cir = cir; |
ns16550_irq.cir_arg = cir_arg; |
irq_register(&ns16550_irq); |
while ((ns16550_lsr_read(&ns16550) & LSR_DATA_READY)) |
ns16550_rbr_read(&ns16550); |
sysinfo_set_item_val("kbd", NULL, true); |
sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); |
142,23 → 137,21 |
sysinfo_set_item_val("kbd.inr", NULL, inr); |
sysinfo_set_item_val("kbd.address.virtual", NULL, port); |
sysinfo_set_item_val("kbd.port", NULL, port); |
#ifdef CONFIG_NS16550_INTERRUPT_DRIVEN |
/* Enable interrupts */ |
ns16550_ier_write(&ns16550, IER_ERBFI); |
ns16550_ier_write(&ns16550, IER_ERBFI); |
ns16550_mcr_write(&ns16550, MCR_OUT2); |
#endif |
#ifdef ia64 |
uint8_t c; |
// This switches rbr & ier to mode when accept baudrate constant |
c = ns16550_lcr_read(&ns16550); |
ns16550_lcr_write(&ns16550, 0x80 | c); |
ns16550_rbr_write(&ns16550, 0x0c); |
ns16550_ier_write(&ns16550, 0x00); |
ns16550_lcr_write(&ns16550, c); |
#endif |
uint8_t c; |
// This switches rbr & ier to mode when accept baudrate constant |
c = ns16550_lcr_read(&ns16550); |
ns16550_lcr_write(&ns16550, 0x80 | c); |
ns16550_rbr_write(&ns16550, 0x0c); |
ns16550_ier_write(&ns16550, 0x00); |
ns16550_lcr_write(&ns16550, c); |
ns16550_grab(); |
} |
185,10 → 178,10 |
while(!(ch = active_read_buff_read())) { |
uint8_t x; |
while (!(ns16550_lsr_read(&ns16550) & LSR_DATA_READY)) |
; |
while (!(ns16550_lsr_read(&ns16550) & LSR_DATA_READY)); |
x = ns16550_rbr_read(&ns16550); |
#ifndef ia64 |
if (x != IGNORE_CODE) { |
if (x & KEY_RELEASE) |
key_released(x ^ KEY_RELEASE); |
195,15 → 188,6 |
else |
active_read_key_pressed(x); |
} |
#else |
extern chardev_t kbrd; |
if(x != 0x0d) { |
if(x == 0x7f) |
x = '\b'; |
chardev_push_character(&kbrd, x); |
} |
#endif |
} |
return ch; |
} |
214,7 → 198,7 |
*/ |
void ns16550_poll(void) |
{ |
#ifndef CONFIG_NS16550_INTERRUPT_DRIVEN |
#ifndef CONFIG_NS16550_INTERRUPT_DRIVEN |
ipl_t ipl; |
ipl = interrupts_disable(); |
240,7 → 224,7 |
uint8_t x; |
x = ns16550_rbr_read(&ns16550); |
#ifndef ia64 |
if (x != IGNORE_CODE) { |
if (x & KEY_RELEASE) |
key_released(x ^ KEY_RELEASE); |
247,15 → 231,6 |
else |
key_pressed(x); |
} |
#else |
extern chardev_t kbrd; |
if(x != 0x0d) { |
if (x == 0x7f) |
x = '\b'; |
chardev_push_character(&kbrd, x); |
} |
#endif |
} |
} |
/branches/dynload/kernel/genarch/src/kbd/i8042.c |
---|
37,9 → 37,7 |
*/ |
#include <genarch/kbd/i8042.h> |
#ifdef ia64 |
#include <arch/drivers/kbd.h> |
#endif |
#include <genarch/kbd/key.h> |
#include <genarch/kbd/scanc.h> |
#include <genarch/kbd/scanc_pc.h> |
171,10 → 169,10 |
i8042_mouse_irq.claim = i8042_claim; |
i8042_mouse_irq.handler = i8042_irq_handler; |
irq_register(&i8042_mouse_irq); |
#ifndef ia64 |
trap_virtual_enable_irqs(1 << kbd_inr); |
trap_virtual_enable_irqs(1 << mouse_inr); |
#endif |
/* |
* Clear input buffer. |
* Number of iterations is limited to prevent infinite looping. |
189,7 → 187,7 |
sysinfo_set_item_val("kbd.inr", NULL, kbd_inr); |
#ifdef KBD_LEGACY |
sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); |
#endif |
#endif |
sysinfo_set_item_val("mouse", NULL, true); |
sysinfo_set_item_val("mouse.devno", NULL, mouse_devno); |
sysinfo_set_item_val("mouse.inr", NULL, mouse_inr); |
209,12 → 207,13 |
char i8042_key_read(chardev_t *d) |
{ |
char ch; |
while(!(ch = active_read_buff_read())) { |
char ch; |
while (!(ch = active_read_buff_read())) { |
uint8_t x; |
while (!(i8042_status_read() & i8042_BUFFER_FULL_MASK)) |
; |
while (!(i8042_status_read() & i8042_BUFFER_FULL_MASK)); |
x = i8042_data_read(); |
if (x & KEY_RELEASE) |
key_released(x ^ KEY_RELEASE); |
231,7 → 230,7 |
void i8042_poll(void) |
{ |
uint8_t x; |
while (((x = i8042_status_read() & i8042_BUFFER_FULL_MASK))) { |
x = i8042_data_read(); |
if (x & KEY_RELEASE) |
/branches/dynload/kernel/genarch/src/kbd/key.c |
---|
40,7 → 40,7 |
#include <genarch/kbd/scanc_pc.h> |
#endif |
#if (defined(sparc64)) |
#if (defined(US)) || (defined(US3)) |
#include <genarch/kbd/scanc_sun.h> |
#endif |
/branches/dynload/kernel/genarch/src/fb/fb.c |
---|
120,23 → 120,28 |
} |
/** BGR 8:8:8 conversion |
/** RGB 8:8:8 conversion |
* |
*/ |
static void rgb_888(void *dst, uint32_t rgb) |
{ |
#if defined(FB_INVERT_ENDIAN) |
((uint8_t *) dst)[0] = RED(rgb, 8); |
((uint8_t *) dst)[1] = GREEN(rgb, 8); |
((uint8_t *) dst)[2] = BLUE(rgb, 8); |
#else |
((uint8_t *) dst)[0] = BLUE(rgb, 8); |
((uint8_t *) dst)[1] = GREEN(rgb, 8); |
((uint8_t *) dst)[2] = RED(rgb, 8); |
#endif |
} |
/** BGR 8:8:8 conversion |
* |
*/ |
static void bgr_888(void *dst, uint32_t rgb) |
{ |
((uint8_t *) dst)[0] = RED(rgb, 8); |
((uint8_t *) dst)[1] = GREEN(rgb, 8); |
((uint8_t *) dst)[2] = BLUE(rgb, 8); |
} |
/** RGB 5:5:5 conversion |
* |
*/ |
449,6 → 454,10 |
rgb_conv = rgb_888; |
pixelbytes = 3; |
break; |
case VISUAL_BGR_8_8_8: |
rgb_conv = bgr_888; |
pixelbytes = 3; |
break; |
case VISUAL_RGB_8_8_8_0: |
rgb_conv = rgb_888; |
pixelbytes = 4; |