RP.PIO

Entities

Simple Types

Array Types

Record Types

Subtypes

Constants

Subprograms

Description

Ack_SM_IRQ

procedure Ack_SM_IRQ
   (This : Device;
    Flag : SM_IRQ_Flag)

Acknolege a state-machine-level IRQ

Parameters
This
Flag

Clear_FIFO_Status

procedure Clear_FIFO_Status
   (This  : Device;
    SM    : SM_Index;
    Flags : SM_FIFO_Status := (others => True))
Parameters
This
SM
Flags

Clear_FIFOs

procedure Clear_FIFOs
   (This    : Device;
    SM      : SM_Index)
Parameters
This
SM

Clear_Force_IRQ_Flag

procedure Clear_Force_IRQ_Flag
   (This : Device;
    IRQ  : PIO_IRQ_ID;
    SM   : SM_Index;
    Flag : PIO_IRQ_Flag)

Clear force a system-level IRQ

Parameters
This
IRQ
SM
Flag

Clear_Force_SM_IRQ

procedure Clear_Force_SM_IRQ
   (This : Device;
    Flag : SM_IRQ_Flag)

Clear force a state-machine-level IRQ

Parameters
This
Flag

Current_Instruction_Address

function Current_Instruction_Address
   (This : Device;
    SM   : SM_Index)
    return PIO_Address

Current instruction address of the given state machine.

Parameters
This
SM
Return Value

Default_SM_Config

function Default_SM_Config
   return SM_Config
Return Value

Device

type Device is range 0 .. RP.Device_Parameters.PIO_Count - 1;

Disable

procedure Disable
   (This : Device)
Parameters
This

Disable_IRQ_Flag

procedure Disable_IRQ_Flag
   (This : Device;
    IRQ  : PIO_IRQ_ID;
    SM   : SM_Index;
    Flag : PIO_IRQ_Flag)

Disable a system-level IRQ

Parameters
This
IRQ
SM
Flag

Disable_SM_IRQ_Flag

procedure Disable_SM_IRQ_Flag
   (This : Device;
    IRQ  : PIO_IRQ_ID;
    Flag : SM_IRQ_Flag)

Disable a system-level IRQ for SM IRQ flag 0..7. On RP2040, Flag must be in 0..3 or Constraint_Error is raised.

Parameters
This
IRQ
Flag

Divider

type Divider is delta Divider_Fraction
   range 0.0 .. (2.0 ** 16 - Divider_Fraction);

Divider_Fraction

Divider_Fraction : constant := 1.0 / 2.0 ** 8;

DMA_RX_Trigger

function DMA_RX_Trigger
   (This : Device;
    SM   : SM_Index)
    return RP.DMA.DMA_Request_Trigger
Parameters
This
SM
Return Value

DMA_TX_Trigger

function DMA_TX_Trigger
   (This : Device;
    SM   : SM_Index)
    return RP.DMA.DMA_Request_Trigger
Parameters
This
SM
Return Value

Enable

procedure Enable
   (This : Device)
Parameters
This

Enable_IRQ_Flag

procedure Enable_IRQ_Flag
   (This : Device;
    IRQ  : PIO_IRQ_ID;
    SM   : SM_Index;
    Flag : PIO_IRQ_Flag)

Enable a system-level IRQ

Parameters
This
IRQ
SM
Flag

Enable_SM_IRQ_Flag

procedure Enable_SM_IRQ_Flag
   (This : Device;
    IRQ  : PIO_IRQ_ID;
    Flag : SM_IRQ_Flag)

Enable a system-level IRQ for SM IRQ flag 0..7. On RP2040, Flag must be in 0..3 or Constraint_Error is raised.

Parameters
This
IRQ
Flag

Enabled

function Enabled
   (This : Device)
   return SM_Mask
Parameters
This
Return Value

Execute

procedure Execute
   (This        : Device;
    SM          : SM_Index;
    Instruction : PIO_Instruction)
