Changeset 253d3d0 in mainline
- Timestamp:
- 2009-04-21T19:52:32Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5646813
- Parents:
- f2d2c7ba
- Location:
- kernel/arch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/drivers/ski.c
rf2d2c7ba r253d3d0 184 184 ski_init(); 185 185 186 ski_instance_t *instance 187 =malloc(sizeof(ski_instance_t), FRAME_ATOMIC);186 ski_instance_t *instance = 187 malloc(sizeof(ski_instance_t), FRAME_ATOMIC); 188 188 189 189 if (instance) { 190 instance->thread = thread_create(kskipoll, (void *) instance, TASK, 0, "kskipoll", true); 190 instance->thread = thread_create(kskipoll, instance, TASK, 0, 191 "kskipoll", true); 191 192 192 193 if (!instance->thread) { -
kernel/arch/sparc64/include/drivers/sgcn.h
rf2d2c7ba r253d3d0 38 38 #include <arch/types.h> 39 39 #include <console/chardev.h> 40 #include <proc/thread.h> 40 41 41 42 /* number of bytes in the TOC magic, including the NULL-terminator */ … … 117 118 } __attribute__ ((packed)) sgcn_buffer_header_t; 118 119 119 void sgcn_grab(void); 120 void sgcn_release(void); 121 indev_t *sgcnin_init(void); 122 void sgcnout_init(void); 120 typedef struct { 121 thread_t *thread; 122 indev_t *srlnin; 123 } sgcn_instance_t; 124 125 extern void sgcn_grab(void); 126 extern void sgcn_release(void); 127 extern sgcn_instance_t *sgcnin_init(void); 128 extern void sgcnin_wire(sgcn_instance_t *, indev_t *); 129 extern void sgcnout_init(void); 123 130 124 131 #endif -
kernel/arch/sparc64/src/console.c
rf2d2c7ba r253d3d0 93 93 { 94 94 #ifdef CONFIG_SGCN_KBD 95 indev_t *kbrdin; 96 kbrdin = sgcnin_init(); 97 if (kbrdin) 98 srln_init(kbrdin); 95 sgcn_instance_t *sgcn_instance = sgcnin_init(); 96 if (sgcn_instance) { 97 srln_instance_t *srln_instance = srln_init(); 98 if (srln_instance) { 99 indev_t *sink = stdin_wire(); 100 indev_t *srln = srln_wire(srln_instance, sink); 101 sgcnin_wire(sgcn_instance, srln); 102 } 103 } 99 104 #endif 100 105 #ifdef CONFIG_SGCN_PRN -
kernel/arch/sparc64/src/drivers/sgcn.c
rf2d2c7ba r253d3d0 135 135 }; 136 136 137 /** SGCN input device operations */138 static indev_operations_t sgcnin_ops = {139 .poll = NULL140 };141 142 static indev_t sgcnin; /**< SGCN input device. */143 137 static outdev_t sgcnout; /**< SGCN output device. */ 144 138 … … 302 296 * and sends them to the upper layers of HelenOS. 303 297 */ 304 static void sgcn_poll( )298 static void sgcn_poll(sgcn_instance_t *instance) 305 299 { 306 300 uint32_t begin = SGCN_BUFFER_HEADER->in_begin; … … 320 314 321 315 while (*in_rdptr_ptr != *in_wrptr_ptr) { 322 323 316 buf_ptr = (volatile char *) 324 317 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); … … 326 319 *in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin; 327 320 328 indev_push_character( &sgcnin, c);321 indev_push_character(instance->srlnin, c); 329 322 } 330 323 … … 335 328 * Polling thread function. 336 329 */ 337 static void k kbdpoll(void *arg) {330 static void ksgcnpoll(void *instance) { 338 331 while (1) { 339 if (!silent) { 340 sgcn_poll(); 341 } 332 if (!silent) 333 sgcn_poll(instance); 342 334 thread_usleep(POLL_INTERVAL); 343 335 } … … 347 339 * A public function which initializes input from the Serengeti console. 348 340 */ 349 indev_t *sgcnin_init(void)341 sgcn_instance_t *sgcnin_init(void) 350 342 { 351 343 sgcn_buffer_begin_init(); 352 344 345 sgcn_instance_t *instance = 346 malloc(sizeof(sgcn_instance_t), FRAME_ATOMIC); 347 if (!instance) 348 return NULL; 349 350 instance->srlnin = NULL; 351 instance->thread = thread_create(ksgcnpoll, instance, TASK, 0, 352 "ksgcnpoll", true); 353 if (!instance->thread) { 354 free(instance); 355 return NULL; 356 } 357 358 return instance; 359 } 360 361 void sgcnin_wire(sgcn_instance_t *instance, indev_t *srlnin) 362 { 363 ASSERT(instance); 364 ASSERT(srlnin); 365 366 instance->srlnin = srlnin; 367 thread_ready(instance->thread); 368 353 369 sysinfo_set_item_val("kbd", NULL, true); 354 355 thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);356 if (!t)357 panic("Cannot create kkbdpoll.");358 thread_ready(t);359 360 indev_initialize("sgcnin", &sgcnin, &sgcnin_ops);361 362 return &sgcnin;363 370 } 364 371
Note:
See TracChangeset
for help on using the changeset viewer.