Skip to content

Commit d00684b

Browse files
XenuIsWatchingmmahadevan108
authored andcommitted
drivers: i3c: shell: add ibi disable/enable commands
Add shell commands for the `i3c_ibi_enable` and `i3c_ibi_disable` apis. Signed-off-by: Ryan McClelland <[email protected]>
1 parent bf700be commit d00684b

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

drivers/i3c/i3c_shell.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,6 +1991,48 @@ static void cmd_i3c_ibi_tir(const struct shell *sh, size_t argc, char **argv)
19911991

19921992
shell_print(sh, "I3C: Issued IBI TIR");
19931993
}
1994+
1995+
/* i3c ibi enable <device> <target> */
1996+
static void cmd_i3c_ibi_enable(const struct shell *sh, size_t argc, char **argv)
1997+
{
1998+
const struct device *dev, *tdev;
1999+
struct i3c_device_desc *desc;
2000+
int ret;
2001+
2002+
ret = i3c_parse_args(sh, argv, &dev, &tdev, &desc);
2003+
if (ret != 0) {
2004+
return ret;
2005+
}
2006+
2007+
ret = i3c_ibi_enable(desc);
2008+
if (ret != 0) {
2009+
shell_error(sh, "I3C: Unable to enable IBI");
2010+
return ret;
2011+
}
2012+
2013+
shell_print(sh, "I3C: Enabled IBI");
2014+
}
2015+
2016+
/* i3c ibi disable <device> <target> */
2017+
static void cmd_i3c_ibi_disable(const struct shell *sh, size_t argc, char **argv)
2018+
{
2019+
const struct device *dev, *tdev;
2020+
struct i3c_device_desc *desc;
2021+
int ret;
2022+
2023+
ret = i3c_parse_args(sh, argv, &dev, &tdev, &desc);
2024+
if (ret != 0) {
2025+
return ret;
2026+
}
2027+
2028+
ret = i3c_ibi_disable(desc);
2029+
if (ret != 0) {
2030+
shell_error(sh, "I3C: Unable to disable IBI");
2031+
return ret;
2032+
}
2033+
2034+
shell_print(sh, "I3C: Disabled IBI");
2035+
}
19942036
#endif
19952037

19962038
static void i3c_device_list_target_name_get(size_t idx, struct shell_static_entry *entry)
@@ -2051,6 +2093,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
20512093
"Send IBI CR\n"
20522094
"Usage: ibi cr <device>",
20532095
cmd_i3c_ibi_cr, 2, 0),
2096+
SHELL_CMD_ARG(enable, &dsub_i3c_device_attached_name,
2097+
"Enable receiving IBI from target\n"
2098+
"Usage: ibi enable <device> <target>",
2099+
cmd_i3c_ibi_enable, 3, 0),
2100+
SHELL_CMD_ARG(disable, &dsub_i3c_device_attached_name,
2101+
"Disable receiving IBI from target\n"
2102+
"Usage: ibi disable <device> <target>",
2103+
cmd_i3c_ibi_disable, 3, 0),
20542104
SHELL_SUBCMD_SET_END /* Array terminated. */
20552105
);
20562106
#endif

0 commit comments

Comments
 (0)