Difference between revisions of "Unit PL011"

From Ultibo.org
Jump to: navigation, search
 
(16 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''ARM PrimeCell PL011 UART Driver unit'''
  
 
=== Constants ===
 
=== Constants ===
Line 56: Line 56:
 
|-
 
|-
 
| <code>PL011_UART_CLOCK_RATE = 24000000;</code>
 
| <code>PL011_UART_CLOCK_RATE = 24000000;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>PL011_UART_RX_POLL_LIMIT = 256;</code>
 +
| Number of times interrupt handler may poll the read FIFO
 +
|-
 +
| <code>PL011_UART_RX_BUFFER_SIZE = 1024;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 62: Line 70:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART data constants''' <code> PL011_UART_DR_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART data''' <code> PL011_UART_DR_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 83: Line 91:
 
|-
 
|-
 
| <code>PL011_UART_DR_DATA = ($FF shl 0);</code>
 
| <code>PL011_UART_DR_DATA = ($FF shl 0);</code>
| Receive / Transmit data
+
| Receive/Transmit data
 
|-
 
|-
 
|colspan="2"|<code>PL011_UART_DR_ERROR = PL011_UART_DR_OE or PL011_UART_DR_BE or PL011_UART_DR_PE or PL011_UART_DR_FE;</code>
 
|colspan="2"|<code>PL011_UART_DR_ERROR = PL011_UART_DR_OE or PL011_UART_DR_BE or PL011_UART_DR_PE or PL011_UART_DR_FE;</code>
Line 91: Line 99:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART receive status/error clear constants''' <code> PL011_UART_RSRECR_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART receive status/error clear''' <code> PL011_UART_RSRECR_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 115: Line 123:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART flag constants''' <code> PL011_UART_FR_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART flag''' <code> PL011_UART_FR_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 154: Line 162:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART integer baud rate divisor constants''' <code> PL011_UART_IBRD_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART integer baud rate divisor''' <code> PL011_UART_IBRD_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 169: Line 177:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART fractional baud rate divisor constants ''' <code> PL011_UART_FBRD_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART fractional baud rate divisor''' <code> PL011_UART_FBRD_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 184: Line 192:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART line control constants''' <code> PL011_UART_LCRH_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART line control''' <code> PL011_UART_LCRH_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 217: Line 225:
 
|-
 
|-
 
| <code>PL011_UART_LCRH_EPS = (1 shl 2);</code>
 
| <code>PL011_UART_LCRH_EPS = (1 shl 2);</code>
| Even parity select (0 = odd parity / 1 = even parity)
+
| Even parity select (0 = odd parity/1 = even parity)
 
|-
 
|-
 
| <code>PL011_UART_LCRH_PEN = (1 shl 1);</code>
 
| <code>PL011_UART_LCRH_PEN = (1 shl 1);</code>
Line 229: Line 237:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART control constants ''' <code> PL011_UART_CR_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART control''' <code> PL011_UART_CR_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 279: Line 287:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART interrupt FIFO level select constants''' <code> PL011_UART_IFLS_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART interrupt FIFO level select''' <code> PL011_UART_IFLS_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 297: Line 305:
 
|-
 
|-
 
| <code>PL011_UART_IFLS_RXIFLSEL1_8 = (0 shl 3);</code>
 
| <code>PL011_UART_IFLS_RXIFLSEL1_8 = (0 shl 3);</code>
| b000 = Receive FIFO becomes 1/8 full
+
| b000 = Receive FIFO becomes >= 1/8 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_RXIFLSEL1_4 = (1 shl 3);</code>
 
| <code>PL011_UART_IFLS_RXIFLSEL1_4 = (1 shl 3);</code>
| b001 = Receive FIFO becomes 1/4 full
+
| b001 = Receive FIFO becomes >= 1/4 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_RXIFLSEL1_2 = (2 shl 3);</code>
 
| <code>PL011_UART_IFLS_RXIFLSEL1_2 = (2 shl 3);</code>
| b010 = Receive FIFO becomes 1/2 full
+
| b010 = Receive FIFO becomes >= 1/2 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_RXIFLSEL3_4 = (3 shl 3);</code>
 
| <code>PL011_UART_IFLS_RXIFLSEL3_4 = (3 shl 3);</code>
| b011 = Receive FIFO becomes 3/4 full
+
| b011 = Receive FIFO becomes >= 3/4 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_RXIFLSEL7_8 = (4 shl 3);</code>
 
| <code>PL011_UART_IFLS_RXIFLSEL7_8 = (4 shl 3);</code>
| b100 = Receive FIFO becomes 7/8 full
+
| b100 = Receive FIFO becomes >= 7/8 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_TXIFLSEL = (7 shl 0);</code>
 
| <code>PL011_UART_IFLS_TXIFLSEL = (7 shl 0);</code>
Line 315: Line 323:
 
|-
 
|-
 
| <code>PL011_UART_IFLS_TXIFLSEL1_8 = (0 shl 0);</code>
 
| <code>PL011_UART_IFLS_TXIFLSEL1_8 = (0 shl 0);</code>
| b000 = Transmit FIFO becomes 1/8 full
+
| b000 = Transmit FIFO becomes <= 1/8 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_TXIFLSEL1_4 = (1 shl 0);</code>
 
| <code>PL011_UART_IFLS_TXIFLSEL1_4 = (1 shl 0);</code>
| b001 = Transmit FIFO becomes 1/4 full
+
| b001 = Transmit FIFO becomes <= 1/4 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_TXIFLSEL1_2 = (2 shl 0);</code>
 
| <code>PL011_UART_IFLS_TXIFLSEL1_2 = (2 shl 0);</code>
| b010 = Transmit FIFO becomes 1/2 full
+
| b010 = Transmit FIFO becomes <= 1/2 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_TXIFLSEL3_4 = (3 shl 0);</code>
 
| <code>PL011_UART_IFLS_TXIFLSEL3_4 = (3 shl 0);</code>
| b011 = Transmit FIFO becomes 3/4 full
+
| b011 = Transmit FIFO becomes <= 3/4 full
 
|-
 
|-
 
| <code>PL011_UART_IFLS_TXIFLSEL7_8 = (4 shl 0);</code>
 
| <code>PL011_UART_IFLS_TXIFLSEL7_8 = (4 shl 0);</code>
| b100 = Transmit FIFO becomes 7/8 full
+
| b100 = Transmit FIFO becomes <= 7/8 full
 
|-
 
|-
 
|}
 
|}
Line 333: Line 341:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART interrupt mask set/clear constants''' <code> PL011_UART_IMSC_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART interrupt mask set/clear''' <code> PL011_UART_IMSC_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 378: Line 386:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART raw interrupt status constants''' <code> PL011_UART_RIS_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART raw interrupt status''' <code> PL011_UART_RIS_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 423: Line 431:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART masked interrupt status constants''' <code> PL011_UART_MIS_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART masked interrupt status''' <code> PL011_UART_MIS_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 468: Line 476:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART interrupt clear constants''' <code> PL011_UART_ICR_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART interrupt clear''' <code> PL011_UART_ICR_* </code></div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 513: Line 521:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART DMA Control constants'''</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART DMA Control'''</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 527: Line 535:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART test control constants'''</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART test control'''</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 537: Line 545:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART integration test input constants'''</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART integration test input'''</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 547: Line 555:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART integration test output constants'''</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART integration test output'''</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 557: Line 565:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART test data constants'''</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''PL011 UART test data'''</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 570: Line 578:
 
----
 
----
  
''To be documented''
+
 
 +
'''PL011 UART registers'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PPL011UARTRegisters = ^TPL011UARTRegisters;</code>
 +
 
 +
<code>TPL011UARTRegisters = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Layout of the PL011 registers (See: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0183g/I18702.html))
 +
