Changeset 24ff4df in mainline for uspace/srv/kbd/port/z8530.c


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.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • 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.