Changeset 24ff4df in mainline


Ignore:
Timestamp:
2009-02-18T21:47:05Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
96f392c
Parents:
f89979b
Message:

Add some missing ports and controllers (untested). Remove old parts of keyboard driver.

Location:
uspace/srv
Files:
1 added
30 deleted
10 edited
3 moved

Legend:

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

    rf89979b r24ff4df  
    3636#include <fb.h>
    3737#include <ipc/ipc.h>
    38 #include <keys.h>
     38#include <kbd.h>
    3939#include <kbd/keycode.h>
    4040#include <ipc/fb.h>
  • uspace/srv/kbd/Makefile

    rf89979b r24ff4df  
    111111ifeq ($(UARCH), sparc64)
    112112        GENARCH_SOURCES += \
    113                 port/dummy.c \
    114                 ctl/stty.c
     113                port/z8350.c \
     114                ctl/sun.c
    115115endif
    116116
  • uspace/srv/kbd/ctl/gxe_fb.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbd
     29/** @addtogroup kbd_ctl
     30 * @ingroup kbd
     31 * @{
     32 */
     33/**
     34 * @file
    3035 * @brief       GXEmul framebuffer-mode keyboard controller driver.
    31  * @{
    32  */
     36 */
    3337
    3438#include <kbd.h>
  • uspace/srv/kbd/ctl/pc.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbd
     29/** @addtogroup kbd_ctl
     30 * @ingroup kbd
     31 * @{
     32 */
     33/**
     34 * @file
    3035 * @brief       PC keyboard controller driver.
    31  * @{
    32  */
     36 */
    3337
    3438#include <kbd.h>
     
    3741#include <kbd_ctl.h>
    3842
    39 int scanmap_simple[];
     43static int scanmap_simple[];
    4044
    4145void kbd_ctl_parse_scancode(int scancode)
     
    4448        unsigned int key;
    4549
    46         if (scancode < 0 || scancode >= 0x100) return;
     50        if (scancode < 0 || scancode >= 0x100)
     51                return;
    4752
    4853        if (scancode & 0x80) {
     
    5863}
    5964
    60 int scanmap_simple[128] = {
     65static int scanmap_simple[128] = {
    6166
    6267        [0x29] = KC_BACKTICK,
  • uspace/srv/kbd/ctl/stty.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbd
     29/** @addtogroup kbd_ctl
     30 * @ingroup kbd
     31 * @{
     32 */
     33/**
     34 * @file
    3035 * @brief       Serial TTY-like keyboard controller driver.
    31  * @{
    32  */
     36 */
    3337
    3438#include <kbd.h>
  • uspace/srv/kbd/port/dummy.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbd
     29/** @addtogroup kbd_port
    3030 * @brief       Dummy keyboard port driver.
     31 * @ingroup  kbd
    3132 * @{
    3233 */
  • uspace/srv/kbd/port/gxemul.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbd
     29/** @addtogroup kbd_port
    3030 * @{
     31 * @ingroup  kbd
    3132 */
    3233/** @file
  • uspace/srv/kbd/port/i8042.c

    rf89979b r24ff4df  
    2828 */
    2929
    30 /** @addtogroup kbd
     30/** @addtogroup kbd_port
     31 * @ingroup kbd
    3132 * @{
    3233 */
    3334/** @file
     35 * @brief i8042 port driver.
    3436 */
    3537
  • uspace/srv/kbd/port/i8042.h

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbdamd64 amd64
    30  * @brief       HelenOS ia32 / amd64 arch dependent parts of uspace keyboard and mouse handler.
     29/** @addtogroup kbd_port
    3130 * @ingroup  kbd
    3231 * @{
     
    3433
    3534/** @file
    36  * @ingroup kbdia32
     35 * @brief i8042 port driver.
    3736 */
    3837
  • uspace/srv/kbd/port/msim.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbd
    30  * @brief       Msim keyboard port driver.
     29/** @addtogroup kbd_port
     30 * @ingroup  kbd
    3131 * @{
    3232 */
    3333/** @file
     34 * @brief       Msim keyboard port driver.
    3435 */
    3536
  • uspace/srv/kbd/port/ns16550.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbdamd64 amd64
    30  * @brief       HelenOS ia32 / amd64 arch dependent parts of uspace keyboard and mouse handler.
     29/** @addtogroup kbd_port
    3130 * @ingroup  kbd
    3231 * @{
     32 */
     33/** @file
     34 * @brief       NS16550 port driver.
    3335 */
    3436
    35 /** @file
    36  * @ingroup kbdia32
    37  */
     37#include <ipc/ipc.h>
     38#include <async.h>
     39#include <sysinfo.h>
     40#include <kbd.h>
     41#include <kbd_port.h>
     42#include <ddi.h>
    3843
    39 #ifndef KBD_ia32_KBD_H_
    40 #define KBD_ia32_KBD_H_
     44/* NS16550 registers */
     45#define RBR_REG         0       /** Receiver Buffer Register. */
     46#define IER_REG         1       /** Interrupt Enable Register. */
     47#define IIR_REG         2       /** Interrupt Ident Register (read). */
     48#define FCR_REG         2       /** FIFO control register (write). */
     49#define LCR_REG         3       /** Line Control register. */
     50#define MCR_REG         4       /** Modem Control Register. */
     51#define LSR_REG         5       /** Line Status Register. */
    4152
    42 #include <ddi.h>
    43 #include <libarch/ddi.h>
     53irq_cmd_t ns16550_cmds[1] = {
     54        { CMD_PORT_READ_1, 0, 0, 2 },
     55};
    4456
    45 #define i8042_DATA      0x60
    46 #define i8042_STATUS    0X64
     57irq_code_t ns16550_kbd = {
     58        1,
     59        ns16550_cmds
     60};
    4761
     62static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call);
    4863
    49 typedef unsigned char u8;
    50 typedef short u16;
     64uint16_t ns16550_port;
    5165
    52 static inline void i8042_data_write(u8 data)
     66int kbd_port_init(void)
    5367{
    54         outb(i8042_DATA, data);
     68        async_set_interrupt_received(ns16550_irq_handler);
     69
     70        ns16550_port = sysinfo_value("kbd.port");
     71        ns16550_kbd.cmds[0].addr = (void *) (ns16550_port + RBR_REG);
     72        ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"),
     73            0, &ns16550_kbd);
     74        iospace_enable(task_get_id(), ns16550_port, 8);
     75
     76        return 0;
    5577}
    5678
    57 static inline u8 i8042_data_read(void)
     79#define LSR_DATA_READY  0x01
     80
     81static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    5882{
    59         return inb(i8042_DATA);
     83        int scan_code = IPC_GET_ARG2(*call);
     84        kbd_push_scancode(scan_code);
    6085}
    61 
    62 static inline u8 i8042_status_read(void)
    63 {
    64         return inb(i8042_STATUS);
    65 }
    66 
    67 static inline void i8042_command_write(u8 command)
    68 {
    69         outb(i8042_STATUS, command);
    70 }
    71 
    72 #endif
    7386
    7487/**
    7588 * @}
    76  */ 
     89 */
  • uspace/srv/kbd/port/sgcn.c

    rf89979b r24ff4df  
    2727 */
    2828
    29 /** @addtogroup kbdsparc64 sparc64
    30  * @brief       Serengeti-specific parts of uspace keyboard handler.
     29/** @addtogroup kbd_port
    3130 * @ingroup  kbd
    3231 * @{
    3332 */
    3433/** @file
     34 * @brief       Z8350 keyboard port driver.
     35 * @brief       SGCN (Serengeti Console) keyboard port driver.
    3536 */
    3637
    37 #include <arch/sgcn.h>
    3838#include <as.h>
    3939#include <ddi.h>
    4040#include <ipc/ipc.h>
     41#include <async.h>
    4142#include <kbd.h>
    42 #include <genarch/nofb.h>
    43 #include <genarch/kbd.h>
     43#include <kbd_port.h>
    4444#include <sysinfo.h>
    4545#include <stdio.h>
    46 #include <futex.h>
    4746
    4847/**
     
    8079#define SGCN_BUFFER_HEADER      (SGCN_BUFFER(sgcn_buffer_header_t, 0))
    8180
    82 extern keybuffer_t keybuffer;
    83 
    8481/**
    8582 * Virtual address mapped to SRAM.
     
    9289static uintptr_t sram_buffer_offset;
    9390
     91static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     92
     93
    9494/**
    9595 * Initializes the SGCN driver.
    9696 * Maps the physical memory (SRAM) and registers the interrupt.
    9797 */
    98 void sgcn_init(void)
     98int kbd_port_init(void)
    9999{
     100        async_set_interrupt_received(sgcn_irq_handler);
    100101        sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size"));
    101102        if (physmem_map((void *) sysinfo_value("sram.address.physical"),
    102103            (void *) sram_virt_addr, sysinfo_value("sram.area.size") / PAGE_SIZE,
    103             AS_AREA_READ | AS_AREA_WRITE) != 0)
     104            AS_AREA_READ | AS_AREA_WRITE) != 0) {
    104105                printf("SGCN: uspace driver could not map physical memory.");
     106                return -1;
     107        }
    105108       
    106109        sram_buffer_offset = sysinfo_value("sram.buffer.offset");
    107110        ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"),
    108111                0, (void *) 0);
     112        return 0;
    109113}
    110114
     
    113117 * the buffer.
    114118 */
    115 void sgcn_key_pressed(void)
     119static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    116120{
    117121        char c;
     
    131135                buf_ptr = (volatile char *)
    132136                        SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr);
    133                 if (c == '\r') {
    134                         c = '\n';
    135                 }
    136                 kbd_process_no_fb(&keybuffer, c);
     137                kbd_push_scancode(c);
    137138        }
    138139}
  • uspace/srv/kbd/port/z8530.c

    rf89979b r24ff4df  
    11/*
    2  * Copyright (c) 2006 Josef Cejka
     2 * Copyright (c) 2006 Martin Decky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup kbdamd64 amd64
    30  * @brief       HelenOS ia32 / amd64 arch dependent parts of uspace keyboard and mouse handler.
     29/** @addtogroup kbd_port
    3130 * @ingroup  kbd
    3231 * @{
     32 */
     33/** @file
     34 * @brief       Z8350 keyboard port driver.
    3335 */
    3436
    35 /** @file
    36  * @ingroup kbdia32
    37  */
     37#include <ipc/ipc.h>
     38#include <async.h>
     39#include <sysinfo.h>
     40#include <kbd.h>
     41#include <kbd_port.h>
     42#include <sys/types.h>
    3843
    39 #ifndef KBD_ia32_KBD_H_
    40 #define KBD_ia32_KBD_H_
     44/** Top-half pseudocode for z8530. */
     45irq_cmd_t z8530_cmds[] = {
     46        {
     47                CMD_MEM_READ_1,
     48                0,              /**< Address. Will be patched in run-time. */
     49                0,              /**< Value. Not used. */
     50                1               /**< Arg 1 will contain the result. */
     51        }
     52};
    4153
    42 #include <ddi.h>
    43 #include <libarch/ddi.h>
     54       
     55irq_code_t z8530_kbd = {
     56        1,
     57        z8530_cmds
     58};
    4459
    45 #define i8042_DATA      0x60
    46 #define i8042_STATUS    0X64
     60static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call);
    4761
    48 
    49 typedef unsigned char u8;
    50 typedef short u16;
    51 
    52 static inline void i8042_data_write(u8 data)
     62int kbd_port_init(void)
    5363{
    54         outb(i8042_DATA, data);
     64        async_set_interrupt_received(z8350_irq_handler);
     65        z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address.virtual") + 6;
     66        ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"),
     67            0, &z8530_kbd);
     68        return 0;
    5569}
    5670
    57 static inline u8 i8042_data_read(void)
     71static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    5872{
    59         return inb(i8042_DATA);
     73        int scan_code = IPC_GET_ARG1(*call);
     74        kbd_push_scancode(scan_code);
    6075}
    6176
    62 static inline u8 i8042_status_read(void)
    63 {
    64         return inb(i8042_STATUS);
    65 }
    66 
    67 static inline void i8042_command_write(u8 command)
    68 {
    69         outb(i8042_STATUS, command);
    70 }
    71 
    72 #endif
    73 
    74 /**
    75  * @}
    76  */
     77/** @}
     78 */
Note: See TracChangeset for help on using the changeset viewer.