Changeset d9fae235 in mainline for uspace/srv/hid/kbd/port/niagara.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/niagara.c

    r9256ad29 rd9fae235  
    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/**
     
    5758 * kernel/arch/sparc64/src/drivers/niagara.c.
    5859 */
    59 #define INPUT_BUFFER_SIZE       ((PAGE_SIZE) - 2 * 8)
     60#define INPUT_BUFFER_SIZE  ((PAGE_SIZE) - 2 * 8)
     61
    6062typedef volatile struct {
    6163        uint64_t write_ptr;
     
    7981int kbd_port_init(void)
    8082{
     83        sysarg_t paddr;
     84        if (sysinfo_get_value("niagara.inbuf.address", &paddr) != EOK)
     85                return -1;
     86       
    8187        input_buffer_addr = (uintptr_t) as_get_mappable_page(PAGE_SIZE);
    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        int rc = physmem_map((void *) paddr, (void *) input_buffer_addr,
     89            1, AS_AREA_READ | AS_AREA_WRITE);
     90       
     91        if (rc != 0) {
    8892                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);
    98         if (rc != 0) {
     93                    rc);
    9994                return rc;
    10095        }
     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       
    101104        return 0;
    102105}
Note: See TracChangeset for help on using the changeset viewer.