Parameters
This
SM
Instruction

FIFO_Status

function FIFO_Status
   (This : Device;
    SM   : SM_Index)
    return SM_FIFO_Status
Parameters
This
SM
Return Value

Force_IRQ_Flag

procedure Force_IRQ_Flag
   (This : Device;
    IRQ  : PIO_IRQ_ID;
    SM   : SM_Index;
    Flag : PIO_IRQ_Flag)

Force a system-level IRQ

Parameters
This
IRQ
SM
Flag

Force_SM_IRQ

procedure Force_SM_IRQ
   (This : Device;
    Flag : SM_IRQ_Flag)

Force a state-machine-level IRQ

Parameters
This
Flag

Get

procedure Get
   (This : Device;
    SM   : SM_Index;
    Data : out UInt32)

Get one word from the RX FIFO of the given state machine. If the FIFO is empty, this call will run a busy loop until there's data available.

Parameters
This
SM
Data

Get

procedure Get
   (This : Device;
    SM   : SM_Index;
    Data : out UInt32_Array)

Get data from the RX FIFO of the given state machine. If the FIFO is empty, this call will run a busy loop until there's data available.

Parameters
This
SM
Data

GPIO_Function

function GPIO_Function
   (PIO : Device)
   return RP.GPIO.GPIO_Function
Parameters
PIO
Return Value

IRQ_Flag_Status

function IRQ_Flag_Status
   (This : Device;
    IRQ  : PIO_IRQ_ID;
    SM   : SM_Index;
    Flag : PIO_IRQ_Flag)
    return Boolean

Return True if a system-level IRQ is signaled (after masking and forcing)

Parameters
This
IRQ
SM
Flag
Return Value

Load

procedure Load
   (This   : Device;
    Prog   : Program;
    Offset : PIO_Address)
Parameters
This
Prog
Offset

MOV_Status_Type

type MOV_Status_Type is (TX_Less_Than, RX_Less_Than, IRQ_Flag);
Enumeration Literal
TX_Less_Than
RX_Less_Than
IRQ_Flag

Pin_Count

subtype Pin_Count is Natural range 0 .. 32;

Pin_Direction

type Pin_Direction is (Input, Output);
Enumeration Literal
Input
Output

PIO_Address

subtype PIO_Address is Natural range 0 .. 31;

PIO_Device

subtype PIO_Device is Device;

PIO_GPIO_Base

type PIO_GPIO_Base is range 0 .. 16
   with Static_Predicate => PIO_GPIO_Base = 0 or PIO_GPIO_Base = 16;

PIO_Instruction

subtype PIO_Instruction is UInt16;

PIO_IRQ_Flag

type PIO_IRQ_Flag is (RXNEMPTY, TXNFULL, SM_IRQ);
Enumeration Literal
RXNEMPTY
TXNFULL
SM_IRQ

PIO_IRQ_ID

type PIO_IRQ_ID is range 0 .. 1;

PIO_SM

subtype PIO_SM is SM_Index;

PIO_SM_Config

subtype PIO_SM_Config is SM_Config;

Program

type Program is array (PIO_Address range <>) of PIO_Instruction;

Put

procedure Put
   (This : Device;
    SM   : SM_Index;
    Data : UInt32)

Put one word in the TX FIFO of the given state machine. If the FIFO is full, this call will run a busy loop until there's room for the data.

Parameters
This
SM
Data

Put

procedure Put
   (This : Device;
    SM   : SM_Index;
    Data : UInt32_Array)

Put data in the TX FIFO of the given state machine. If the FIFO is full, this call will run a busy loop until there's room for the data.

Parameters
This
SM
Data

RX_FIFO_Address

function RX_FIFO_Address
   (This : Device;
    SM   : SM_Index)
   return System.Address
Parameters
This
SM
Return Value

RX_FIFO_Empty

function RX_FIFO_Empty
   (This : Device;
    SM   : SM_Index)
    return Boolean
