oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
shell.h
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
27#ifndef OVE_SHELL_H
28#define OVE_SHELL_H
29
30#include "ove/types.h"
31#include "ove_config.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
43#define OVE_SHELL_MAX_ARGS 8
44
57typedef void (*ove_shell_cmd_fn)(int argc, const char *argv[]);
58
67 const char *name;
68 const char *help;
70};
71
77typedef void (*ove_shell_output_hook_t)(const char *data, size_t len);
78
79#ifdef CONFIG_OVE_SHELL
80
92
105
121
131void ove_shell_process_line(const char *line);
132
142
143#else /* !CONFIG_OVE_SHELL */
144
145static inline int ove_shell_init(void) { return OVE_ERR_NOT_SUPPORTED; }
146static inline int ove_shell_register_cmd(const struct ove_shell_cmd *c) { (void)c; return OVE_ERR_NOT_SUPPORTED; }
147static inline void ove_shell_process_char(int c) { (void)c; }
148static inline void ove_shell_process_line(const char *l) { (void)l; }
149static inline void ove_shell_set_output_hook(ove_shell_output_hook_t h) { (void)h; }
150
151#endif /* CONFIG_OVE_SHELL */
152
153#ifdef __cplusplus
154}
155#endif
156
/* end of ove_shell group */
158
159#endif /* OVE_SHELL_H */
int ove_shell_init(void)
Initialise the shell subsystem.
int ove_shell_register_cmd(const struct ove_shell_cmd *cmd)
Register a command with the shell.
void ove_shell_process_char(int c)
Feed one character into the shell input processor.
void(* ove_shell_output_hook_t)(const char *data, size_t len)
Shell output hook for capturing command output.
Definition shell.h:77
void ove_shell_set_output_hook(ove_shell_output_hook_t hook)
Set a hook to capture shell output.
void(* ove_shell_cmd_fn)(int argc, const char *argv[])
Prototype for a shell command handler function.
Definition shell.h:57
void ove_shell_process_line(const char *line)
Process a complete input line through the shell.
#define OVE_ERR_NOT_SUPPORTED
The requested feature is not supported by the active backend.
Definition types.h:38
Descriptor for a single shell command.
Definition shell.h:66
const char * name
Command name used to match input tokens.
Definition shell.h:67
const char * help
One-line help string shown by the built-in help command.
Definition shell.h:68
ove_shell_cmd_fn handler
Function invoked when the command is matched.
Definition shell.h:69