OpenOCD
armv7m_cache.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /*
4  * Copyright (C) 2025 by STMicroelectronics
5  * Copyright (C) 2025 by Antonio Borneo <borneo.antonio@gmail.com>
6  */
7 
8 #ifndef OPENOCD_TARGET_ARMV7M_CACHE_H
9 #define OPENOCD_TARGET_ARMV7M_CACHE_H
10 
11 #include <stdbool.h>
12 #include <stdint.h>
13 
14 #include <helper/types.h>
15 
16 struct target;
17 
19  // cache dimensioning
20  uint32_t line_len;
21  uint32_t associativity;
22  uint32_t num_sets;
23  uint32_t cache_size;
24  // info for set way operation on cache
25  uint32_t index;
26  uint32_t index_shift;
27  uint32_t way;
28  uint32_t way_shift;
29 };
30 
31 // information about one architecture cache at any level
33  unsigned int ctype; // cache type, CLIDR encoding
34  struct armv7m_cache_size d_u_size; // data cache
35  struct armv7m_cache_size i_size; // instruction cache
36 };
37 
38 // common cache information
40  bool info_valid;
43  unsigned int loc; // level of coherency
44  uint32_t d_min_line_len; // minimum d-cache line_len
45  uint32_t i_min_line_len; // minimum i-cache line_len
46  struct armv7m_arch_cache arch[6]; // cache info, L1 - L7
47 };
48 
50 int armv7m_d_cache_flush(struct target *target, uint32_t address,
51  unsigned int length);
52 int armv7m_i_cache_inval(struct target *target, uint32_t address,
53  unsigned int length);
55  struct target *target);
56 
57 #endif /* OPENOCD_TARGET_ARMV7M_CACHE_H */
int armv7m_handle_cache_info_command(struct command_invocation *cmd, struct target *target)
Definition: armv7m_cache.c:242
int armv7m_i_cache_inval(struct target *target, uint32_t address, unsigned int length)
Definition: armv7m_cache.c:218
int armv7m_d_cache_flush(struct target *target, uint32_t address, unsigned int length)
Definition: armv7m_cache.c:194
int armv7m_identify_cache(struct target *target)
Definition: armv7m_cache.c:71
uint32_t address
Starting address. Sector aligned.
Definition: dw-spi-helper.h:0
uint8_t length
Definition: esp_usb_jtag.c:1
struct armv7m_cache_size i_size
Definition: armv7m_cache.h:35
unsigned int ctype
Definition: armv7m_cache.h:33
struct armv7m_cache_size d_u_size
Definition: armv7m_cache.h:34
struct armv7m_arch_cache arch[6]
Definition: armv7m_cache.h:46
unsigned int loc
Definition: armv7m_cache.h:43
uint32_t d_min_line_len
Definition: armv7m_cache.h:44
uint32_t i_min_line_len
Definition: armv7m_cache.h:45
uint32_t associativity
Definition: armv7m_cache.h:21
uint32_t cache_size
Definition: armv7m_cache.h:23
uint32_t index_shift
Definition: armv7m_cache.h:26
uint32_t way_shift
Definition: armv7m_cache.h:28
When run_command is called, a new instance will be created on the stack, filled with the proper value...
Definition: command.h:76
Definition: target.h:119
uint8_t cmd
Definition: vdebug.c:1