OpenOCD
esp32_apptrace.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * ESP32 application trace module *
5  * Copyright (C) 2017-2019 Espressif Systems Ltd. *
6  ***************************************************************************/
7 
8 #ifndef OPENOCD_TARGET_ESP32_APPTRACE_H
9 #define OPENOCD_TARGET_ESP32_APPTRACE_H
10 
11 #include <helper/command.h>
12 #include <helper/time_support.h>
13 #include <target/target.h>
14 
15 #define ESP32_APPTRACE_MAX_CORES_NUM 2
16 
18  uint32_t max_block_id;
19  uint32_t (*max_block_size_get)(struct target *target);
20  int (*status_reg_read)(struct target *target, uint32_t *stat);
21  int (*ctrl_reg_write)(struct target *target,
22  uint32_t block_id,
23  uint32_t len,
24  bool conn,
25  bool data);
26  int (*ctrl_reg_read)(struct target *target,
27  uint32_t *block_id,
28  uint32_t *len,
29  bool *conn);
30  int (*data_len_read)(struct target *target,
31  uint32_t *block_id,
32  uint32_t *len);
33  int (*data_read)(struct target *target,
34  uint32_t size,
35  uint8_t *buffer,
36  uint32_t block_id,
37  bool ack);
38  uint32_t (*usr_block_max_size_get)(struct target *target);
39  int (*buffs_write)(struct target *target,
40  uint32_t bufs_num,
41  uint32_t buf_sz[],
42  const uint8_t *bufs[],
43  uint32_t block_id,
44  bool ack,
45  bool data);
48 };
49 
51  uint16_t block_sz;
52 };
53 
55  void *priv;
56  int (*write)(void *priv, uint8_t *data, int size);
57  int (*clean)(void *priv);
59 };
60 
62  uint32_t hdr_sz;
63  int (*core_id_get)(struct target *target, uint8_t *hdr_buf);
64  uint32_t (*usr_block_len_get)(struct target *target, uint8_t *hdr_buf, uint32_t *wr_len);
65 };
66 
68  uint32_t incompl_blocks;
69  uint32_t lost_bytes;
74 };
75 
77  volatile int running;
78  int mode;
79  /* TODO: use subtargets from target arch info */
81  /* TODO: use cores num from target */
82  unsigned int cores_num;
83  const struct esp32_apptrace_hw *hw;
85  uint32_t last_blk_id;
90  int (*process_data)(struct esp32_apptrace_cmd_ctx *ctx, unsigned int core_id, uint8_t *data, uint32_t data_len);
91  void (*auto_clean)(struct esp32_apptrace_cmd_ctx *ctx);
92  uint32_t tot_len;
93  uint32_t raw_tot_len;
94  float stop_tmo;
96  struct duration read_time;
97  struct duration idle_time;
98  void *cmd_priv;
99  struct target *target;
101 };
102 
105  uint32_t poll_period;
106  uint32_t max_len;
107  uint32_t skip_len;
108  bool wait4halt;
109 };
110 
114  struct esp32_apptrace_cmd_data *cmd_data,
115  const char **argv,
116  int argc);
117 int esp32_apptrace_dest_init(struct esp32_apptrace_dest dest[], const char *dest_paths[], unsigned int max_dests);
118 int esp32_apptrace_dest_cleanup(struct esp32_apptrace_dest dest[], unsigned int max_dests);
119 int esp_apptrace_usr_block_write(const struct esp32_apptrace_hw *hw, struct target *target,
120  uint32_t block_id,
121  const uint8_t *data,
122  uint32_t size);
123 
125 
126 #endif /* OPENOCD_TARGET_ESP32_APPTRACE_H */
enum arm_mode mode
Definition: armv4_5.c:277
int esp_apptrace_usr_block_write(const struct esp32_apptrace_hw *hw, struct target *target, uint32_t block_id, const uint8_t *data, uint32_t size)
void esp32_apptrace_cmd_args_parse(struct esp32_apptrace_cmd_ctx *cmd_ctx, struct esp32_apptrace_cmd_data *cmd_data, const char **argv, int argc)
int esp32_apptrace_dest_cleanup(struct esp32_apptrace_dest dest[], unsigned int max_dests)
#define ESP32_APPTRACE_MAX_CORES_NUM
int esp32_apptrace_dest_init(struct esp32_apptrace_dest dest[], const char *dest_paths[], unsigned int max_dests)
int esp32_apptrace_cmd_ctx_init(struct esp32_apptrace_cmd_ctx *cmd_ctx, struct command_invocation *cmd, int mode)
const struct command_registration esp32_apptrace_command_handlers[]
int esp32_apptrace_cmd_ctx_cleanup(struct esp32_apptrace_cmd_ctx *cmd_ctx)
struct target * target
Definition: rtt/rtt.c:26
size_t size
Size of the control block search area.
Definition: rtt/rtt.c:30
When run_command is called, a new instance will be created on the stack, filled with the proper value...
Definition: command.h:76
struct target * cpus[ESP32_APPTRACE_MAX_CORES_NUM]
enum target_state target_state
struct target * target
struct duration idle_time
struct duration read_time
struct list_head ready_trace_blocks
struct esp32_apptrace_cmd_stats stats
int(* process_data)(struct esp32_apptrace_cmd_ctx *ctx, unsigned int core_id, uint8_t *data, uint32_t data_len)
struct command_invocation * cmd
const struct esp32_apptrace_hw * hw
void(* auto_clean)(struct esp32_apptrace_cmd_ctx *ctx)
struct list_head free_trace_blocks
struct esp32_apptrace_format trace_format
struct esp32_apptrace_dest data_dest
int(* write)(void *priv, uint8_t *data, int size)
int(* clean)(void *priv)
int(* core_id_get)(struct target *target, uint8_t *hdr_buf)
uint32_t(* usr_block_len_get)(struct target *target, uint8_t *hdr_buf, uint32_t *wr_len)
uint32_t(* usr_block_max_size_get)(struct target *target)
int(* leave_trace_crit_section_stop)(struct target *target)
int(* ctrl_reg_read)(struct target *target, uint32_t *block_id, uint32_t *len, bool *conn)
int(* data_read)(struct target *target, uint32_t size, uint8_t *buffer, uint32_t block_id, bool ack)
int(* data_len_read)(struct target *target, uint32_t *block_id, uint32_t *len)
int(* leave_trace_crit_section_start)(struct target *target)
uint32_t(* max_block_size_get)(struct target *target)
int(* ctrl_reg_write)(struct target *target, uint32_t block_id, uint32_t len, bool conn, bool data)
int(* status_reg_read)(struct target *target, uint32_t *stat)
int(* buffs_write)(struct target *target, uint32_t bufs_num, uint32_t buf_sz[], const uint8_t *bufs[], uint32_t block_id, bool ack, bool data)
Definition: list.h:40
Definition: target.h:116
target_state
Definition: target.h:53
uint8_t cmd
Definition: vdebug.c:1