Loading...
Searching...
No Matches
PIO Instructions

Macros for PIO (Programmable I/O) instructions. More...

Detailed Description

Macros for PIO (Programmable I/O) instructions.

Macros

#define PIO_JMP(cond, addr)
 JMP instruction encoding.
 
#define PIO_JMP_ALWAYS(addr)
 JMP - unconditional jump.
 
#define PIO_JMP_X_ZERO(addr)
 JMP !X - jump if X is zero.
 
#define PIO_JMP_X_DEC(addr)
 JMP X– - jump if X non-zero, then decrement X.
 
#define PIO_JMP_Y_ZERO(addr)
 JMP !Y - jump if Y is zero.
 
#define PIO_JMP_Y_DEC(addr)
 JMP Y– - jump if Y non-zero, then decrement Y.
 
#define PIO_JMP_X_NE_Y(addr)
 JMP X!=Y - jump if X not equal to Y.
 
#define PIO_JMP_PIN(addr)
 JMP PIN - jump if input pin is high.
 
#define PIO_JMP_OSRE_NOT_EMPTY(addr)
 JMP !OSRE - jump if OSR not empty.
 
#define PIO_WAIT(pol, src, index)
 WAIT instruction encoding.
 
#define PIO_WAIT_GPIO(pol, gpio)
 WAIT GPIO - wait on absolute GPIO pin.
 
#define PIO_WAIT_PIN(pol, pin)
 WAIT PIN - wait on mapped input pin.
 
#define PIO_WAIT_IRQ(pol, idxmode, irq)
 WAIT IRQ - wait on IRQ flag.
 
#define PIO_WAIT_IRQ_REL(pol, irq)
 WAIT IRQ with relative addressing.
 
#define PIO_WAIT_IRQ_PREV(pol, irq)
 WAIT IRQ on previous PIO block.
 
#define PIO_WAIT_IRQ_NEXT(pol, irq)
 WAIT IRQ on next PIO block.
 
#define PIO_WAIT_JMPPIN(pol, offset)
 WAIT JMPPIN - wait on jump pin.
 
#define PIO_IN(src, bitcount)
 IN instruction encoding.
 
#define PIO_IN_PINS(bits)
 IN PINS - shift bits from pins into ISR.
 
#define PIO_IN_X(bits)
 IN X - shift bits from X into ISR.
 
#define PIO_IN_Y(bits)
 IN Y - shift bits from Y into ISR.
 
#define PIO_IN_NULL(bits)
 IN NULL - shift zero bits into ISR.
 
#define PIO_IN_ISR(bits)
 IN ISR - shift bits from ISR into ISR.
 
#define PIO_IN_OSR(bits)
 IN OSR - shift bits from OSR into ISR.
 
#define PIO_OUT(dest, bitcount)
 OUT instruction encoding.
 
#define PIO_OUT_PINS(bits)
 OUT PINS - shift bits from OSR to pins.
 
#define PIO_OUT_X(bits)
 OUT X - shift bits from OSR to X.
 
#define PIO_OUT_Y(bits)
 OUT Y - shift bits from OSR to Y.
 
#define PIO_OUT_NULL(bits)
 OUT NULL - discard bits from OSR.
 
#define PIO_OUT_PINDIRS(bits)
 OUT PINDIRS - shift bits from OSR to pin directions.
 
#define PIO_OUT_PC(bits)
 OUT PC - shift bits from OSR to program counter (jump)
 
#define PIO_OUT_ISR(bits)
 OUT ISR - shift bits from OSR to ISR.
 
#define PIO_OUT_EXEC(bits)
 OUT EXEC - execute bits from OSR as instruction.
 
#define PIO_PUSH(iffull, block)
 PUSH instruction encoding.
 
#define PIO_PUSH_BLOCK()
 PUSH instruction - block by default.
 
#define PIO_PUSH_NOBLOCK()
 PUSH instruction - non-blocking.
 
#define PIO_PUSH_IFFULL()
 PUSH instruction - if full, blocking.
 
#define PIO_PUSH_IFFULL_NOBLOCK()
 PUSH instruction - if full, non-blocking.
 
#define PIO_PULL(ifempty, block)
 PULL instruction encoding.
 
#define PIO_PULL_BLOCK()
 PULL instruction - block by default.
 
#define PIO_PULL_NOBLOCK()
 PULL instruction - non-blocking.
 
#define PIO_PULL_IFEMPTY()
 PULL instruction - if empty, blocking.
 
#define PIO_PULL_IFEMPTY_NOBLOCK()
 PULL instruction - if empty, non-blocking.
 
#define PIO_MOV_RXFIFO_ISR(idxi, index)
 MOV to RX FIFO instruction encoding.
 
#define PIO_MOV_RXFIFO_Y_ISR()
 MOV rxfifo[y], isr - index by Y register.
 
#define PIO_MOV_RXFIFO_IDX_ISR(idx)
 MOV rxfifo[index], isr - index by immediate value.
 
#define PIO_MOV_OSR_RXFIFO(idxi, index)
 MOV from RX FIFO instruction encoding.
 
#define PIO_MOV_OSR_RXFIFO_Y()
 MOV osr, rxfifo[y] - index by Y register.
 
#define PIO_MOV_OSR_RXFIFO_IDX(idx)
 MOV osr, rxfifo[index] - index by immediate value.
 
#define PIO_MOV(dest, op, src)
 MOV instruction encoding.
 
#define PIO_IRQ(clr, wait, idxmode, index)
 IRQ instruction encoding.
 
#define PIO_IRQ_SET(num)
 IRQ set - raise IRQ without waiting.
 
#define PIO_IRQ_NOWAIT(num)
 IRQ nowait - raise IRQ without waiting (same as SET)
 
#define PIO_IRQ_WAIT(num)
 IRQ wait - raise IRQ and wait for it to be cleared.
 
