Changeset 9be360ee in mainline
- Timestamp:
- 2011-06-11T22:06:47Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4f3f9659
- Parents:
- 56ad818
- Location:
- uspace/srv/hid/kbd
- Files:
-
- 1 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/kbd/Makefile
r56ad818 r9be360ee 52 52 port/adb.c \ 53 53 port/chardev.c \ 54 port/dummy.c \55 54 port/gxemul.c \ 56 55 port/msim.c \ -
uspace/srv/hid/kbd/ctl/apple.c
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 201 0Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 42 42 #include <kbd_port.h> 43 43 44 static void apple_ctl_parse_scancode(int scancode);45 static int apple_ctl_init(kbd_ port_ops_t *kbd_port);46 static void apple_ctl_set_ind(unsigned mods);44 static void apple_ctl_parse_scancode(int); 45 static int apple_ctl_init(kbd_dev_t *); 46 static void apple_ctl_set_ind(unsigned); 47 47 48 48 kbd_ctl_ops_t apple_ctl = { … … 54 54 #define KBD_KEY_RELEASE 0x80 55 55 56 static kbd_dev_t *kbd_dev; 57 56 58 static int scanmap[]; 57 59 58 static int apple_ctl_init(kbd_ port_ops_t *kbd_port)60 static int apple_ctl_init(kbd_dev_t *kdev) 59 61 { 60 (void) kbd_port;62 kbd_dev = kdev; 61 63 return 0; 62 64 } … … 79 81 key = scanmap[scancode]; 80 82 if (key != 0) 81 kbd_push_ev( type, key);83 kbd_push_ev(kbd_dev, type, key); 82 84 } 83 85 -
uspace/srv/hid/kbd/ctl/gxe_fb.c
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 20 09Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 44 44 #include <stroke.h> 45 45 46 static void gxe_fb_ctl_parse_scancode(int scancode);47 static int gxe_fb_ctl_init(kbd_ port_ops_t *kbd_port);48 static void gxe_fb_ctl_set_ind(unsigned mods);46 static void gxe_fb_ctl_parse_scancode(int); 47 static int gxe_fb_ctl_init(kbd_dev_t *); 48 static void gxe_fb_ctl_set_ind(unsigned); 49 49 50 50 kbd_ctl_ops_t gxe_fb_ctl = { … … 53 53 .set_ind = gxe_fb_ctl_set_ind 54 54 }; 55 56 static kbd_dev_t *kbd_dev; 55 57 56 58 /** Scancode parser */ … … 218 220 }; 219 221 220 static int gxe_fb_ctl_init(kbd_ port_ops_t *kbd_port)222 static int gxe_fb_ctl_init(kbd_dev_t *kdev) 221 223 { 222 (void) kbd_port;224 kbd_dev = kdev; 223 225 ds = 0; 224 226 … … 233 235 ds = gsp_step(&sp, ds, scancode, &mods, &key); 234 236 if (key != 0) { 235 stroke_sim( mods, key);237 stroke_sim(kbd_dev, mods, key); 236 238 } 237 239 } -
uspace/srv/hid/kbd/ctl/pc.c
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 20 09Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 #include <gsp.h> 44 44 45 static void pc_ctl_parse_scancode(int scancode);46 static int pc_ctl_init(kbd_ port_ops_t *kbd_port);47 static void pc_ctl_set_ind(unsigned mods);45 static void pc_ctl_parse_scancode(int); 46 static int pc_ctl_init(kbd_dev_t *); 47 static void pc_ctl_set_ind(unsigned); 48 48 49 49 kbd_ctl_ops_t pc_ctl = { … … 74 74 75 75 static enum dec_state ds; 76 static kbd_ port_ops_t *kbd_port;76 static kbd_dev_t *kbd_dev; 77 77 78 78 static int scanmap_simple[] = { … … 208 208 }; 209 209 210 static int pc_ctl_init(kbd_ port_ops_t *kbd_p)210 static int pc_ctl_init(kbd_dev_t *kdev) 211 211 { 212 kbd_ port = kbd_p;212 kbd_dev = kdev; 213 213 ds = ds_s; 214 214 return 0; … … 262 262 key = map[scancode]; 263 263 if (key != 0) 264 kbd_push_ev( type, key);264 kbd_push_ev(kbd_dev, type, key); 265 265 } 266 266 … … 277 277 b = b | LI_SCROLL; 278 278 279 (*kbd_ port->write)(KBD_CMD_SET_LEDS);280 (*kbd_ port->write)(b);279 (*kbd_dev->port_ops->write)(KBD_CMD_SET_LEDS); 280 (*kbd_dev->port_ops->write)(b); 281 281 } 282 282 -
uspace/srv/hid/kbd/ctl/stty.c
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 20 09Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 #include <stroke.h> 44 44 45 static void stty_ctl_parse_scancode(int scancode);46 static int stty_ctl_init(kbd_ port_ops_t *kbd_port);47 static void stty_ctl_set_ind(unsigned mods);45 static void stty_ctl_parse_scancode(int); 46 static int stty_ctl_init(kbd_dev_t *); 47 static void stty_ctl_set_ind(unsigned); 48 48 49 49 kbd_ctl_ops_t stty_ctl = { … … 52 52 .set_ind = stty_ctl_set_ind 53 53 }; 54 55 static kbd_dev_t *kbd_dev; 54 56 55 57 /** Scancode parser */ … … 217 219 }; 218 220 219 static int stty_ctl_init(kbd_ port_ops_t *kbd_port)221 static int stty_ctl_init(kbd_dev_t *kdev) 220 222 { 221 (void) kbd_port;223 kbd_dev = kdev; 222 224 ds = 0; 223 225 … … 232 234 ds = gsp_step(&sp, ds, scancode, &mods, &key); 233 235 if (key != 0) { 234 stroke_sim( mods, key);236 stroke_sim(kbd_dev, mods, key); 235 237 } 236 238 } -
uspace/srv/hid/kbd/ctl/sun.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2006 Jakub Jermar 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 42 43 #include <kbd_port.h> 43 44 44 static void sun_ctl_parse_scancode(int scancode);45 static int sun_ctl_init(kbd_ port_ops_t *kbd_port);46 static void sun_ctl_set_ind(unsigned mods);45 static void sun_ctl_parse_scancode(int); 46 static int sun_ctl_init(kbd_dev_t *); 47 static void sun_ctl_set_ind(unsigned); 47 48 48 49 kbd_ctl_ops_t sun_ctl = { … … 52 53 }; 53 54 55 static kbd_dev_t *kbd_dev; 56 54 57 #define KBD_KEY_RELEASE 0x80 55 58 #define KBD_ALL_KEYS_UP 0x7f … … 57 60 static int scanmap_simple[]; 58 61 59 static int sun_ctl_init(kbd_ port_ops_t *kbd_port)62 static int sun_ctl_init(kbd_dev_t *kdev) 60 63 { 64 kbd_dev = kdev; 61 65 return 0; 62 66 } … … 82 86 key = scanmap_simple[scancode]; 83 87 if (key != 0) 84 kbd_push_ev( type, key);88 kbd_push_ev(kbd_dev, type, key); 85 89 } 86 90 -
uspace/srv/hid/kbd/genarch/stroke.c
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 20 09Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 52 52 53 53 /** Simulate keystroke using sequences of key presses and releases. */ 54 void stroke_sim( unsigned mod, unsigned key)54 void stroke_sim(kbd_dev_t *kdev, unsigned mod, unsigned key) 55 55 { 56 56 int i; … … 60 60 while (mods_keys[i][0] != 0) { 61 61 if (mod & mods_keys[i][0]) { 62 kbd_push_ev( KEY_PRESS, mods_keys[i][1]);62 kbd_push_ev(kdev, KEY_PRESS, mods_keys[i][1]); 63 63 } 64 64 ++i; … … 67 67 /* Simulate key press and release. */ 68 68 if (key != 0) { 69 kbd_push_ev( KEY_PRESS, key);70 kbd_push_ev( KEY_RELEASE, key);69 kbd_push_ev(kdev, KEY_PRESS, key); 70 kbd_push_ev(kdev, KEY_RELEASE, key); 71 71 } 72 72 … … 75 75 while (mods_keys[i][0] != 0) { 76 76 if (mod & mods_keys[i][0]) { 77 kbd_push_ev( KEY_RELEASE, mods_keys[i][1]);77 kbd_push_ev(kdev, KEY_RELEASE, mods_keys[i][1]); 78 78 } 79 79 ++i; -
uspace/srv/hid/kbd/generic/kbd.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2006 Josef Cejka 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 36 37 */ 37 38 39 #include <adt/list.h> 38 40 #include <ipc/services.h> 39 41 #include <ipc/kbd.h> … … 63 65 #define NAMESPACE "hid_in" 64 66 67 static void kbd_devs_yield(void); 68 static void kbd_devs_reclaim(void); 69 65 70 int client_phone = -1; 66 71 … … 71 76 static unsigned lock_keys; 72 77 73 static kbd_port_ops_t *kbd_port; 74 static kbd_ctl_ops_t *kbd_ctl;78 /** List of keyboard devices */ 79 static link_t kbd_devs; 75 80 76 81 bool irc_service = false; … … 87 92 static int active_layout = 0; 88 93 89 void kbd_push_scancode( int scancode)94 void kbd_push_scancode(kbd_dev_t *kdev, int scancode) 90 95 { 91 96 /* printf("scancode: 0x%x\n", scancode);*/ 92 (*k bd_ctl->parse_scancode)(scancode);93 } 94 95 void kbd_push_ev( int type, unsigned int key)97 (*kdev->ctl_ops->parse_scancode)(scancode); 98 } 99 100 void kbd_push_ev(kbd_dev_t *kdev, int type, unsigned int key) 96 101 { 97 102 kbd_event_t ev; … … 133 138 134 139 /* Update keyboard lock indicator lights. */ 135 (*k bd_ctl->set_ind)(mods);140 (*kdev->ctl_ops->set_ind)(mods); 136 141 } else { 137 142 lock_keys = lock_keys & ~mod_mask; … … 204 209 break; 205 210 case KBD_YIELD: 206 (*kbd_port->yield)();211 kbd_devs_yield(); 207 212 retval = 0; 208 213 break; 209 214 case KBD_RECLAIM: 210 (*kbd_port->reclaim)();215 kbd_devs_reclaim(); 211 216 retval = 0; 212 217 break; … … 218 223 } 219 224 220 static void kbd_select_drivers(kbd_port_ops_t **port, kbd_ctl_ops_t **ctl) 221 { 225 /** Add new keyboard device. */ 226 static void kbd_add_dev(kbd_port_ops_t *port, kbd_ctl_ops_t *ctl) 227 { 228 kbd_dev_t *kdev; 229 230 kdev = malloc(sizeof(kbd_dev_t)); 231 if (kdev == NULL) { 232 printf(NAME ": Failed adding keyboard device. Out of memory.\n"); 233 return; 234 } 235 236 link_initialize(&kdev->kbd_devs); 237 kdev->port_ops = port; 238 kdev->ctl_ops = ctl; 239 240 /* Initialize port driver. */ 241 if ((*kdev->port_ops->init)(kdev) != 0) 242 goto fail; 243 244 /* Initialize controller driver. */ 245 if ((*kdev->ctl_ops->init)(kdev) != 0) { 246 /* XXX Uninit port */ 247 goto fail; 248 } 249 250 list_append(&kdev->kbd_devs, &kbd_devs); 251 return; 252 fail: 253 free(kdev); 254 } 255 256 /** Add legacy drivers/devices. */ 257 static void kbd_add_legacy_devs(void) 258 { 259 /* 260 * Need to add these drivers based on config unless we can probe 261 * them automatically. 262 */ 222 263 #if defined(UARCH_amd64) 223 *port = &chardev_port; 224 *ctl = &pc_ctl; 225 #elif defined(UARCH_arm32) && defined(MACHINE_gta02) 226 *port = &chardev_port; 227 *ctl = &stty_ctl; 228 #elif defined(UARCH_arm32) && defined(MACHINE_testarm) 229 *port = &gxemul_port; 230 #ifdef CONFIG_FB 231 *ctl = &gxe_fb_ctl; 232 #else 233 *ctl = &stty_ctl; 234 #endif 235 #elif defined(UARCH_arm32) && defined(MACHINE_integratorcp) 236 *port = &pl050_port; 237 *ctl = &pc_ctl; 238 #elif defined(UARCH_ia32) 239 *port = &chardev_port; 240 *ctl = &pc_ctl; 241 #elif defined(MACHINE_i460GX) 242 *port = &chardev_port; 243 *ctl = &pc_ctl; 244 #elif defined(MACHINE_ski) 245 *port = &ski_port; 246 *ctl = &stty_ctl; 247 #elif defined(MACHINE_msim) 248 *port = &msim_port; 249 *ctl = &stty_ctl; 250 #elif defined(MACHINE_lgxemul) || defined(MACHINE_bgxemul) 251 *port = &gxemul_port; 252 #ifdef CONFIG_FB 253 *ctl = &gxe_fb_ctl; 254 #else 255 *ctl = &stty_ctl; 256 #endif 257 #elif defined(UARCH_ppc32) 258 *port = &adb_port; 259 *ctl = &apple_ctl; 260 #elif defined(UARCH_sparc64) && defined(PROCESSOR_sun4v) 261 *port = &niagara_port; 262 *ctl = &stty_ctl; 263 #elif defined(UARCH_sparc64) && defined(MACHINE_serengeti) 264 *port = &sgcn_port; 265 *ctl = &stty_ctl; 266 #elif defined(UARCH_sparc64) && defined(MACHINE_generic) 267 *port = &sun_port; 268 *ctl = &sun_ctl; 269 #else 270 *port = &dummy_port; 271 *ctl = &pc_ctl; 272 #endif 264 kbd_add_dev(&chardev_port, &pc_ctl); 265 #endif 266 #if defined(UARCH_arm32) && defined(MACHINE_gta02) 267 kbd_add_dev(&chardev_port, &stty_ctl); 268 #endif 269 #if defined(UARCH_arm32) && defined(MACHINE_testarm) && defined(CONFIG_FB) 270 kbd_add_dev(&gxemul_port, &gxe_fb_ctl); 271 #endif 272 #if defined(UARCH_arm32) && defined(MACHINE_testarm) && !defined(CONFIG_FB) 273 kbd_add_dev(&gxemul_port, &stty_ctl); 274 #endif 275 #if defined(UARCH_arm32) && defined(MACHINE_integratorcp) 276 kbd_add_dev(&pl050_port, &pc_ctl); 277 #endif 278 #if defined(UARCH_ia32) 279 kbd_add_dev(&chardev_port, &pc_ctl); 280 #endif 281 #if defined(MACHINE_i460GX) 282 kbd_add_dev(&chardev_port, &pc_ctl); 283 #endif 284 #if defined(MACHINE_ski) 285 kbd_add_dev(&ski_port, &stty_ctl); 286 #endif 287 #if defined(MACHINE_msim) 288 kbd_add_dev(&msim_port, &pc_ctl); 289 #endif 290 #if (defined(MACHINE_lgxemul) || defined(MACHINE_bgxemul)) && defined(CONFIG_FB) 291 kbd_add_dev(&gxemul_port, &gxe_fb_ctl); 292 #endif 293 #if defined(MACHINE_lgxemul) || defined(MACHINE_bgxemul) && !defined(CONFIG_FB) 294 kbd_add_dev(&gxemul_port, &stty_ctl); 295 #endif 296 #if defined(UARCH_ppc32) 297 kbd_add_dev(&adb_port, &apple_ctl); 298 #endif 299 #if defined(UARCH_sparc64) && defined(PROCESSOR_sun4v) 300 kbd_add_dev(&niagara_port, &stty_ctl); 301 #endif 302 #if defined(UARCH_sparc64) && defined(MACHINE_serengeti) 303 kbd_add_dev(&sgcn_port, &stty_ctl); 304 #endif 305 #if defined(UARCH_sparc64) && defined(MACHINE_generic) 306 kbd_add_dev(&sun_port, &sun_ctl); 307 #endif 308 /* Silence warning on abs32le about kbd_add_dev() being unused */ 309 (void) kbd_add_dev; 310 } 311 312 static void kbd_devs_yield(void) 313 { 314 /* For each keyboard device */ 315 list_foreach(kbd_devs, kdev_link) { 316 kbd_dev_t *kdev = list_get_instance(kdev_link, kbd_dev_t, 317 kbd_devs); 318 319 /* Yield port */ 320 (*kdev->port_ops->yield)(); 321 } 322 } 323 324 static void kbd_devs_reclaim(void) 325 { 326 /* For each keyboard device */ 327 list_foreach(kbd_devs, kdev_link) { 328 kbd_dev_t *kdev = list_get_instance(kdev_link, kbd_dev_t, 329 kbd_devs); 330 331 /* Reclaim port */ 332 (*kdev->port_ops->reclaim)(); 333 } 273 334 } 274 335 … … 279 340 sysarg_t fhc; 280 341 sysarg_t obio; 342 343 list_initialize(&kbd_devs); 281 344 282 345 if (((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc)) … … 289 352 } 290 353 291 /* Select port and controller drivers. */ 292 kbd_select_drivers(&kbd_port, &kbd_ctl); 293 294 /* Initialize port driver. */ 295 if ((*kbd_port->init)() != 0) 296 return -1; 297 298 /* Initialize controller driver. */ 299 if ((*kbd_ctl->init)(kbd_port) != 0) 300 return -1; 354 /* Add legacy devices. */ 355 kbd_add_legacy_devs(); 301 356 302 357 /* Initialize (reset) layout. */ -
uspace/srv/hid/kbd/include/kbd.h
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2006 Josef Cejka 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 38 39 #define KBD_KBD_H_ 39 40 41 #include <adt/list.h> 40 42 #include <bool.h> 43 44 struct kbd_port_ops; 45 struct kbd_ctl_ops; 46 47 typedef struct kbd_dev { 48 /** Link to kbd_devs list */ 49 link_t kbd_devs; 50 51 /** Port ops */ 52 struct kbd_port_ops *port_ops; 53 54 /** Ctl ops */ 55 struct kbd_ctl_ops *ctl_ops; 56 } kbd_dev_t; 41 57 42 58 extern bool irc_service; 43 59 extern int irc_phone; 44 60 45 extern void kbd_push_scancode( int);46 extern void kbd_push_ev( int, unsigned int);61 extern void kbd_push_scancode(kbd_dev_t *, int); 62 extern void kbd_push_ev(kbd_dev_t *, int, unsigned int); 47 63 48 64 #endif -
uspace/srv/hid/kbd/include/kbd_ctl.h
r56ad818 r9be360ee 40 40 #include <kbd_port.h> 41 41 42 typedef struct { 42 struct kbd_dev; 43 44 typedef struct kbd_ctl_ops { 43 45 void (*parse_scancode)(int); 44 int (*init)( kbd_port_ops_t*);46 int (*init)(struct kbd_dev *); 45 47 void (*set_ind)(unsigned); 46 48 } kbd_ctl_ops_t; -
uspace/srv/hid/kbd/include/kbd_port.h
r56ad818 r9be360ee 40 40 #include <sys/types.h> 41 41 42 typedef struct { 43 int (*init)(void); 42 struct kbd_dev; 43 44 typedef struct kbd_port_ops { 45 int (*init)(struct kbd_dev *); 44 46 void (*yield)(void); 45 47 void (*reclaim)(void); -
uspace/srv/hid/kbd/include/stroke.h
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 20 09Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #define KBD_STROKE_H_ 39 39 40 extern void stroke_sim(unsigned, unsigned); 40 #include <kbd.h> 41 42 extern void stroke_sim(kbd_dev_t *, unsigned, unsigned); 41 43 42 44 #endif -
uspace/srv/hid/kbd/include/sun.h
r56ad818 r9be360ee 38 38 #define KBD_SUN_H_ 39 39 40 extern int ns16550_port_init(void); 41 extern int z8530_port_init(void); 40 #include <kbd.h> 41 42 extern int ns16550_port_init(kbd_dev_t *); 43 extern int z8530_port_init(kbd_dev_t *); 42 44 43 45 #endif -
uspace/srv/hid/kbd/port/adb.c
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 201 0Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 49 49 static void adb_kbd_reg0_data(uint16_t data); 50 50 51 static int adb_port_init( void);51 static int adb_port_init(kbd_dev_t *); 52 52 static void adb_port_yield(void); 53 53 static void adb_port_reclaim(void); … … 61 61 }; 62 62 63 static kbd_dev_t *kbd_dev; 63 64 static int dev_phone; 64 65 65 66 #define NAME "kbd" 66 67 67 static int adb_port_init( void)68 static int adb_port_init(kbd_dev_t *kdev) 68 69 { 69 70 const char *dev = "adb/kbd"; 70 71 devmap_handle_t handle; 72 73 kbd_dev = kdev; 71 74 72 75 int rc = devmap_device_get_handle(dev, &handle, 0); … … 137 140 138 141 if (b0 != 0xff) 139 kbd_push_scancode( b0);142 kbd_push_scancode(kbd_dev, b0); 140 143 if (b1 != 0xff) 141 kbd_push_scancode( b1);144 kbd_push_scancode(kbd_dev, b1); 142 145 } 143 146 -
uspace/srv/hid/kbd/port/chardev.c
r56ad818 r9be360ee 1 1 /* 2 * Copyright (c) 20 09Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 49 49 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall); 50 50 51 static int chardev_port_init( void);51 static int chardev_port_init(kbd_dev_t *); 52 52 static void chardev_port_yield(void); 53 53 static void chardev_port_reclaim(void); … … 61 61 }; 62 62 63 static kbd_dev_t *kbd_dev; 63 64 static int dev_phone; 64 65 … … 71 72 static const unsigned int num_devs = sizeof(in_devs) / sizeof(in_devs[0]); 72 73 73 static int chardev_port_init( void)74 static int chardev_port_init(kbd_dev_t *kdev) 74 75 { 75 76 devmap_handle_t handle; 76 77 unsigned int i; 77 78 int rc; 79 80 kbd_dev = kdev; 78 81 79 82 for (i = 0; i < num_devs; i++) { … … 133 136 switch (IPC_GET_IMETHOD(call)) { 134 137 case CHAR_NOTIF_BYTE: 135 kbd_push_scancode( IPC_GET_ARG1(call));138 kbd_push_scancode(kbd_dev, IPC_GET_ARG1(call)); 136 139 break; 137 140 default: -
uspace/srv/hid/kbd/port/gxemul.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2007 Michal Kebrt 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 42 43 #include <errno.h> 43 44 44 static int gxemul_port_init( void);45 static int gxemul_port_init(kbd_dev_t *); 45 46 static void gxemul_port_yield(void); 46 47 static void gxemul_port_reclaim(void); … … 53 54 .write = gxemul_port_write 54 55 }; 56 57 static kbd_dev_t *kbd_dev; 55 58 56 59 static irq_cmd_t gxemul_cmds[] = { … … 73 76 74 77 /** Initializes keyboard handler. */ 75 static int gxemul_port_init( void)78 static int gxemul_port_init(kbd_dev_t *kdev) 76 79 { 80 kbd_dev = kdev; 81 77 82 sysarg_t addr; 78 83 if (sysinfo_get_value("kbd.address.virtual", &addr) != EOK) … … 113 118 int scan_code = IPC_GET_ARG2(*call); 114 119 115 kbd_push_scancode( scan_code);120 kbd_push_scancode(kbd_dev, scan_code); 116 121 } 117 122 -
uspace/srv/hid/kbd/port/msim.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2006 Josef Cejka 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 42 43 #include <errno.h> 43 44 44 static int msim_port_init( void);45 static int msim_port_init(kbd_dev_t *); 45 46 static void msim_port_yield(void); 46 47 static void msim_port_reclaim(void); … … 53 54 .write = msim_port_write 54 55 }; 56 57 static kbd_dev_t *kbd_dev; 55 58 56 59 static irq_cmd_t msim_cmds[] = { … … 72 75 static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call); 73 76 74 static int msim_port_init( void)77 static int msim_port_init(kbd_dev_t *kdev) 75 78 { 79 kbd_dev = kdev; 80 76 81 sysarg_t vaddr; 77 82 if (sysinfo_get_value("kbd.address.virtual", &vaddr) != EOK) … … 105 110 { 106 111 int scan_code = IPC_GET_ARG2(*call); 107 kbd_push_scancode( scan_code);112 kbd_push_scancode(kbd_dev, scan_code); 108 113 } 109 114 -
uspace/srv/hid/kbd/port/niagara.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2008 Pavel Rimsky 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <errno.h> 47 48 48 static int niagara_port_init( void);49 static int niagara_port_init(kbd_dev_t *); 49 50 static void niagara_port_yield(void); 50 51 static void niagara_port_reclaim(void); … … 57 58 .write = niagara_port_write 58 59 }; 60 61 static kbd_dev_t *kbd_dev; 59 62 60 63 #define POLL_INTERVAL 10000 … … 91 94 * Maps the shared buffer and creates the polling thread. 92 95 */ 93 static int niagara_port_init( void)96 static int niagara_port_init(kbd_dev_t *kdev) 94 97 { 98 kbd_dev = kdev; 99 95 100 sysarg_t paddr; 96 101 if (sysinfo_get_value("niagara.inbuf.address", &paddr) != EOK) … … 144 149 input_buffer->read_ptr = 145 150 ((input_buffer->read_ptr) + 1) % INPUT_BUFFER_SIZE; 146 kbd_push_scancode( c);151 kbd_push_scancode(kbd_dev, c); 147 152 } 148 153 } -
uspace/srv/hid/kbd/port/ns16550.c
r56ad818 r9be360ee 93 93 static uintptr_t ns16550_kernel; 94 94 95 int ns16550_port_init(void) 95 static kbd_dev_t *kbd_dev; 96 97 int ns16550_port_init(kbd_dev_t *kdev) 96 98 { 97 99 void *vaddr; 100 101 kbd_dev = kdev; 98 102 99 103 if (sysinfo_get_value("kbd.address.physical", &ns16550_physical) != EOK) … … 119 123 { 120 124 int scan_code = IPC_GET_ARG2(*call); 121 kbd_push_scancode( scan_code);125 kbd_push_scancode(kbd_dev, scan_code); 122 126 123 127 if (irc_service) -
uspace/srv/hid/kbd/port/pl050.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2009 Vineeth Pillai 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <errno.h> 47 48 48 static int pl050_port_init( void);49 static int pl050_port_init(kbd_dev_t *); 49 50 static void pl050_port_yield(void); 50 51 static void pl050_port_reclaim(void); … … 57 58 .write = pl050_port_write 58 59 }; 60 61 static kbd_dev_t *kbd_dev; 59 62 60 63 #define PL050_STAT_RXFULL (1 << 4) … … 94 97 static void pl050_irq_handler(ipc_callid_t iid, ipc_call_t *call); 95 98 96 static int pl050_port_init( void)99 static int pl050_port_init(kbd_dev_t *kdev) 97 100 { 101 kbd_dev = kdev; 102 98 103 sysarg_t addr; 99 104 if (sysinfo_get_value("kbd.address.status", &addr) != EOK) … … 134 139 int scan_code = IPC_GET_ARG2(*call); 135 140 136 kbd_push_scancode( scan_code);141 kbd_push_scancode(kbd_dev, scan_code); 137 142 return; 138 143 } -
uspace/srv/hid/kbd/port/sgcn.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2008 Pavel Rimsky 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <errno.h> 47 48 48 static int sgcn_port_init( void);49 static int sgcn_port_init(kbd_dev_t *); 49 50 static void sgcn_port_yield(void); 50 51 static void sgcn_port_reclaim(void); … … 58 59 }; 59 60 61 static kbd_dev_t *kbd_dev; 62 60 63 #define POLL_INTERVAL 10000 61 64 … … 113 116 * Maps the physical memory (SRAM) and creates the polling thread. 114 117 */ 115 static int sgcn_port_init(void) 116 { 118 static int sgcn_port_init(kbd_dev_t *kdev) 119 { 120 kbd_dev = kdev; 121 117 122 sysarg_t sram_paddr; 118 123 if (sysinfo_get_value("sram.address.physical", &sram_paddr) != EOK) … … 179 184 buf_ptr = (volatile char *) 180 185 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); 181 kbd_push_scancode( c);186 kbd_push_scancode(kbd_dev, c); 182 187 } 183 188 } -
uspace/srv/hid/kbd/port/ski.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2005 Jakub Jermar 3 * Copyright (c) 20 09Jiri Svoboda3 * Copyright (c) 2011 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 45 45 #include <bool.h> 46 46 47 static int ski_port_init( void);47 static int ski_port_init(kbd_dev_t *); 48 48 static void ski_port_yield(void); 49 49 static void ski_port_reclaim(void); … … 57 57 }; 58 58 59 static kbd_dev_t *kbd_dev; 60 59 61 #define SKI_GETCHAR 21 60 62 … … 67 69 68 70 /** Initialize Ski port driver. */ 69 static int ski_port_init( void)71 static int ski_port_init(kbd_dev_t *kdev) 70 72 { 71 73 thread_id_t tid; 72 74 int rc; 75 76 kbd_dev = kdev; 73 77 74 78 rc = thread_create(ski_thread_impl, NULL, "kbd_poll", &tid); … … 106 110 if (c == 0) 107 111 break; 108 kbd_push_scancode( c);112 kbd_push_scancode(kbd_dev, c); 109 113 } 110 114 -
uspace/srv/hid/kbd/port/sun.c
r56ad818 r9be360ee 1 1 /* 2 2 * Copyright (c) 2009 Martin Decky 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 42 43 #include <bool.h> 43 44 44 static int sun_port_init( void);45 static int sun_port_init(kbd_dev_t *); 45 46 static void sun_port_yield(void); 46 47 static void sun_port_reclaim(void); … … 63 64 * 64 65 */ 65 static int sun_port_init( void)66 static int sun_port_init(kbd_dev_t *kdev) 66 67 { 67 68 sysarg_t z8530; … … 74 75 75 76 if (z8530) { 76 if (z8530_port_init( ) == 0)77 if (z8530_port_init(kdev) == 0) 77 78 return 0; 78 79 } 79 80 80 81 if (ns16550) { 81 if (ns16550_port_init( ) == 0)82 if (ns16550_port_init(kdev) == 0) 82 83 return 0; 83 84 } -
uspace/srv/hid/kbd/port/z8530.c
r56ad818 r9be360ee 46 46 #include <errno.h> 47 47 48 static kbd_dev_t *kbd_dev; 49 48 50 #define CHAN_A_STATUS 4 49 51 #define CHAN_A_DATA 6 … … 85 87 static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call); 86 88 87 int z8530_port_init( void)89 int z8530_port_init(kbd_dev_t *kdev) 88 90 { 91 kbd_dev = kdev; 92 89 93 sysarg_t kaddr; 90 94 if (sysinfo_get_value("kbd.address.kernel", &kaddr) != EOK) … … 107 111 { 108 112 int scan_code = IPC_GET_ARG2(*call); 109 kbd_push_scancode( scan_code);113 kbd_push_scancode(kbd_dev, scan_code); 110 114 111 115 if (irc_service)
Note:
See TracChangeset
for help on using the changeset viewer.