DIY Logging Volt/Ampmeter
Cache Functions
Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » | Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » | Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI) » | Floating Point Unit (FPU) » Core Debug Registers (CoreDebug) » Core register bit field macros » Core DefinitionsDefines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » | Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB)Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » | System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » | Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI) » | Floating Point Unit (FPU) » Core Debug Registers (CoreDebug) » Core register bit field macros » Core Definitions » | Functions and Instructions Reference » NVIC Functions » FPU Functions

Functions that configure Instruction and Data cache. More...

Modules

 SysTick Functions
 Functions that configure the System.
 
__STATIC_INLINE void SCB_EnableICache (void)
 Enable I-Cache. More...
 
__STATIC_INLINE void SCB_DisableICache (void)
 Disable I-Cache. More...
 
__STATIC_INLINE void SCB_InvalidateICache (void)
 Invalidate I-Cache. More...
 
__STATIC_INLINE void SCB_EnableDCache (void)
 Enable D-Cache. More...
 
__STATIC_INLINE void SCB_DisableDCache (void)
 Disable D-Cache. More...
 
__STATIC_INLINE void SCB_InvalidateDCache (void)
 Invalidate D-Cache. More...
 
__STATIC_INLINE void SCB_CleanDCache (void)
 Clean D-Cache. More...
 
__STATIC_INLINE void SCB_CleanInvalidateDCache (void)
 Clean & Invalidate D-Cache. More...
 
__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
 D-Cache Invalidate by address. More...
 
__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
 D-Cache Clean by address. More...
 
__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
 D-Cache Clean and Invalidate by address. More...
 
#define CCSIDR_WAYS(x)   (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos)
 
#define CCSIDR_SETS(x)   (((x) & SCB_CCSIDR_NUMSETS_Msk ) >> SCB_CCSIDR_NUMSETS_Pos )
 

Detailed Description

Functions that configure Instruction and Data cache.

Macro Definition Documentation

◆ CCSIDR_SETS

#define CCSIDR_SETS (   x)    (((x) & SCB_CCSIDR_NUMSETS_Msk ) >> SCB_CCSIDR_NUMSETS_Pos )

Definition at line 2222 of file core_cm7.h.

◆ CCSIDR_WAYS

#define CCSIDR_WAYS (   x)    (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos)

Definition at line 2221 of file core_cm7.h.

Function Documentation

◆ SCB_CleanDCache()

__STATIC_INLINE void SCB_CleanDCache ( void  )

Clean D-Cache.

Cleans D-Cache

Definition at line 2392 of file core_cm7.h.

2393 {
2394  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2395  uint32_t ccsidr;
2396  uint32_t sets;
2397  uint32_t ways;
2398 
2399  SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
2400  __DSB();
2401 
2402  ccsidr = SCB->CCSIDR;
2403 
2404  /* clean D-Cache */
2405  sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2406  do {
2407  ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
2408  do {
2409  SCB->DCCSW = (((sets << SCB_DCCSW_SET_Pos) & SCB_DCCSW_SET_Msk) |
2410  ((ways << SCB_DCCSW_WAY_Pos) & SCB_DCCSW_WAY_Msk) );
2411  #if defined ( __CC_ARM )
2412  __schedule_barrier();
2413  #endif
2414  } while (ways-- != 0U);
2415  } while(sets-- != 0U);
2416 
2417  __DSB();
2418  __ISB();
2419  #endif
2420 }

◆ SCB_CleanDCache_by_Addr()

__STATIC_INLINE void SCB_CleanDCache_by_Addr ( uint32_t *  addr,
int32_t  dsize 
)

D-Cache Clean by address.

Cleans D-Cache for the given address

Parameters
[in]addraddress (aligned to 32-byte boundary)
[in]dsizesize of memory block (in number of bytes)

Definition at line 2491 of file core_cm7.h.

2492 {
2493  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2494  int32_t op_size = dsize;
2495  uint32_t op_addr = (uint32_t) addr;
2496  int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2497 
2498  __DSB();
2499 
2500  while (op_size > 0) {
2501  SCB->DCCMVAC = op_addr;
2502  op_addr += (uint32_t)linesize;
2503  op_size -= linesize;
2504  }
2505 
2506  __DSB();
2507  __ISB();
2508  #endif
2509 }

◆ SCB_CleanInvalidateDCache()

__STATIC_INLINE void SCB_CleanInvalidateDCache ( void  )

Clean & Invalidate D-Cache.