#define PIO_IRQ_CLEAR(num)
 IRQ clear - clear IRQ flag.
 
#define PIO_IRQ_SET_REL(num)
 IRQ set with relative addressing.
 
#define PIO_IRQ_WAIT_REL(num)
 IRQ wait with relative addressing.
 
#define PIO_IRQ_SET_PREV(num)
 IRQ set targeting previous PIO block.
 
#define PIO_IRQ_SET_NEXT(num)
 IRQ set targeting next PIO block.
 
#define PIO_SET(dest, data)
 SET instruction encoding.
 
#define PIO_SET_PINS(val)
 SET pins - set pin values.
 
#define PIO_SET_X(val)
 SET x - set scratch register X.
 
#define PIO_SET_Y(val)
 SET y - set scratch register Y.
 
#define PIO_SET_PINDIRS(val)
 SET pindirs - set pin directions.
 

JMP instruction conditions

#define PIO_JMP_COND_ALWAYS   (0)
 Always jump.
 
#define PIO_JMP_COND_X_ZERO   (1)
 Jump if X is zero (!X)
 
#define PIO_JMP_COND_X_DEC   (2)
 Jump if X non-zero pre-decrement (X–)
 
#define PIO_JMP_COND_Y_ZERO   (3)
 Jump if Y is zero (!Y)
 
#define PIO_JMP_COND_Y_DEC   (4)
 Jump if Y non-zero pre-decrement (Y–)
 
#define PIO_JMP_COND_X_NE_Y   (5)
 Jump if X not equal Y.
 
#define PIO_JMP_COND_PIN   (6)
 Jump if input pin is high.
 
#define PIO_JMP_COND_OSRE_NOT_EMPTY   (7)
 Jump if OSR not empty (!OSRE)
 

WAIT instruction sources

#define PIO_WAIT_SRC_GPIO   (0)
 Wait on GPIO (absolute)
 
#define PIO_WAIT_SRC_PIN   (1)
 Wait on PIN (mapped)
 
#define PIO_WAIT_SRC_IRQ   (2)
 Wait on IRQ flag.
 
#define PIO_WAIT_SRC_JMPPIN   (3)
 Wait on JMPPIN.
 

WAIT IRQ index modes (decoded from 2 MSBs of index)

#define PIO_WAIT_IRQ_IDXMODE_DIRECT   (0)
 Direct indexing (0-7)
 
#define PIO_WAIT_IRQ_IDXMODE_PREV   (1)
 Previous PIO block.
 
#define PIO_WAIT_IRQ_IDXMODE_REL   (2)
 Relative (add state machine ID)
 
#define PIO_WAIT_IRQ_IDXMODE_NEXT   (3)
 Next PIO block.
 

IN instruction sources

#define PIO_IN_SRC_PINS   (0)
 PINS.
 
#define PIO_IN_SRC_X   (1)
 Scratch register X.
 
#define PIO_IN_SRC_Y   (2)
 Scratch register Y.
 
#define PIO_IN_SRC_NULL   (3)
 NULL (all zeroes)
 
#define PIO_IN_SRC_ISR   (6)
 Input shift register.
 
#define PIO_IN_SRC_OSR   (7)
 Output shift register.
 

OUT instruction destinations

#define PIO_OUT_DEST_PINS   (0)
 PINS.
 
#define PIO_OUT_DEST_X   (1)
 Scratch register X.
 
#define PIO_OUT_DEST_Y   (2)
 Scratch register Y.
 
#define PIO_OUT_DEST_NULL   (3)
 NULL (discard data)
 
#define PIO_OUT_DEST_PINDIRS   (4)
 PINDIRS.
 
#define PIO_OUT_DEST_PC   (5)
 Program counter.
 
#define PIO_OUT_DEST_ISR   (6)
 Input shift register.
 
#define PIO_OUT_DEST_EXEC   (7)
 Execute as instruction.
 

MOV instruction destinations

#define PIO_MOV_DEST_PINS   (0)
 PINS (uses same pin mapping as OUT)
 
#define PIO_MOV_DEST_X   (1)
 Scratch register X.
 
#define PIO_MOV_DEST_Y   (2)
 Scratch register Y.
 
#define PIO_MOV_DEST_PINDIRS   (3)
 PINDIRS (uses same pin mapping as OUT)
 
#define PIO_MOV_DEST_EXEC   (4)
 Execute data as instruction.
 
#define PIO_MOV_DEST_PC   (5)
 Program counter.
 
#define PIO_MOV_DEST_ISR   (6)
 Input shift register.
 
#define PIO_MOV_DEST_OSR   (7)
 Output shift register.
 

MOV instruction operations

#define PIO_MOV_OP_NONE   (0)
 No operation.
 
#define PIO_MOV_OP_INVERT   (1)
 Bitwise complement.
 
#define PIO_MOV_OP_BITREV   (2)
 Bit-reverse.
 

MOV instruction sources

#define PIO_MOV_SRC_PINS   (0)
 PINS (uses same pin mapping as IN)
 
#define PIO_MOV_SRC_X   (1)
 Scratch register X.
 
#define PIO_MOV_SRC_Y   (2)
 Scratch register Y.
 
#define PIO_MOV_SRC_NULL   (3)
 NULL (all zeroes)
 
#define PIO_MOV_SRC_STATUS   (5)
 STATUS (configured by EXECCTRL_STATUS_SEL)
 
#define PIO_MOV_SRC_ISR   (6)
 Input shift register.
 
#define PIO_MOV_SRC_OSR   (7)
 Output shift register.
 

IRQ instruction index modes

#define PIO_IRQ_IDXMODE_DIRECT   (0)
 Direct indexing (0-7)
 
#define PIO_IRQ_IDXMODE_PREV   (1)
 Previous PIO block.
 
