Changeset af75db9 in mainline for kernel/genarch/src/kbd/ns16550.c


Ignore:
Timestamp:
2009-02-12T20:05:15Z (17 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
912ee7c
Parents:
95b9963
Message:

remove (almost all) platform dependent code from drivers

File:
1 edited

Legend:

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

    r95b9963 raf75db9  
    4040#include <genarch/kbd/scanc_sun.h>
    4141#include <arch/drivers/kbd.h>
    42 #ifndef ia64
    43 #include <arch/drivers/ns16550.h>
    44 #endif
    4542#include <ddi/irq.h>
    4643#include <ipc/irq.h>
     
    131128        ns16550_irq.cir_arg = cir_arg;
    132129        irq_register(&ns16550_irq);
    133 
    134 
     130       
    135131        while ((ns16550_lsr_read(&ns16550) & LSR_DATA_READY))
    136132                ns16550_rbr_read(&ns16550);
    137 
    138133       
    139134        sysinfo_set_item_val("kbd", NULL, true);
     
    143138        sysinfo_set_item_val("kbd.address.virtual", NULL, port);
    144139        sysinfo_set_item_val("kbd.port", NULL, port);
    145 
     140       
    146141#ifdef CONFIG_NS16550_INTERRUPT_DRIVEN
    147142        /* Enable interrupts */
    148         ns16550_ier_write(&ns16550, IER_ERBFI);
     143        ns16550_ier_write(&ns16550, IER_ERBFI);
    149144        ns16550_mcr_write(&ns16550, MCR_OUT2);
    150145#endif
    151 
    152 #ifdef ia64
    153         uint8_t c;
    154         // This switches rbr & ier to mode when accept baudrate constant
    155         c = ns16550_lcr_read(&ns16550);
    156         ns16550_lcr_write(&ns16550, 0x80 | c);
    157         ns16550_rbr_write(&ns16550, 0x0c);
    158         ns16550_ier_write(&ns16550, 0x00);
    159         ns16550_lcr_write(&ns16550, c);
    160 #endif
     146       
     147        uint8_t c;
     148        // This switches rbr & ier to mode when accept baudrate constant
     149        c = ns16550_lcr_read(&ns16550);
     150        ns16550_lcr_write(&ns16550, 0x80 | c);
     151        ns16550_rbr_write(&ns16550, 0x0c);
     152        ns16550_ier_write(&ns16550, 0x00);
     153        ns16550_lcr_write(&ns16550, c);
    161154       
    162155        ns16550_grab();
     
    186179        while(!(ch = active_read_buff_read())) {
    187180                uint8_t x;
    188                 while (!(ns16550_lsr_read(&ns16550) & LSR_DATA_READY))
    189                         ;
     181                while (!(ns16550_lsr_read(&ns16550) & LSR_DATA_READY));
     182               
    190183                x = ns16550_rbr_read(&ns16550);
    191 #ifndef ia64
     184               
    192185                if (x != IGNORE_CODE) {
    193186                        if (x & KEY_RELEASE)
     
    196189                                active_read_key_pressed(x);
    197190                }
    198 #else
    199                 extern chardev_t kbrd;
    200                 if(x != 0x0d) {
    201                         if(x == 0x7f)
    202                                 x = '\b';
    203                          chardev_push_character(&kbrd, x);
    204                 }   
    205 #endif         
    206 
    207191        }
    208192        return ch;
     
    215199void ns16550_poll(void)
    216200{
    217 #ifndef CONFIG_NS16550_INTERRUPT_DRIVEN 
     201#ifndef CONFIG_NS16550_INTERRUPT_DRIVEN
    218202        ipl_t ipl;
    219203
     
    241225               
    242226                x = ns16550_rbr_read(&ns16550);
    243 #ifndef ia64
     227               
    244228                if (x != IGNORE_CODE) {
    245229                        if (x & KEY_RELEASE)
     
    248232                                key_pressed(x);
    249233                }
    250 #else
    251                 extern chardev_t kbrd;
    252                 if(x != 0x0d) {
    253                         if (x == 0x7f)
    254                                 x = '\b';
    255                         chardev_push_character(&kbrd, x);
    256                 }   
    257 #endif         
    258 
    259234        }
    260235}
Note: See TracChangeset for help on using the changeset viewer.