Skip to content

Commit

Permalink
drivers: i3c: shell: add ibi disable/enable commands
Browse files Browse the repository at this point in the history
Add shell commands for the `i3c_ibi_enable` and `i3c_ibi_disable` apis.

Signed-off-by: Ryan McClelland <[email protected]>
  • Loading branch information
XenuIsWatching authored and mmahadevan108 committed Sep 28, 2024
1 parent bf700be commit d00684b
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions drivers/i3c/i3c_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,48 @@ static void cmd_i3c_ibi_tir(const struct shell *sh, size_t argc, char **argv)

shell_print(sh, "I3C: Issued IBI TIR");
}

/* i3c ibi enable <device> <target> */
static void cmd_i3c_ibi_enable(const struct shell *sh, size_t argc, char **argv)
{
const struct device *dev, *tdev;
struct i3c_device_desc *desc;
int ret;

ret = i3c_parse_args(sh, argv, &dev, &tdev, &desc);
if (ret != 0) {
return ret;
}

ret = i3c_ibi_enable(desc);
if (ret != 0) {
shell_error(sh, "I3C: Unable to enable IBI");
return ret;
}

shell_print(sh, "I3C: Enabled IBI");
}

/* i3c ibi disable <device> <target> */
static void cmd_i3c_ibi_disable(const struct shell *sh, size_t argc, char **argv)
{
const struct device *dev, *tdev;
struct i3c_device_desc *desc;
int ret;

ret = i3c_parse_args(sh, argv, &dev, &tdev, &desc);
if (ret != 0) {
return ret;
}

ret = i3c_ibi_disable(desc);
if (ret != 0) {
shell_error(sh, "I3C: Unable to disable IBI");
return ret;
}

shell_print(sh, "I3C: Disabled IBI");
}
#endif

static void i3c_device_list_target_name_get(size_t idx, struct shell_static_entry *entry)
Expand Down Expand Up @@ -2051,6 +2093,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
"Send IBI CR\n"
"Usage: ibi cr <device>",
cmd_i3c_ibi_cr, 2, 0),
SHELL_CMD_ARG(enable, &dsub_i3c_device_attached_name,
"Enable receiving IBI from target\n"
"Usage: ibi enable <device> <target>",
cmd_i3c_ibi_enable, 3, 0),
SHELL_CMD_ARG(disable, &dsub_i3c_device_attached_name,
"Disable receiving IBI from target\n"
"Usage: ibi disable <device> <target>",
cmd_i3c_ibi_disable, 3, 0),
SHELL_SUBCMD_SET_END /* Array terminated. */
);
#endif
Expand Down

0 comments on commit d00684b

Please sign in to comment.