|-
 +
| <code>DR:LongWord;</code>
 +
| Data Register
 +
|-
 +
| <code>RSRECR:LongWord;</code>
 +
| Receive Status Register/Error Clear Register
 +
|-
 +
| <code>Reserved01:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved02:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved03:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved04:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FR:LongWord;</code>
 +
| Flag register
 +
|-
 +
| <code>Reserved05:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ILPR:LongWord;</code>
 +
| IrDA Low-Power Counter Register
 +
|-
 +
| <code>IBRD:LongWord;</code>
 +
| Integer Baud rate divisor
 +
|-
 +
| <code>FBRD:LongWord;</code>
 +
| Fractional Baud rate divisor
 +
|-
 +
| <code>LCRH:LongWord;</code>
 +
| Line Control register
 +
|-
 +
| <code>CR:LongWord;</code>
 +
| Control register
 +
|-
 +
| <code>IFLS:LongWord;</code>
 +
| Interrupt FIFO Level Select Register
 +
|-
 +
| <code>IMSC:LongWord;</code>
 +
| Interrupt Mask Set Clear Register
 +
|-
 +
| <code>RIS:LongWord;</code>
 +
| Raw Interrupt Status Register
 +
|-
 +
| <code>MIS:LongWord;</code>
 +
| Masked Interrupt Status Register
 +