#define PIO_IRQ_IDXMODE_REL   (2)
 Relative (add state machine ID)
 
#define PIO_IRQ_IDXMODE_NEXT   (3)
 Next PIO block.
 

SET instruction destinations

#define PIO_SET_DEST_PINS   (0)
 PINS.
 
#define PIO_SET_DEST_X   (1)
 Scratch register X.
 
#define PIO_SET_DEST_Y   (2)
 Scratch register Y.
 
#define PIO_SET_DEST_PINDIRS   (4)
 PINDIRS.
 

Macro Definition Documentation

◆ PIO_IN

#define PIO_IN ( src,
bitcount )
Value:
(0b0100000000000000 | (((src) & 0b111) << 5) | ((bitcount) & 0b11111))

IN instruction encoding.

Shift bit count bits from source into the ISR.

Parameters
[in]srcSource (PIO_IN_SRC_*)
[in]bitcountNumber of bits to shift (1-32, 32 encoded as 0)

Definition at line 230 of file pio.h.

◆ PIO_IN_ISR

#define PIO_IN_ISR ( bits)
Value:
PIO_IN(PIO_IN_SRC_ISR, (bits) & 0b11111)
#define PIO_IN(src, bitcount)
IN instruction encoding.
Definition pio.h:230
#define PIO_IN_SRC_ISR
Input shift register.
Definition pio.h:218

IN ISR - shift bits from ISR into ISR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 266 of file pio.h.

◆ PIO_IN_NULL

#define PIO_IN_NULL ( bits)
Value:
PIO_IN(PIO_IN_SRC_NULL, (bits) & 0b11111)
#define PIO_IN_SRC_NULL
NULL (all zeroes)
Definition pio.h:217

IN NULL - shift zero bits into ISR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 259 of file pio.h.

◆ PIO_IN_OSR

#define PIO_IN_OSR ( bits)
Value:
PIO_IN(PIO_IN_SRC_OSR, (bits) & 0b11111)
#define PIO_IN_SRC_OSR
Output shift register.
Definition pio.h:219

IN OSR - shift bits from OSR into ISR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 273 of file pio.h.

◆ PIO_IN_PINS

#define PIO_IN_PINS ( bits)
Value:
PIO_IN(PIO_IN_SRC_PINS, (bits) & 0b11111)
#define PIO_IN_SRC_PINS
PINS.
Definition pio.h:214

IN PINS - shift bits from pins into ISR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 238 of file pio.h.

◆ PIO_IN_SRC_ISR

#define PIO_IN_SRC_ISR   (6)

Input shift register.

Definition at line 218 of file pio.h.

◆ PIO_IN_SRC_NULL

#define PIO_IN_SRC_NULL   (3)

NULL (all zeroes)

Definition at line 217 of file pio.h.

◆ PIO_IN_SRC_OSR

#define PIO_IN_SRC_OSR   (7)

Output shift register.

Definition at line 219 of file pio.h.

◆ PIO_IN_SRC_PINS

#define PIO_IN_SRC_PINS   (0)

PINS.

Definition at line 214 of file pio.h.

◆ PIO_IN_SRC_X

#define PIO_IN_SRC_X   (1)

Scratch register X.

Definition at line 215 of file pio.h.

◆ PIO_IN_SRC_Y

#define PIO_IN_SRC_Y   (2)

Scratch register Y.

Definition at line 216 of file pio.h.

◆ PIO_IN_X

#define PIO_IN_X ( bits)
Value:
PIO_IN(PIO_IN_SRC_X, (bits) & 0b11111)
#define PIO_IN_SRC_X
Scratch register X.
Definition pio.h:215

IN X - shift bits from X into ISR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 245 of file pio.h.

◆ PIO_IN_Y

#define PIO_IN_Y ( bits)
Value:
PIO_IN(PIO_IN_SRC_Y, (bits) & 0b11111)
#define PIO_IN_SRC_Y
Scratch register Y.
Definition pio.h:216

IN Y - shift bits from Y into ISR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 252 of file pio.h.

◆ PIO_IRQ

#define PIO_IRQ ( clr,
wait,
idxmode,
index )
Value:
(0b1100000000000000 | ((clr) ? 0b0000000001000000 : 0) | ((wait) ? 0b0000000000100000 : 0) | \
(((idxmode) & 0b11) << 3) | ((index) & 0b111))

IRQ instruction encoding.

Set or clear the IRQ flag selected by index.

Parameters
[in]clrIf 1, clear the flag instead of raising it
[in]waitIf 1, halt until the raised flag is lowered again
[in]idxmodeIndex mode (PIO_IRQ_IDXMODE_*)
[in]indexIRQ index (0-7)

Definition at line 563 of file pio.h.

◆ PIO_IRQ_CLEAR

#define PIO_IRQ_CLEAR ( num)
Value:
#define PIO_IRQ(clr, wait, idxmode, index)
IRQ instruction encoding.
Definition pio.h:563
#define PIO_IRQ_IDXMODE_DIRECT
Direct indexing (0-7)
Definition pio.h:547

IRQ clear - clear IRQ flag.

Parameters
[in]numIRQ number (0-7)

Definition at line 593 of file pio.h.

◆ PIO_IRQ_IDXMODE_DIRECT

#define PIO_IRQ_IDXMODE_DIRECT   (0)

Direct indexing (0-7)

Definition at line 547 of file pio.h.

◆ PIO_IRQ_IDXMODE_NEXT

#define PIO_IRQ_IDXMODE_NEXT   (3)

Next PIO block.

Definition at line 550 of file pio.h.

◆ PIO_IRQ_IDXMODE_PREV

#define PIO_IRQ_IDXMODE_PREV   (1)

Previous PIO block.

Definition at line 548 of file pio.h.

◆ PIO_IRQ_IDXMODE_REL

