Initializing the cache support system. STMicroelectronics OS20
Quảng cáo
Quảng cáo
OS20 User Manual 12.2 Initializing the cache support system
12.2 Initializing the cache support system
Before any call is made to the cache handling routines, the cache control hardware needs to be configured and initialized in order that OS20 knows which hardware model is being targeted.
If the st20cc -runtime os20 command is used when linking, the cache controller is configured automatically before the user’s application starts to run.
If st20cc -runtime os20 is not used, the cache_init_controller function enables you to specify how the cache control hardware is configured:
#include <cache.h> void cache_init_controller( void* cache_controller, cache_map_data_t cache_map );
Both the cache controller address and the cache map are device-specific. The cache controller address can be obtained from the device datasheet. The correct cache map can be found in
Chapter 16: Alphabetical list of functions , function
cache_init_controller on page 126
.
Note: Some ST20 devices have two base addresses, one for the instruction cache and one for the data cache, for example the STm5700 and the STi5516. It is the base address of the instruction cache that should be passed to the cache_init_controller function.
12.3 Configuring the caches
On any ST20 device with a data cache the cache_config_data function is used to configure the data cache to treat certain blocks of memory as cacheable or non-cacheable.
Note: By default all configurable blocks are set to non-cacheable, therefore for all devices with a data cache, the use of the cache_config_data function is vital to achieve maximum performance.
#include <cache.h> int cache_config_data( void* start_address, void* end_address, cache_config_flags_t flags );
There are two types of ST20 instruction cache: configurable and fixed. A fixed instruction cache can only be enabled or disabled; it cannot be selectively applied to specific blocks of memory.
On devices which have a configurable instruction cache, the function cache_config_instruction is used to enable or disable specific blocks of memory. A configurable instruction cache, like the data cache, treats all configurable blocks as noncacheable by default. For devices with a configurable instruction cache the use of cache_config_instruction is necessary to achieve maximum performance.
#include <cache.h> int cache_config_instruction( void* start_address, void* end_address, cache_config_flags_t flags);
82
ADCS 7473749D
Tải xuống
Quảng cáo