Cleans and Invalidates D-Cache

Definition at line 2427 of file core_cm7.h.

2428 {
2429  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2430  uint32_t ccsidr;
2431  uint32_t sets;
2432  uint32_t ways;
2433 
2434  SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
2435  __DSB();
2436 
2437  ccsidr = SCB->CCSIDR;
2438 
2439  /* clean & invalidate D-Cache */
2440  sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2441  do {
2442  ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
2443  do {
2444  SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
2445  ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) );
2446  #if defined ( __CC_ARM )
2447  __schedule_barrier();
2448  #endif
2449  } while (ways-- != 0U);
2450  } while(sets-- != 0U);
2451 
2452  __DSB();
2453  __ISB();
2454  #endif
2455 }

◆ SCB_CleanInvalidateDCache_by_Addr()

__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr ( uint32_t *  addr,
int32_t  dsize 
)

D-Cache Clean and Invalidate by address.

Cleans and invalidates D_Cache for the given address

Parameters
[in]addraddress (aligned to 32-byte boundary)
[in]dsizesize of memory block (in number of bytes)

Definition at line 2518 of file core_cm7.h.

2519 {
2520  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2521  int32_t op_size = dsize;
2522  uint32_t op_addr = (uint32_t) addr;
2523  int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2524 
2525  __DSB();
2526 
2527  while (op_size > 0) {
2528  SCB->DCCIMVAC = op_addr;
2529  op_addr += (uint32_t)linesize;
2530  op_size -= linesize;
2531  }
2532 
2533  __DSB();
2534  __ISB();
2535  #endif
2536 }

◆ SCB_DisableDCache()

__STATIC_INLINE void SCB_DisableDCache ( void  )

Disable D-Cache.

Turns off D-Cache

Definition at line 2319 of file core_cm7.h.

2320 {
2321  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2322  uint32_t ccsidr;
2323  uint32_t sets;
2324  uint32_t ways;
2325 
2326  SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
2327  __DSB();
2328 
2329  SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; /* disable D-Cache */
2330  __DSB();
2331 
2332  ccsidr = SCB->CCSIDR;
2333 
2334  /* clean & invalidate D-Cache */
2335  sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2336  do {
2337  ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
2338  do {
2339  SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
2340  ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) );
2341  #if defined ( __CC_ARM )
2342  __schedule_barrier();
2343  #endif
2344  } while (ways-- != 0U);
2345  } while(sets-- != 0U);
2346 
2347  __DSB();
2348  __ISB();
2349  #endif
2350 }

◆ SCB_DisableICache()

__STATIC_INLINE void SCB_DisableICache ( void  )

Disable I-Cache.

Turns off I-Cache

Definition at line 2248 of file core_cm7.h.

2249 {
2250  #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
2251  __DSB();
2252  __ISB();
2253  SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk; /* disable I-Cache */
2254  SCB->ICIALLU = 0UL; /* invalidate I-Cache */
2255  __DSB();
2256  __ISB();
2257  #endif
2258 }

◆ SCB_EnableDCache()

__STATIC_INLINE void SCB_EnableDCache ( void  )

Enable D-Cache.

Turns on D-Cache

Definition at line 2281 of file core_cm7.h.

2282 {
2283  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2284  uint32_t ccsidr;
2285  uint32_t sets;
2286  uint32_t ways;
2287 
2288  SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
2289  __DSB();
2290 
2291  ccsidr = SCB->CCSIDR;
2292 
2293  /* invalidate D-Cache */
2294  sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2295  do {
2296  ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
2297  do {
2298  SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
2299  ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) );
2300  #if defined ( __CC_ARM )
2301  __schedule_barrier();
2302  #endif
2303  } while (ways-- != 0U);
2304  } while(sets-- != 0U);
2305  __DSB();
2306 
2307  SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; /* enable D-Cache */
2308 
2309  __DSB();
2310  __ISB();
2311  #endif
2312 }

◆ SCB_EnableICache()

__STATIC_INLINE void SCB_EnableICache ( void  )

Enable I-Cache.

Turns on I-Cache

Definition at line 2229 of file core_cm7.h.

2230 {
2231  #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
2232  __DSB();
2233  __ISB();
2234  SCB->ICIALLU = 0UL; /* invalidate I-Cache */
2235  __DSB();
2236  __ISB();
2237  SCB->CCR |= (uint32_t)SCB_CCR_IC_Msk; /* enable I-Cache */
2238  __DSB();
2239  __ISB();
2240  #endif
2241 }

