XCORE SDK
XCORE Software Development Kit
Macros | Functions
rtos_swmem_driver

Macros

#define RTOS_SWMEM_READ_FLAG   0x01
 
#define RTOS_SWMEM_WRITE_FLAG   0x02
 

Functions

bool rtos_swmem_read_request_isr (unsigned offset, uint32_t *buf)
 
bool rtos_swmem_write_request_isr (unsigned offset, uint32_t dirty_mask, const uint32_t *buf)
 
void rtos_swmem_read_request (unsigned offset, uint32_t *buf)
 
void rtos_swmem_write_request (unsigned offset, uint32_t dirty_mask, const uint32_t *buf)
 
void rtos_swmem_start (unsigned priority)
 
void rtos_swmem_init (uint32_t init_flags)
 
unsigned int rtos_swmem_offset_get ()
 

Detailed Description

The public API for using the RTOS software memory driver.

Macro Definition Documentation

◆ RTOS_SWMEM_READ_FLAG

#define RTOS_SWMEM_READ_FLAG   0x01

Flag indicating that software memory reads should be enabled. This should probably always be set when using software memory.

◆ RTOS_SWMEM_WRITE_FLAG

#define RTOS_SWMEM_WRITE_FLAG   0x02

Flag indicating that software memory writes should be enabled. This will not always need to be set, especially if flash is backing the software memory and intended to be read only.

Function Documentation

◆ rtos_swmem_init()

void rtos_swmem_init ( uint32_t  init_flags)

Initializes the software memory for use by the RTOS software memory driver.

Parameters
init_flagsA bitfield consisting of initialization flags.
  • RTOS_SWMEM_READ_FLAG enables swmem reads.
  • RTOS_SWMEM_WRITE_FLAG enables swmem writes.

◆ rtos_swmem_offset_get()

unsigned int rtos_swmem_offset_get ( )

Return the offset from XS1_SWMEM_BASE to the start of the software memory.

◆ rtos_swmem_read_request()

void rtos_swmem_read_request ( unsigned  offset,
uint32_t *  buf 
)

Services a software memory read request from within the software memory RTOS thread. This function may be provided by the application when the software memory driver is initialized with the RTOS_SWMEM_READ_FLAG flag. If rtos_swmem_read_request_isr() is also implemented, then it will be called first. If it is unable to satisfy the request, then this handler will be called. See the description for rtos_swmem_read_request_isr().

Parameters
offsetThe byte offset into the software memory of the cache line that has had a cache miss.
bufThis function must fill this with SWMEM_EVICT_SIZE_WORDS words of data. Where this data comes from is up to the application. One example is from a flash memory.

◆ rtos_swmem_read_request_isr()

bool rtos_swmem_read_request_isr ( unsigned  offset,
uint32_t *  buf 
)

Services a software memory read request from within the software memory fill interrupt handler. This function may be provided by the application when the software memory driver is initialized with the RTOS_SWMEM_READ_FLAG flag. If the application code to satisfy a fill request requires being run from within an RTOS thread, then rtos_swmem_read_request() should be used instead. Both this handler and rtos_swmem_read_request() may be used together. If the ISR handler is able to satisfy the request it should return true. If it is not, but the request can be satisfied from within rtos_swmem_read_request(), then it should return false.

Parameters
offsetThe byte offset into the software memory of the cache line that has had a cache miss.
bufThis function must fill this with SWMEM_EVICT_SIZE_WORDS words of data. Where this data comes from is up to the application. One example is from a flash memory.
Return values
trueif the fill request was satisfied.
falseif the fill request was not satisfied. This requires that rtos_swmem_read_request() also be provided.

◆ rtos_swmem_start()

void rtos_swmem_start ( unsigned  priority)

Starts the RTOS software memory driver.

Parameters
priorityThe priority of the task that gets created by the driver to service the software memory.

◆ rtos_swmem_write_request()

void rtos_swmem_write_request ( unsigned  offset,
uint32_t  dirty_mask,
const uint32_t *  buf 
)

Services a software memory write request from within the software memory RTOS thread. This function may be provided by the application when the software memory driver is initialized with the RTOS_SWMEM_WRITE_FLAG flag. If rtos_swmem_write_request_isr() is also implemented, then it will be called first. If it is unable to satisfy the request, then this handler will be called. See the description for rtos_swmem_write_request_isr().

Parameters
offsetThe byte offset into the software memory of the cache line that is being evicted.
dirty_maskA bytewise dirty mask for the data in buf. The least significant bit corresponds to the lowest byte address in buf and each subsequent byte address corresponds to the next least significant bit.
bufA pointer to a buffer containing SWMEM_EVICT_SIZE_WORDS words of data from the cache line being evicted. It is up to the application what it does with this data. One example is to write it to flash memory.

◆ rtos_swmem_write_request_isr()

bool rtos_swmem_write_request_isr ( unsigned  offset,
uint32_t  dirty_mask,
const uint32_t *  buf 
)

Services a software memory write request from within the software memory fill interrupt handler. This function may be provided by the application when the software memory driver is initialized with the RTOS_SWMEM_WRITE_FLAG flag. If the application code to satisfy an evict request requires being run from within an RTOS thread, then rtos_swmem_write_request() should be used instead. Both this handler and rtos_swmem_write_request() may be used together. If the ISR handler is able to satisfy the request it should return true. If it is not, but the request can be satisfied from within rtos_swmem_write_request(), then it should return false.

Parameters
offsetThe byte offset into the software memory of the cache line that is being evicted.
dirty_maskA bytewise dirty mask for the data in buf. The least significant bit corresponds to the lowest byte address in buf and each subsequent byte address corresponds to the next least significant bit.
bufA pointer to a buffer containing SWMEM_EVICT_SIZE_WORDS words of data from the cache line being evicted. It is up to the application what it does with this data. One example is to write it to flash memory.
Return values
trueif the evict request was satisifed.
falseif the evict request was not satisfied. This requires that rtos_swmem_write_request() also be provided.