Deleted Added
full compact
kbd.c (47294) kbd.c (47295)
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $Id: kbd.c,v 1.4 1999/03/10 10:36:52 yokota Exp $
26 * $Id: kbd.c,v 1.5 1999/05/18 11:07:12 yokota Exp $
27 */
28
29#include "kbd.h"
30#include "opt_kbd.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/kernel.h>

--- 130 unchanged lines hidden (view full) ---

165 kbd->kb_fkeytab = fkeymap;
166 kbd->kb_fkeytab_size = fkeymap_size;
167}
168
169/* register a keyboard and associate it with a function table */
170int
171kbd_register(keyboard_t *kbd)
172{
27 */
28
29#include "kbd.h"
30#include "opt_kbd.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/kernel.h>

--- 130 unchanged lines hidden (view full) ---

165 kbd->kb_fkeytab = fkeymap;
166 kbd->kb_fkeytab_size = fkeymap_size;
167}
168
169/* register a keyboard and associate it with a function table */
170int
171kbd_register(keyboard_t *kbd)
172{
173 keyboard_driver_t **list;
174 keyboard_driver_t *p;
173 const keyboard_driver_t **list;
174 const keyboard_driver_t *p;
175 int index;
176
177 for (index = 0; index < keyboards; ++index) {
178 if (keyboard[index] == NULL)
179 break;
180 }
181 if (index >= keyboards) {
182 if (kbd_realloc_array())
183 return -1;
184 }
185
186 kbd->kb_index = index;
187 KBD_UNBUSY(kbd);
188 KBD_VALID(kbd);
189 kbd->kb_active = 0; /* disabled until someone calls kbd_enable() */
190 kbd->kb_token = NULL;
191 kbd->kb_callback.kc_func = NULL;
192 kbd->kb_callback.kc_arg = NULL;
193
175 int index;
176
177 for (index = 0; index < keyboards; ++index) {
178 if (keyboard[index] == NULL)
179 break;
180 }
181 if (index >= keyboards) {
182 if (kbd_realloc_array())
183 return -1;
184 }
185
186 kbd->kb_index = index;
187 KBD_UNBUSY(kbd);
188 KBD_VALID(kbd);
189 kbd->kb_active = 0; /* disabled until someone calls kbd_enable() */
190 kbd->kb_token = NULL;
191 kbd->kb_callback.kc_func = NULL;
192 kbd->kb_callback.kc_arg = NULL;
193
194 list = (keyboard_driver_t **)kbddriver_set.ls_items;
194 list = (const keyboard_driver_t **)kbddriver_set.ls_items;
195 while ((p = *list++) != NULL) {
196 if (strcmp(p->name, kbd->kb_name) == 0) {
197 keyboard[index] = kbd;
198 kbdsw[index] = p->kbdsw;
199 return index;
200 }
201 }
202

--- 31 unchanged lines hidden (view full) ---

234 splx(s);
235 return 0;
236}
237
238/* find a funciton table by the driver name */
239keyboard_switch_t
240*kbd_get_switch(char *driver)
241{
195 while ((p = *list++) != NULL) {
196 if (strcmp(p->name, kbd->kb_name) == 0) {
197 keyboard[index] = kbd;
198 kbdsw[index] = p->kbdsw;
199 return index;
200 }
201 }
202

--- 31 unchanged lines hidden (view full) ---

234 splx(s);
235 return 0;
236}
237
238/* find a funciton table by the driver name */
239keyboard_switch_t
240*kbd_get_switch(char *driver)
241{
242 keyboard_driver_t **list;
243 keyboard_driver_t *p;
242 const keyboard_driver_t **list;
243 const keyboard_driver_t *p;
244
244
245 list = (keyboard_driver_t **)kbddriver_set.ls_items;
245 list = (const keyboard_driver_t **)kbddriver_set.ls_items;
246 while ((p = *list++) != NULL) {
247 if (strcmp(p->name, driver) == 0)
248 return p->kbdsw;
249 }
250
251 return NULL;
252}
253

--- 113 unchanged lines hidden (view full) ---

367 * The back door for the console driver; configure keyboards
368 * This function is for the kernel console to initialize keyboards
369 * at very early stage.
370 */
371
372int
373kbd_configure(int flags)
374{
246 while ((p = *list++) != NULL) {
247 if (strcmp(p->name, driver) == 0)
248 return p->kbdsw;
249 }
250
251 return NULL;
252}
253

--- 113 unchanged lines hidden (view full) ---

367 * The back door for the console driver; configure keyboards
368 * This function is for the kernel console to initialize keyboards
369 * at very early stage.
370 */
371
372int
373kbd_configure(int flags)
374{
375 keyboard_driver_t **list;
376 keyboard_driver_t *p;
375 const keyboard_driver_t **list;
376 const keyboard_driver_t *p;
377
377
378 list = (keyboard_driver_t **)kbddriver_set.ls_items;
378 list = (const keyboard_driver_t **)kbddriver_set.ls_items;
379 while ((p = *list++) != NULL) {
380 if (p->configure != NULL)
381 (*p->configure)(flags);
382 }
383
384 return 0;
385}
386

--- 857 unchanged lines hidden ---
379 while ((p = *list++) != NULL) {
380 if (p->configure != NULL)
381 (*p->configure)(flags);
382 }
383
384 return 0;
385}
386

--- 857 unchanged lines hidden ---