#define PIO_IRQ_IDXMODE_REL   (2)

Relative (add state machine ID)

Definition at line 549 of file pio.h.

◆ PIO_IRQ_NOWAIT

#define PIO_IRQ_NOWAIT ( num)
Value:

IRQ nowait - raise IRQ without waiting (same as SET)

Parameters
[in]numIRQ number (0-7)

Definition at line 579 of file pio.h.

◆ PIO_IRQ_SET

#define PIO_IRQ_SET ( num)
Value:

IRQ set - raise IRQ without waiting.

Parameters
[in]numIRQ number (0-7)

Definition at line 572 of file pio.h.

◆ PIO_IRQ_SET_NEXT

#define PIO_IRQ_SET_NEXT ( num)
Value:
#define PIO_IRQ_IDXMODE_NEXT
Next PIO block.
Definition pio.h:550

IRQ set targeting next PIO block.

Parameters
[in]numIRQ number (0-7)

Definition at line 621 of file pio.h.

◆ PIO_IRQ_SET_PREV

#define PIO_IRQ_SET_PREV ( num)
Value:
#define PIO_IRQ_IDXMODE_PREV
Previous PIO block.
Definition pio.h:548

IRQ set targeting previous PIO block.

Parameters
[in]numIRQ number (0-7)

Definition at line 614 of file pio.h.

◆ PIO_IRQ_SET_REL

#define PIO_IRQ_SET_REL ( num)
Value:
#define PIO_IRQ_IDXMODE_REL
Relative (add state machine ID)
Definition pio.h:549

IRQ set with relative addressing.

Parameters
[in]numIRQ number (0-7), low 2 bits added to state machine ID

Definition at line 600 of file pio.h.

◆ PIO_IRQ_WAIT

#define PIO_IRQ_WAIT ( num)
Value:

IRQ wait - raise IRQ and wait for it to be cleared.

Parameters
[in]numIRQ number (0-7)

Definition at line 586 of file pio.h.

◆ PIO_IRQ_WAIT_REL

#define PIO_IRQ_WAIT_REL ( num)
Value:

IRQ wait with relative addressing.

Parameters
[in]numIRQ number (0-7), low 2 bits added to state machine ID

Definition at line 607 of file pio.h.

◆ PIO_JMP

#define PIO_JMP ( cond,
addr )
Value:
(0b0000000000000000 | (((cond) & 0b111) << 5) | ((addr) & 0b11111))

JMP instruction encoding.

Set program counter to address if condition is true.

Parameters
[in]condCondition (PIO_JMP_COND_*)
[in]addrTarget address (0-31)

Definition at line 48 of file pio.h.

◆ PIO_JMP_ALWAYS

#define PIO_JMP_ALWAYS ( addr)
Value:
#define PIO_JMP_COND_ALWAYS
Always jump.
Definition pio.h:30
#define PIO_JMP(cond, addr)
JMP instruction encoding.
Definition pio.h:48

JMP - unconditional jump.

Parameters
[in]addrTarget address (0-31)

Definition at line 56 of file pio.h.

◆ PIO_JMP_COND_ALWAYS

#define PIO_JMP_COND_ALWAYS   (0)

Always jump.

Definition at line 30 of file pio.h.

◆ PIO_JMP_COND_OSRE_NOT_EMPTY

#define PIO_JMP_COND_OSRE_NOT_EMPTY   (7)

Jump if OSR not empty (!OSRE)

Definition at line 37 of file pio.h.

◆ PIO_JMP_COND_PIN

#define PIO_JMP_COND_PIN   (6)

Jump if input pin is high.

Definition at line 36 of file pio.h.

◆ PIO_JMP_COND_X_DEC

#define PIO_JMP_COND_X_DEC   (2)

Jump if X non-zero pre-decrement (X–)

Definition at line 32 of file pio.h.

◆ PIO_JMP_COND_X_NE_Y

#define PIO_JMP_COND_X_NE_Y   (5)

Jump if X not equal Y.

Definition at line 35 of file pio.h.

◆ PIO_JMP_COND_X_ZERO

#define PIO_JMP_COND_X_ZERO   (1)

Jump if X is zero (!X)

Definition at line 31 of file pio.h.

◆ PIO_JMP_COND_Y_DEC

#define PIO_JMP_COND_Y_DEC   (4)

Jump if Y non-zero pre-decrement (Y–)

Definition at line 34 of file pio.h.

◆ PIO_JMP_COND_Y_ZERO

#define PIO_JMP_COND_Y_ZERO   (3)

Jump if Y is zero (!Y)

Definition at line 33 of file pio.h.

◆ PIO_JMP_OSRE_NOT_EMPTY

#define PIO_JMP_OSRE_NOT_EMPTY ( addr)
Value:
#define PIO_JMP_COND_OSRE_NOT_EMPTY
Jump if OSR not empty (!OSRE)
Definition pio.h:37

JMP !OSRE - jump if OSR not empty.

Parameters
[in]addrTarget address (0-31)

Definition at line 105 of file pio.h.

◆ PIO_JMP_PIN

#define PIO_JMP_PIN ( addr)
Value:
#define PIO_JMP_COND_PIN
Jump if input pin is high.
Definition pio.h:36

JMP PIN - jump if input pin is high.

Parameters
[in]addrTarget address (0-31)

Definition at line 98 of file pio.h.

◆ PIO_JMP_X_DEC

#define PIO_JMP_X_DEC ( addr)
Value:
#define PIO_JMP_COND_X_DEC
Jump if X non-zero pre-decrement (X–)
Definition pio.h:32

JMP X– - jump if X non-zero, then decrement X.

Parameters
[in]addrTarget address (0-31)

Definition at line 70 of file pio.h.

◆ PIO_JMP_X_NE_Y

