Changeset 253d3d0 in mainline for kernel/arch/sparc64/src/drivers/sgcn.c
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.