XFusion API v1.3.0
|
吞吐量测试。 更多...
结构体 | |
struct | _xf_iperf_cfg_t |
iperf 配置类型。 更多... | |
struct | _xf_iperf_ctx_t |
iperf 上下文. 更多... | |
struct | _xf_ota_t |
xf_ota 对象容器类型。 更多... | |
struct | _xf_ota_partition_t |
xf_ota 分区对象容器类型。 更多... | |
struct | _xf_ota_partition_info_t |
xf_ota 分区信息类型。 更多... | |
类型定义 | |
typedef struct _xf_iperf_ctx_t * | xf_iperf_t |
iperf 句柄。 | |
typedef enum _xf_iperf_event_code_t | xf_iperf_event_code_t |
iperf 事件声明。 | |
typedef int32_t | xf_iperf_event_id_t |
iperf 事件 id。见 xf_iperf_event_code_t. | |
typedef void(* | xf_iperf_cb_t) (xf_iperf_event_id_t event_id, xf_iperf_t hdl, void *user_args) |
iperf 回调函数原型。 | |
typedef struct _xf_iperf_cfg_t | xf_iperf_cfg_t |
iperf 配置类型。 | |
typedef struct _xf_iperf_ctx_t | xf_iperf_ctx_t |
iperf 上下文. | |
typedef struct _xf_ota_t | xf_ota_t |
xf_ota 对象容器类型。 | |
typedef enum xf_ota_partition_id_code_e | xf_ota_partition_id_code_t |
xf_ota 分区枚举代码。 | |
typedef uint8_t | xf_ota_partition_id_t |
xf_ota 分区类型。 | |
typedef struct _xf_ota_partition_t | xf_ota_partition_t |
xf_ota 分区对象容器类型。 | |
typedef struct _xf_ota_partition_info_t | xf_ota_partition_info_t |
xf_ota 分区信息类型。 | |
函数 | |
xf_err_t | xf_iperf_start (const xf_iperf_cfg_t *p_cfg, xf_iperf_cb_t cb_func, void *user_args) |
启动 iperf. | |
xf_iperf_t | xf_iperf_get_handle (void) |
获取 iperf 句柄。 | |
bool | xf_iperf_is_running (void) |
检查 iperf 是否正在运行。 | |
xf_err_t | xf_iperf_stop (void) |
停止 iperf. | |
xf_err_t | xf_ota_init (void) |
初始化 xf_ota 模块。 | |
xf_err_t | xf_ota_deinit (void) |
反初始化 xf_ota 模块。 | |
xf_err_t | xf_ota_get_running_partition (xf_ota_partition_t *p_part_hdl) |
获取当前程序运行分区信息。 | |
xf_err_t | xf_ota_get_next_update_partition (xf_ota_partition_t *p_start_part_hdl, xf_ota_partition_t *p_next_part_hdl) |
获取下一个固件分区。 | |
xf_err_t | xf_ota_get_partition_info (const xf_ota_partition_t *p_part_hdl, xf_ota_partition_info_t *p_info) |
获取分区信息。 | |
size_t | xf_ota_get_platform_app_desc_size (void) |
获取平台 APP 描述块的大小。 | |
xf_err_t | xf_ota_get_platform_app_desc_block (xf_ota_partition_t *p_part_hdl, void *p_desc_out, size_t buff_size) |
获取平台 APP 描述块。 | |
size_t | xf_ota_get_platform_app_digest_size (void) |
获取平台 APP 摘要块的大小。 | |
xf_err_t | xf_ota_get_platform_app_digest_block (xf_ota_partition_t *p_part_hdl, void *p_digest_out, size_t buff_size) |
获取平台 APP 摘要块。 | |
xf_err_t | xf_ota_start (xf_ota_partition_t *p_part_hdl, uint32_t package_len, bool sequential_write, xf_ota_t *p_hdl) |
开始 OTA 固件写入流程。 | |
xf_err_t | xf_ota_abort (xf_ota_t *p_hdl) |
中断 OTA 固件写入流程。 | |
xf_err_t | xf_ota_end (xf_ota_t *p_hdl) |
终止 OTA 固件写入流程。 | |
xf_err_t | xf_ota_upgrade (xf_ota_partition_t *p_part_hdl, bool reboot) |
更新固件。 | |
xf_err_t | xf_ota_write (xf_ota_t *p_hdl, const void *src, size_t size) |
顺序写入 OTA 固件。 | |
xf_err_t | xf_ota_write_to (xf_ota_t *p_hdl, size_t dst_offset, const void *src, size_t size) |
指定偏移地址写入 OTA 固件。 | |
吞吐量测试。
#define IPERF_IP_TYPE_IPV4 0 |
#define IPERF_IP_TYPE_IPV6 1 |
在文件 xf_iperf.h 第 52 行定义.
#define IPERF_TRANS_TYPE_TCP 0 |
在文件 xf_iperf.h 第 53 行定义.
#define IPERF_TRANS_TYPE_UDP 1 |
在文件 xf_iperf.h 第 54 行定义.
#define IPERF_FLAG_SET | ( | cfg, | |
flag | |||
) | ((cfg) |= (flag)) |
在文件 xf_iperf.h 第 56 行定义.
#define IPERF_FLAG_CLR | ( | cfg, | |
flag | |||
) | ((cfg) &= (~(flag))) |
在文件 xf_iperf.h 第 57 行定义.
#define IPERF_FLAG_CLIENT (1) |
#define IPERF_FLAG_SERVER (1 << 1) |
#define IPERF_FLAG_TCP (1 << 2) |
#define IPERF_FLAG_UDP (1 << 3) |
#define IPERF_DEFAULT_PORT 5001 |
在文件 xf_iperf.h 第 64 行定义.
#define IPERF_DEFAULT_INTERVAL 1 |
在文件 xf_iperf.h 第 65 行定义.
#define IPERF_DEFAULT_TIME 30 |
在文件 xf_iperf.h 第 66 行定义.
#define IPERF_DEFAULT_NO_BW_LIMIT -1 |
在文件 xf_iperf.h 第 67 行定义.
#define IPERF_TRAFFIC_TASK_NAME "iperf_traffic" |
在文件 xf_iperf.h 第 69 行定义.
#define IPERF_TRAFFIC_TASK_PRIORITY XF_OSAL_PRIORITY_NORMOL |
在文件 xf_iperf.h 第 70 行定义.
#define IPERF_TRAFFIC_TASK_STACK 4096 |
在文件 xf_iperf.h 第 71 行定义.
#define IPERF_REPORT_TASK_NAME "iperf_report" |
在文件 xf_iperf.h 第 72 行定义.
#define IPERF_REPORT_TASK_PRIORITY XF_OSAL_PRIORITY_NORMOL |
在文件 xf_iperf.h 第 73 行定义.
#define IPERF_REPORT_TASK_STACK 4096 |
在文件 xf_iperf.h 第 74 行定义.
#define IPERF_DEFAULT_IPV4_UDP_TX_LEN (1470) |
在文件 xf_iperf.h 第 76 行定义.
#define IPERF_DEFAULT_IPV6_UDP_TX_LEN (1450) |
在文件 xf_iperf.h 第 77 行定义.
#define IPERF_DEFAULT_UDP_RX_LEN (16 << 10) |
在文件 xf_iperf.h 第 78 行定义.
#define IPERF_DEFAULT_TCP_TX_LEN (16 << 10) |
在文件 xf_iperf.h 第 79 行定义.
#define IPERF_DEFAULT_TCP_RX_LEN (16 << 10) |
在文件 xf_iperf.h 第 80 行定义.
#define IPERF_MAX_DELAY 64 |
在文件 xf_iperf.h 第 82 行定义.
#define IPERF_SOCKET_RX_TIMEOUT_MS 3000 |
#define XF_IPERF_DEFAULT_CONFIG | ( | ) |
默认 iperf 配置
在文件 xf_iperf.h 第 165 行定义.
#define XF_OTA_PACKAGE_LEN_UNKNOWN 0xffffffff |
如果固件大小未知
在文件 xf_ota_types.h 第 33 行定义.
typedef struct _xf_iperf_ctx_t* xf_iperf_t |
iperf 句柄。
在文件 xf_iperf.h 第 96 行定义.
typedef enum _xf_iperf_event_code_t xf_iperf_event_code_t |
iperf 事件声明。
typedef int32_t xf_iperf_event_id_t |
iperf 事件 id。见 xf_iperf_event_code_t.
在文件 xf_iperf.h 第 120 行定义.
typedef void(* xf_iperf_cb_t) (xf_iperf_event_id_t event_id, xf_iperf_t hdl, void *user_args) |
iperf 回调函数原型。
不要在回调内重启 iperf.
event_id | 事件 id. 根据事件类型, 见 xf_iperf_event_code_t. |
hdl | 事件数据. 见 xf_iperf_t. |
user_args | 用户数据. xf_iperf_new_session() 时传入. |
在文件 xf_iperf.h 第 131 行定义.
typedef struct _xf_iperf_cfg_t xf_iperf_cfg_t |
iperf 配置类型。
typedef struct _xf_iperf_ctx_t xf_iperf_ctx_t |
iperf 上下文.
public:
部分是在回调中可读的, 用户 禁止 修改其中任何内容。 xf_ota 对象容器类型。
typedef enum xf_ota_partition_id_code_e xf_ota_partition_id_code_t |
xf_ota 分区枚举代码。
typedef uint8_t xf_ota_partition_id_t |
xf_ota 分区类型。
在文件 xf_ota_types.h 第 77 行定义.
typedef struct _xf_ota_partition_t xf_ota_partition_t |
xf_ota 分区对象容器类型。
typedef struct _xf_ota_partition_info_t xf_ota_partition_info_t |
xf_ota 分区信息类型。
iperf 事件声明。
枚举值 | |
---|---|
XF_IPERF_EVENT_START | iperf 开始。 |
XF_IPERF_EVENT_REPORT | iperf 报告带宽。 事件数据见 xf_iperf_t::curr_time, xf_iperf_t::actual_len, 和 xf_iperf_t::actual_bandwidth. |
XF_IPERF_EVENT_END | iperf 完成。 事件数据见 xf_iperf_t::average_bandwidth. 不要在回调内重启 iperf. |
XF_IPERF_EVENT_MAX | iperf 事件 ID 最大值,无效 ID。 |
在文件 xf_iperf.h 第 101 行定义.
xf_ota 分区枚举代码。
在文件 xf_ota_types.h 第 53 行定义.
xf_err_t xf_iperf_start | ( | const xf_iperf_cfg_t * | p_cfg, |
xf_iperf_cb_t | cb_func, | ||
void * | user_args | ||
) |
启动 iperf.
p_cfg | iperf 配置。 |
cb_func | iperf 回调函数。 |
user_args | iperf 回调函数用户参数。 |
在文件 xf_iperf.c 第 81 行定义.
xf_iperf_t xf_iperf_get_handle | ( | void | ) |
获取 iperf 句柄。
bool xf_iperf_is_running | ( | void | ) |
xf_err_t xf_iperf_stop | ( | void | ) |
xf_err_t xf_ota_init | ( | void | ) |
初始化 xf_ota 模块。
xf_err_t xf_ota_deinit | ( | void | ) |
反初始化 xf_ota 模块。
xf_err_t xf_ota_get_running_partition | ( | xf_ota_partition_t * | p_part_hdl | ) |
获取当前程序运行分区信息。
[out] | p_part_hdl | 传出当前运行分区句柄信息。 |
xf_err_t xf_ota_get_next_update_partition | ( | xf_ota_partition_t * | p_start_part_hdl, |
xf_ota_partition_t * | p_next_part_hdl | ||
) |
获取下一个固件分区。
p_start_part_hdl | 传入起始的分区,可以为 NULL. | |
[out] | p_next_part_hdl | 传出下一个可用于固件升级的分区句柄。 禁止与 p_start_part_hdl 相同。 |
xf_err_t xf_ota_get_partition_info | ( | const xf_ota_partition_t * | p_part_hdl, |
xf_ota_partition_info_t * | p_info | ||
) |
获取分区信息。
p_part_hdl | 需要查询的分区. 可以从 xf_ota_get_running_partition() 或 xf_ota_get_next_update_partition() 获取。 | |
[out] | p_info | 传出分区信息。 |
size_t xf_ota_get_platform_app_desc_size | ( | void | ) |
获取平台 APP 描述块的大小。
xf_err_t xf_ota_get_platform_app_desc_block | ( | xf_ota_partition_t * | p_part_hdl, |
void * | p_desc_out, | ||
size_t | buff_size | ||
) |
获取平台 APP 描述块。
p_part_hdl | 需要查询的分区。 可以从 xf_ota_get_running_partition() 或 xf_ota_get_next_update_partition() 获取。 | |
[out] | p_desc_out | 描述块缓冲区。 |
buff_size | 缓冲区大小,单位字节。可以从 xf_ota_get_platform_app_desc_size() 获取。 |
size_t xf_ota_get_platform_app_digest_size | ( | void | ) |
获取平台 APP 摘要块的大小。
xf_err_t xf_ota_get_platform_app_digest_block | ( | xf_ota_partition_t * | p_part_hdl, |
void * | p_digest_out, | ||
size_t | buff_size | ||
) |
获取平台 APP 摘要块。
p_part_hdl | 需要查询的分区。 可以从 xf_ota_get_running_partition() 或 xf_ota_get_next_update_partition() 获取。 | |
[out] | p_digest_out | 摘要块缓冲区。 |
buff_size | 缓冲区大小,单位字节。可以从 xf_ota_get_platform_app_digest_size() 获取。 |
xf_err_t xf_ota_start | ( | xf_ota_partition_t * | p_part_hdl, |
uint32_t | package_len, | ||
bool | sequential_write, | ||
xf_ota_t * | p_hdl | ||
) |
开始 OTA 固件写入流程。
p_part_hdl | 需要升级的分区。 可以从 xf_ota_get_next_update_partition() 获取。 | |
package_len | 固件包长。不同平台对此参数要求不同,通常需要填入此信息。 如果确认平台支持不指定固件包长,可填入 XF_OTA_PACKAGE_LEN_UNKNOWN. | |
sequential_write | 是否顺序写入。不同平台对能否随机写入的支持程度不同。 顺序写入是最低要求。 | |
[out] | p_hdl | 传出 OTA 句柄。 |
中断 OTA 固件写入流程。
p_hdl | 由 xf_ota_start() 传出的 OTA 句柄。 调用 xf_ota_abort() 后句柄内容无效。 |
终止 OTA 固件写入流程。
p_hdl | 由 xf_ota_start() 传出的 OTA 句柄。 调用 xf_ota_end() 后句柄内容无效。 |
xf_err_t xf_ota_upgrade | ( | xf_ota_partition_t * | p_part_hdl, |
bool | reboot | ||
) |
更新固件。
p_part_hdl | 需要升级的分区。 从 xf_ota_get_next_update_partition() 获取,并且程序写入完毕。 |
reboot | 如果内部检测成功,是否重启。 |
顺序写入 OTA 固件。
p_hdl | OTA 句柄,从 xf_ota_start() 获取。 |
src | OTA 固件数据。 |
size | 本次 OTA 固件数据大小。 必须以 xf_ota_partition_info_t.unit_size 为单位写入。 |
指定偏移地址写入 OTA 固件。
p_hdl | OTA 句柄,从 xf_ota_start() 获取。 |
dst_offset | 偏移量,单位字节。 |
src | OTA 固件数据。 |
size | 本次 OTA 固件数据大小。 必须以 xf_ota_partition_info_t.unit_size 为单位写入。 |