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