Difference between revisions of "Unit PL011"
From Ultibo.org
(8 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
'''ARM PrimeCell PL011 UART Driver unit''' | '''ARM PrimeCell PL011 UART Driver unit''' | ||
− | |||
− | |||
=== Constants === | === Constants === | ||
Line 58: | Line 56: | ||
|- | |- | ||
| <code>PL011_UART_CLOCK_RATE = 24000000;</code> | | <code>PL011_UART_CLOCK_RATE = 24000000;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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> | ||
| | | | ||
|- | |- | ||
Line 582: | Line 588: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| 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/ | + | |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> | | <code>DR:LongWord;</code> | ||
Line 713: | Line 719: | ||
| <code>IRQ:LongWord;</code> | | <code>IRQ:LongWord;</code> | ||
| | | | ||
+ | |- | ||
+ | | <code>Lock:TSpinHandle;</code> | ||
+ | | Device lock (Differs from lock in UART device) (Spin lock due to use by interrupt handler) | ||
|- | |- | ||
| <code>ClockRate:LongWord;</code> | | <code>ClockRate:LongWord;</code> | ||
Line 719: | Line 728: | ||
| <code>Registers:PPL011UARTRegisters;</code> | | <code>Registers:PPL011UARTRegisters;</code> | ||
| Device registers | | Device registers | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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'' | |colspan="2"|''Statistics Properties'' | ||
Line 732: | Line 752: | ||
---- | ---- | ||
− | '' | + | |
+ | '''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 741: | 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: | + | <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 |
| The address of the PL011 registers | | The address of the PL011 registers | ||
|- | |- | ||
− | ! | + | ! 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 |
| The interrupt number for the PL011 | | The interrupt number for the PL011 | ||
|- | |- | ||
− | ! | + | ! ClockRate |
| The clock source frequency for the PL011 | | The clock source frequency for the PL011 | ||
|- | |- | ||
− | ! | + | ! 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 770: | Line 799: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! UART |
| The UART device to destroy | | The UART device to destroy | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 788: | Line 817: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use UARTDeviceOpen instead | + | | Not intended to be called directly by applications, use UARTDeviceOpen instead. |
|- | |- | ||
|} | |} | ||
Line 800: | Line 829: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use UARTDeviceClose instead | + | | Not intended to be called directly by applications, use UARTDeviceClose instead. |
|- | |- | ||
|} | |} | ||
Line 812: | Line 841: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! 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 824: | Line 865: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! ''' | + | ! Note |
− | | Not intended to be called directly by applications, use | + | | Not intended to be called directly by applications, use UARTDeviceWrite 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 PL011UARTGetStatus(UART:PUARTDevice):LongWord;</pre> | ||
+ | <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;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use UARTDeviceGetStatus instead. | ||
|- | |- | ||
|} | |} | ||
Line 831: | Line 884: | ||
<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 | + | <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 | + | <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;"> | <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 |
− | | Not intended to be called directly by applications, use | + | | Not intended to be called directly by applications, use UARTDeviceSetStatus instead. |
|- | |- | ||
|} | |} | ||
Line 848: | Line 901: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 860: | Line 913: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 872: | Line 925: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 884: | Line 937: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! UART |
| The PL011 UART device to enable the interrupt for | | The PL011 UART device to enable the interrupt for | ||
|- | |- | ||
− | ! | + | ! Interrupt |
| The interrupt to enable | | The interrupt to enable | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the UART lock | | Caller must hold the UART lock | ||
|- | |- | ||
Line 902: | Line 955: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Network |
| The PL011 UART device to disable the interrupt for | | The PL011 UART device to disable the interrupt for | ||
|- | |- | ||
− | ! | + | ! Interrupt |
| The interrupt to disable | | The interrupt to disable | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the UART lock | | Caller must hold the UART lock | ||
|- | |- |
Latest revision as of 05:46, 31 August 2021
Return to Unit Reference
Contents
[hide]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
[Expand]
PL011 UART test control
[Expand]
PL011 UART integration test input
[Expand]
PL011 UART integration test output
[Expand]
PL011 UART test data
Type definitions
PL011 UART registers
PL011 UART properties
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 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