Changeset 63b1537 in mainline for uspace/srv/kbd/port/sgcn.c


Ignore:
Timestamp:
2009-03-11T17:26:48Z (15 years ago)
Author:
Pavel Rimsky <rimskyp@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
de88998
Parents:
04d672c3
Message:

SGCN driver modified to reflect the new keyboard driver architecture. Making the Serengeti bootable image smaller by not including some servers/applications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/kbd/port/sgcn.c

    r04d672c3 r63b1537  
    3737#include <as.h>
    3838#include <ddi.h>
    39 #include <ipc/ipc.h>
    4039#include <async.h>
    4140#include <kbd.h>
     
    4342#include <sysinfo.h>
    4443#include <stdio.h>
     44#include <thread.h>
     45
     46#define POLL_INTERVAL           10000
    4547
    4648/**
     
    8890static uintptr_t sram_buffer_offset;
    8991
    90 static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     92/* polling thread */
     93static void *sgcn_thread_impl(void *arg);
    9194
    9295
    9396/**
    9497 * Initializes the SGCN driver.
    95  * Maps the physical memory (SRAM) and registers the interrupt.
     98 * Maps the physical memory (SRAM) and creates the polling thread.
    9699 */
    97100int kbd_port_init(void)
    98101{
    99         async_set_interrupt_received(sgcn_irq_handler);
    100102        sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size"));
    101103        if (physmem_map((void *) sysinfo_value("sram.address.physical"),
     
    107109       
    108110        sram_buffer_offset = sysinfo_value("sram.buffer.offset");
    109         ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"),
    110                 0, (void *) 0);
     111
     112        thread_id_t tid;
     113        int rc;
     114
     115        rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid);
     116        if (rc != 0) {
     117                return rc;
     118        }
     119
    111120        return 0;
    112121}
     
    116125 * the buffer.
    117126 */
    118 static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call)
     127static void sgcn_key_pressed(void)
    119128{
    120129        char c;
     
    138147}
    139148
     149/**
     150 * Thread to poll SGCN for keypresses.
     151 */
     152static void *sgcn_thread_impl(void *arg)
     153{
     154        (void) arg;
     155
     156        while (1) {
     157                sgcn_key_pressed();
     158                usleep(POLL_INTERVAL);
     159        }
     160}
     161
     162
    140163/** @}
    141164 */
Note: See TracChangeset for help on using the changeset viewer.