cli

结构体

struct  cli_command
 
struct  cli_region
 

宏定义

#define SECTION(x)   __attribute__((section(x)))
 
#define USED   __attribute__((used))
 
#define ALIOS_CLI_CMD_REGISTER(name, cmd, desc)
 

类型定义

typedef void(* cmd_fun_t) (char *outbuf, int len, int argc, char **argv)
 
typedef int(* cli_region_func) (int argc, char **argv)
 

函数

int aos_cli_init (void)
 Initialize the CLI module 更多...
 
int aos_cli_register_command (const struct cli_command *cmd)
 This function register a command with the command-line interface 更多...
 
int aos_cli_unregister_command (const struct cli_command *cmd)
 This function unregister a command from the command-line interface 更多...
 
int aos_cli_register_commands (const struct cli_command *cmds, int num)
 This function register multi CLI commands 更多...
 
int aos_cli_unregister_commands (const struct cli_command *cmds, int num)
 This function unregisters multi CLI commands 更多...
 
int aos_cli_printf (const char *fmt,...)
 use aos_cli_printf instead of printf in cli cmd 更多...
 
int aos_cli_suspend (void)
 Suspend cli task 更多...
 
int aos_cli_resume (void)
 Resume cli task 更多...
 

详细描述

宏定义说明

◆ ALIOS_CLI_CMD_REGISTER

#define ALIOS_CLI_CMD_REGISTER (   name,
  cmd,
  desc 
)
值:
const char __clisym_##cmd##_name[] SECTION(".rodata") = #cmd; \
const char __clisym_##cmd##_desc[] SECTION(".rodata") = #desc; \
static void name##_stub(char *buf, int len, int argc, char **argv) \
{ \
name(argc, argv); \
} \
USED const struct cli_region __clisym_##cmd SECTION("CliRegion") = \
{ \
__clisym_##cmd##_name, \
__clisym_##cmd##_desc, \
(cli_region_func)&name##_stub};
#define SECTION(x)
Definition: cli.h:27
int(* cli_region_func)(int argc, char **argv)
Definition: cli.h:30
Definition: cli.h:34
const char * name
Definition: cli.h:35

在文件 cli.h40 行定义.

◆ SECTION

#define SECTION (   x)    __attribute__((section(x)))

在文件 cli.h27 行定义.

◆ USED

#define USED   __attribute__((used))

在文件 cli.h28 行定义.

类型定义说明

◆ cli_region_func

typedef int(* cli_region_func) (int argc, char **argv)

在文件 cli.h30 行定义.

◆ cmd_fun_t

typedef void(* cmd_fun_t) (char *outbuf, int len, int argc, char **argv)

在文件 cli.h18 行定义.

函数说明

◆ aos_cli_init()

int aos_cli_init ( void  )

Initialize the CLI module

返回
0 on success, otherwise failed

◆ aos_cli_printf()

int aos_cli_printf ( const char *  fmt,
  ... 
)

use aos_cli_printf instead of printf in cli cmd

参数
[in]fmtpointer to a char * buffer
返回
0 on success, otherwise failed

◆ aos_cli_register_command()

int aos_cli_register_command ( const struct cli_command cmd)

This function register a command with the command-line interface

参数
[in]cmdthe structure to regiter one CLI command
返回
0 on success, otherwise failed

◆ aos_cli_register_commands()

int aos_cli_register_commands ( const struct cli_command cmds,
int  num 
)

This function register multi CLI commands

参数
[in]cmdspointer to an array of commands
[in]numnumber of commands in the array
返回
0 on success, otherwise failed

◆ aos_cli_resume()

int aos_cli_resume ( void  )

Resume cli task

返回
0 on success, otherwise failed

◆ aos_cli_suspend()

int aos_cli_suspend ( void  )

Suspend cli task

返回
0 on success, otherwise failed

◆ aos_cli_unregister_command()

int aos_cli_unregister_command ( const struct cli_command cmd)

This function unregister a command from the command-line interface

参数
[in]cmdthe structure to unregister one CLI command
返回
0 on success, otherwise failed

◆ aos_cli_unregister_commands()

int aos_cli_unregister_commands ( const struct cli_command cmds,
int  num 
)

This function unregisters multi CLI commands

参数
[in]cmdspointer to an array of commands
[in]numnumber of command in the array
返回
0 on success, otherwise failed