21 #define CROS_EC_MAX_TASKS 32
22 #define CROS_EC_MAX_NAME 200
23 #define CROS_EC_IDLE_STRING "<< idle >>"
39 .task_offset_next = 24,
41 .task_offset_events = 4,
42 .task_offset_runtime = 8,
47 .target_name =
"cortex_m",
49 .task_offset_next = 24,
51 .task_offset_events = 4,
52 .task_offset_runtime = 8,
80 #define CROS_EC_MAX_BUILDINFO 512
94 LOG_DEBUG(
"Chromium-EC: Symbol \"%s\" found",
97 LOG_ERROR(
"Chromium-EC: Symbol \"%s\" missing",
105 sizeof(build_info_buf),
106 (uint8_t *)build_info_buf);
111 LOG_INFO(
"Chromium-EC: Buildinfo: %s", build_info_buf);
124 params = malloc(
sizeof(*params));
156 uint32_t tasks_enabled;
163 LOG_ERROR(
"Failed to determine #of tasks");
169 if (tasks_enabled &
BIT(t))
179 uint32_t tasks_enabled, tasks_ready, start_called;
180 uint32_t current_task, thread_ptr, name_ptr;
182 int ret, t, num_tasks, tasks_found;
184 uint8_t runtime_buf[8];
198 LOG_ERROR(
"Failed to get number of tasks");
208 LOG_DEBUG(
"Current task: %lx tasks_found: %d",
209 (
unsigned long)current_task,
223 LOG_ERROR(
"Failed to load start_called");
237 if (!num_tasks || !start_called) {
251 LOG_ERROR(
"Failed to load tasks_enabled");
267 if (!(tasks_enabled &
BIT(t)))
270 if (thread_ptr == current_task)
284 (uint8_t *)thread_str_buf);
303 LOG_ERROR(
"Failed to get task %d's events", t);
308 sizeof(runtime_buf), runtime_buf);
310 LOG_ERROR(
"Failed to get task %d's runtime", t);
314 if (thread_ptr == current_task)
315 snprintf(thread_str_buf,
sizeof(thread_str_buf),
316 "State: Running, Priority: %u, Events: %" PRIx32
", Runtime: %" PRIu64
"\n",
319 snprintf(thread_str_buf,
sizeof(thread_str_buf),
320 "State: %s, Priority: %u, Events: %" PRIx32
", Runtime: %" PRIu64
"\n",
321 tasks_ready &
BIT(t) ?
"Ready" :
"Waiting", t,
343 uint32_t stack_ptr = 0;
364 stack_ptr, reg_list, num_regs);
373 if (!(*symbol_list)) {
385 .
name =
"Chromium-EC",
static int chromium_ec_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
#define CROS_EC_MAX_BUILDINFO
static int chromium_ec_update_threads(struct rtos *rtos)
const struct rtos_type chromium_ec_rtos
#define CROS_EC_MAX_TASKS
static bool chromium_ec_detect_rtos(struct target *target)
chromium_ec_symbol_values
@ CHROMIUM_EC_VAL_START_CALLED
@ CHROMIUM_EC_VAL_BUILD_INFO
@ CHROMIUM_EC_VAL_TASKS_READY
@ CHROMIUM_EC_VAL_CURRENT_TASK
@ CHROMIUM_EC_VAL_TASK_NAMES
@ CHROMIUM_EC_VAL_TASKS_ENABLED
static int chromium_ec_get_num_tasks(struct rtos *rtos, int *num_tasks)
static const char *const chromium_ec_symbol_list[]
static int chromium_ec_create(struct target *target)
static int chromium_ec_get_thread_reg_list(struct rtos *rtos, threadid_t threadid, struct rtos_reg **reg_list, int *num_regs)
static const struct chromium_ec_params chromium_ec_params_list[]
#define CROS_EC_IDLE_STRING
static int chromium_ec_get_current_task_ptr(struct rtos *rtos, uint32_t *current_task)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
int rtos_generic_stack_read(struct target *target, const struct rtos_register_stacking *stacking, int64_t stack_ptr, struct rtos_reg **reg_list, int *num_regs)
void rtos_free_threadlist(struct rtos *rtos)
const struct rtos_register_stacking rtos_standard_cortex_m3_stacking
const struct rtos_register_stacking * stacking
off_t task_offset_runtime
struct thread_detail * thread_details
struct symbol_table_elem * symbols
void * rtos_specific_params
threadid_t current_thread
Table should be terminated by an element with NULL in symbol_name.
const char * name
Name of this type of target.
struct target_type * type
uint64_t target_buffer_get_u64(struct target *target, const uint8_t *buffer)
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.