zephyr/modzephyr: Add shell_net_iface() function.

Calls out to Zephyr's shell, submodule "net", command "iface", and shows
network interface information (if CONFIG_NET_SHELL is enabled).
This commit is contained in:
Paul Sokolovsky 2017-08-20 08:45:00 +03:00
parent 394c536675
commit 478887c62f
2 changed files with 19 additions and 0 deletions

View File

@ -48,11 +48,27 @@ STATIC mp_obj_t mod_stacks_analyze(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_stacks_analyze_obj, mod_stacks_analyze);
#ifdef CONFIG_NET_SHELL
//int net_shell_cmd_iface(int argc, char *argv[]);
STATIC mp_obj_t mod_shell_net_iface(void) {
net_shell_cmd_iface(0, NULL);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_shell_net_iface_obj, mod_shell_net_iface);
#endif // CONFIG_NET_SHELL
STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_zephyr) },
{ MP_ROM_QSTR(MP_QSTR_is_preempt_thread), MP_ROM_PTR(&mod_is_preempt_thread_obj) },
{ MP_ROM_QSTR(MP_QSTR_current_tid), MP_ROM_PTR(&mod_current_tid_obj) },
{ MP_ROM_QSTR(MP_QSTR_stacks_analyze), MP_ROM_PTR(&mod_stacks_analyze_obj) },
#ifdef CONFIG_NET_SHELL
{ MP_ROM_QSTR(MP_QSTR_shell_net_iface), MP_ROM_PTR(&mod_shell_net_iface_obj) },
#endif
};
STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);

View File

@ -32,6 +32,9 @@ CONFIG_INIT_STACKS=y
# Required for usocket.pkt_get_info()
CONFIG_NET_BUF_POOL_USAGE=y
# Required for usocket.shell_*()
#CONFIG_NET_SHELL=y
# Uncomment to enable "INFO" level net_buf logging
#CONFIG_NET_LOG=y
#CONFIG_NET_DEBUG_NET_BUF=y