Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/dsrln/dsrlnout.c

    ra71c158 rc8bf88d  
    3535 */
    3636
     37
    3738#include <genarch/drivers/dsrln/dsrlnout.h>
    3839#include <console/chardev.h>
    3940#include <arch/asm.h>
    40 #include <mm/slab.h>
    4141#include <console/console.h>
    4242#include <sysinfo/sysinfo.h>
    4343#include <string.h>
    4444
    45 typedef struct {
    46         ioport8_t *base;
    47 } dsrlnout_instance_t;
     45static ioport8_t *dsrlnout_base;
    4846
    49 static void dsrlnout_putchar(outdev_t *dev, const wchar_t ch, bool silent)
     47static void dsrlnout_putchar(outdev_t *dev __attribute__((unused)), const wchar_t ch, bool silent)
    5048{
    51         dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data;
    52        
    5349        if (!silent) {
    5450                if (ascii_check(ch))
    55                         pio_write_8(instance->base, ch);
     51                        pio_write_8(dsrlnout_base, ch);
    5652                else
    57                         pio_write_8(instance->base, U_SPECIAL);
     53                        pio_write_8(dsrlnout_base, U_SPECIAL);
    5854        }
    5955}
    6056
    61 static outdev_operations_t dsrlndev_ops = {
    62         .write = dsrlnout_putchar,
    63         .redraw = NULL
     57static outdev_t dsrlnout_console;
     58static outdev_operations_t dsrlnout_ops = {
     59        .write = dsrlnout_putchar
    6460};
    6561
    66 outdev_t *dsrlnout_init(ioport8_t *base)
     62void dsrlnout_init(ioport8_t *base)
    6763{
    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;
    7166       
    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;
    7769       
    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));
    9673}
    9774
Note: See TracChangeset for help on using the changeset viewer.