NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_slink.h File Reference

Stream Link Interface HW driver header file. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  neorv32_slink_t
 

Functions

Prototypes
int neorv32_slink_available (void)
 
void neorv32_slink_setup (uint32_t rx_irq, uint32_t tx_irq)
 
void neorv32_slink_rx_clear (void)
 
void neorv32_slink_tx_clear (void)
 
int neorv32_slink_get_rx_fifo_depth (void)
 
int neorv32_slink_get_tx_fifo_depth (void)
 
uint32_t neorv32_slink_get (void)
 
uint32_t neorv32_slink_check_last (void)
 
void neorv32_slink_set_dst (uint32_t dst)
 
uint32_t neorv32_slink_get_src (void)
 
void neorv32_slink_put (uint32_t tx_data)
 
void neorv32_slink_put_last (uint32_t tx_data)
 
int neorv32_slink_rx_status (void)
 
int neorv32_slink_tx_status (void)
 

IO Device: Stream Link Interface (SLINK)

#define NEORV32_SLINK   ((neorv32_slink_t*) (NEORV32_SLINK_BASE))
 
enum  NEORV32_SLINK_CTRL_enum {
  SLINK_CTRL_EN = 0 , SLINK_CTRL_RX_CLR = 1 , SLINK_CTRL_TX_CLR = 2 , SLINK_CTRL_RX_LAST = 4 ,
  SLINK_CTRL_RX_EMPTY = 8 , SLINK_CTRL_RX_HALF = 9 , SLINK_CTRL_RX_FULL = 10 , SLINK_CTRL_TX_EMPTY = 11 ,
  SLINK_CTRL_TX_HALF = 12 , SLINK_CTRL_TX_FULL = 13 , SLINK_CTRL_IRQ_RX_NEMPTY = 16 , SLINK_CTRL_IRQ_RX_HALF = 17 ,
  SLINK_CTRL_IRQ_RX_FULL = 18 , SLINK_CTRL_IRQ_TX_EMPTY = 19 , SLINK_CTRL_IRQ_TX_NHALF = 20 , SLINK_CTRL_IRQ_TX_NFULL = 21 ,
  SLINK_CTRL_RX_FIFO_LSB = 24 , SLINK_CTRL_RX_FIFO_MSB = 27 , SLINK_CTRL_TX_FIFO_LSB = 28 , SLINK_CTRL_TX_FIFO_MSB = 31
}
 
enum  NEORV32_SLINK_ROUTE_enum { SLINK_ROUTE_DST_LSB = 0 , SLINK_ROUTE_DST_MSB = 3 , SLINK_ROUTE_SRC_LSB = 4 , SLINK_ROUTE_SRC_MSB = 7 }
 
enum  NEORV32_SLINK_STATUS_enum { SLINK_FIFO_EMPTY = 0 , SLINK_FIFO_HALF = 1 , SLINK_FIFO_FULL = 2 }
 

Detailed Description

Stream Link Interface HW driver header file.

See also
https://stnolting.github.io/neorv32/sw/files.html

Macro Definition Documentation

◆ NEORV32_SLINK

#define NEORV32_SLINK   ((neorv32_slink_t*) (NEORV32_SLINK_BASE))

SLINK module hardware access (neorv32_slink_t)

Enumeration Type Documentation

◆ NEORV32_SLINK_CTRL_enum

SLINK control register bits

Enumerator
SLINK_CTRL_EN 

SLINK control register(0) (r/w): SLINK unit enable

SLINK_CTRL_RX_CLR 

SLINK control register(1) (-/w): Clear RX FIFO, auto-clears

SLINK_CTRL_TX_CLR 

SLINK control register(2) (-/w): Clear TX FIFO, auto-clears

SLINK_CTRL_RX_LAST 

SLINK control register(4) (r/-): RX end-of-stream delimiter

SLINK_CTRL_RX_EMPTY 

SLINK control register(8) (r/-): RX FIFO empty

SLINK_CTRL_RX_HALF 

SLINK control register(9) (r/-): RX FIFO at least half full

SLINK_CTRL_RX_FULL 

SLINK control register(10) (r/-): RX FIFO full

SLINK_CTRL_TX_EMPTY 

SLINK control register(11) (r/-): TX FIFO empty

SLINK_CTRL_TX_HALF 

SLINK control register(12) (r/-): TX FIFO at least half full

SLINK_CTRL_TX_FULL 

SLINK control register(13) (r/-): TX FIFO full

SLINK_CTRL_IRQ_RX_NEMPTY 

SLINK control register(16) (r/w): RX interrupt if RX FIFO not empty

SLINK_CTRL_IRQ_RX_HALF 

SLINK control register(17) (r/w): RX interrupt if RX FIFO at least half full

SLINK_CTRL_IRQ_RX_FULL 