#define PIO_JMP_X_NE_Y ( addr)
Value:
#define PIO_JMP_COND_X_NE_Y
Jump if X not equal Y.
Definition pio.h:35

JMP X!=Y - jump if X not equal to Y.

Parameters
[in]addrTarget address (0-31)

Definition at line 91 of file pio.h.

◆ PIO_JMP_X_ZERO

#define PIO_JMP_X_ZERO ( addr)
Value:
#define PIO_JMP_COND_X_ZERO
Jump if X is zero (!X)
Definition pio.h:31

JMP !X - jump if X is zero.

Parameters
[in]addrTarget address (0-31)

Definition at line 63 of file pio.h.

◆ PIO_JMP_Y_DEC

#define PIO_JMP_Y_DEC ( addr)
Value:
#define PIO_JMP_COND_Y_DEC
Jump if Y non-zero pre-decrement (Y–)
Definition pio.h:34

JMP Y– - jump if Y non-zero, then decrement Y.

Parameters
[in]addrTarget address (0-31)

Definition at line 84 of file pio.h.

◆ PIO_JMP_Y_ZERO

#define PIO_JMP_Y_ZERO ( addr)
Value:
#define PIO_JMP_COND_Y_ZERO
Jump if Y is zero (!Y)
Definition pio.h:33

JMP !Y - jump if Y is zero.

Parameters
[in]addrTarget address (0-31)

Definition at line 77 of file pio.h.

◆ PIO_MOV

#define PIO_MOV ( dest,
op,
src )
Value:
(0b1010000000000000 | (((dest) & 0b111) << 5) | (((op) & 0b11) << 3) | ((src) & 0b111))

MOV instruction encoding.

Copy data from Source to Destination.

Parameters
[in]destDestination (PIO_MOV_DEST_*)
[in]opOperation (PIO_MOV_OP_*)
[in]srcSource (PIO_MOV_SRC_*)

Definition at line 536 of file pio.h.

◆ PIO_MOV_DEST_EXEC

#define PIO_MOV_DEST_EXEC   (4)

Execute data as instruction.

Definition at line 499 of file pio.h.

◆ PIO_MOV_DEST_ISR

#define PIO_MOV_DEST_ISR   (6)

Input shift register.

Definition at line 501 of file pio.h.

◆ PIO_MOV_DEST_OSR

#define PIO_MOV_DEST_OSR   (7)

Output shift register.

Definition at line 502 of file pio.h.

◆ PIO_MOV_DEST_PC

#define PIO_MOV_DEST_PC   (5)

Program counter.

Definition at line 500 of file pio.h.

◆ PIO_MOV_DEST_PINDIRS

#define PIO_MOV_DEST_PINDIRS   (3)

PINDIRS (uses same pin mapping as OUT)

Definition at line 498 of file pio.h.

◆ PIO_MOV_DEST_PINS

#define PIO_MOV_DEST_PINS   (0)

PINS (uses same pin mapping as OUT)

Definition at line 495 of file pio.h.

◆ PIO_MOV_DEST_X

#define PIO_MOV_DEST_X   (1)

Scratch register X.

Definition at line 496 of file pio.h.

◆ PIO_MOV_DEST_Y

#define PIO_MOV_DEST_Y   (2)

Scratch register Y.

Definition at line 497 of file pio.h.

◆ PIO_MOV_OP_BITREV

#define PIO_MOV_OP_BITREV   (2)

Bit-reverse.

Definition at line 511 of file pio.h.

◆ PIO_MOV_OP_INVERT

#define PIO_MOV_OP_INVERT   (1)

Bitwise complement.

Definition at line 510 of file pio.h.

◆ PIO_MOV_OP_NONE

#define PIO_MOV_OP_NONE   (0)

No operation.

Definition at line 509 of file pio.h.

◆ PIO_MOV_OSR_RXFIFO

#define PIO_MOV_OSR_RXFIFO ( idxi,
index )
Value:
(0b1000000010010000 | ((idxi) ? 0b0000000000010000 : 0) | ((index) & 0b0000000000001111))

MOV from RX FIFO instruction encoding.

Read the selected RX FIFO entry into the OSR (indexed access). Requires SHIFTCTRL_FJOIN_RX_GET configuration.

Parameters
[in]idxiIf 1, index by immediate. If 0, index by Y register
[in]indexRX FIFO entry index (0-3) or 0 when indexing by Y

Definition at line 472 of file pio.h.

◆ PIO_MOV_OSR_RXFIFO_IDX

#define PIO_MOV_OSR_RXFIFO_IDX ( idx)
Value:
#define PIO_MOV_OSR_RXFIFO(idxi, index)
MOV from RX FIFO instruction encoding.
Definition pio.h:472

MOV osr, rxfifo[index] - index by immediate value.

Parameters
[in]idxRX FIFO entry index (0-3)

Definition at line 485 of file pio.h.

◆ PIO_MOV_OSR_RXFIFO_Y

#define PIO_MOV_OSR_RXFIFO_Y ( )
Value:

MOV osr, rxfifo[y] - index by Y register.

Definition at line 478 of file pio.h.

◆ PIO_MOV_RXFIFO_IDX_ISR

#define PIO_MOV_RXFIFO_IDX_ISR ( idx)
Value:
#define PIO_MOV_RXFIFO_ISR(idxi, index)
MOV to RX FIFO instruction encoding.
Definition pio.h:444

MOV rxfifo[index], isr - index by immediate value.

Parameters
[in]idxRX FIFO entry index (0-3)

Definition at line 457 of file pio.h.

◆ PIO_MOV_RXFIFO_ISR

#define PIO_MOV_RXFIFO_ISR ( idxi,
index )
Value:
(0b1000000000010000 | ((idxi) ? 0b0000000000010000 : 0) | ((index) & 0b0000000000001111))

MOV to RX FIFO instruction encoding.

