Changes in uspace/srv/hid/input/port/niagara.c [3e6a98c5:593e023] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/port/niagara.c
r3e6a98c5 r593e023 48 48 49 49 static int niagara_port_init(kbd_dev_t *); 50 static void niagara_port_yield(void);51 static void niagara_port_reclaim(void);52 50 static void niagara_port_write(uint8_t data); 53 51 54 52 kbd_port_ops_t niagara_port = { 55 53 .init = niagara_port_init, 56 .yield = niagara_port_yield,57 .reclaim = niagara_port_reclaim,58 54 .write = niagara_port_write 59 55 }; … … 74 70 uint64_t read_ptr; 75 71 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; 80 73 81 74 /* virtual address of the shared buffer */ 82 static input_buffer_t input_buffer ;75 static input_buffer_t input_buffer = (input_buffer_t) AS_AREA_ANY; 83 76 84 static volatile bool polling_disabled = false;85 77 static void niagara_thread_impl(void *arg); 86 78 87 79 /** 88 80 * Initializes the Niagara driver. 89 * Maps the shared buffer and creates the polling thread. 81 * Maps the shared buffer and creates the polling thread. 90 82 */ 91 83 static int niagara_port_init(kbd_dev_t *kdev) … … 97 89 return -1; 98 90 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); 101 93 if (rc != 0) { 102 94 printf("Niagara: uspace driver couldn't map physical memory: %d\n", … … 113 105 } 114 106 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 125 107 static void niagara_port_write(uint8_t data) 126 108 { … … 130 112 /** 131 113 * Called regularly by the polling thread. Reads codes of all the 132 * pressed keys from the buffer. 114 * pressed keys from the buffer. 133 115 */ 134 116 static void niagara_key_pressed(void) … … 152 134 153 135 while (1) { 154 if (polling_disabled == false) 155 niagara_key_pressed(); 136 niagara_key_pressed(); 156 137 usleep(POLL_INTERVAL); 157 138 }
Note:
See TracChangeset
for help on using the changeset viewer.