20 #define CROS_EC_MAX_TASKS 32
21 #define CROS_EC_MAX_NAME 200
22 #define CROS_EC_IDLE_STRING "<< idle >>"
38 .task_offset_next = 24,
40 .task_offset_events = 4,
41 .task_offset_runtime = 8,
46 .target_name =
"cortex_m",
48 .task_offset_next = 24,
50 .task_offset_events = 4,
51 .task_offset_runtime = 8,
79 #define CROS_EC_MAX_BUILDINFO 512
93 LOG_DEBUG(
"Chromium-EC: Symbol \"%s\" found",
96 LOG_ERROR(
"Chromium-EC: Symbol \"%s\" missing",
104 sizeof(build_info_buf),
105 (uint8_t *)build_info_buf);
110 LOG_INFO(
"Chromium-EC: Buildinfo: %s", build_info_buf);
123 params = malloc(
sizeof(*params));
155 uint32_t tasks_enabled;
162 LOG_ERROR(
"Failed to determine #of tasks");
168 if (tasks_enabled &
BIT(t))
178 uint32_t tasks_enabled, tasks_ready, start_called;
179 uint32_t current_task, thread_ptr, name_ptr;
181 int ret, t, num_tasks, tasks_found;
183 uint8_t runtime_buf[8];
197 LOG_ERROR(
"Failed to get number of tasks");
207 LOG_DEBUG(
"Current task: %lx tasks_found: %d",
208 (
unsigned long)current_task,
222 LOG_ERROR(
"Failed to load start_called");
236 if (!num_tasks || !start_called) {
250 LOG_ERROR(
"Failed to load tasks_enabled");
266 if (!(tasks_enabled &
BIT(t)))
269 if (thread_ptr == current_task)
283 (uint8_t *)thread_str_buf);
302 LOG_ERROR(
"Failed to get task %d's events", t);
307 sizeof(runtime_buf), runtime_buf);
309 LOG_ERROR(
"Failed to get task %d's runtime", t);
313 if (thread_ptr == current_task)
314 snprintf(thread_str_buf,
sizeof(thread_str_buf),
315 "State: Running, Priority: %u, Events: %" PRIx32
", Runtime: %" PRIu64
"\n",
318 snprintf(thread_str_buf,
sizeof(thread_str_buf),
319 "State: %s, Priority: %u, Events: %" PRIx32
", Runtime: %" PRIu64
"\n",
320 tasks_ready &
BIT(t) ?
"Ready" :
"Waiting", t,
342 uint32_t stack_ptr = 0;
363 stack_ptr, reg_list, num_regs);
372 if (!(*symbol_list)) {
384 .
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.
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)
const char * target_type_name(const struct target *target)
Get the target type name.
static const char * target_name(const 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.