Changes in kernel/genarch/src/drivers/dsrln/dsrlnout.c [a71c158:c8bf88d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/dsrln/dsrlnout.c
ra71c158 rc8bf88d 35 35 */ 36 36 37 37 38 #include <genarch/drivers/dsrln/dsrlnout.h> 38 39 #include <console/chardev.h> 39 40 #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 typedef struct { 46 ioport8_t *base; 47 } dsrlnout_instance_t; 45 static ioport8_t *dsrlnout_base; 48 46 49 static void dsrlnout_putchar(outdev_t *dev , const wchar_t ch, bool silent)47 static void dsrlnout_putchar(outdev_t *dev __attribute__((unused)), const wchar_t ch, bool silent) 50 48 { 51 dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data;52 53 49 if (!silent) { 54 50 if (ascii_check(ch)) 55 pio_write_8( instance->base, ch);51 pio_write_8(dsrlnout_base, ch); 56 52 else 57 pio_write_8( instance->base, U_SPECIAL);53 pio_write_8(dsrlnout_base, U_SPECIAL); 58 54 } 59 55 } 60 56 61 static outdev_ operations_t dsrlndev_ops = {62 .write = dsrlnout_putchar, 63 . redraw = NULL57 static outdev_t dsrlnout_console; 58 static outdev_operations_t dsrlnout_ops = { 59 .write = dsrlnout_putchar 64 60 }; 65 61 66 outdev_t *dsrlnout_init(ioport8_t *base)62 void dsrlnout_init(ioport8_t *base) 67 63 { 68 outdev_t *dsrlndev = malloc(sizeof(outdev_t), FRAME_ATOMIC); 69 if (!dsrlndev) 70 return NULL; 64 /* Initialize the software structure. */ 65 dsrlnout_base = base; 71 66 72 dsrlnout_instance_t *instance = malloc(sizeof(dsrlnout_instance_t), FRAME_ATOMIC); 73 if (!instance) { 74 free(dsrlndev); 75 return NULL; 76 } 67 outdev_initialize("dsrlnout", &dsrlnout_console, &dsrlnout_ops); 68 stdout = &dsrlnout_console; 77 69 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; 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)); 96 73 } 97 74
Note:
See TracChangeset
for help on using the changeset viewer.