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


Ignore:
Timestamp:
2009-02-18T21:47:05Z (16 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/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}
Note: See TracChangeset for help on using the changeset viewer.