Parameters
This
SM
Return Value

RX_FIFO_Full

function RX_FIFO_Full
   (This : Device;
    SM   : SM_Index)
    return Boolean
Parameters
This
SM
Return Value

Set_Clkdiv_Int_Frac

procedure Set_Clkdiv_Int_Frac
   (Config    : in out SM_Config;
    Div_Int   : UInt16;
    Div_Frac  : UInt8)
Parameters
Config
Div_Int
Div_Frac

Set_Clock_Divider

procedure Set_Clock_Divider
   (Config : in out SM_Config;
    Div    : Divider)
Parameters
Config
Div

Set_Clock_Frequency

procedure Set_Clock_Frequency
   (Config    : in out SM_Config;
    Frequency : Hertz)
Parameters
Config
Frequency

Set_Config

procedure Set_Config
   (This   : Device;
    SM     : SM_Index;
    Config : SM_Config)
Parameters
This
SM
Config

Set_Enabled

procedure Set_Enabled
   (This    : Device;
    SM      : SM_Index;
    Enabled : Boolean)
Parameters
This
SM
Enabled

Set_Enabled

procedure Set_Enabled
   (This : Device;
    SM   : SM_Mask)
Parameters
This
SM

Set_FIFO_Join

procedure Set_FIFO_Join
   (Config  : in out SM_Config;
    Join_TX : Boolean;
    Join_RX : Boolean)
Parameters
Config
Join_TX
Join_RX

Set_GPIO_Base

procedure Set_GPIO_Base
   (This : Device;
    Base : PIO_GPIO_Base)

PIO GPIO numbering can be offset by 0 or 16 pins on RP2350 On RP2040 this procedure raises an exception

Parameters
This
Base

Set_In_Pins

procedure Set_In_Pins
   (Config    : in out SM_Config;
    In_Base   : RP.GPIO.GPIO_Pin)
Parameters
Config
In_Base

Set_In_Shift

procedure Set_In_Shift
   (Config         : in out SM_Config;
    Shift_Right    : Boolean;
    Autopush       : Boolean;
    Push_Threshold : Shift_Threshold)
Parameters
Config
Shift_Right
Autopush
Push_Threshold

Set_Jmp_Pin

procedure Set_Jmp_Pin
   (Config : in out SM_Config;
    Pin    : RP.GPIO.GPIO_Pin)
Parameters
Config
Pin

Set_MOV_Status

procedure Set_MOV_Status
   (Config     : in out SM_Config;
    Status_Sel : MOV_Status_Type;
    Status_N   : UInt5)

Status_Sel = IRQ_Flag or Status_N > 15 not supported on RP2040

Parameters
Config
Status_Sel
Status_N

Set_Out_Pins

procedure Set_Out_Pins
   (Config    : in out SM_Config;
    Out_Base  : RP.GPIO.GPIO_Pin;
    Out_Count : Pin_Count)
Parameters
Config
Out_Base
Out_Count

Set_Out_Shift

procedure Set_Out_Shift
   (Config         : in out SM_Config;
    Shift_Right    : Boolean;
    Autopull       : Boolean;
    Pull_Threshold : Shift_Threshold)
Parameters
Config
Shift_Right
Autopull
Pull_Threshold

Set_Out_Special

procedure Set_Out_Special
   (Config           : in out SM_Config;
    Sticky           : Boolean;
    Has_Enable_Pin   : Boolean;
    Enable_Pin_Index : RP.GPIO.GPIO_Pin)
Parameters
Config
Sticky
Has_Enable_Pin
Enable_Pin_Index

Set_Pin_Direction

procedure Set_Pin_Direction
   (This      : Device;
    SM        : SM_Index;
    Pin       : RP.GPIO.GPIO_Pin;
    Direction : Pin_Direction)
Parameters
This
SM
Pin
Direction

Set_Set_Pins

procedure Set_Set_Pins
   (Config    : in out SM_Config;
    Set_Base  : RP.GPIO.GPIO_Pin;
    Set_Count : Pin_Count)