|-
 +
| <code>ICR:LongWord;</code>
 +
| Interrupt Clear Register
 +
|-
 +
| <code>DMACR:LongWord;</code>
 +
| DMA Control Register
 +
|-
 +
| <code>Reserved11:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved12:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved13:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved14:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved15:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved16:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved17:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved18:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved19:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved1A:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved1B:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved1C:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Reserved1D:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ITCR:LongWord;</code>
 +
| Test Control Register
 +
|-
 +
| <code>ITIP:LongWord;</code>
 +
| Integration Test Input Register
 +
|-
 +
| <code>ITOP:LongWord;</code>
 +
| Integration Test Output Register
 +
|-
 +
| <code>TDR:LongWord;</code>
 +
| Test Data Register
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''PL011 UART properties'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PPL011UART = ^TPL011UART;</code>
 +
 
 +
<code>TPL011UART = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''UART Properties''
 +
|-
 +
| <code>UART:TUARTDevice;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''PL011 Properties''
 +
|-
 +
| <code>IRQ:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Lock:TSpinHandle;</code>
 +
| Device lock (Differs from lock in UART device) (Spin lock due to use by interrupt handler)
 +
|-
 +
| <code>ClockRate:LongWord;</code>
 +
| Device clock rate
 +
|-
 +
| <code>Registers:PPL011UARTRegisters;</code>
 +
| Device registers
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Start:LongWord;</code>
 +
| Index of first available buffer entry
 +
|-
 +
| <code>Count:LongWord;</code>
 +
| Number of available entries in the buffer
 +
|-
 +
| <code>Buffer:array[0..(PL011_UART_RX_BUFFER_SIZE - 1)] of Word;</code>
 +
| Buffer for received data (Includes data and status)
 +
|-
 +
|colspan="2"|''Statistics Properties''
 +
|-
 +
| <code>InterruptCount:LongWord;</code>
 +
| Number of interrupt requests received by the device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''PL011 specific variables'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>PL011_RX_IRQ_MASK:Boolean = False;</code>
 +
