Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 448e093 in mainline


Ignore:
Timestamp:
2018-02-13T10:07:22Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial
Children:
06ae793
Parents:
38b0ae2
git-author:
Jiri Svoboda <jiri@…> (2018-02-12 21:06:46)
git-committer:
Jiri Svoboda <jiri@…> (2018-02-13 10:07:22)
Message:

Fix function names, other minor tweaks.

Location:
kernel/genarch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/genarch/drivers/ns16550/ns16550.h

    r38b0ae2 r448e093  
    5050
    5151/** NS16550 registers. */
    52 enum {
     52typedef enum {
    5353        NS16550_REG_RBR = 0,  /**< Receiver Buffer Register (read). */
    5454        NS16550_REG_THR = 0,  /**< Transmitter Holder Register (write). */
     
    5959        NS16550_REG_MCR = 4,  /**< Modem Control Register. */
    6060        NS16550_REG_LSR = 5,  /**< Line Status Register. */
    61 };
     61} ns16550_reg_t;
    6262
    6363/** Structure representing the ns16550 device. */
     
    7171} ns16550_instance_t;
    7272
    73 extern ns16550_instance_t *ns16550_init(ioport8_t *, int, inr_t, cir_t, void *,
    74     outdev_t **);
     73extern ns16550_instance_t *ns16550_init(ioport8_t *, unsigned, inr_t, cir_t,
     74    void *, outdev_t **);
    7575extern void ns16550_wire(ns16550_instance_t *, indev_t *);
    7676
  • kernel/genarch/src/drivers/ns16550/ns16550.c

    r38b0ae2 r448e093  
    4747#define LSR_TH_READY    0x20
    4848
    49 static inline uint8_t _read(ns16550_instance_t *inst, int reg) {
     49static uint8_t ns16550_reg_read(ns16550_instance_t *inst, ns16550_reg_t reg)
     50{
    5051        return pio_read_8(&inst->ns16550[reg << inst->reg_shift]);
    5152}
    5253
    53 static inline void _write(ns16550_instance_t *inst, int reg, uint8_t val) {
     54static void ns16550_reg_write(ns16550_instance_t *inst, ns16550_reg_t reg,
     55    uint8_t val)
     56{
    5457        pio_write_8(&inst->ns16550[reg << inst->reg_shift], val);
    5558}
     
    5962        ns16550_instance_t *instance = irq->instance;
    6063
    61         if (_read(instance, NS16550_REG_LSR) & LSR_DATA_READY)
     64        if (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY)
    6265                return IRQ_ACCEPT;
    6366        else
     
    6972        ns16550_instance_t *instance = irq->instance;
    7073       
    71         while (_read(instance, NS16550_REG_LSR) & LSR_DATA_READY) {
    72                 uint8_t data = _read(instance, NS16550_REG_RBR);
     74        while (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY) {
     75                uint8_t data = ns16550_reg_read(instance, NS16550_REG_RBR);
    7376                indev_push_character(instance->input, data);
    7477        }
     
    7881static void ns16550_clear_buffer(ns16550_instance_t *instance)
    7982{
    80         while (_read(instance, NS16550_REG_LSR) & LSR_DATA_READY)
    81                 (void) _read(instance, NS16550_REG_RBR);
     83        while (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY)
     84                (void) ns16550_reg_read(instance, NS16550_REG_RBR);
    8285}
    8386
    8487static void ns16550_sendb(ns16550_instance_t *instance, uint8_t byte)
    8588{
    86         while (!(_read(instance, NS16550_REG_LSR) & LSR_TH_READY))
     89        while (!(ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_TH_READY))
    8790                ;
    88         _write(instance, NS16550_REG_THR, byte);
     91        ns16550_reg_write(instance, NS16550_REG_THR, byte);
    8992}
    9093
     
    122125 *
    123126 */
    124 ns16550_instance_t *ns16550_init(ioport8_t *dev, int reg_shift, inr_t inr,
     127ns16550_instance_t *ns16550_init(ioport8_t *dev, unsigned reg_shift, inr_t inr,
    125128    cir_t cir, void *cir_arg, outdev_t **output)
    126129{
     
    176179       
    177180        /* Enable interrupts */
    178         _write(instance, NS16550_REG_IER, IER_ERBFI);
    179         _write(instance, NS16550_REG_MCR, MCR_OUT2);
     181        ns16550_reg_write(instance, NS16550_REG_IER, IER_ERBFI);
     182        ns16550_reg_write(instance, NS16550_REG_MCR, MCR_OUT2);
    180183}
    181184
Note: See TracChangeset for help on using the changeset viewer.