Write the ISR to a selected RX FIFO entry (indexed access). Requires SHIFTCTRL_FJOIN_RX_PUT configuration.

Parameters
[in]idxiIf 1, index by immediate. If 0, index by Y register
[in]indexRX FIFO entry index (0-3) or 0 when indexing by Y

Definition at line 444 of file pio.h.

◆ PIO_MOV_RXFIFO_Y_ISR

#define PIO_MOV_RXFIFO_Y_ISR ( )
Value:

MOV rxfifo[y], isr - index by Y register.

Definition at line 450 of file pio.h.

◆ PIO_MOV_SRC_ISR

#define PIO_MOV_SRC_ISR   (6)

Input shift register.

Definition at line 523 of file pio.h.

◆ PIO_MOV_SRC_NULL

#define PIO_MOV_SRC_NULL   (3)

NULL (all zeroes)

Definition at line 521 of file pio.h.

◆ PIO_MOV_SRC_OSR

#define PIO_MOV_SRC_OSR   (7)

Output shift register.

Definition at line 524 of file pio.h.

◆ PIO_MOV_SRC_PINS

#define PIO_MOV_SRC_PINS   (0)

PINS (uses same pin mapping as IN)

Definition at line 518 of file pio.h.

◆ PIO_MOV_SRC_STATUS

#define PIO_MOV_SRC_STATUS   (5)

STATUS (configured by EXECCTRL_STATUS_SEL)

Definition at line 522 of file pio.h.

◆ PIO_MOV_SRC_X

#define PIO_MOV_SRC_X   (1)

Scratch register X.

Definition at line 519 of file pio.h.

◆ PIO_MOV_SRC_Y

#define PIO_MOV_SRC_Y   (2)

Scratch register Y.

Definition at line 520 of file pio.h.

◆ PIO_OUT

#define PIO_OUT ( dest,
bitcount )
Value:
(0b0110000000000000 | (((dest) & 0b111) << 5) | ((bitcount) & 0b11111))

OUT instruction encoding.

Shift bit count bits out of the OSR and write to destination.

Parameters
[in]destDestination (PIO_OUT_DEST_*)
[in]bitcountNumber of bits to shift (1-32, 32 encoded as 0)

Definition at line 301 of file pio.h.

◆ PIO_OUT_DEST_EXEC

#define PIO_OUT_DEST_EXEC   (7)

Execute as instruction.

Definition at line 290 of file pio.h.

◆ PIO_OUT_DEST_ISR

#define PIO_OUT_DEST_ISR   (6)

Input shift register.

Definition at line 289 of file pio.h.

◆ PIO_OUT_DEST_NULL

#define PIO_OUT_DEST_NULL   (3)

NULL (discard data)

Definition at line 286 of file pio.h.

◆ PIO_OUT_DEST_PC

#define PIO_OUT_DEST_PC   (5)

Program counter.

Definition at line 288 of file pio.h.

◆ PIO_OUT_DEST_PINDIRS

#define PIO_OUT_DEST_PINDIRS   (4)

PINDIRS.

Definition at line 287 of file pio.h.

◆ PIO_OUT_DEST_PINS

#define PIO_OUT_DEST_PINS   (0)

PINS.

Definition at line 283 of file pio.h.

◆ PIO_OUT_DEST_X

#define PIO_OUT_DEST_X   (1)

Scratch register X.

Definition at line 284 of file pio.h.

◆ PIO_OUT_DEST_Y

#define PIO_OUT_DEST_Y   (2)

Scratch register Y.

Definition at line 285 of file pio.h.

◆ PIO_OUT_EXEC

#define PIO_OUT_EXEC ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_EXEC, (bits) & 0b11111)
#define PIO_OUT_DEST_EXEC
Execute as instruction.
Definition pio.h:290
#define PIO_OUT(dest, bitcount)
OUT instruction encoding.
Definition pio.h:301

OUT EXEC - execute bits from OSR as instruction.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 358 of file pio.h.

◆ PIO_OUT_ISR

#define PIO_OUT_ISR ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_ISR, (bits) & 0b11111)
#define PIO_OUT_DEST_ISR
Input shift register.
Definition pio.h:289

OUT ISR - shift bits from OSR to ISR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 351 of file pio.h.

◆ PIO_OUT_NULL

#define PIO_OUT_NULL ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_NULL, (bits) & 0b11111)
#define PIO_OUT_DEST_NULL
NULL (discard data)
Definition pio.h:286

OUT NULL - discard bits from OSR.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 330 of file pio.h.

◆ PIO_OUT_PC

#define PIO_OUT_PC ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_PC, (bits) & 0b11111)
#define PIO_OUT_DEST_PC
Program counter.
Definition pio.h:288

OUT PC - shift bits from OSR to program counter (jump)

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 344 of file pio.h.

◆ PIO_OUT_PINDIRS

#define PIO_OUT_PINDIRS ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_PINDIRS, (bits) & 0b11111)
#define PIO_OUT_DEST_PINDIRS
PINDIRS.
Definition pio.h:287

OUT PINDIRS - shift bits from OSR to pin directions.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 337 of file pio.h.

◆ PIO_OUT_PINS

#define PIO_OUT_PINS ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_PINS, (bits) & 0b11111)
#define PIO_OUT_DEST_PINS
PINS.
Definition pio.h:283

OUT PINS - shift bits from OSR to pins.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 309 of file pio.h.

◆ PIO_OUT_X

#define PIO_OUT_X ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_X, (bits) & 0b11111)
#define PIO_OUT_DEST_X
Scratch register X.
Definition pio.h:284

OUT X - shift bits from OSR to X.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 316 of file pio.h.

◆ PIO_OUT_Y

