Ignore:
File:
1 edited

Legend:

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

    r3e6a98c5 r593e023  
    4848
    4949static int niagara_port_init(kbd_dev_t *);
    50 static void niagara_port_yield(void);
    51 static void niagara_port_reclaim(void);
    5250static void niagara_port_write(uint8_t data);
    5351
    5452kbd_port_ops_t niagara_port = {
    5553        .init = niagara_port_init,
    56         .yield = niagara_port_yield,
    57         .reclaim = niagara_port_reclaim,
    5854        .write = niagara_port_write
    5955};
     
    7470        uint64_t read_ptr;
    7571        char data[INPUT_BUFFER_SIZE];
    76 }
    77         __attribute__ ((packed))
    78         __attribute__ ((aligned(PAGE_SIZE)))
    79         *input_buffer_t;
     72} __attribute__((packed)) __attribute__((aligned(PAGE_SIZE))) *input_buffer_t;
    8073
    8174/* virtual address of the shared buffer */
    82 static input_buffer_t input_buffer;
     75static input_buffer_t input_buffer = (input_buffer_t) AS_AREA_ANY;
    8376
    84 static volatile bool polling_disabled = false;
    8577static void niagara_thread_impl(void *arg);
    8678
    8779/**
    8880 * Initializes the Niagara driver.
    89  * Maps the shared buffer and creates the polling thread. 
     81 * Maps the shared buffer and creates the polling thread.
    9082 */
    9183static int niagara_port_init(kbd_dev_t *kdev)
     
    9789                return -1;
    9890       
    99         int rc = physmem_map((void *) paddr, 1,
    100             AS_AREA_READ | AS_AREA_WRITE, (void *) &input_buffer);
     91        int rc = physmem_map(paddr, 1, AS_AREA_READ | AS_AREA_WRITE,
     92            (void *) &input_buffer);
    10193        if (rc != 0) {
    10294                printf("Niagara: uspace driver couldn't map physical memory: %d\n",
     
    113105}
    114106
    115 static void niagara_port_yield(void)
    116 {
    117         polling_disabled = true;
    118 }
    119 
    120 static void niagara_port_reclaim(void)
    121 {
    122         polling_disabled = false;
    123 }
    124 
    125107static void niagara_port_write(uint8_t data)
    126108{
     
    130112/**
    131113 * Called regularly by the polling thread. Reads codes of all the
    132  * pressed keys from the buffer. 
     114 * pressed keys from the buffer.
    133115 */
    134116static void niagara_key_pressed(void)
     
    152134
    153135        while (1) {
    154                 if (polling_disabled == false)
    155                         niagara_key_pressed();
     136                niagara_key_pressed();
    156137                usleep(POLL_INTERVAL);
    157138        }
Note: See TracChangeset for help on using the changeset viewer.