Changeset 08fed0a in mainline for kernel/arch/sparc64/src/drivers/sgcn.c
- Timestamp:
- 2009-03-12T19:16:36Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 29295cd
- Parents:
- 91ea7c4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/drivers/sgcn.c
r91ea7c4 r08fed0a 131 131 132 132 /* functions referenced from definitions of I/O operations structures */ 133 static void sgcn_noop(chardev_t *); 134 static void sgcn_putchar(chardev_t *, const char, bool); 135 static char sgcn_key_read(chardev_t *); 136 137 /** character device operations */ 138 static chardev_operations_t sgcn_ops = { 139 .suspend = sgcn_noop, 140 .resume = sgcn_noop, 141 .read = sgcn_key_read, 133 static void sgcn_putchar(outdev_t *, const char, bool); 134 135 /** SGCN output device operations */ 136 static outdev_operations_t sgcnout_ops = { 142 137 .write = sgcn_putchar 143 138 }; 144 139 145 /** SGCN character device */ 146 chardev_t sgcn_io; 147 148 /** Address of the chardev, which is connected to SGCN. */ 149 static chardev_t *sgcnout; 140 /** SGCN input device operations */ 141 static indev_operations_t sgcnin_ops = { 142 .poll = NULL 143 }; 144 145 static indev_t sgcnin; /**< SGCN input device. */ 146 static outdev_t sgcnout; /**< SGCN output device. */ 150 147 151 148 /** … … 204 201 static void sgcn_buffer_begin_init(void) 205 202 { 203 static bool initialized; 204 205 if (initialized) 206 return; 207 206 208 init_sram_begin(); 207 209 … … 220 222 sysinfo_set_item_val("sram.buffer.offset", NULL, 221 223 SRAM_TOC->keys[i].offset); 222 } 223 224 /** 225 * Default suspend/resume operation for the input device. 226 */ 227 static void sgcn_noop(chardev_t *d) 228 { 224 225 initialized = true; 229 226 } 230 227 … … 272 269 * written straight away. 273 270 */ 274 static void sgcn_putchar( struct chardev * cd, const char c, bool silent)271 static void sgcn_putchar(outdev_t *od, const char c, bool silent) 275 272 { 276 273 if (!silent) { … … 286 283 287 284 /** 288 * Called when actively reading the character. Not implemented yet.289 */290 static char sgcn_key_read(chardev_t *d)291 {292 return (char) 0;293 }294 295 /**296 285 * Grabs the input for kernel. 297 286 */ … … 338 327 *in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin; 339 328 340 if (sgcnout) 341 chardev_push_character(sgcnout, c); 329 indev_push_character(&sgcnin, c); 342 330 } 343 331 … … 358 346 359 347 /** 360 * A public function which initializes I/O from/to Serengeti console 361 * and sets it as a default input/output. 362 */ 363 void sgcn_init(chardev_t *devout) 348 * A public function which initializes input from the Serengeti console. 349 */ 350 indev_t *sgcnin_init(void) 364 351 { 365 352 sgcn_buffer_begin_init(); … … 369 356 sysinfo_set_item_val("kbd", NULL, true); 370 357 sysinfo_set_item_val("kbd.type", NULL, KBD_SGCN); 371 sysinfo_set_item_val("fb.kind", NULL, 4);372 358 373 359 thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true); … … 376 362 thread_ready(t); 377 363 378 chardev_initialize("sgcn_io", &sgcn_io, &sgcn_ops); 379 stdout = &sgcn_io; 380 381 sgcnout = devout; 364 indev_initialize("sgcnin", &sgcnin, &sgcnin_ops); 365 366 return &sgcnin; 367 } 368 369 /** 370 * A public function which initializes output to the Serengeti console. 371 */ 372 void sgcnout_init(void) 373 { 374 sgcn_buffer_begin_init(); 375 376 sysinfo_set_item_val("fb.kind", NULL, 4); 377 378 outdev_initialize("sgcnout", &sgcnout, &sgcnout_ops); 379 stdout = &sgcnout; 382 380 } 383 381
Note:
See TracChangeset
for help on using the changeset viewer.