Line 48... |
Line 48... |
*
|
*
|
* @return 0 if SLINK was not synthesized, 1 if SLINK is available.
|
* @return 0 if SLINK was not synthesized, 1 if SLINK is available.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_available(void) {
|
int neorv32_slink_available(void) {
|
|
|
if (SYSINFO_FEATURES & (1 << SYSINFO_FEATURES_IO_SLINK)) {
|
if (NEORV32_SYSINFO.SOC & (1 << SYSINFO_SOC_IO_SLINK)) {
|
return 1;
|
return 1;
|
}
|
}
|
else {
|
else {
|
return 0;
|
return 0;
|
}
|
}
|
Line 62... |
Line 62... |
/**********************************************************************//**
|
/**********************************************************************//**
|
* Activate stream link interface.
|
* Activate stream link interface.
|
**************************************************************************/
|
**************************************************************************/
|
void neorv32_slink_enable(void) {
|
void neorv32_slink_enable(void) {
|
|
|
SLINK_CT |= (uint32_t)(1 << SLINK_CT_EN);
|
NEORV32_SLINK.CTRL |= (uint32_t)(1 << SLINK_CTRL_EN);
|
}
|
}
|
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
* Deactivate stream link interface.
|
* Deactivate stream link interface.
|
*
|
*
|
* @note This will also clear all link FIFOs.
|
* @note This will also clear all link FIFOs.
|
**************************************************************************/
|
**************************************************************************/
|
void neorv32_slink_disable(void) {
|
void neorv32_slink_disable(void) {
|
|
|
SLINK_CT &= ~(uint32_t)(1 << SLINK_CT_EN);
|
NEORV32_SLINK.CTRL &= ~(uint32_t)(1 << SLINK_CTRL_EN);
|
}
|
}
|
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
* Get number of implemented RX links
|
* Get number of implemented RX links
|
Line 85... |
Line 85... |
* @return Number of implemented RX link (0..8).
|
* @return Number of implemented RX link (0..8).
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_get_rx_num(void) {
|
int neorv32_slink_get_rx_num(void) {
|
|
|
if (neorv32_slink_available()) {
|
if (neorv32_slink_available()) {
|
return (int)((SLINK_CT >> SLINK_CT_RX_NUM0) & 0xf);
|
return (int)((NEORV32_SLINK.CTRL >> SLINK_CTRL_RX_NUM0) & 0xf);
|
}
|
}
|
else {
|
else {
|
return 0;
|
return 0;
|
}
|
}
|
}
|
}
|
Line 101... |
Line 101... |
* @return Number of implemented TX link (0..8).
|
* @return Number of implemented TX link (0..8).
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_get_tx_num(void) {
|
int neorv32_slink_get_tx_num(void) {
|
|
|
if (neorv32_slink_available()) {
|
if (neorv32_slink_available()) {
|
return (int)((SLINK_CT >> SLINK_CT_TX_NUM0) & 0xf);
|
return (int)((NEORV32_SLINK.CTRL >> SLINK_CTRL_TX_NUM0) & 0xf);
|
}
|
}
|
else {
|
else {
|
return 0;
|
return 0;
|
}
|
}
|
}
|
}
|
Line 117... |
Line 117... |
* @return FIFO depth of RX links (1..32768); 0 if no RX links implemented.
|
* @return FIFO depth of RX links (1..32768); 0 if no RX links implemented.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_get_rx_depth(void) {
|
int neorv32_slink_get_rx_depth(void) {
|
|
|
if (neorv32_slink_available()) {
|
if (neorv32_slink_available()) {
|
uint32_t tmp = (SLINK_CT >> SLINK_CT_RX_FIFO_S0) & 0x0f;
|
uint32_t tmp = (NEORV32_SLINK.CTRL >> SLINK_CTRL_RX_FIFO_S0) & 0x0f;
|
return (int)(1 << tmp);
|
return (int)(1 << tmp);
|
}
|
}
|
else {
|
else {
|
return 0;
|
return 0;
|
}
|
}
|
Line 134... |
Line 134... |
* @return FIFO depth of TX links (1..32768); 0 if no TX links implemented.
|
* @return FIFO depth of TX links (1..32768); 0 if no TX links implemented.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_get_tx_depth(void) {
|
int neorv32_slink_get_tx_depth(void) {
|
|
|
if (neorv32_slink_available()) {
|
if (neorv32_slink_available()) {
|
uint32_t tmp = (SLINK_CT >> SLINK_CT_TX_FIFO_S0) & 0x0f;
|
uint32_t tmp = (NEORV32_SLINK.CTRL >> SLINK_CTRL_TX_FIFO_S0) & 0x0f;
|
return (int)(1 << tmp);
|
return (int)(1 << tmp);
|
}
|
}
|
else {
|
else {
|
return 0;
|
return 0;
|
}
|
}
|
Line 153... |
Line 153... |
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_check_rx_half_full(int link_id) {
|
int neorv32_slink_check_rx_half_full(int link_id) {
|
|
|
const uint32_t mask = 1 << SLINK_STATUS_RX0_HALF;
|
const uint32_t mask = 1 << SLINK_STATUS_RX0_HALF;
|
|
|
if (SLINK_STATUS & (mask << (link_id & 0x7))) {
|
if (NEORV32_SLINK.STATUS & (mask << (link_id & 0x7))) {
|
return 1;
|
return 1;
|
}
|
}
|
else {
|
else {
|
return 0;
|
return 0;
|
}
|
}
|
Line 172... |
Line 172... |
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_check_tx_half_full(int link_id) {
|
int neorv32_slink_check_tx_half_full(int link_id) {
|
|
|
const uint32_t mask = 1 << SLINK_STATUS_TX0_HALF;
|
const uint32_t mask = 1 << SLINK_STATUS_TX0_HALF;
|
|
|
if (SLINK_STATUS & (mask << (link_id & 0x7))) {
|
if (NEORV32_SLINK.STATUS & (mask << (link_id & 0x7))) {
|
return 1;
|
return 1;
|
}
|
}
|
else {
|
else {
|
return 0;
|
return 0;
|
}
|
}
|
Line 189... |
Line 189... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx0_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx0_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX0_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX0_FREE)) {
|
SLINK_CH0 = tx_data;
|
NEORV32_SLINK.DATA[0] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 205... |
Line 205... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx1_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx1_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX1_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX1_FREE)) {
|
SLINK_CH1 = tx_data;
|
NEORV32_SLINK.DATA[1] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 221... |
Line 221... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx2_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx2_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX2_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX2_FREE)) {
|
SLINK_CH2 = tx_data;
|
NEORV32_SLINK.DATA[2] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 237... |
Line 237... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx3_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx3_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX3_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX3_FREE)) {
|
SLINK_CH3 = tx_data;
|
NEORV32_SLINK.DATA[3] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 253... |
Line 253... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx4_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx4_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX4_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX4_FREE)) {
|
SLINK_CH4 = tx_data;
|
NEORV32_SLINK.DATA[4] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 269... |
Line 269... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx5_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx5_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX5_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX5_FREE)) {
|
SLINK_CH5 = tx_data;
|
NEORV32_SLINK.DATA[5] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 285... |
Line 285... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx6_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx6_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX6_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX6_FREE)) {
|
SLINK_CH6 = tx_data;
|
NEORV32_SLINK.DATA[6] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 301... |
Line 301... |
* @param[in] tx_data Data to send to link.
|
* @param[in] tx_data Data to send to link.
|
* @return 0 if data was send, 1 if link is still busy.
|
* @return 0 if data was send, 1 if link is still busy.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_tx7_nonblocking(uint32_t tx_data) {
|
int neorv32_slink_tx7_nonblocking(uint32_t tx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_TX7_FREE)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_TX7_FREE)) {
|
SLINK_CH7 = tx_data;
|
NEORV32_SLINK.DATA[7] = tx_data;
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 317... |
Line 317... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx0_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx0_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX0_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX0_AVAIL)) {
|
*rx_data = SLINK_CH0;
|
*rx_data = NEORV32_SLINK.DATA[0];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 333... |
Line 333... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx1_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx1_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX1_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX1_AVAIL)) {
|
*rx_data = SLINK_CH1;
|
*rx_data = NEORV32_SLINK.DATA[1];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 349... |
Line 349... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx2_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx2_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX2_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX2_AVAIL)) {
|
*rx_data = SLINK_CH2;
|
*rx_data = NEORV32_SLINK.DATA[2];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 365... |
Line 365... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx3_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx3_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX3_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX3_AVAIL)) {
|
*rx_data = SLINK_CH3;
|
*rx_data = NEORV32_SLINK.DATA[3];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 381... |
Line 381... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx4_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx4_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX4_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX4_AVAIL)) {
|
*rx_data = SLINK_CH4;
|
*rx_data = NEORV32_SLINK.DATA[4];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 397... |
Line 397... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx5_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx5_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX5_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX5_AVAIL)) {
|
*rx_data = SLINK_CH5;
|
*rx_data = NEORV32_SLINK.DATA[5];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 413... |
Line 413... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx6_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx6_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX6_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX6_AVAIL)) {
|
*rx_data = SLINK_CH6;
|
*rx_data = NEORV32_SLINK.DATA[6];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
Line 429... |
Line 429... |
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @param[in,out] rx_data Pointer to return read data. Only valid if function return value = 0.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
* @return 0 if data was received, 1 if there is no data to fetch.
|
**************************************************************************/
|
**************************************************************************/
|
int neorv32_slink_rx7_nonblocking(uint32_t *rx_data) {
|
int neorv32_slink_rx7_nonblocking(uint32_t *rx_data) {
|
|
|
if (SLINK_STATUS & (1 << SLINK_STATUS_RX7_AVAIL)) {
|
if (NEORV32_SLINK.STATUS & (1 << SLINK_STATUS_RX7_AVAIL)) {
|
*rx_data = SLINK_CH7;
|
*rx_data = NEORV32_SLINK.DATA[7];
|
return 0;
|
return 0;
|
}
|
}
|
return 1;
|
return 1;
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|