Changeset d9fae235 in mainline for uspace/srv/hid/kbd/port/sgcn.c


Ignore:
Timestamp:
2010-04-17T01:28:38Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d6bfa5
Parents:
9256ad29
Message:

sysinfo overhaul

  • cleanup (nicer data structures, use of SLAB allocator)
  • add support for storing arbitrary binary data
  • properly reimplement non-constant values (generated by functions)
  • add support for non-constant subtrees (generated by functions)
  • syscall ABI change, libc API change
  • reflect changes in user code

libc: task_spawn() can now return error code

  • reflect change in user code, print error strings after failed task_spawn()

uspace cleanup

  • more use of string and other constants
  • more use of str_error()
  • unify error reporting in init
File:
1 edited

Legend:

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

    r9256ad29 rd9fae235  
    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>
    4647
    47 #define POLL_INTERVAL           10000
     48#define POLL_INTERVAL  10000
    4849
    4950/**
    5051 * SGCN buffer header. It is placed at the very beginning of the SGCN
    51  * buffer. 
     52 * buffer.
    5253 */
    5354typedef struct {
     
    102103int kbd_port_init(void)
    103104{
    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) {
     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) {
    108120                printf("SGCN: uspace driver could not map physical memory.");
    109121                return -1;
    110122        }
    111123       
    112         sram_buffer_offset = sysinfo_value("sram.buffer.offset");
    113 
    114124        thread_id_t tid;
    115         int rc;
    116 
    117         rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid);
    118         if (rc != 0) {
     125        int rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid);
     126        if (rc != 0)
    119127                return rc;
    120         }
    121 
     128       
    122129        return 0;
    123130}
Note: See TracChangeset for help on using the changeset viewer.