Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
External Cache Controller

Interfaces for external cache controllers. More...

Files

file  cache.h
 Main header file for external cache controller driver API.

Functions

void cache_data_enable (void)
 Enable the d-cache.
void cache_data_disable (void)
 Disable the d-cache.
int cache_data_flush_all (void)
 Flush the d-cache.
int cache_data_invd_all (void)
 Invalidate the d-cache.
int cache_data_flush_and_invd_all (void)
 Flush and Invalidate the d-cache.
int cache_data_flush_range (void *addr, size_t size)
 Flush an address range in the d-cache.
int cache_data_invd_range (void *addr, size_t size)
 Invalidate an address range in the d-cache.
int cache_data_flush_and_invd_range (void *addr, size_t size)
 Flush and Invalidate an address range in the d-cache.
size_t cache_data_line_size_get (void)
 Get the d-cache line size.
void cache_instr_enable (void)
 Enable the i-cache.
void cache_instr_disable (void)
 Disable the i-cache.
int cache_instr_flush_all (void)
 Flush the i-cache.
int cache_instr_invd_all (void)
 Invalidate the i-cache.
int cache_instr_flush_and_invd_all (void)
 Flush and Invalidate the i-cache.
int cache_instr_flush_range (void *addr, size_t size)
 Flush an address range in the i-cache.
int cache_instr_invd_range (void *addr, size_t size)
 Invalidate an address range in the i-cache.
int cache_instr_flush_and_invd_range (void *addr, size_t size)
 Flush and Invalidate an address range in the i-cache.
size_t cache_instr_line_size_get (void)
 Get the i-cache line size.

Detailed Description

Interfaces for external cache controllers.

Since
2.6
Version
1.0.0

Function Documentation

◆ cache_data_disable()

void cache_data_disable ( void )

#include <cache.h>

Disable the d-cache.

Disable the data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.

◆ cache_data_enable()

void cache_data_enable ( void )

#include <cache.h>

Enable the d-cache.

Enable the data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.

◆ cache_data_flush_all()

int cache_data_flush_all ( void )

#include <cache.h>

Flush the d-cache.

Flush the whole data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_data_flush_and_invd_all()

int cache_data_flush_and_invd_all ( void )

#include <cache.h>

Flush and Invalidate the d-cache.

Flush and Invalidate the whole data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_data_flush_and_invd_range()

int cache_data_flush_and_invd_range ( void * addr,
size_t size )

#include <cache.h>

Flush and Invalidate an address range in the d-cache.

Flush and Invalidate the specified address range of the data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.
Note
the cache operations act on cache line. When multiple data structures share the same cache line being flushed, all the portions of the data structures sharing the same line will be flushed before being invalidated. This is usually not a problem because writing back is a non-destructive process that could be triggered by hardware at any time, so having an aligned addr or a padded size is not strictly necessary.
Parameters
addrStarting address to flush and invalidate.
sizeRange size.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_data_flush_range()

int cache_data_flush_range ( void * addr,
size_t size )

#include <cache.h>

Flush an address range in the d-cache.

Flush the specified address range of the data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.
Note
the cache operations act on cache line. When multiple data structures share the same cache line being flushed, all the portions of the data structures sharing the same line will be flushed. This is usually not a problem because writing back is a non-destructive process that could be triggered by hardware at any time, so having an aligned addr or a padded size is not strictly necessary.
Parameters
addrStarting address to flush.
sizeRange size.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_data_invd_all()

int cache_data_invd_all ( void )

#include <cache.h>

Invalidate the d-cache.

Invalidate the whole data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_data_invd_range()

int cache_data_invd_range ( void * addr,
size_t size )

#include <cache.h>

Invalidate an address range in the d-cache.

Invalidate the specified address range of the data cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE 
.
Note
the cache operations act on cache line. When multiple data structures share the same cache line being invalidated, all the portions of the non-read-only data structures sharing the same line will be invalidated as well. This is a destructive process that could lead to data loss and/or corruption. When addr is not aligned to the cache line and/or size is not a multiple of the cache line size the behaviour is undefined.
Parameters
addrStarting address to invalidate.
sizeRange size.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_data_line_size_get()

size_t cache_data_line_size_get ( void )

#include <cache.h>

Get the d-cache line size.

The API is provided to dynamically detect the data cache line size at run time.

The function must be implemented only when CONFIG_DCACHE_LINE_SIZE_DETECT is defined.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_DCACHE_LINE_SIZE_DETECT 
.
Return values
sizeSize of the d-cache line.
0The d-cache is not enabled.

◆ cache_instr_disable()

void cache_instr_disable ( void )

#include <cache.h>

Disable the i-cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.

Disable the instruction cache.

◆ cache_instr_enable()

void cache_instr_enable ( void )

#include <cache.h>

Enable the i-cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.

Enable the instruction cache.

◆ cache_instr_flush_all()

int cache_instr_flush_all ( void )

#include <cache.h>

Flush the i-cache.

Flush the whole instruction cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_instr_flush_and_invd_all()

int cache_instr_flush_and_invd_all ( void )

#include <cache.h>

Flush and Invalidate the i-cache.

Flush and Invalidate the whole instruction cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_instr_flush_and_invd_range()

int cache_instr_flush_and_invd_range ( void * addr,
size_t size )

#include <cache.h>

Flush and Invalidate an address range in the i-cache.

Flush and Invalidate the specified address range of the instruction cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.
Note
the cache operations act on cache line. When multiple data structures share the same cache line being flushed, all the portions of the data structures sharing the same line will be flushed before being invalidated. This is usually not a problem because writing back is a non-destructive process that could be triggered by hardware at any time, so having an aligned addr or a padded size is not strictly necessary.
Parameters
addrStarting address to flush and invalidate.
sizeRange size.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_instr_flush_range()

int cache_instr_flush_range ( void * addr,
size_t size )

#include <cache.h>

Flush an address range in the i-cache.

Flush the specified address range of the instruction cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.
Note
the cache operations act on cache line. When multiple data structures share the same cache line being flushed, all the portions of the data structures sharing the same line will be flushed. This is usually not a problem because writing back is a non-destructive process that could be triggered by hardware at any time, so having an aligned addr or a padded size is not strictly necessary.
Parameters
addrStarting address to flush.
sizeRange size.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_instr_invd_all()

int cache_instr_invd_all ( void )

#include <cache.h>

Invalidate the i-cache.

Invalidate the whole instruction cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_instr_invd_range()

int cache_instr_invd_range ( void * addr,
size_t size )

#include <cache.h>

Invalidate an address range in the i-cache.

Invalidate the specified address range of the instruction cache.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE 
.
Note
the cache operations act on cache line. When multiple data structures share the same cache line being invalidated, all the portions of the non-read-only data structures sharing the same line will be invalidated as well. This is a destructive process that could lead to data loss and/or corruption. When addr is not aligned to the cache line and/or size is not a multiple of the cache line size the behaviour is undefined.
Parameters
addrStarting address to invalidate.
sizeRange size.
Returns
0 on success, negative errno value on failure.
Return values
-ENOTSUPNot supported.

◆ cache_instr_line_size_get()

size_t cache_instr_line_size_get ( void )

#include <cache.h>

Get the i-cache line size.

The API is provided to dynamically detect the instruction cache line size at run time.

The function must be implemented only when

CONFIG_ICACHE_LINE_SIZE_DETECT 

is defined.

Attention
Available only when the following Kconfig option is enabled:
CONFIG_ICACHE_LINE_SIZE_DETECT 
.
Return values
sizeSize of the i-cache line.
0The i-cache is not enabled.