Lines Matching refs:config

187 static int input_queue_ascii(struct input_config *config, int ch)  in input_queue_ascii()  argument
189 if (config->fifo_in + 1 == INPUT_BUFFER_LEN) { in input_queue_ascii()
190 if (!config->fifo_out) in input_queue_ascii()
193 config->fifo_in = 0; in input_queue_ascii()
195 if (config->fifo_in + 1 == config->fifo_out) in input_queue_ascii()
197 config->fifo_in++; in input_queue_ascii()
200 config->fifo[config->fifo_in] = (uchar)ch; in input_queue_ascii()
205 int input_tstc(struct input_config *config) in input_tstc() argument
207 if (config->fifo_in == config->fifo_out && config->read_keys) { in input_tstc()
208 if (!(*config->read_keys)(config)) in input_tstc()
211 return config->fifo_in != config->fifo_out; in input_tstc()
214 int input_getc(struct input_config *config) in input_getc() argument
218 while (config->fifo_in == config->fifo_out) { in input_getc()
219 if (config->read_keys) in input_getc()
220 err = (*config->read_keys)(config); in input_getc()
225 if (++config->fifo_out == INPUT_BUFFER_LEN) in input_getc()
226 config->fifo_out = 0; in input_getc()
228 return config->fifo[config->fifo_out]; in input_getc()
242 static struct input_key_xlate *process_modifier(struct input_config *config, in process_modifier() argument
246 struct udevice *dev = config->dev; in process_modifier()
253 assert(config->num_tables > 0); in process_modifier()
254 table = &config->table[0]; in process_modifier()
255 for (i = 1; i < config->num_tables; i++) { in process_modifier()
256 struct input_key_xlate *tab = &config->table[i]; in process_modifier()
281 config->flags ^= flip; in process_modifier()
282 if (config->flags & FLAG_NUM_LOCK) in process_modifier()
284 if (config->flags & FLAG_CAPS_LOCK) in process_modifier()
286 if (config->flags & FLAG_SCROLL_LOCK) in process_modifier()
288 config->leds = leds; in process_modifier()
289 config->leds_changed = flip; in process_modifier()
293 if (ops->update_leds(dev, config->leds)) in process_modifier()
376 static int input_check_keycodes(struct input_config *config, in input_check_keycodes() argument
380 if (!config->num_tables) { in input_check_keycodes()
387 config->prev_keycodes, config->num_prev_keycodes); in input_check_keycodes()
389 memcpy(config->prev_keycodes, keycode, num_keycodes * sizeof(int)); in input_check_keycodes()
390 config->num_prev_keycodes = num_keycodes; in input_check_keycodes()
408 static int input_keycode_to_ansi364(struct input_config *config, in input_keycode_to_ansi364() argument
451 static int input_keycodes_to_ascii(struct input_config *config, in input_keycodes_to_ascii() argument
459 table = &config->table[0]; in input_keycodes_to_ascii()
466 table = process_modifier(config, key, in input_keycodes_to_ascii()
482 if ((config->flags & FLAG_CAPS_LOCK) && in input_keycodes_to_ascii()
486 if (!(config->flags & FLAG_NUM_LOCK)) { in input_keycodes_to_ascii()
494 ch_count += input_keycode_to_ansi364(config, key, in input_keycodes_to_ascii()
509 static int _input_send_keycodes(struct input_config *config, int keycode[], in _input_send_keycodes() argument
517 config->modifiers = 0; in _input_send_keycodes()
518 if (!input_check_keycodes(config, keycode, num_keycodes, &same)) { in _input_send_keycodes()
527 is_repeat = config->allow_repeats || (config->repeat_rate_ms && in _input_send_keycodes()
528 (int)get_timer(config->next_repeat_ms) >= 0); in _input_send_keycodes()
533 count = input_keycodes_to_ascii(config, keycode, num_keycodes, in _input_send_keycodes()
537 input_queue_ascii(config, ch[i]); in _input_send_keycodes()
540 config->repeat_rate_ms : in _input_send_keycodes()
541 config->repeat_delay_ms; in _input_send_keycodes()
543 config->next_repeat_ms = get_timer(0) + delay_ms; in _input_send_keycodes()
548 int input_send_keycodes(struct input_config *config, int keycode[], in input_send_keycodes() argument
551 return _input_send_keycodes(config, keycode, num_keycodes, true); in input_send_keycodes()
554 int input_add_keycode(struct input_config *config, int new_keycode, in input_add_keycode() argument
561 for (i = 0, count = 0; i < config->num_prev_keycodes; i++) { in input_add_keycode()
562 int code = config->prev_keycodes[i]; in input_add_keycode()
580 return _input_send_keycodes(config, keycode, count, !release); in input_add_keycode()
583 int input_add_table(struct input_config *config, int left_keycode, in input_add_table() argument
588 if (config->num_tables == INPUT_MAX_MODIFIERS) { in input_add_table()
593 table = &config->table[config->num_tables++]; in input_add_table()
602 void input_set_delays(struct input_config *config, int repeat_delay_ms, in input_set_delays() argument
605 config->repeat_delay_ms = repeat_delay_ms; in input_set_delays()
606 config->repeat_rate_ms = repeat_rate_ms; in input_set_delays()
609 void input_allow_repeats(struct input_config *config, bool allow_repeats) in input_allow_repeats() argument
611 config->allow_repeats = allow_repeats; in input_allow_repeats()
614 int input_leds_changed(struct input_config *config) in input_leds_changed() argument
616 if (config->leds_changed) in input_leds_changed()
617 return config->leds; in input_leds_changed()
622 int input_add_tables(struct input_config *config, bool german) in input_add_tables() argument
632 ret = input_add_table(config, entry->left_keycode, in input_add_tables()
642 int input_init(struct input_config *config, int leds) in input_init() argument
644 memset(config, '\0', sizeof(*config)); in input_init()
645 config->leds = leds; in input_init()