Changeset 63530c62 in mainline for kernel/genarch/src/kbd/ns16550.c
- Timestamp:
- 2006-10-14T19:31:03Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3890b3f
- Parents:
- 7dcf22a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/kbd/ns16550.c
r7dcf22a r63530c62 1 1 /* 2 * Copyright (C) 2001-200 4Jakub Jermar2 * Copyright (C) 2001-2006 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 53 53 #define LSR_DATA_READY 0x01 54 54 55 /** Structure representing the ns16550. */ 56 static ns16550_t ns16550; 57 58 /** Structure for ns16550's IRQ. */ 59 static irq_t ns16550_irq; 60 55 61 /* 56 62 * These codes read from ns16550 data register are silently ignored. … … 82 88 } 83 89 84 /** Initialize ns16550. */ 85 void ns16550_init(void) 90 /** Initialize ns16550. 91 * 92 * @param devno Device number. 93 * @param inr Interrupt number. 94 * @param vaddr Virtual address of device's registers. 95 */ 96 void ns16550_init(devno_t devno, inr_t inr, uintptr_t vaddr) 86 97 { 87 98 ns16550_grab(); … … 89 100 stdin = &kbrd; 90 101 102 ns16550.devno = devno; 103 ns16550.reg = (uint8_t *) vaddr; 104 105 irq_initialize(&ns16550_irq); 106 ns16550_irq.devno = devno; 107 ns16550_irq.inr = inr; 108 ns16550_irq.claim = ns16550_claim; 109 ns16550_irq.handler = ns16550_irq_handler; 110 irq_register(&ns16550_irq); 111 91 112 sysinfo_set_item_val("kbd", NULL, true); 92 sysinfo_set_item_val("kbd.irq", NULL, 0); 93 sysinfo_set_item_val("kbd.address.virtual", NULL, (uintptr_t) kbd_virt_address); 113 sysinfo_set_item_val("kbd.devno", NULL, devno); 114 sysinfo_set_item_val("kbd.inr", NULL, inr); 115 sysinfo_set_item_val("kbd.address.virtual", NULL, vaddr); 94 116 95 ns16550_ier_write( IER_ERBFI);/* enable receiver interrupt */117 ns16550_ier_write(&ns16550, IER_ERBFI); /* enable receiver interrupt */ 96 118 97 while (ns16550_lsr_read( ) & LSR_DATA_READY)98 (void) ns16550_rbr_read( );119 while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY) 120 (void) ns16550_rbr_read(&ns16550); 99 121 } 100 122 … … 130 152 while(!(ch = active_read_buff_read())) { 131 153 uint8_t x; 132 while (!(ns16550_lsr_read( ) & LSR_DATA_READY))154 while (!(ns16550_lsr_read(&ns16550) & LSR_DATA_READY)) 133 155 ; 134 x = ns16550_rbr_read( );156 x = ns16550_rbr_read(&ns16550); 135 157 if (x != IGNORE_CODE) { 136 158 if (x & KEY_RELEASE) … … 151 173 uint8_t x; 152 174 153 while (ns16550_lsr_read( ) & LSR_DATA_READY) {154 x = ns16550_rbr_read( );175 while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY) { 176 x = ns16550_rbr_read(&ns16550); 155 177 if (x != IGNORE_CODE) { 156 178 if (x & KEY_RELEASE)
Note:
See TracChangeset
for help on using the changeset viewer.