jtag: linuxgpiod: drop extra parenthesis
[openocd.git] / src / rtos / rtos.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /***************************************************************************
4 * Copyright (C) 2011 by Broadcom Corporation *
5 * Evan Hunter - ehunter@broadcom.com *
6 ***************************************************************************/
7
8 #ifndef OPENOCD_RTOS_RTOS_H
9 #define OPENOCD_RTOS_RTOS_H
10
11 #include "server/server.h"
12 #include "target/target.h"
13 #include <helper/jim-nvp.h>
14
15 typedef int64_t threadid_t;
16 typedef int64_t symbol_address_t;
17
18 struct reg;
19
20 /**
21 * Table should be terminated by an element with NULL in symbol_name
22 */
23 struct symbol_table_elem {
24 const char *symbol_name;
25 symbol_address_t address;
26 bool optional;
27 };
28
29 struct thread_detail {
30 threadid_t threadid;
31 bool exists;
32 char *thread_name_str;
33 char *extra_info_str;
34 };
35
36 struct rtos {
37 const struct rtos_type *type;
38
39 struct symbol_table_elem *symbols;
40 struct target *target;
41 /* add a context variable instead of global variable */
42 /* The thread currently selected by gdb. */
43 int64_t current_threadid;
44 /* The currently selected thread according to the target. */
45 threadid_t current_thread;
46 struct thread_detail *thread_details;
47 int thread_count;
48 int (*gdb_thread_packet)(struct connection *connection, char const *packet, int packet_size);
49 int (*gdb_target_for_threadid)(struct connection *connection, int64_t thread_id, struct target **p_target);
50 void *rtos_specific_params;
51 };
52
53 struct rtos_reg {
54 uint32_t number;
55 uint32_t size;
56 uint8_t value[16];
57 };
58
59 struct rtos_type {
60 const char *name;
61 bool (*detect_rtos)(struct target *target);
62 int (*create)(struct target *target);
63 int (*smp_init)(struct target *target);
64 int (*update_threads)(struct rtos *rtos);
65 /** Return a list of general registers, with their values filled out. */
66 int (*get_thread_reg_list)(struct rtos *rtos, int64_t thread_id,
67 struct rtos_reg **reg_list, int *num_regs);
68 int (*get_thread_reg)(struct rtos *rtos, int64_t thread_id,
69 uint32_t reg_num, struct rtos_reg *reg);
70 int (*get_symbol_list_to_lookup)(struct symbol_table_elem *symbol_list[]);
71 int (*clean)(struct target *target);
72 char * (*ps_command)(struct target *target);
73 int (*set_reg)(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value);
74 /* Implement these if different threads in the RTOS can see memory
75 * differently (for instance because address translation might be different
76 * for each thread). */
77 int (*read_buffer)(struct rtos *rtos, target_addr_t address, uint32_t size,
78 uint8_t *buffer);
79 int (*write_buffer)(struct rtos *rtos, target_addr_t address, uint32_t size,
80 const uint8_t *buffer);
81 };
82
83 struct stack_register_offset {
84 unsigned short number; /* register number */
85 signed short offset; /* offset in bytes from stack head, or -1 to indicate
86 * register is not stacked, or -2 to indicate this is the
87 * stack pointer register */
88 unsigned short width_bits;
89 };
90
91 struct rtos_register_stacking {
92 unsigned char stack_registers_size;
93 signed char stack_growth_direction;
94 unsigned char num_output_registers;
95 /* Some targets require evaluating the stack to determine the
96 * actual stack pointer for a process. If this field is NULL,
97 * just use stacking->stack_registers_size * stack_growth_direction
98 * to calculate adjustment.
99 */
100 target_addr_t (*calculate_process_stack)(struct target *target,
101 const uint8_t *stack_data,
102 const struct rtos_register_stacking *stacking,
103 target_addr_t stack_ptr);
104 const struct stack_register_offset *register_offsets;
105 /* Optional field for targets which may have to implement their own stack read function.
106 * Because stack format can be weird or stack data needed to be edited before passing to the gdb.
107 */
108 int (*read_stack)(struct target *target,
109 int64_t stack_ptr,
110 const struct rtos_register_stacking *stacking,
111 uint8_t *stack_data);
112 };
113
114 #define GDB_THREAD_PACKET_NOT_CONSUMED (-40)
115
116 int rtos_create(struct jim_getopt_info *goi, struct target *target);
117 void rtos_destroy(struct target *target);
118 int rtos_set_reg(struct connection *connection, int reg_num,
119 uint8_t *reg_value);
120 int rtos_generic_stack_read(struct target *target,
121 const struct rtos_register_stacking *stacking,
122 int64_t stack_ptr,
123 struct rtos_reg **reg_list,
124 int *num_regs);
125 int gdb_thread_packet(struct connection *connection, char const *packet, int packet_size);
126 int rtos_thread_packet(struct connection *connection, const char *packet, int packet_size);
127 int rtos_get_gdb_reg(struct connection *connection, int reg_num);
128 int rtos_get_gdb_reg_list(struct connection *connection);
129 int rtos_update_threads(struct target *target);
130 void rtos_free_threadlist(struct rtos *rtos);
131 int rtos_smp_init(struct target *target);
132 /* function for handling symbol access */
133 int rtos_qsymbol(struct connection *connection, char const *packet, int packet_size);
134 int rtos_read_buffer(struct target *target, target_addr_t address,
135 uint32_t size, uint8_t *buffer);
136 int rtos_write_buffer(struct target *target, target_addr_t address,
137 uint32_t size, const uint8_t *buffer);
138
139 extern const struct rtos_type chibios_rtos;
140 extern const struct rtos_type chromium_ec_rtos;
141 extern const struct rtos_type ecos_rtos;
142 extern const struct rtos_type embkernel_rtos;
143 extern const struct rtos_type freertos_rtos;
144 extern const struct rtos_type hwthread_rtos;
145 extern const struct rtos_type linux_rtos;
146 extern const struct rtos_type mqx_rtos;
147 extern const struct rtos_type nuttx_rtos;
148 extern const struct rtos_type riot_rtos;
149 extern const struct rtos_type rtkernel_rtos;
150 extern const struct rtos_type threadx_rtos;
151 extern const struct rtos_type ucos_iii_rtos;
152 extern const struct rtos_type zephyr_rtos;
153
154 #endif /* OPENOCD_RTOS_RTOS_H */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)