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

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

#include <neorv32.h>

Functions

int neorv32_xip_available (void)
 
void neorv32_xip_setup (int prsc, int cdiv, int cpol, int cpha, uint8_t rd_cmd)
 
int neorv32_xip_start (int abytes)
 
void neorv32_xip_highspeed_enable (void)
 
void neorv32_xip_highspeed_disable (void)
 
uint32_t neorv32_xip_get_clock_speed (void)
 
void neorv32_xip_spi_trans (int 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).
See also
https://stnolting.github.io/neorv32/sw/files.html

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_get_clock_speed()

uint32_t neorv32_xip_get_clock_speed ( void )

Get configured clock speed in Hz.

Returns
Actual configured XIP clock speed in Hz.

◆ 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()

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

Configure XIP module: configure SPI/flash 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). @prama[in] cdiv Clock divider (0..15).
[in]cpolSPI clock polarity (0/1).
[in]cphaSPI clock phase(0/1).
[in]rd_cmdSPI flash read byte command.

◆ neorv32_xip_spi_trans()

void neorv32_xip_spi_trans ( int 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 ( int abytes)

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).
Returns
0 if XIP configuration is OK, -1 if configuration error.