Ignore:
File:
1 edited

Legend:

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

    rd9fae235 r36e9cd1  
    3030 * @ingroup  kbd
    3131 * @{
    32  */
     32 */ 
    3333/** @file
    34  * @brief SGCN (Serengeti Console) keyboard port driver.
     34 * @brief       SGCN (Serengeti Console) keyboard port driver.
    3535 */
    3636
     
    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/**
    5150 * SGCN buffer header. It is placed at the very beginning of the SGCN
    52  * buffer.
     51 * buffer. 
    5352 */
    5453typedef struct {
     
    103102int kbd_port_init(void)
    104103{
    105         sysarg_t sram_paddr;
    106         if (sysinfo_get_value("sram.address.physical", &sram_paddr) != EOK)
    107                 return -1;
    108        
    109         sysarg_t sram_size;
    110         if (sysinfo_get_value("sram.area.size", &sram_size) != EOK)
    111                 return -1;
    112        
    113         if (sysinfo_get_value("sram.buffer.offset", &sram_buffer_offset) != EOK)
    114                 sram_buffer_offset = 0;
    115        
    116         sram_virt_addr = (uintptr_t) as_get_mappable_page(sram_size);
    117        
    118         if (physmem_map((void *) sram_paddr, (void *) sram_virt_addr,
    119             sram_size / PAGE_SIZE, AS_AREA_READ | AS_AREA_WRITE) != 0) {
     104        sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size"));
     105        if (physmem_map((void *) sysinfo_value("sram.address.physical"),
     106            (void *) sram_virt_addr, sysinfo_value("sram.area.size") / PAGE_SIZE,
     107            AS_AREA_READ | AS_AREA_WRITE) != 0) {
    120108                printf("SGCN: uspace driver could not map physical memory.");
    121109                return -1;
    122110        }
    123111       
     112        sram_buffer_offset = sysinfo_value("sram.buffer.offset");
     113
    124114        thread_id_t tid;
    125         int rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid);
    126         if (rc != 0)
     115        int rc;
     116
     117        rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid);
     118        if (rc != 0) {
    127119                return rc;
    128        
     120        }
     121
    129122        return 0;
    130123}
Note: See TracChangeset for help on using the changeset viewer.