oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
shell.h
Go to the documentation of this file.
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
28#ifndef OVE_SHELL_H
29#define OVE_SHELL_H
30
31#include "ove/types.h"
32#include "ove_config.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
44#define OVE_SHELL_MAX_ARGS 8
45
58typedef void (*ove_shell_cmd_fn)(int argc, const char *argv[]);
59
68 const char *name;
69 const char *help;
71};
72
78typedef void (*ove_shell_output_hook_t)(const char *data, size_t len);
79
80#ifdef CONFIG_OVE_SHELL
81
93
106
122
132void ove_shell_process_line(const char *line);
133
143
144#else /* !CONFIG_OVE_SHELL */
145
146static inline int ove_shell_init(void)
147{
149}
150static inline int ove_shell_register_cmd(const struct ove_shell_cmd *c)
151{
152 (void)c;
154}
155static inline void ove_shell_process_char(int c)
156{
157 (void)c;
158}
159static inline void ove_shell_process_line(const char *l)
160{
161 (void)l;
162}
164{
165 (void)h;
166}
167
168#endif /* CONFIG_OVE_SHELL */
169
170#ifdef __cplusplus
171}
172#endif
173
/* end of ove_shell group */
175
176#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:78
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:58
void ove_shell_process_line(const char *line)
Process a complete input line through the shell.
@ OVE_ERR_NOT_SUPPORTED
Definition types.h:98
Descriptor for a single shell command.
Definition shell.h:67
const char * name
Command name used to match input tokens.
Definition shell.h:68
const char * help
One-line help string shown by the built-in help command.
Definition shell.h:69
ove_shell_cmd_fn handler
Function invoked when the command is matched.
Definition shell.h:70