Parameters
Config
Set_Base
Set_Count

Set_Sideset

procedure Set_Sideset
   (Config    : in out SM_Config;
    Bit_Count : Sideset_Bit_Count;
    Optional  : Boolean;
    Pindirs   : Boolean)
Parameters
Config
Bit_Count
Optional
Pindirs

Set_Sideset_Pins

procedure Set_Sideset_Pins
   (Config       : in out SM_Config;
    Sideset_Base : RP.GPIO.GPIO_Pin)
Parameters
Config
Sideset_Base

Set_Wrap

procedure Set_Wrap
   (Config      : in out SM_Config;
    Wrap_Target : PIO_Address;
    Wrap        : PIO_Address)
Parameters
Config
Wrap_Target
Wrap

Shift_Threshold

subtype Shift_Threshold is Natural range 1 .. 32;

Sideset_Bit_Count

subtype Sideset_Bit_Count is Natural range 0 .. 5;

SM_Config

type SM_Config is private;

SM_FIFO_Status

type SM_FIFO_Status is record
   TXSTALL  : Boolean;
   TXOVER   : Boolean;
   RXUNDER  : Boolean;
   RXSTALL  : Boolean;
end record;
Record fields
TXSTALL

State machine has stalled on empty TX FIFO during a blocking PULL, or an OUT with autopull enabled.

TXOVER

TX FIFO overflow (i.e. write-on-full by the system) has occurred. Write-on-full does not alter the state or contents of the FIFO in any way, but the data that the system attempted to write is dropped, so if this flag is set, your software has quite likely dropped some data on the floor.

RXUNDER

RX FIFO underflow (i.e. read-on-empty by the system) has occurred. Read-on-empty does not perturb the state of the FIFO in any way, but the data returned by reading from an empty FIFO is undefined, so this flag generally only becomes set due to some kind of software error.

RXSTALL

State machine has stalled on full RX FIFO during a blocking PUSH, or an IN with autopush enabled. This flag is also set when a nonblocking PUSH to a full FIFO took place, in which case the state machine has dropped data.

SM_Index

type SM_Index is range 0 .. 3;

SM_Initialize

procedure SM_Initialize
   (This       : Device;
    SM         : SM_Index;
    Initial_PC : PIO_Address;
    Config     : SM_Config)
Parameters
This
SM
Initial_PC
Config

SM_IRQ_Flag

type SM_IRQ_Flag is range 0 .. 7;

SM_IRQ_Status

function SM_IRQ_Status
   (This : Device;
    Flag : SM_IRQ_Flag)
    return Boolean

Return True if a state-machine-level IRQ is signaled

Parameters
This
Flag
Return Value

SM_Mask

type SM_Mask is array (SM_Index) of Boolean
   with Size => 4, Component_Size => 1;

Try_Get

procedure Try_Get
   (This    : Device;
    SM      : SM_Index;
    Data    : out UInt32;
    Success : out Boolean)

Try to get one word from the RX FIFO of the given state machine. If the FIFO is empty, Success is set to False and Data is not set.

Parameters
This
SM
Data
Success

Try_Put

procedure Try_Put
   (This    : Device;
    SM      : SM_Index;
    Data    : UInt32;
    Success : out Boolean)

Try to put one word in the TX FIFO of the given state machine. If the FIFO is full, Success is set to False and the data not transmitted.

Parameters
This
SM
Data
Success

TX_FIFO_Address

function TX_FIFO_Address
   (This : Device;
    SM   : SM_Index)
   return System.Address
Parameters
This
SM
Return Value

TX_FIFO_Empty

function TX_FIFO_Empty
   (This : Device;
    SM   : SM_Index)
    return Boolean
Parameters
This
SM
Return Value

TX_FIFO_Full

function TX_FIFO_Full
   (This : Device;
    SM   : SM_Index)
    return Boolean
Parameters
This
SM
Return Value