Ignore:
File:
1 edited

Legend:

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

    r593e023 r3e6a98c5  
    4848
    4949static int niagara_port_init(kbd_dev_t *);
     50static void niagara_port_yield(void);
     51static void niagara_port_reclaim(void);
    5052static void niagara_port_write(uint8_t data);
    5153
    5254kbd_port_ops_t niagara_port = {
    5355        .init = niagara_port_init,
     56        .yield = niagara_port_yield,
     57        .reclaim = niagara_port_reclaim,
    5458        .write = niagara_port_write
    5559};
     
    7074        uint64_t read_ptr;
    7175        char data[INPUT_BUFFER_SIZE];
    72 } __attribute__((packed)) __attribute__((aligned(PAGE_SIZE))) *input_buffer_t;
     76}
     77        __attribute__ ((packed))
     78        __attribute__ ((aligned(PAGE_SIZE)))
     79        *input_buffer_t;
    7380
    7481/* virtual address of the shared buffer */
    75 static input_buffer_t input_buffer = (input_buffer_t) AS_AREA_ANY;
     82static input_buffer_t input_buffer;
    7683
     84static volatile bool polling_disabled = false;
    7785static void niagara_thread_impl(void *arg);
    7886
    7987/**
    8088 * Initializes the Niagara driver.
    81  * Maps the shared buffer and creates the polling thread.
     89 * Maps the shared buffer and creates the polling thread. 
    8290 */
    8391static int niagara_port_init(kbd_dev_t *kdev)
     
    8997                return -1;
    9098       
    91         int rc = physmem_map(paddr, 1, AS_AREA_READ | AS_AREA_WRITE,
    92             (void *) &input_buffer);
     99        int rc = physmem_map((void *) paddr, 1,
     100            AS_AREA_READ | AS_AREA_WRITE, (void *) &input_buffer);
    93101        if (rc != 0) {
    94102                printf("Niagara: uspace driver couldn't map physical memory: %d\n",
     
    105113}
    106114
     115static void niagara_port_yield(void)
     116{
     117        polling_disabled = true;
     118}
     119
     120static void niagara_port_reclaim(void)
     121{
     122        polling_disabled = false;
     123}
     124
    107125static void niagara_port_write(uint8_t data)
    108126{
     
    112130/**
    113131 * Called regularly by the polling thread. Reads codes of all the
    114  * pressed keys from the buffer.
     132 * pressed keys from the buffer. 
    115133 */
    116134static void niagara_key_pressed(void)
     
    134152
    135153        while (1) {
    136                 niagara_key_pressed();
     154                if (polling_disabled == false)
     155                        niagara_key_pressed();
    137156                usleep(POLL_INTERVAL);
    138157        }
Note: See TracChangeset for help on using the changeset viewer.