#define PIO_OUT_Y ( bits)
Value:
PIO_OUT(PIO_OUT_DEST_Y, (bits) & 0b11111)
#define PIO_OUT_DEST_Y
Scratch register Y.
Definition pio.h:285

OUT Y - shift bits from OSR to Y.

Parameters
[in]bitsNumber of bits (1-32)

Definition at line 323 of file pio.h.

◆ PIO_PULL

#define PIO_PULL ( ifempty,
block )
Value:
(0b1000000010000000 | ((ifempty) ? 0b0000000001000000 : 0) | ((block) ? 0b0000000000100000 : 0))

PULL instruction encoding.

Load a 32-bit word from the TX FIFO into the OSR.

Parameters
[in]ifemptyIf 1, do nothing unless shift count reached threshold
[in]blockIf 1, stall if TX FIFO is empty. If 0, copy X to OSR

Definition at line 408 of file pio.h.

◆ PIO_PULL_BLOCK

#define PIO_PULL_BLOCK ( )
Value:
PIO_PULL(0, 1)
#define PIO_PULL(ifempty, block)
PULL instruction encoding.
Definition pio.h:408

PULL instruction - block by default.

Definition at line 414 of file pio.h.

◆ PIO_PULL_IFEMPTY

#define PIO_PULL_IFEMPTY ( )
Value:
PIO_PULL(1, 1)

PULL instruction - if empty, blocking.

Definition at line 424 of file pio.h.

◆ PIO_PULL_IFEMPTY_NOBLOCK

#define PIO_PULL_IFEMPTY_NOBLOCK ( )
Value:
PIO_PULL(1, 0)

PULL instruction - if empty, non-blocking.

Definition at line 429 of file pio.h.

◆ PIO_PULL_NOBLOCK

#define PIO_PULL_NOBLOCK ( )
Value:
PIO_PULL(0, 0)

PULL instruction - non-blocking.

Definition at line 419 of file pio.h.

◆ PIO_PUSH

#define PIO_PUSH ( iffull,
block )
Value:
(0b1000000000000000 | ((iffull) ? 0b0000000001000000 : 0) | ((block) ? 0b0000000000100000 : 0))

PUSH instruction encoding.

Push the contents of the ISR into the RX FIFO as a single 32-bit word. Clear ISR to all-zeroes.

Parameters
[in]iffullIf 1, do nothing unless shift count reached threshold
[in]blockIf 1, stall execution if RX FIFO is full

Definition at line 373 of file pio.h.

◆ PIO_PUSH_BLOCK

#define PIO_PUSH_BLOCK ( )
Value:
PIO_PUSH(0, 1)
#define PIO_PUSH(iffull, block)
PUSH instruction encoding.
Definition pio.h:373

PUSH instruction - block by default.

Definition at line 379 of file pio.h.

◆ PIO_PUSH_IFFULL

#define PIO_PUSH_IFFULL ( )
Value:
PIO_PUSH(1, 1)

PUSH instruction - if full, blocking.

Definition at line 389 of file pio.h.

◆ PIO_PUSH_IFFULL_NOBLOCK

#define PIO_PUSH_IFFULL_NOBLOCK ( )
Value:
PIO_PUSH(1, 0)

PUSH instruction - if full, non-blocking.

Definition at line 394 of file pio.h.

◆ PIO_PUSH_NOBLOCK

#define PIO_PUSH_NOBLOCK ( )
Value:
PIO_PUSH(0, 0)

PUSH instruction - non-blocking.

Definition at line 384 of file pio.h.

◆ PIO_SET

#define PIO_SET ( dest,
data )
Value:
(0b1110000000000000 | (((dest) & 0b111) << 5) | ((data) & 0b11111))

SET instruction encoding.

Write immediate value to destination.

Parameters
[in]destDestination (PIO_SET_DEST_*)
[in]data5-bit immediate value (0-31)

Definition at line 645 of file pio.h.

◆ PIO_SET_DEST_PINDIRS

#define PIO_SET_DEST_PINDIRS   (4)

PINDIRS.

Definition at line 634 of file pio.h.

◆ PIO_SET_DEST_PINS

#define PIO_SET_DEST_PINS   (0)

PINS.

Definition at line 631 of file pio.h.

◆ PIO_SET_DEST_X

#define PIO_SET_DEST_X   (1)

Scratch register X.

Definition at line 632 of file pio.h.

◆ PIO_SET_DEST_Y

#define PIO_SET_DEST_Y   (2)

Scratch register Y.

Definition at line 633 of file pio.h.

◆ PIO_SET_PINDIRS

#define PIO_SET_PINDIRS ( val)
Value:
#define PIO_SET_DEST_PINDIRS
PINDIRS.
Definition pio.h:634
#define PIO_SET(dest, data)
SET instruction encoding.
Definition pio.h:645

SET pindirs - set pin directions.

Parameters
[in]valValue to set (0-31)

Definition at line 674 of file pio.h.

◆ PIO_SET_PINS

#define PIO_SET_PINS ( val)
Value:
#define PIO_SET_DEST_PINS
PINS.
Definition pio.h:631

SET pins - set pin values.

Parameters
[in]valValue to set (0-31)

Definition at line 653 of file pio.h.

◆ PIO_SET_X

#define PIO_SET_X ( val)
Value:
#define PIO_SET_DEST_X
Scratch register X.
Definition pio.h:632

SET x - set scratch register X.

Parameters
[in]valValue to set (0-31)

Definition at line 660 of file pio.h.

◆ PIO_SET_Y

#define PIO_SET_Y ( val)
Value:
#define PIO_SET_DEST_Y
Scratch register Y.
Definition pio.h:633

SET y - set scratch register Y.

Parameters
[in]valValue to set (0-31)

Definition at line 667 of file pio.h.

◆ PIO_WAIT