| style="width: 40%;"|If True then mask RX interrupts while RX FIFO is not empty (Allows for implementation variations)
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
Line 584: Line 770:
  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function PL011UARTCreate(Address:LongWord; const Name:String; IRQ,ClockRate:LongWord):PUARTDevice;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function PL011UARTCreate(Address:PtrUInt; const Name:String; IRQ,ClockRate:LongWord):PUARTDevice;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and register a new PL011 UART device which can be accessed using the UART API</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and register a new PL011 UART device which can be accessed using the UART API</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Address'''
+
! Address
 
| The address of the PL011 registers
 
| The address of the PL011 registers
 
|-
 
|-
! '''Name'''
+
! Name
 
| The text description of this device which will show in the device list (Optional)
 
| The text description of this device which will show in the device list (Optional)
 
|-
 
|-
! '''IRQ'''
+
! IRQ
 
| The interrupt number for the PL011
 
| The interrupt number for the PL011
 
|-
 
|-
! '''ClockRate'''
+
! ClockRate
 
| The clock source frequency for the PL011
 
| The clock source frequency for the PL011
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to the new UART device or nil if the UART device could not be created
 
| Pointer to the new UART device or nil if the UART device could not be created
 
|-
 
|-
Line 613: Line 799:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''UART'''
+
! UART
 
| The UART device to destroy
 
| The UART device to destroy
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 631: Line 817:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Not intended to be called directly by applications, use UARTDeviceOpen instead
+
| Not intended to be called directly by applications, use UARTDeviceOpen instead.
 
|-
 
|-
 
|}
 
|}
Line 643: Line 829:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Not intended to be called directly by applications, use UARTDeviceClose instead
+
| Not intended to be called directly by applications, use UARTDeviceClose instead.
 
|-
 
|-
 
|}
 
|}
Line 655: Line 841:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Not intended to be called directly by applications, use UARTDeviceRead instead
+
| Not intended to be called directly by applications, use UARTDeviceRead instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function PL011UARTPushRX(UART:PUARTDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 
|-
 
|-
 
|}
 
|}
Line 667: Line 865:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Not intended to be called directly by applications, use UARTDeviceWrite instead
+
| Not intended to be called directly by applications, use UARTDeviceWrite instead.
 
|-
 
|-
 
|}
 
|}
Line 674: Line 872:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function PL011UARTStatus(UART:PUARTDevice):LongWord;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function PL011UARTGetStatus(UART:PUARTDevice):LongWord;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of UARTDeviceStatus API for PL011 UART</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of UARTDeviceGetStatus API for PL011 UART</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Not intended to be called directly by applications, use UARTDeviceStatus instead
+
| Not intended to be called directly by applications, use UARTDeviceGetStatus instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function PL011UARTSetStatus(UART:PUARTDevice; Status:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of UARTDeviceSetStatus API for PL011 UART</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use UARTDeviceSetStatus instead.
 
|-
 
|-
 
|}
 
|}
Line 687: Line 897:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTInterruptHandler(UART:PUARTDevice);</pre>
 
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTInterruptHandler(UART:PUARTDevice);</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Interrupt handler for the PL011 UART device</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications
 
|-
 
|-
 
|}
 
|}
Line 699: Line 909:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTReceive(UART:PUARTDevice);</pre>
 
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTReceive(UART:PUARTDevice);</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Receive handler for the PL011 UART device</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications
 
|-
 
|-
 
|}
 
|}
Line 711: Line 921:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTTransmit(UART:PUARTDevice);</pre>
 
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTTransmit(UART:PUARTDevice);</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Transmit handler for the PL011 UART device</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| None documented
+
| Not intended to be called directly by applications
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTEnableInterrupt(UART:PPL011UART; Interrupt:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enable the specified interrupt in the interrupt mask register of a PL011 UART device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! UART
 +
| The PL011 UART device to enable the interrupt for
 +
|-
 +
! Interrupt
 +
| The interrupt to enable
 +
|-
 +
! Note
 +
| Caller must hold the UART lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure PL011UARTDisableInterrupt(UART:PPL011UART; Interrupt:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Disable the specified interrupt in the interrupt mask register of a PL011 UART device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Network
 +
| The PL011 UART device to disable the interrupt for
 +
|-
 +
! Interrupt
 +
| The interrupt to disable
 +
|-
 +
! Note
 +
| Caller must hold the UART lock
 
|-
 
|-
 
|}
 
|}

