OpenOCD
esp_algorithm.h File Reference
Include dependency graph for esp_algorithm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  esp_algorithm_hw
 
struct  esp_algorithm_image
 API defined below allows executing pieces of code on target without breaking the execution of the running program. More...
 
struct  esp_algorithm_mem_args
 Algorithm stub in-memory arguments. More...
 
struct  esp_algorithm_reg_args
 Algorithm stub register arguments. More...
 
struct  esp_algorithm_run_data
 Algorithm run data. More...
 
struct  esp_algorithm_stub
 Algorithm stub data. More...
 

Macros

#define ESP_IMAGE_ELF_PHF_EXEC   0x1
 

Typedefs

typedef int(* esp_algorithm_func_t) (struct target *target, struct esp_algorithm_run_data *run, void *arg)
 Algorithm run function. More...
 
typedef void(* esp_algorithm_usr_func_done_t) (struct target *target, struct esp_algorithm_run_data *run, void *usr_arg)
 Algorithm's arguments cleanup function. More...
 
typedef int(* esp_algorithm_usr_func_init_t) (struct target *target, struct esp_algorithm_run_data *run, void *usr_arg)
 Algorithm's arguments setup function. More...
 
typedef int(* esp_algorithm_usr_func_t) (struct target *target, void *usr_arg)
 Host part of algorithm. More...
 

Functions

int esp_algorithm_exec_func_image_va (struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args, va_list ap)
 
int esp_algorithm_exec_onboard_func_va (struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args, va_list ap)
 
int esp_algorithm_load_func_image (struct target *target, struct esp_algorithm_run_data *run)
 
int esp_algorithm_load_onboard_func (struct target *target, target_addr_t func_addr, struct esp_algorithm_run_data *run)
 
static int esp_algorithm_run_func_image (struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args,...)
 
static int esp_algorithm_run_func_image_va (struct target *target, struct esp_algorithm_run_data *run, uint32_t num_args, va_list ap)
 Loads and runs stub from specified image. More...
 
static int esp_algorithm_run_onboard_func (struct target *target, struct esp_algorithm_run_data *run, target_addr_t func_addr, uint32_t num_args,...)
 
static int esp_algorithm_run_onboard_func_va (struct target *target, struct esp_algorithm_run_data *run, target_addr_t func_addr, uint32_t num_args, va_list ap)
 Runs pre-compiled on-board function. More...
 
int esp_algorithm_unload_func_image (struct target *target, struct esp_algorithm_run_data *run)
 
int esp_algorithm_unload_onboard_func (struct target *target, struct esp_algorithm_run_data *run)
 
static uint64_t esp_algorithm_user_arg_get_uint (struct esp_algorithm_run_data *run, int arg_num)
 Get the value of an argument passed via registers from the stub main function. More...
 
static void esp_algorithm_user_arg_set_uint (struct esp_algorithm_run_data *run, int arg_num, uint64_t val)
 Set the value of an argument passed via registers to the stub main function. More...
 

Macro Definition Documentation

◆ ESP_IMAGE_ELF_PHF_EXEC

#define ESP_IMAGE_ELF_PHF_EXEC   0x1

Definition at line 134 of file esp_algorithm.h.

Typedef Documentation

◆ esp_algorithm_func_t

typedef int(* esp_algorithm_func_t) (struct target *target, struct esp_algorithm_run_data *run, void *arg)

Algorithm run function.

Parameters
targetPointer to target.
runPointer to algo run data.
argFunction specific argument.
Returns
ERROR_OK on success, otherwise ERROR_XXX.

Definition at line 202 of file esp_algorithm.h.

◆ esp_algorithm_usr_func_done_t

typedef void(* esp_algorithm_usr_func_done_t) (struct target *target, struct esp_algorithm_run_data *run, void *usr_arg)

Algorithm's arguments cleanup function.

This function will be called just after stub exit. It can be used to cleanup stub memory parameters.

Parameters
targetPointer to target.
runPointer to algo run data.
usr_argFunction specific argument. The same as for esp_algorithm_usr_func_t.
Returns
ERROR_OK on success, otherwise ERROR_XXX.

Definition at line 243 of file esp_algorithm.h.

◆ esp_algorithm_usr_func_init_t

typedef int(* esp_algorithm_usr_func_init_t) (struct target *target, struct esp_algorithm_run_data *run, void *usr_arg)

Algorithm's arguments setup function.

This function will be called just before stub start. It must return when all operations with running stub are completed. It can be used to prepare stub memory parameters.

Parameters
targetPointer to target.
runPointer to algo run data.
usr_argFunction specific argument. The same as for esp_algorithm_usr_func_t.
Returns
ERROR_OK on success, otherwise ERROR_XXX.

Definition at line 228 of file esp_algorithm.h.

◆ esp_algorithm_usr_func_t