#define PIO_WAIT ( pol,
src,
index )
Value:
(0b0010000000000000 | ((pol) ? 0b0000000010000000 : 0) | \
(((src) & 0b11) << 5) | ((index) & 0b11111))

WAIT instruction encoding.

Stall until some condition is met.

Parameters
[in]polPolarity: 1 to wait for 1, 0 to wait for 0
[in]srcSource (PIO_WAIT_SRC_*)
[in]indexIndex value (interpretation depends on source)

Definition at line 140 of file pio.h.

◆ PIO_WAIT_GPIO

#define PIO_WAIT_GPIO ( pol,
gpio )
Value:
PIO_WAIT((pol), PIO_WAIT_SRC_GPIO, (gpio))
#define PIO_WAIT_SRC_GPIO
Wait on GPIO (absolute)
Definition pio.h:115
#define PIO_WAIT(pol, src, index)
WAIT instruction encoding.
Definition pio.h:140

WAIT GPIO - wait on absolute GPIO pin.

Parameters
[in]polPolarity (0 or 1)
[in]gpioGPIO number

Definition at line 150 of file pio.h.

◆ PIO_WAIT_IRQ

#define PIO_WAIT_IRQ ( pol,
idxmode,
irq )
Value:
PIO_WAIT((pol), PIO_WAIT_SRC_IRQ, (((idxmode) & 0b11) << 3) | ((irq) & 0b111))
#define PIO_WAIT_SRC_IRQ
Wait on IRQ flag.
Definition pio.h:117

WAIT IRQ - wait on IRQ flag.

Parameters
[in]polPolarity (0 or 1)
[in]idxmodeIndex mode (PIO_WAIT_IRQ_IDXMODE_*)
[in]irqIRQ number (0-7)

Definition at line 167 of file pio.h.

◆ PIO_WAIT_IRQ_IDXMODE_DIRECT

#define PIO_WAIT_IRQ_IDXMODE_DIRECT   (0)

Direct indexing (0-7)

Definition at line 125 of file pio.h.

◆ PIO_WAIT_IRQ_IDXMODE_NEXT

#define PIO_WAIT_IRQ_IDXMODE_NEXT   (3)

Next PIO block.

Definition at line 128 of file pio.h.

◆ PIO_WAIT_IRQ_IDXMODE_PREV

#define PIO_WAIT_IRQ_IDXMODE_PREV   (1)

Previous PIO block.

Definition at line 126 of file pio.h.

◆ PIO_WAIT_IRQ_IDXMODE_REL

#define PIO_WAIT_IRQ_IDXMODE_REL   (2)

Relative (add state machine ID)

Definition at line 127 of file pio.h.

◆ PIO_WAIT_IRQ_NEXT

#define PIO_WAIT_IRQ_NEXT ( pol,
irq )
Value:
#define PIO_WAIT_IRQ_IDXMODE_NEXT
Next PIO block.
Definition pio.h:128
#define PIO_WAIT_IRQ(pol, idxmode, irq)
WAIT IRQ - wait on IRQ flag.
Definition pio.h:167

WAIT IRQ on next PIO block.

Parameters
[in]polPolarity (0 or 1)
[in]irqIRQ number (0-7)

Definition at line 194 of file pio.h.

◆ PIO_WAIT_IRQ_PREV

#define PIO_WAIT_IRQ_PREV ( pol,
irq )
Value:
#define PIO_WAIT_IRQ_IDXMODE_PREV
Previous PIO block.
Definition pio.h:126

WAIT IRQ on previous PIO block.

Parameters
[in]polPolarity (0 or 1)
[in]irqIRQ number (0-7)

Definition at line 185 of file pio.h.

◆ PIO_WAIT_IRQ_REL

#define PIO_WAIT_IRQ_REL ( pol,
irq )
Value:
#define PIO_WAIT_IRQ_IDXMODE_REL
Relative (add state machine ID)
Definition pio.h:127

WAIT IRQ with relative addressing.

Parameters
[in]polPolarity (0 or 1)
[in]irqIRQ number (0-7), low 2 bits added to state machine ID

Definition at line 176 of file pio.h.

◆ PIO_WAIT_JMPPIN

#define PIO_WAIT_JMPPIN ( pol,
offset )
Value:
PIO_WAIT((pol), PIO_WAIT_SRC_JMPPIN, (offset))
#define PIO_WAIT_SRC_JMPPIN
Wait on JMPPIN.
Definition pio.h:118

WAIT JMPPIN - wait on jump pin.

Parameters
[in]polPolarity (0 or 1)
[in]offsetOffset added to PINCTRL_JMP_PIN (0-3)

Definition at line 203 of file pio.h.

◆ PIO_WAIT_PIN

#define PIO_WAIT_PIN ( pol,
pin )
Value:
PIO_WAIT((pol), PIO_WAIT_SRC_PIN, (pin))
#define PIO_WAIT_SRC_PIN
Wait on PIN (mapped)
Definition pio.h:116

WAIT PIN - wait on mapped input pin.

Parameters
[in]polPolarity (0 or 1)
[in]pinPin number (mapped via PINCTRL_IN_BASE)

Definition at line 158 of file pio.h.

◆ PIO_WAIT_SRC_GPIO

#define PIO_WAIT_SRC_GPIO   (0)

Wait on GPIO (absolute)

Definition at line 115 of file pio.h.

◆ PIO_WAIT_SRC_IRQ

#define PIO_WAIT_SRC_IRQ   (2)

Wait on IRQ flag.

Definition at line 117 of file pio.h.

◆ PIO_WAIT_SRC_JMPPIN

#define PIO_WAIT_SRC_JMPPIN   (3)

Wait on JMPPIN.

Definition at line 118 of file pio.h.

◆ PIO_WAIT_SRC_PIN

#define PIO_WAIT_SRC_PIN   (1)

Wait on PIN (mapped)

Definition at line 116 of file pio.h.