Latest revision as of 05:46, 31 August 2021

Return to Unit Reference


Description


ARM PrimeCell PL011 UART Driver unit

Constants



[Expand]
PL011 specific constants PL011_*


[Expand]
PL011 UART data PL011_UART_DR_*


[Expand]
PL011 UART receive status/error clear PL011_UART_RSRECR_*


[Expand]
PL011 UART flag PL011_UART_FR_*


[Expand]
PL011 UART integer baud rate divisor PL011_UART_IBRD_*


[Expand]
PL011 UART fractional baud rate divisor PL011_UART_FBRD_*


[Expand]
PL011 UART line control PL011_UART_LCRH_*


[Expand]
PL011 UART control PL011_UART_CR_*


[Expand]
PL011 UART interrupt FIFO level select PL011_UART_IFLS_*


[Expand]
PL011 UART interrupt mask set/clear PL011_UART_IMSC_*


[Expand]
PL011 UART raw interrupt status PL011_UART_RIS_*


[Expand]
PL011 UART masked interrupt status PL011_UART_MIS_*


[Expand]
PL011 UART interrupt clear PL011_UART_ICR_*


[Expand]
PL011 UART DMA Control






Type definitions



PL011 UART registers

[Expand]

PPL011UARTRegisters = ^TPL011UARTRegisters;

TPL011UARTRegisters = record

PL011 UART properties

[Expand]

PPL011UART = ^TPL011UART;

TPL011UART = record


Public variables



PL011 specific variables

PL011_RX_IRQ_MASK:Boolean = False; If True then mask RX interrupts while RX FIFO is not empty (Allows for implementation variations)


Function declarations



PL011 functions

[Expand]
function PL011UARTCreate(Address:PtrUInt; const Name:String; IRQ,ClockRate:LongWord):PUARTDevice;
Description: Create and register a new PL011 UART device which can be accessed using the UART API


[Expand]
function PL011UARTDestroy(UART:PUARTDevice):LongWord;
Description: Close, deregister and destroy a PL011 UART device created by this driver


PL011 UART functions

[Expand]
function PL011UARTOpen(UART:PUARTDevice; BaudRate,DataBits,StopBits,Parity,FlowControl:LongWord):LongWord;
Description: Implementation of UARTDeviceOpen API for PL011 UART


[Expand]
function PL011UARTClose(UART:PUARTDevice):LongWord;
Description: Implementation of UARTDeviceClose API for PL011 UART


[Expand]
function PL011UARTRead(UART:PUARTDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Implementation of UARTDeviceRead API for PL011 UART


[Expand]
function PL011UARTPushRX(UART:PUARTDevice):LongWord;
Description: To be documented


[Expand]
function PL011UARTWrite(UART:PUARTDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Implementation of UARTDeviceWrite API for PL011 UART


[Expand]
function PL011UARTGetStatus(UART:PUARTDevice):LongWord;
Description: Implementation of UARTDeviceGetStatus API for PL011 UART


[Expand]
function PL011UARTSetStatus(UART:PUARTDevice; Status:LongWord):LongWord;
Description: Implementation of UARTDeviceSetStatus API for PL011 UART


[Expand]
procedure PL011UARTInterruptHandler(UART:PUARTDevice);
Description: Interrupt handler for the PL011 UART device


[Expand]
procedure PL011UARTReceive(UART:PUARTDevice);
Description: Receive handler for the PL011 UART device


[Expand]
procedure PL011UARTTransmit(UART:PUARTDevice);
Description: Transmit handler for the PL011 UART device


[Expand]
procedure PL011UARTEnableInterrupt(UART:PPL011UART; Interrupt:LongWord);
Description: Enable the specified interrupt in the interrupt mask register of a PL011 UART device


[Expand]
procedure PL011UARTDisableInterrupt(UART:PPL011UART; Interrupt:LongWord);
Description: Disable the specified interrupt in the interrupt mask register of a PL011 UART device


Return to Unit Reference