typedef int(* esp_algorithm_usr_func_t) (struct target *target, void *usr_arg)

Host part of algorithm.

This function will be called while stub is running on target. It can be used for communication with stub.

Parameters
targetPointer to target.
usr_argFunction specific argument.
Returns
ERROR_OK on success, otherwise ERROR_XXX.

Definition at line 214 of file esp_algorithm.h.

Function Documentation

◆ esp_algorithm_exec_func_image_va()

int esp_algorithm_exec_func_image_va ( struct target target,
struct esp_algorithm_run_data run,
uint32_t  num_args,
va_list  ap 
)

◆ esp_algorithm_exec_onboard_func_va()

int esp_algorithm_exec_onboard_func_va ( struct target target,
struct esp_algorithm_run_data run,
uint32_t  num_args,
va_list  ap 
)

Definition at line 589 of file esp_algorithm.c.

References esp_algorithm_run_debug_stub().

Referenced by esp_algorithm_run_onboard_func_va().

◆ esp_algorithm_load_func_image()

◆ esp_algorithm_load_onboard_func()

◆ esp_algorithm_run_func_image()

static int esp_algorithm_run_func_image ( struct target target,
struct esp_algorithm_run_data run,
uint32_t  num_args,
  ... 
)
inlinestatic

Definition at line 329 of file esp_algorithm.h.

References esp_algorithm_run_func_image_va().

◆ esp_algorithm_run_func_image_va()

static int esp_algorithm_run_func_image_va ( struct target target,
struct esp_algorithm_run_data run,
uint32_t  num_args,
va_list  ap 
)
inlinestatic

Loads and runs stub from specified image.

This function should be used to run external stub code on target.

Parameters
targetPointer to target.
runPointer to algo run data.
num_argsNumber of stub arguments that follow.
Returns
ERROR_OK on success, otherwise ERROR_XXX. Stub return code is in run->ret_code.

Definition at line 316 of file esp_algorithm.h.

References ERROR_OK, esp_algorithm_exec_func_image_va(), esp_algorithm_load_func_image(), and esp_algorithm_unload_func_image().

Referenced by esp_algorithm_run_func_image(), and esp_xtensa_smp_run_func_image().

◆ esp_algorithm_run_onboard_func()

static int esp_algorithm_run_onboard_func ( struct target target,
struct esp_algorithm_run_data run,
target_addr_t  func_addr,
uint32_t  num_args,
  ... 
)
inlinestatic

Definition at line 376 of file esp_algorithm.h.

References esp_algorithm_run_onboard_func_va().

◆ esp_algorithm_run_onboard_func_va()

static int esp_algorithm_run_onboard_func_va ( struct target target,
struct esp_algorithm_run_data run,
target_addr_t  func_addr,
uint32_t  num_args,
va_list  ap 
)
inlinestatic

Runs pre-compiled on-board function.

This function should be used to run on-board stub code.

Parameters
targetPointer to target.
runPointer to algo run data.
func_entryAddress of the function to run.
num_argsNumber of function arguments that follow.
Returns
ERROR_OK on success, otherwise ERROR_XXX. Stub return code is in run->ret_code.

Definition at line 361 of file esp_algorithm.h.

References ERROR_OK, esp_algorithm_exec_onboard_func_va(), esp_algorithm_load_onboard_func(), and esp_algorithm_unload_onboard_func().

Referenced by esp_algorithm_run_onboard_func(), and esp_xtensa_smp_run_onboard_func().

◆ esp_algorithm_unload_func_image()

◆ esp_algorithm_unload_onboard_func()

int esp_algorithm_unload_onboard_func ( struct target target,
struct esp_algorithm_run_data run 
)

Definition at line 584 of file esp_algorithm.c.

References ERROR_OK.

Referenced by esp_algorithm_load_onboard_func(), and esp_algorithm_run_onboard_func_va().

◆ esp_algorithm_user_arg_get_uint()

static uint64_t esp_algorithm_user_arg_get_uint ( struct esp_algorithm_run_data run,
int  arg_num 
)
inlinestatic

Get the value of an argument passed via registers from the stub main function.

Definition at line 409 of file esp_algorithm.h.

Referenced by esp_algorithm_run_debug_stub(), and esp_algorithm_run_image().

◆ esp_algorithm_user_arg_set_uint()

static void esp_algorithm_user_arg_set_uint ( struct esp_algorithm_run_data run,
int  arg_num,
uint64_t  val 
)
inlinestatic

Set the value of an argument passed via registers to the stub main function.

Definition at line 392 of file esp_algorithm.h.

References buf_set_u32(), buf_set_u64(), esp_algorithm_reg_args::first_user_param, esp_algorithm_reg_args::params, esp_algorithm_run_data::reg_args, reg_param::size, and reg_param::value.

Referenced by esp_algorithm_run_image(), and esp_xtensa_algo_init().