Ignore:
Timestamp:
2019-09-23T12:49:29Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9be2358
Parents:
9259d20 (diff), 1a4ec93f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiri Svoboda <jiri@…> (2019-09-22 12:49:07)
git-committer:
Jiri Svoboda <jiri@…> (2019-09-23 12:49:29)
Message:

Merge changes from master, especially Meson build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    r9259d20 r3e828ea  
    3939#include <genarch/drivers/ns16550/ns16550.h>
    4040#include <ddi/irq.h>
     41#include <ddi/ddi.h>
    4142#include <arch/asm.h>
    4243#include <console/chardev.h>
    4344#include <stdlib.h>
     45#include <align.h>
    4446#include <str.h>
    4547
     
    115117
    116118        if ((!instance->parea.mapped) || (console_override)) {
     119                if (ch == '\n')
     120                        ns16550_sendb(instance, '\r');
     121
    117122                if (ascii_check(ch))
    118123                        ns16550_sendb(instance, (uint8_t) ch);
     
    143148 *
    144149 */
    145 ns16550_instance_t *ns16550_init(ioport8_t *dev, unsigned reg_shift, inr_t inr,
    146     cir_t cir, void *cir_arg, outdev_t **output)
    147 {
    148         ns16550_instance_t *instance =
    149             malloc(sizeof(ns16550_instance_t));
     150ns16550_instance_t *ns16550_init(ioport8_t *dev_phys, unsigned reg_shift,
     151    inr_t inr, cir_t cir, void *cir_arg, outdev_t **output)
     152{
     153        size_t size = 6 * (1U << reg_shift);
     154        ioport8_t *dev = pio_map((void *) dev_phys, size);
     155
     156        ns16550_instance_t *instance = malloc(sizeof(ns16550_instance_t));
    150157        if (instance) {
    151158                instance->ns16550 = dev;
     
    158165                        if (!instance->output) {
    159166                                free(instance);
     167                                pio_unmap((void *) dev_phys, (void *) dev,
     168                                    size);
    160169                                return NULL;
    161170                        }
     
    176185
    177186                ddi_parea_init(&instance->parea);
    178                 instance->parea.pbase = (uintptr_t) dev;
    179                 instance->parea.frames = 1;
     187                instance->parea.pbase = ALIGN_DOWN((uintptr_t) dev_phys,
     188                    PAGE_SIZE);
     189                instance->parea.frames = ALIGN_UP(size, PAGE_SIZE);
    180190                instance->parea.unpriv = false;
    181191                instance->parea.mapped = false;
Note: See TracChangeset for help on using the changeset viewer.