Changeset a71c158 in mainline for kernel/genarch/src/drivers/dsrln/dsrlnout.c
- Timestamp:
- 2009-08-21T14:12:45Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0e6dce8, b50b5af2, e5792d1
- Parents:
- 90c8b8d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/dsrln/dsrlnout.c
r90c8b8d ra71c158 35 35 */ 36 36 37 38 37 #include <genarch/drivers/dsrln/dsrlnout.h> 39 38 #include <console/chardev.h> 40 39 #include <arch/asm.h> 40 #include <mm/slab.h> 41 41 #include <console/console.h> 42 42 #include <sysinfo/sysinfo.h> 43 43 #include <string.h> 44 44 45 static ioport8_t *dsrlnout_base; 45 typedef struct { 46 ioport8_t *base; 47 } dsrlnout_instance_t; 46 48 47 static void dsrlnout_putchar(outdev_t *dev __attribute__((unused)), const wchar_t ch, bool silent)49 static void dsrlnout_putchar(outdev_t *dev, const wchar_t ch, bool silent) 48 50 { 51 dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data; 52 49 53 if (!silent) { 50 54 if (ascii_check(ch)) 51 pio_write_8( dsrlnout_base, ch);55 pio_write_8(instance->base, ch); 52 56 else 53 pio_write_8( dsrlnout_base, U_SPECIAL);57 pio_write_8(instance->base, U_SPECIAL); 54 58 } 55 59 } 56 60 57 static outdev_ t dsrlnout_console;58 static outdev_operations_t dsrlnout_ops = { 59 . write = dsrlnout_putchar61 static outdev_operations_t dsrlndev_ops = { 62 .write = dsrlnout_putchar, 63 .redraw = NULL 60 64 }; 61 65 62 voiddsrlnout_init(ioport8_t *base)66 outdev_t *dsrlnout_init(ioport8_t *base) 63 67 { 64 /* Initialize the software structure. */ 65 dsrlnout_base = base; 68 outdev_t *dsrlndev = malloc(sizeof(outdev_t), FRAME_ATOMIC); 69 if (!dsrlndev) 70 return NULL; 66 71 67 outdev_initialize("dsrlnout", &dsrlnout_console, &dsrlnout_ops); 68 stdout_wire(&dsrlnout_console); 72 dsrlnout_instance_t *instance = malloc(sizeof(dsrlnout_instance_t), FRAME_ATOMIC); 73 if (!instance) { 74 free(dsrlndev); 75 return NULL; 76 } 69 77 70 sysinfo_set_item_val("fb", NULL, true); 71 sysinfo_set_item_val("fb.kind", NULL, 3); 72 sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(base)); 78 outdev_initialize("dsrlndev", dsrlndev, &dsrlndev_ops); 79 dsrlndev->data = instance; 80 81 instance->base = base; 82 83 if (!fb_exported) { 84 /* 85 * This is the necessary evil until the userspace driver is entirely 86 * self-sufficient. 87 */ 88 sysinfo_set_item_val("fb", NULL, true); 89 sysinfo_set_item_val("fb.kind", NULL, 3); 90 sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(base)); 91 92 fb_exported = true; 93 } 94 95 return dsrlndev; 73 96 } 74 97
Note:
See TracChangeset
for help on using the changeset viewer.