NEORV32 - Software Framework Documentation
Functions
neorv32_xip.c File Reference

Execute in place module (XIP) HW driver source file. More...

#include "neorv32.h"
#include "neorv32_xip.h"

Functions

int neorv32_xip_available (void)
 
int neorv32_xip_setup (uint8_t prsc, uint8_t cpol, uint8_t cpha, uint8_t rd_cmd)
 
int neorv32_xip_start (uint8_t abytes, uint32_t page_base)
 
void neorv32_xip_highspeed_enable (void)
 
void neorv32_xip_highspeed_disable (void)
 
int neorv32_xip_spi_trans (uint8_t nbytes, uint64_t *rtx_data)
 

Detailed Description

Execute in place module (XIP) HW driver source file.

Note
These functions should only be used if the XIP module was synthesized (IO_XIP_EN = true).

Function Documentation

◆ neorv32_xip_available()

int neorv32_xip_available ( void  )

Check if XIP module was synthesized.

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

◆ neorv32_xip_highspeed_disable()

void neorv32_xip_highspeed_disable ( void  )

Disable high-speed SPI mode.

◆ neorv32_xip_highspeed_enable()

void neorv32_xip_highspeed_enable ( void  )

Enable high-speed SPI mode (running at half of the processor clock).

Note
High-speed SPI mode ignores the programmed clock prescaler configuration.

◆ neorv32_xip_setup()

int neorv32_xip_setup ( uint8_t  prsc,
uint8_t  cpol,
uint8_t  cpha,
uint8_t  rd_cmd 
)

Configure XIP module: configure SPI properties.

Warning
This will reset the XIP module overriding the CTRL register.
Note
This function will also send 64 dummy clocks via the SPI port (with chip-select disabled).
Parameters
[in]prscSPI clock prescaler select (0..7).
[in]cpolSPI clock polarity (0/1).
[in]cphaSPI clock phase(0/1).
[in]rd_cmdSPI flash read command.
Returns
0 if configuration is OK, -1 if configuration error.

◆ neorv32_xip_spi_trans()

int neorv32_xip_spi_trans ( uint8_t  nbytes,
uint64_t *  rtx_data 
)

Direct SPI access to the XIP flash.

Warning
This function can only be used BEFORE the XIP-mode is activated!
Note
This function is blocking.
Parameters
[in]nbytesNumber of bytes to transfer (1..8).
[in,out]rtx_dataPointer to 64-bit TX/RX data (MSB-aligned for sending, LSB-aligned for receiving (only 32-bit)).
Returns
0 if valid transfer, 1 if transfer configuration error.

◆ neorv32_xip_start()

int neorv32_xip_start ( uint8_t  abytes,
uint32_t  page_base 
)

Enable XIP mode (to allow CPU to transparently fetch data & instructions).

Parameters
[in]abytesNumber of address bytes used to access the SPI flash (1,2,3,4).
[in]page_baseXIP memory page base address (top 4 address bits, 0..15).
Returns
0 if XIP configuration is OK, -1 if configuration error.