src/dev/pl011.bend checks
raw source on the hub · import 0x52665ac86ffabb948213a4975b350ccb/src/dev/pl011.bend as Pl011
1 import
import Base
Types
type Pl011 source · line 20 · raw
Data
Pl011@ibrd:U32 -> @fbrd:U32 -> @lcr_h:U32 -> @cr:U32 -> @ifls:U32 -> @imsc:U32 -> @rx:List<&2, U32> -> Pl011
Definitions
def Pl011.pick source · line 32 · raw
@b:Bool -> @x:U32 -> @y:U32 -> U32
x when b holds, else y.
def Pl011.set source · line 40 · raw
@+off:U32 -> @k:U32 -> @mask:U32 -> @+v:U32 -> @old:U32 -> U32
A register write: the masked new value at offset k, else the old value.
def Pl011.fr source · line 45 · raw
@rx:List<&2, U32> -> U32
FR: TXFE always (instant TX, never BUSY or TXFF), RXFE when the FIFO is empty, RXFF when it holds 32 bytes.
def Pl011.ris source · line 53 · raw
@rx:List<&2, U32> -> U32
RIS: TX always; RX and RT while the FIFO is non-empty.
def Pl011.mis source · line 60 · raw
@+imsc:U32 -> @rx:List<&2, U32> -> U32
def Pl011.id source · line 64 · raw
@+off:U32 -> U32
PeriphID0..3 and PCellID0..3; 0 elsewhere.
def Pl011.peek source · line 75 · raw
@s:Pl011 -> @+off:U32 -> U32
A side-effect-free register read (every register but DR). RSR/ECR, ILPR and DMACR read 0: no receive errors, no IrDA, no DMA.
def Pl011.pop source · line 89 · raw
@s:Pl011 -> Pair(Pl011, U32)
A DR read: pops the oldest byte; an empty FIFO reads 0 and keeps its state.
def Pl011.read.go source · line 98 · raw
@is_dr:Bool -> @s:Pl011 -> @off:U32 -> Pair(Pl011, U32)
def Pl011.tx source · line 107 · raw
@is_dr:Bool -> @v:U32 -> List<&2, U32>
The bytes a write prints: the low byte of a DR write, nothing elsewhere.
def Pl011.write.go source · line 114 · raw
@s:Pl011 -> @+off:U32 -> @+v:U32 -> Pair(Pl011, List<&2, U32>)
def Pl011.new source · line 129 · raw
Pl011
The reset state: CR 768 (0x300, TXE | RXE), IFLS 18 (0x12), the rest 0.
def Pl011.read source · line 133 · raw
@s:Pl011 -> @off:U32 -> Pair(Pl011, U32)
Reads a 32-bit register; returns the new state (a DR read pops the FIFO).
def Pl011.write source · line 140 · raw
@s:Pl011 -> @off:U32 -> @v:U32 -> Pair(Pl011, List<&2, U32>)
Writes a 32-bit register; returns the new state and the bytes to print. Writing ICR clears nothing that would stay asserted (RX/RT follow the FIFO, TX is always pending).
def Pl011.push_rx source · line 146 · raw
@s:Pl011 -> @bytes:List<&2, U32> -> Pl011
Queues bytes typed on the host console, dropping those past the FIFO depth. The FIFO keeps its first max(32, |rx|) bytes of rx ++ bytes (a reachable state never holds more than 32, so that is 32).
def Pl011.room source · line 153 · raw
@s:Pl011 -> Nat
How many more bytes the receive FIFO takes.
def Pl011.irq source · line 159 · raw
@s:Pl011 -> Bool
The interrupt line's level: MIS (RIS & IMSC) is non-zero.