Changeset 4f1173bc in rtems
- Timestamp:
- 02/23/12 16:40:33 (12 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 8f7f6ca
- Parents:
- 6903c7cd
- Location:
- c/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/ChangeLog
r6903c7cd r4f1173bc 1 2012-02-23 Jennifer Averett <jennifer.averett@oarcorp.com> 2 3 * libchip/serial/ns16550.c, libchip/serial/ns16550.h, 4 libchip/serial/ns16550_p.h: With the addition of dynamically 5 registered libchip serial devices, there is the need to be able to 6 use printk() before the console driver has initialized the indirect 7 pointer table. This lets printk() support routines call pass a 8 control structure directly without a lookup through the uninitialized 9 indirect one. 10 1 11 2011-12-13 Ralf Corsépius <ralf.corsepius@rtems.org> 2 12 -
c/src/libchip/serial/ns16550.c
r6903c7cd r4f1173bc 1 /* 1 /** 2 * @file 3 * 2 4 * This file contains the TTY driver for the National Semiconductor NS16550. 3 5 * … … 5 7 * of "Super IO" controllers. 6 8 * 9 * This driver uses the termios pseudo driver. 10 */ 11 12 /* 7 13 * COPYRIGHT (c) 1998 by Radstone Technology 8 14 * 9 * 10 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY 11 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 12 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK 13 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. 14 * 15 * You are hereby granted permission to use, copy, modify, and distribute 16 * this file, provided that this notice, plus the above copyright notice 17 * and disclaimer, appears in all copies. Radstone Technology will provide 18 * no support for this code. 19 * 20 * This driver uses the termios pseudo driver. 21 */ 22 23 /* 24 * $Id$ 15 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY 16 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK 18 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. 19 * 20 * You are hereby granted permission to use, copy, modify, and distribute 21 * this file, provided that this notice, plus the above copyright notice 22 * and disclaimer, appears in all copies. Radstone Technology will provide 23 * no support for this code. 24 * 25 * COPYRIGHT (c) 1989-2012. 26 * On-Line Applications Research Corporation (OAR). 27 * 28 * The license and distribution terms for this file may be 29 * found in the file LICENSE in this distribution or at 30 * http://www.rtems.com/license/LICENSE. 31 * 32 * $Id$ 25 33 */ 26 34 … … 102 110 setRegister_f setReg; 103 111 getRegister_f getReg; 112 console_tbl *c = Console_Port_Tbl [minor]; 104 113 105 114 pns16550Context=(ns16550_context *)malloc(sizeof(ns16550_context)); … … 113 122 pns16550Context->ucModemCtrl=SP_MODEM_IRQ; 114 123 115 pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;116 setReg = Console_Port_Tbl[minor]->setRegister;117 getReg = Console_Port_Tbl[minor]->getRegister;124 pNS16550 = c->ulCtrlPort1; 125 setReg = c->setRegister; 126 getReg = c->getRegister; 118 127 119 128 /* Clear the divisor latch, clear all interrupt enables, … … 123 132 124 133 (*setReg)(pNS16550, NS16550_LINE_CONTROL, 0x0); 125 ns16550_enable_interrupts( minor, NS16550_DISABLE_ALL_INTR);134 ns16550_enable_interrupts( c, NS16550_DISABLE_ALL_INTR ); 126 135 127 136 /* Set the divisor latch and set the baud rate. */ 128 137 129 138 ulBaudDivisor = NS16550_Baud( 130 (uint32_t) Console_Port_Tbl[minor]->ulClock,131 (uint32_t) ((uintptr_t) Console_Port_Tbl[minor]->pDeviceParams)139 (uint32_t) c->ulClock, 140 (uint32_t) ((uintptr_t)c->pDeviceParams) 132 141 ); 133 142 ucDataByte = SP_LINE_DLAB; … … 135 144 136 145 /* XXX */ 137 (*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, (uint8_t) (ulBaudDivisor & 0xffU)); 138 (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, (uint8_t) ((ulBaudDivisor >> 8) & 0xffU)); 146 (*setReg)(pNS16550,NS16550_TRANSMIT_BUFFER,(uint8_t)(ulBaudDivisor & 0xffU)); 147 (*setReg)( 148 pNS16550,NS16550_INTERRUPT_ENABLE, 149 (uint8_t)(( ulBaudDivisor >> 8 ) & 0xffU ) 150 ); 139 151 140 152 /* Clear the divisor latch and set the character size to eight bits */ … … 150 162 (*setReg)(pNS16550, NS16550_FIFO_CONTROL, ucDataByte); 151 163 152 ns16550_enable_interrupts( minor, NS16550_DISABLE_ALL_INTR);164 ns16550_enable_interrupts(c, NS16550_DISABLE_ALL_INTR); 153 165 154 166 /* Set data terminal ready. */ … … 187 199 if (c->pDeviceFns->deviceOutputUsesInterrupts) { 188 200 ns16550_initialize_interrupts( minor); 189 ns16550_enable_interrupts( minor, NS16550_ENABLE_ALL_INTR_EXCEPT_TX);201 ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR_EXCEPT_TX); 190 202 } 191 203 … … 212 224 } 213 225 214 ns16550_enable_interrupts( minor, NS16550_DISABLE_ALL_INTR);226 ns16550_enable_interrupts(c, NS16550_DISABLE_ALL_INTR); 215 227 216 228 if (c->pDeviceFns->deviceOutputUsesInterrupts) { … … 224 236 * @brief Polled write for NS16550. 225 237 */ 226 NS16550_STATIC void ns16550_write_polled(int minor, char out) 227 { 228 console_tbl *c = Console_Port_Tbl [minor]; 238 void ns16550_outch_polled(console_tbl *c, char out) 239 { 229 240 uintptr_t port = c->ulCtrlPort1; 230 241 getRegister_f get = c->getRegister; … … 237 248 238 249 /* Disable port interrupts */ 239 ns16550_enable_interrupts( minor, NS16550_DISABLE_ALL_INTR);250 ns16550_enable_interrupts( c, NS16550_DISABLE_ALL_INTR); 240 251 241 252 while (true) { … … 264 275 /* Restore port interrupt mask */ 265 276 set( port, NS16550_INTERRUPT_ENABLE, interrupt_mask); 277 } 278 279 NS16550_STATIC void ns16550_write_polled(int minor, char out) 280 { 281 console_tbl *c = Console_Port_Tbl [minor]; 282 283 ns16550_outch_polled( c, out ); 266 284 } 267 285 … … 522 540 /* Nothing to do */ 523 541 d->bActive = false; 524 ns16550_enable_interrupts( minor, NS16550_ENABLE_ALL_INTR_EXCEPT_TX);542 ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR_EXCEPT_TX); 525 543 } 526 544 } … … 559 577 ctx->transmitFifoChars = out; 560 578 d->bActive = true; 561 ns16550_enable_interrupts( minor, NS16550_ENABLE_ALL_INTR);579 ns16550_enable_interrupts( c, NS16550_ENABLE_ALL_INTR); 562 580 } 563 581 … … 571 589 */ 572 590 NS16550_STATIC void ns16550_enable_interrupts( 573 int minor,574 int mask591 console_tbl *c, 592 int mask 575 593 ) 576 594 { … … 578 596 setRegister_f setReg; 579 597 580 pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;581 setReg = Console_Port_Tbl[minor]->setRegister;598 pNS16550 = c->ulCtrlPort1; 599 setReg = c->setRegister; 582 600 583 601 (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, mask); … … 722 740 723 741 /* 724 * ns16550_inbyte_nonblocking_polled 725 * 726 * Console Termios polling input entry point. 727 */ 728 729 NS16550_STATIC int ns16550_inbyte_nonblocking_polled( 730 int minor 742 * Debug gets() support 743 */ 744 int ns16550_inch_polled( 745 console_tbl *c 731 746 ) 732 747 { … … 736 751 getRegister_f getReg; 737 752 738 pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;739 getReg = Console_Port_Tbl[minor]->getRegister;753 pNS16550 = c->ulCtrlPort1; 754 getReg = c->getRegister; 740 755 741 756 ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS); 742 if (ucLineStatus & SP_LSR_RDY) {757 if (ucLineStatus & SP_LSR_RDY) { 743 758 cChar = (*getReg)(pNS16550, NS16550_RECEIVE_BUFFER); 744 759 return (int)cChar; 745 } else { 746 return -1; 747 } 748 } 760 } 761 return -1; 762 } 763 764 /* 765 * ns16550_inbyte_nonblocking_polled 766 * 767 * Console Termios polling input entry point. 768 */ 769 NS16550_STATIC int ns16550_inbyte_nonblocking_polled(int minor) 770 { 771 console_tbl *c = Console_Port_Tbl [minor]; 772 773 return ns16550_inch_polled( c ); 774 } -
c/src/libchip/serial/ns16550.h
r6903c7cd r4f1173bc 1 /** 2 * @file 3 * 4 */ 5 1 6 /* 2 7 * COPYRIGHT (c) 1998 by Radstone Technology 3 8 * 9 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY 10 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 11 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK 12 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. 4 13 * 5 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY6 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE7 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK8 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.14 * You are hereby granted permission to use, copy, modify, and distribute 15 * this file, provided that this notice, plus the above copyright notice 16 * and disclaimer, appears in all copies. Radstone Technology will provide 17 * no support for this code. 9 18 * 10 * You are hereby granted permission to use, copy, modify, and distribute 11 * this file, provided that this notice, plus the above copyright notice 12 * and disclaimer, appears in all copies. Radstone Technology will provide 13 * no support for this code. 19 * COPYRIGHT (c) 1989-2012. 20 * On-Line Applications Research Corporation (OAR). 14 21 * 22 * The license and distribution terms for this file may be 23 * found in the file LICENSE in this distribution or at 24 * http://www.rtems.com/license/LICENSE. 25 * 26 * $Id$ 15 27 */ 16 28 … … 36 48 extern console_flow ns16550_flow_DTRCTS; 37 49 50 /* 51 * Helpers for printk 52 */ 53 void ns16550_outch_polled(console_tbl *c, char out); 54 int ns16550_inch_polled(console_tbl *c); 55 38 56 #ifdef __cplusplus 39 57 } -
c/src/libchip/serial/ns16550_p.h
r6903c7cd r4f1173bc 1 /** 2 * @file 3 * 4 */ 5 1 6 /* 2 7 * COPYRIGHT (c) 1998 by Radstone Technology 3 8 * 4 9 * 5 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY 6 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 7 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK 8 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. 9 * 10 * You are hereby granted permission to use, copy, modify, and distribute 11 * this file, provided that this notice, plus the above copyright notice 12 * and disclaimer, appears in all copies. Radstone Technology will provide 13 * no support for this code. 14 * 10 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY 11 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 12 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK 13 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. 14 * 15 * You are hereby granted permission to use, copy, modify, and distribute 16 * this file, provided that this notice, plus the above copyright notice 17 * and disclaimer, appears in all copies. Radstone Technology will provide 18 * no support for this code. 19 * 20 * COPYRIGHT (c) 1989-2012. 21 * On-Line Applications Research Corporation (OAR). 22 * 23 * The license and distribution terms for this file may be 24 * found in the file LICENSE in this distribution or at 25 * http://www.rtems.com/license/LICENSE. 26 * 15 27 * $Id$ 16 28 */ … … 191 203 192 204 NS16550_STATIC void ns16550_enable_interrupts( 193 int minor,194 int mask205 console_tbl *c, 206 int mask 195 207 ); 196 208
Note: See TracChangeset
for help on using the changeset viewer.