SLINK control register(18) (r/w): RX interrupt if RX FIFO full

SLINK_CTRL_IRQ_TX_EMPTY 

SLINK control register(19) (r/w): TX interrupt if TX FIFO empty

SLINK_CTRL_IRQ_TX_NHALF 

SLINK control register(20) (r/w): TX interrupt if TX FIFO not at least half full

SLINK_CTRL_IRQ_TX_NFULL 

SLINK control register(21) (r/w): TX interrupt if TX FIFO not full

SLINK_CTRL_RX_FIFO_LSB 

SLINK control register(24) (r/-): log2(RX FIFO size) LSB

SLINK_CTRL_RX_FIFO_MSB 

SLINK control register(27) (r/-): log2(RX FIFO size) MSB

SLINK_CTRL_TX_FIFO_LSB 

SLINK control register(28) (r/-): log2(TX FIFO size) LSB

SLINK_CTRL_TX_FIFO_MSB 

SLINK control register(31) (r/-): log2(TX FIFO size) MSB

◆ NEORV32_SLINK_ROUTE_enum

ROUTE register bits

Enumerator
SLINK_ROUTE_DST_LSB 

SLINK routing register(0) (r/w): Destination routing information LSB

SLINK_ROUTE_DST_MSB 

SLINK routing register(3) (r/w): Destination routing information MSB

SLINK_ROUTE_SRC_LSB 

SLINK routing register(4) (r/-): Source routing information LSB

SLINK_ROUTE_SRC_MSB 

SLINK routing register(7) (r/-): Source routing information MSB

◆ NEORV32_SLINK_STATUS_enum

SLINK module hardware access (neorv32_slink_t)

Enumerator
SLINK_FIFO_EMPTY 

FIFO is empty

SLINK_FIFO_HALF 

FIFO is at least half full

SLINK_FIFO_FULL 

FIFO is full

Function Documentation

◆ neorv32_slink_available()

int neorv32_slink_available ( void )

Check if stream link interface was synthesized.

Returns
0 if SLINK was not synthesized, 1 if SLINK is available.

◆ neorv32_slink_check_last()

uint32_t neorv32_slink_check_last ( void )
inline

Check if last RX word has "end-of-stream" delimiter.

Note
This needs has to be called AFTER reading the actual data word using neorv32_slink_get(void).
Returns
0 if not end of stream, !=0 if end of stream.

◆ neorv32_slink_get()

uint32_t neorv32_slink_get ( void )
inline

Read data from RX link (non-blocking)

Returns
Data received from link.

◆ neorv32_slink_get_rx_fifo_depth()

int neorv32_slink_get_rx_fifo_depth ( void )

Get FIFO depth of RX link.

Returns
FIFO depth of RX link (1..32768).

◆ neorv32_slink_get_src()

uint32_t neorv32_slink_get_src ( void )
inline

Get RX link routing source

Note
This needs has to be called AFTER reading the actual data word using neorv32_slink_get(void).
Returns
4-bit source routing ID.

◆ neorv32_slink_get_tx_fifo_depth()

int neorv32_slink_get_tx_fifo_depth ( void )

Get FIFO depth of TX link.

Returns
FIFO depth of TX link (1..32768).

◆ neorv32_slink_put()

void neorv32_slink_put ( uint32_t tx_data)
inline

Write data to TX link (non-blocking)

Parameters
[in]tx_dataData to send to link.

◆ neorv32_slink_put_last()

void neorv32_slink_put_last ( uint32_t tx_data)
inline

Write data to TX link (non-blocking) and set "last" (end-of-stream) delimiter.

Parameters
[in]tx_dataData to send to link.

◆ neorv32_slink_rx_clear()

void neorv32_slink_rx_clear ( void )

Clear RX FIFO.

◆ neorv32_slink_rx_status()

int neorv32_slink_rx_status ( void )

Get RX link FIFO status.

Returns
FIFO status NEORV32_SLINK_STATUS_enum.

◆ neorv32_slink_set_dst()

void neorv32_slink_set_dst ( uint32_t dst)
inline

Set TX link routing destination

Parameters
[in]dstRouting destination ID (4-bit, LSB-aligned).

◆ neorv32_slink_setup()

void neorv32_slink_setup ( uint32_t rx_irq,
uint32_t tx_irq )

Reset, enable and configure SLINK.

Parameters
[in]rx_irqConfigure RX interrupt conditions (NEORV32_SLINK_CTRL_enum).
[in]tx_irqConfigure TX interrupt conditions (NEORV32_SLINK_CTRL_enum).

◆ neorv32_slink_tx_clear()

void neorv32_slink_tx_clear ( void )

Clear TX FIFO.

◆ neorv32_slink_tx_status()

int neorv32_slink_tx_status ( void )

Get TX link FIFO status.

Returns
FIFO status NEORV32_SLINK_STATUS_enum.