◆ SCB_InvalidateDCache()

__STATIC_INLINE void SCB_InvalidateDCache ( void  )

Invalidate D-Cache.

Invalidates D-Cache

Definition at line 2357 of file core_cm7.h.

2358 {
2359  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2360  uint32_t ccsidr;
2361  uint32_t sets;
2362  uint32_t ways;
2363 
2364  SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
2365  __DSB();
2366 
2367  ccsidr = SCB->CCSIDR;
2368 
2369  /* invalidate D-Cache */
2370  sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2371  do {
2372  ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
2373  do {
2374  SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
2375  ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) );
2376  #if defined ( __CC_ARM )
2377  __schedule_barrier();
2378  #endif
2379  } while (ways-- != 0U);
2380  } while(sets-- != 0U);
2381 
2382  __DSB();
2383  __ISB();
2384  #endif
2385 }

◆ SCB_InvalidateDCache_by_Addr()

__STATIC_INLINE void SCB_InvalidateDCache_by_Addr ( uint32_t *  addr,
int32_t  dsize 
)

D-Cache Invalidate by address.

Invalidates D-Cache for the given address

Parameters
[in]addraddress (aligned to 32-byte boundary)
[in]dsizesize of memory block (in number of bytes)

Definition at line 2464 of file core_cm7.h.

2465 {
2466  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2467  int32_t op_size = dsize;
2468  uint32_t op_addr = (uint32_t)addr;
2469  int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2470 
2471  __DSB();
2472 
2473  while (op_size > 0) {
2474  SCB->DCIMVAC = op_addr;
2475  op_addr += (uint32_t)linesize;
2476  op_size -= linesize;
2477  }
2478 
2479  __DSB();
2480  __ISB();
2481  #endif
2482 }

◆ SCB_InvalidateICache()

__STATIC_INLINE void SCB_InvalidateICache ( void  )

Invalidate I-Cache.

Invalidates I-Cache

Definition at line 2265 of file core_cm7.h.

2266 {
2267  #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
2268  __DSB();
2269  __ISB();
2270  SCB->ICIALLU = 0UL;
2271  __DSB();
2272  __ISB();
2273  #endif
2274 }
SCB
#define SCB
Definition: core_cm7.h:1772
SCB_DCISW_WAY_Pos
#define SCB_DCISW_WAY_Pos
Definition: core_cm7.h:816
SCB_DCCSW_WAY_Msk
#define SCB_DCCSW_WAY_Msk
Definition: core_cm7.h:824
SCB_CCR_DC_Msk
#define SCB_CCR_DC_Msk
Definition: core_cm7.h:600
SCB_DCCSW_SET_Msk
#define SCB_DCCSW_SET_Msk
Definition: core_cm7.h:827
SCB_DCISW_SET_Pos
#define SCB_DCISW_SET_Pos
Definition: core_cm7.h:819
SCB_DCCISW_SET_Pos
#define SCB_DCCISW_SET_Pos
Definition: core_cm7.h:833
CCSIDR_WAYS
#define CCSIDR_WAYS(x)
Definition: core_cm7.h:2221
SCB_DCISW_WAY_Msk
#define SCB_DCISW_WAY_Msk
Definition: core_cm7.h:817
__ISB
#define __ISB()
Instruction Synchronization Barrier.
Definition: cmsis_armcc.h:418
SCB_DCCSW_WAY_Pos
#define SCB_DCCSW_WAY_Pos
Definition: core_cm7.h:823
SCB_DCCSW_SET_Pos
#define SCB_DCCSW_SET_Pos
Definition: core_cm7.h:826
CCSIDR_SETS
#define CCSIDR_SETS(x)
Definition: core_cm7.h:2222
SCB_CCR_IC_Msk
#define SCB_CCR_IC_Msk
Definition: core_cm7.h:597
SCB_DCISW_SET_Msk
#define SCB_DCISW_SET_Msk
Definition: core_cm7.h:820
SCB_DCCISW_WAY_Msk
#define SCB_DCCISW_WAY_Msk
Definition: core_cm7.h:831
__DSB
#define __DSB()
Data Synchronization Barrier.
Definition: cmsis_armcc.h:429
SCB_DCCISW_WAY_Pos
#define SCB_DCCISW_WAY_Pos
Definition: core_cm7.h:830
SCB_DCCISW_SET_Msk
#define SCB_DCCISW_SET_Msk
Definition: core_cm7.h:834