Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/kbd/port/niagara.c

    rd9fae235 r8e33e1d  
    4444#include <thread.h>
    4545#include <bool.h>
    46 #include <errno.h>
    4746
    48 #define POLL_INTERVAL  10000
     47#define POLL_INTERVAL           10000
    4948
    5049/**
     
    5857 * kernel/arch/sparc64/src/drivers/niagara.c.
    5958 */
    60 #define INPUT_BUFFER_SIZE  ((PAGE_SIZE) - 2 * 8)
    61 
     59#define INPUT_BUFFER_SIZE       ((PAGE_SIZE) - 2 * 8)
    6260typedef volatile struct {
    6361        uint64_t write_ptr;
     
    7371
    7472static volatile bool polling_disabled = false;
    75 static void niagara_thread_impl(void *arg);
     73static void *niagara_thread_impl(void *arg);
    7674
    7775/**
     
    8179int kbd_port_init(void)
    8280{
    83         sysarg_t paddr;
    84         if (sysinfo_get_value("niagara.inbuf.address", &paddr) != EOK)
    85                 return -1;
    86        
    8781        input_buffer_addr = (uintptr_t) as_get_mappable_page(PAGE_SIZE);
    88         int rc = physmem_map((void *) paddr, (void *) input_buffer_addr,
    89             1, AS_AREA_READ | AS_AREA_WRITE);
    90        
     82        int result = physmem_map(
     83                (void *) sysinfo_value("niagara.inbuf.address"),
     84                (void *) input_buffer_addr,
     85                1, AS_AREA_READ | AS_AREA_WRITE);
     86
     87        if (result != 0) {
     88                printf("Niagara: uspace driver couldn't map physical memory: %d\n",
     89                        result);
     90        }
     91
     92        input_buffer = (input_buffer_t) input_buffer_addr;
     93
     94        thread_id_t tid;
     95        int rc;
     96
     97        rc = thread_create(niagara_thread_impl, NULL, "kbd_poll", &tid);
    9198        if (rc != 0) {
    92                 printf("Niagara: uspace driver couldn't map physical memory: %d\n",
    93                     rc);
    9499                return rc;
    95100        }
    96        
    97         input_buffer = (input_buffer_t) input_buffer_addr;
    98        
    99         thread_id_t tid;
    100         rc = thread_create(niagara_thread_impl, NULL, "kbd_poll", &tid);
    101         if (rc != 0)
    102                 return rc;
    103        
    104101        return 0;
    105102}
     
    139136 * Thread to poll SGCN for keypresses.
    140137 */
    141 static void niagara_thread_impl(void *arg)
     138static void *niagara_thread_impl(void *arg)
    142139{
    143140        (void) arg;
     
    148145                usleep(POLL_INTERVAL);
    149146        }
     147        return 0;
    150148}
    151149/** @}
Note: See TracChangeset for help on using the changeset viewer.