zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g" git grep -l 's\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g" Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
ee6fa31af6
commit
a1b77fd589
2364 changed files with 32505 additions and 32505 deletions
|
@ -99,7 +99,7 @@ static int cmd_device_list(const struct shell *shell,
|
|||
shell_fprintf(shell, SHELL_NORMAL, "- %s", dev->name);
|
||||
|
||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
u32_t state = DEVICE_PM_ACTIVE_STATE;
|
||||
uint32_t state = DEVICE_PM_ACTIVE_STATE;
|
||||
int err;
|
||||
|
||||
err = device_get_power_state(dev, &state);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
static int cmd_kernel_version(const struct shell *shell,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
u32_t version = sys_kernel_version_get();
|
||||
uint32_t version = sys_kernel_version_get();
|
||||
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
|
@ -137,7 +137,7 @@ extern K_THREAD_STACK_ARRAY_DEFINE(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
|
|||
static int cmd_kernel_stacks(const struct shell *shell,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
u8_t *buf;
|
||||
uint8_t *buf;
|
||||
size_t size, unused = 0;
|
||||
|
||||
ARG_UNUSED(argc);
|
||||
|
|
|
@ -92,11 +92,11 @@ static void state_set(const struct shell *shell, enum shell_state state)
|
|||
}
|
||||
|
||||
static void tab_item_print(const struct shell *shell, const char *option,
|
||||
u16_t longest_option)
|
||||
uint16_t longest_option)
|
||||
{
|
||||
static const char *tab = " ";
|
||||
u16_t columns;
|
||||
u16_t diff;
|
||||
uint16_t columns;
|
||||
uint16_t diff;
|
||||
|
||||
/* Function initialization has been requested. */
|
||||
if (option == NULL) {
|
||||
|
@ -148,7 +148,7 @@ static void history_mode_exit(const struct shell *shell)
|
|||
shell_history_mode_exit(shell->history);
|
||||
}
|
||||
|
||||
static void history_put(const struct shell *shell, u8_t *line, size_t length)
|
||||
static void history_put(const struct shell *shell, uint8_t *line, size_t length)
|
||||
{
|
||||
if (!IS_ENABLED(CONFIG_SHELL_HISTORY)) {
|
||||
return;
|
||||
|
@ -160,7 +160,7 @@ static void history_put(const struct shell *shell, u8_t *line, size_t length)
|
|||
static void history_handle(const struct shell *shell, bool up)
|
||||
{
|
||||
bool history_mode;
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
/*optional feature */
|
||||
if (!IS_ENABLED(CONFIG_SHELL_HISTORY)) {
|
||||
|
@ -176,7 +176,7 @@ static void history_handle(const struct shell *shell, bool up)
|
|||
/* Backup command if history is entered */
|
||||
if (!shell_history_active(shell->history)) {
|
||||
if (up) {
|
||||
u16_t cmd_len = shell_strlen(shell->ctx->cmd_buff);
|
||||
uint16_t cmd_len = shell_strlen(shell->ctx->cmd_buff);
|
||||
|
||||
if (cmd_len) {
|
||||
strcpy(shell->ctx->temp_buff,
|
||||
|
@ -208,9 +208,9 @@ static void history_handle(const struct shell *shell, bool up)
|
|||
shell_op_cond_next_line(shell);
|
||||
}
|
||||
|
||||
static inline u16_t completion_space_get(const struct shell *shell)
|
||||
static inline uint16_t completion_space_get(const struct shell *shell)
|
||||
{
|
||||
u16_t space = (CONFIG_SHELL_CMD_BUFF_SIZE - 1) -
|
||||
uint16_t space = (CONFIG_SHELL_CMD_BUFF_SIZE - 1) -
|
||||
shell->ctx->cmd_buff_len;
|
||||
return space;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ static bool tab_prepare(const struct shell *shell,
|
|||
size_t *complete_arg_idx,
|
||||
struct shell_static_entry *d_entry)
|
||||
{
|
||||
u16_t compl_space = completion_space_get(shell);
|
||||
uint16_t compl_space = completion_space_get(shell);
|
||||
size_t search_argc;
|
||||
|
||||
if (compl_space == 0U) {
|
||||
|
@ -292,7 +292,7 @@ static void find_completion_candidates(const struct shell *shell,
|
|||
const struct shell_static_entry *cmd,
|
||||
const char *incompl_cmd,
|
||||
size_t *first_idx, size_t *cnt,
|
||||
u16_t *longest)
|
||||
uint16_t *longest)
|
||||
{
|
||||
size_t incompl_cmd_len = shell_strlen(incompl_cmd);
|
||||
const struct shell_static_entry *candidate;
|
||||
|
@ -325,8 +325,8 @@ static void autocomplete(const struct shell *shell,
|
|||
size_t subcmd_idx)
|
||||
{
|
||||
const struct shell_static_entry *match;
|
||||
u16_t cmd_len;
|
||||
u16_t arg_len = shell_strlen(arg);
|
||||
uint16_t cmd_len;
|
||||
uint16_t arg_len = shell_strlen(arg);
|
||||
|
||||
/* shell->ctx->active_cmd can be safely used outside of command context
|
||||
* to save stack
|
||||
|
@ -381,7 +381,7 @@ static size_t str_common(const char *s1, const char *s2, size_t n)
|
|||
static void tab_options_print(const struct shell *shell,
|
||||
const struct shell_static_entry *cmd,
|
||||
const char *str, size_t first, size_t cnt,
|
||||
u16_t longest)
|
||||
uint16_t longest)
|
||||
{
|
||||
const struct shell_static_entry *match;
|
||||
size_t str_len = shell_strlen(str);
|
||||
|
@ -413,14 +413,14 @@ static void tab_options_print(const struct shell *shell,
|
|||
shell_print_prompt_and_cmd(shell);
|
||||
}
|
||||
|
||||
static u16_t common_beginning_find(const struct shell *shell,
|
||||
static uint16_t common_beginning_find(const struct shell *shell,
|
||||
const struct shell_static_entry *cmd,
|
||||
const char **str,
|
||||
size_t first, size_t cnt, u16_t arg_len)
|
||||
size_t first, size_t cnt, uint16_t arg_len)
|
||||
{
|
||||
struct shell_static_entry dynamic_entry;
|
||||
const struct shell_static_entry *match;
|
||||
u16_t common = UINT16_MAX;
|
||||
uint16_t common = UINT16_MAX;
|
||||
size_t idx = first + 1;
|
||||
|
||||
__ASSERT_NO_MSG(cnt > 1);
|
||||
|
@ -459,8 +459,8 @@ static void partial_autocomplete(const struct shell *shell,
|
|||
size_t first, size_t cnt)
|
||||
{
|
||||
const char *completion;
|
||||
u16_t arg_len = shell_strlen(arg);
|
||||
u16_t common = common_beginning_find(shell, cmd, &completion, first,
|
||||
uint16_t arg_len = shell_strlen(arg);
|
||||
uint16_t common = common_beginning_find(shell, cmd, &completion, first,
|
||||
cnt, arg_len);
|
||||
|
||||
if (common) {
|
||||
|
@ -492,9 +492,9 @@ static int exec_cmd(const struct shell *shell, size_t argc, const char **argv,
|
|||
}
|
||||
|
||||
if (shell->ctx->active_cmd.args.mandatory) {
|
||||
u32_t mand = shell->ctx->active_cmd.args.mandatory;
|
||||
u8_t opt8 = shell->ctx->active_cmd.args.optional;
|
||||
u32_t opt = (opt8 == SHELL_OPT_ARG_CHECK_SKIP) ?
|
||||
uint32_t mand = shell->ctx->active_cmd.args.mandatory;
|
||||
uint8_t opt8 = shell->ctx->active_cmd.args.optional;
|
||||
uint32_t opt = (opt8 == SHELL_OPT_ARG_CHECK_SKIP) ?
|
||||
UINT16_MAX : opt8;
|
||||
bool in_range = (argc >= mand) && (argc <= (mand + opt));
|
||||
|
||||
|
@ -741,7 +741,7 @@ static void tab_handle(const struct shell *shell)
|
|||
const char **argv = __argv;
|
||||
size_t first = 0;
|
||||
size_t arg_idx;
|
||||
u16_t longest;
|
||||
uint16_t longest;
|
||||
size_t argc;
|
||||
size_t cnt;
|
||||
|
||||
|
@ -860,7 +860,7 @@ static void ctrl_metakeys_handle(const struct shell *shell, char data)
|
|||
}
|
||||
|
||||
/* Functions returns true if new line character shall be processed */
|
||||
static bool process_nl(const struct shell *shell, u8_t data)
|
||||
static bool process_nl(const struct shell *shell, uint8_t data)
|
||||
{
|
||||
if ((data != '\r') && (data != '\n')) {
|
||||
flag_last_nl_set(shell, 0);
|
||||
|
@ -879,7 +879,7 @@ static bool process_nl(const struct shell *shell, u8_t data)
|
|||
#define SHELL_ASCII_MAX_CHAR (127u)
|
||||
static inline int ascii_filter(const char data)
|
||||
{
|
||||
return (u8_t) data > SHELL_ASCII_MAX_CHAR ? -EINVAL : 0;
|
||||
return (uint8_t) data > SHELL_ASCII_MAX_CHAR ? -EINVAL : 0;
|
||||
}
|
||||
|
||||
static void state_collect(const struct shell *shell)
|
||||
|
@ -1195,7 +1195,7 @@ void shell_thread(void *shell_handle, void *arg_log_backend,
|
|||
{
|
||||
struct shell *shell = shell_handle;
|
||||
bool log_backend = (bool)arg_log_backend;
|
||||
u32_t log_level = POINTER_TO_UINT(arg_log_level);
|
||||
uint32_t log_level = POINTER_TO_UINT(arg_log_level);
|
||||
int err;
|
||||
|
||||
err = shell->iface->api->enable(shell->iface, false);
|
||||
|
@ -1243,7 +1243,7 @@ void shell_thread(void *shell_handle, void *arg_log_backend,
|
|||
}
|
||||
|
||||
int shell_init(const struct shell *shell, const void *transport_config,
|
||||
bool use_colors, bool log_backend, u32_t init_log_level)
|
||||
bool use_colors, bool log_backend, uint32_t init_log_level)
|
||||
{
|
||||
__ASSERT_NO_MSG(shell);
|
||||
__ASSERT_NO_MSG(shell->ctx && shell->iface && shell->default_prompt);
|
||||
|
@ -1390,7 +1390,7 @@ void shell_fprintf(const struct shell *shell, enum shell_vt100_color color,
|
|||
}
|
||||
|
||||
static void shell_hexdump_line(const struct shell *shell, unsigned int offset,
|
||||
const u8_t *data, size_t len)
|
||||
const uint8_t *data, size_t len)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1429,9 +1429,9 @@ static void shell_hexdump_line(const struct shell *shell, unsigned int offset,
|
|||
shell_print(shell, "|");
|
||||
}
|
||||
|
||||
void shell_hexdump(const struct shell *shell, const u8_t *data, size_t len)
|
||||
void shell_hexdump(const struct shell *shell, const uint8_t *data, size_t len)
|
||||
{
|
||||
const u8_t *p = data;
|
||||
const uint8_t *p = data;
|
||||
size_t line_len;
|
||||
|
||||
while (len) {
|
||||
|
@ -1466,7 +1466,7 @@ void shell_help(const struct shell *shell)
|
|||
|
||||
int shell_execute_cmd(const struct shell *shell, const char *cmd)
|
||||
{
|
||||
u16_t cmd_len = shell_strlen(cmd);
|
||||
uint16_t cmd_len = shell_strlen(cmd);
|
||||
int ret_val;
|
||||
|
||||
if (cmd == NULL) {
|
||||
|
|
|
@ -60,9 +60,9 @@
|
|||
#define SHELL_DEFAULT_TERMINAL_HEIGHT 24
|
||||
|
||||
/* Function reads cursor position from terminal. */
|
||||
static int cursor_position_get(const struct shell *shell, u16_t *x, u16_t *y)
|
||||
static int cursor_position_get(const struct shell *shell, uint16_t *x, uint16_t *y)
|
||||
{
|
||||
u16_t buff_idx = 0U;
|
||||
uint16_t buff_idx = 0U;
|
||||
size_t cnt;
|
||||
char c = 0;
|
||||
|
||||
|
@ -82,7 +82,7 @@ static int cursor_position_get(const struct shell *shell, u16_t *x, u16_t *y)
|
|||
transport_buffer_flush(shell);
|
||||
|
||||
/* timeout for terminal response = ~1s */
|
||||
for (u16_t i = 0; i < 1000; i++) {
|
||||
for (uint16_t i = 0; i < 1000; i++) {
|
||||
do {
|
||||
(void)shell->iface->api->read(shell->iface, &c,
|
||||
sizeof(c), &cnt);
|
||||
|
@ -167,8 +167,8 @@ static int cursor_position_get(const struct shell *shell, u16_t *x, u16_t *y)
|
|||
/* Function gets terminal width and height. */
|
||||
static int terminal_size_get(const struct shell *shell)
|
||||
{
|
||||
u16_t x; /* horizontal position */
|
||||
u16_t y; /* vertical position */
|
||||
uint16_t x; /* horizontal position */
|
||||
uint16_t y; /* vertical position */
|
||||
int ret_val = 0;
|
||||
|
||||
cursor_save(shell);
|
||||
|
@ -304,7 +304,7 @@ static int cmd_history(const struct shell *shell, size_t argc, char **argv)
|
|||
ARG_UNUSED(argv);
|
||||
|
||||
size_t i = 0;
|
||||
u16_t len;
|
||||
uint16_t len;
|
||||
|
||||
while (1) {
|
||||
shell_history_get(shell->history, true,
|
||||
|
|
|
@ -26,7 +26,7 @@ static int out_func(int c, void *ctx)
|
|||
(void)out_func('\r', ctx);
|
||||
}
|
||||
|
||||
sh_fprintf->buffer[sh_fprintf->ctrl_blk->buffer_cnt] = (u8_t)c;
|
||||
sh_fprintf->buffer[sh_fprintf->ctrl_blk->buffer_cnt] = (uint8_t)c;
|
||||
sh_fprintf->ctrl_blk->buffer_cnt++;
|
||||
|
||||
if (sh_fprintf->ctrl_blk->buffer_cnt == sh_fprintf->buffer_size) {
|
||||
|
|
|
@ -107,10 +107,10 @@ static void formatted_text_print(const struct shell *shell, const char *str,
|
|||
}
|
||||
|
||||
static void help_item_print(const struct shell *shell, const char *item_name,
|
||||
u16_t item_name_width, const char *item_help)
|
||||
uint16_t item_name_width, const char *item_help)
|
||||
{
|
||||
static const u8_t tabulator[] = " ";
|
||||
const u16_t offset = 2 * strlen(tabulator) + item_name_width + 1;
|
||||
static const uint8_t tabulator[] = " ";
|
||||
const uint16_t offset = 2 * strlen(tabulator) + item_name_width + 1;
|
||||
|
||||
if (item_name == NULL) {
|
||||
return;
|
||||
|
@ -123,12 +123,12 @@ static void help_item_print(const struct shell *shell, const char *item_name,
|
|||
item_name_width, item_name,
|
||||
tabulator);
|
||||
} else {
|
||||
u16_t tmp = item_name_width - strlen(item_name);
|
||||
uint16_t tmp = item_name_width - strlen(item_name);
|
||||
char space = ' ';
|
||||
|
||||
shell_internal_fprintf(shell, SHELL_NORMAL, "%s%s", tabulator,
|
||||
item_name);
|
||||
for (u16_t i = 0; i < tmp; i++) {
|
||||
for (uint16_t i = 0; i < tmp; i++) {
|
||||
shell_write(shell, &space, 1);
|
||||
}
|
||||
shell_internal_fprintf(shell, SHELL_NORMAL, "%s:", tabulator);
|
||||
|
@ -150,7 +150,7 @@ void shell_help_subcmd_print(const struct shell *shell)
|
|||
const struct shell_static_entry *entry = NULL;
|
||||
const struct shell_static_entry *parent = &shell->ctx->active_cmd;
|
||||
struct shell_static_entry dloc;
|
||||
u16_t longest = 0U;
|
||||
uint16_t longest = 0U;
|
||||
size_t idx = 0;
|
||||
|
||||
/* Searching for the longest subcommand to print. */
|
||||
|
@ -177,7 +177,7 @@ void shell_help_cmd_print(const struct shell *shell)
|
|||
{
|
||||
static const char cmd_sep[] = " - "; /* commands separator */
|
||||
|
||||
u16_t field_width = shell_strlen(shell->ctx->active_cmd.syntax) +
|
||||
uint16_t field_width = shell_strlen(shell->ctx->active_cmd.syntax) +
|
||||
shell_strlen(cmd_sep);
|
||||
|
||||
shell_internal_fprintf(shell, SHELL_NORMAL, "%s%s",
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
*/
|
||||
struct shell_history_item {
|
||||
sys_dnode_t dnode;
|
||||
u16_t len;
|
||||
u16_t padding;
|
||||
uint16_t len;
|
||||
uint16_t padding;
|
||||
char data[0];
|
||||
};
|
||||
|
||||
|
@ -47,7 +47,7 @@ void shell_history_mode_exit(struct shell_history *history)
|
|||
}
|
||||
|
||||
bool shell_history_get(struct shell_history *history, bool up,
|
||||
u8_t *dst, u16_t *len)
|
||||
uint8_t *dst, uint16_t *len)
|
||||
{
|
||||
struct shell_history_item *h_item; /* history item */
|
||||
sys_dnode_t *l_item; /* list item */
|
||||
|
@ -90,7 +90,7 @@ bool shell_history_get(struct shell_history *history, bool up,
|
|||
|
||||
static void add_to_head(struct shell_history *history,
|
||||
struct shell_history_item *item,
|
||||
u8_t *src, size_t len, u16_t padding)
|
||||
uint8_t *src, size_t len, uint16_t padding)
|
||||
{
|
||||
item->len = len;
|
||||
item->padding = padding;
|
||||
|
@ -103,7 +103,7 @@ static bool remove_from_tail(struct shell_history *history)
|
|||
{
|
||||
sys_dnode_t *l_item; /* list item */
|
||||
struct shell_history_item *h_item;
|
||||
u32_t total_len;
|
||||
uint32_t total_len;
|
||||
|
||||
if (sys_dlist_is_empty(&history->list)) {
|
||||
return false;
|
||||
|
@ -127,14 +127,14 @@ void shell_history_purge(struct shell_history *history)
|
|||
}
|
||||
}
|
||||
|
||||
void shell_history_put(struct shell_history *history, u8_t *line, size_t len)
|
||||
void shell_history_put(struct shell_history *history, uint8_t *line, size_t len)
|
||||
{
|
||||
sys_dnode_t *l_item; /* list item */
|
||||
struct shell_history_item *h_item;
|
||||
u32_t total_len = len + offsetof(struct shell_history_item, data);
|
||||
u32_t claim_len;
|
||||
u32_t claim2_len;
|
||||
u16_t padding = (~total_len + 1) & (sizeof(void *) - 1);
|
||||
uint32_t total_len = len + offsetof(struct shell_history_item, data);
|
||||
uint32_t claim_len;
|
||||
uint32_t claim2_len;
|
||||
uint16_t padding = (~total_len + 1) & (sizeof(void *) - 1);
|
||||
|
||||
/* align to word. */
|
||||
total_len += padding;
|
||||
|
@ -161,14 +161,14 @@ void shell_history_put(struct shell_history *history, u8_t *line, size_t len)
|
|||
|
||||
do {
|
||||
claim_len = ring_buf_put_claim(history->ring_buf,
|
||||
(u8_t **)&h_item, total_len);
|
||||
(uint8_t **)&h_item, total_len);
|
||||
/* second allocation may succeed if we were at the end of the
|
||||
* buffer.
|
||||
*/
|
||||
if (claim_len < total_len) {
|
||||
claim2_len =
|
||||
ring_buf_put_claim(history->ring_buf,
|
||||
(u8_t **)&h_item, total_len);
|
||||
(uint8_t **)&h_item, total_len);
|
||||
if (claim2_len == total_len) {
|
||||
ring_buf_put_finish(history->ring_buf,
|
||||
claim_len);
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
#include "shell_ops.h"
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
int shell_log_backend_output_func(u8_t *data, size_t length, void *ctx)
|
||||
int shell_log_backend_output_func(uint8_t *data, size_t length, void *ctx)
|
||||
{
|
||||
shell_print_stream(ctx, data, length);
|
||||
return length;
|
||||
}
|
||||
|
||||
void shell_log_backend_enable(const struct shell_log_backend *backend,
|
||||
void *ctx, u32_t init_log_level)
|
||||
void *ctx, uint32_t init_log_level)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
|
@ -62,8 +62,8 @@ static void flush_expired_messages(const struct shell *shell)
|
|||
int err;
|
||||
struct shell_log_backend_msg msg;
|
||||
struct k_msgq *msgq = shell->log_backend->msgq;
|
||||
u32_t timeout = shell->log_backend->timeout;
|
||||
u32_t now = k_uptime_get_32();
|
||||
uint32_t timeout = shell->log_backend->timeout;
|
||||
uint32_t now = k_uptime_get_32();
|
||||
|
||||
while (1) {
|
||||
err = k_msgq_peek(msgq, &msg);
|
||||
|
@ -127,7 +127,7 @@ void shell_log_backend_disable(const struct shell_log_backend *backend)
|
|||
static void msg_process(const struct log_output *log_output,
|
||||
struct log_msg *msg, bool colors)
|
||||
{
|
||||
u32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
||||
uint32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
||||
LOG_OUTPUT_FLAG_TIMESTAMP |
|
||||
LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP;
|
||||
|
||||
|
@ -141,7 +141,7 @@ static void msg_process(const struct log_output *log_output,
|
|||
|
||||
bool shell_log_backend_process(const struct shell_log_backend *backend)
|
||||
{
|
||||
u32_t dropped;
|
||||
uint32_t dropped;
|
||||
const struct shell *shell =
|
||||
(const struct shell *)backend->backend->cb->ctx;
|
||||
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
|
||||
|
@ -208,12 +208,12 @@ static void put(const struct log_backend *const backend, struct log_msg *msg)
|
|||
}
|
||||
|
||||
static void put_sync_string(const struct log_backend *const backend,
|
||||
struct log_msg_ids src_level, u32_t timestamp,
|
||||
struct log_msg_ids src_level, uint32_t timestamp,
|
||||
const char *fmt, va_list ap)
|
||||
{
|
||||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
||||
u32_t key;
|
||||
u32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
||||
uint32_t key;
|
||||
uint32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
||||
LOG_OUTPUT_FLAG_TIMESTAMP |
|
||||
LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP;
|
||||
|
||||
|
@ -234,12 +234,12 @@ static void put_sync_string(const struct log_backend *const backend,
|
|||
}
|
||||
|
||||
static void put_sync_hexdump(const struct log_backend *const backend,
|
||||
struct log_msg_ids src_level, u32_t timestamp,
|
||||
const char *metadata, const u8_t *data, u32_t length)
|
||||
struct log_msg_ids src_level, uint32_t timestamp,
|
||||
const char *metadata, const uint8_t *data, uint32_t length)
|
||||
{
|
||||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
||||
u32_t key;
|
||||
u32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
||||
uint32_t key;
|
||||
uint32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
||||
LOG_OUTPUT_FLAG_TIMESTAMP |
|
||||
LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP;
|
||||
|
||||
|
@ -290,7 +290,7 @@ static void panic(const struct log_backend *const backend)
|
|||
}
|
||||
}
|
||||
|
||||
static void dropped(const struct log_backend *const backend, u32_t cnt)
|
||||
static void dropped(const struct log_backend *const backend, uint32_t cnt)
|
||||
{
|
||||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
||||
const struct shell_log_backend *log_backend = shell->log_backend;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <ctype.h>
|
||||
#include "shell_ops.h"
|
||||
|
||||
void shell_op_cursor_vert_move(const struct shell *shell, s32_t delta)
|
||||
void shell_op_cursor_vert_move(const struct shell *shell, int32_t delta)
|
||||
{
|
||||
if (delta != 0) {
|
||||
shell_raw_fprintf(shell->fprintf_ctx, "\033[%d%c",
|
||||
|
@ -16,7 +16,7 @@ void shell_op_cursor_vert_move(const struct shell *shell, s32_t delta)
|
|||
}
|
||||
}
|
||||
|
||||
void shell_op_cursor_horiz_move(const struct shell *shell, s32_t delta)
|
||||
void shell_op_cursor_horiz_move(const struct shell *shell, int32_t delta)
|
||||
{
|
||||
if (delta != 0) {
|
||||
shell_raw_fprintf(shell->fprintf_ctx, "\033[%d%c",
|
||||
|
@ -74,12 +74,12 @@ void shell_op_cursor_position_synchronize(const struct shell *shell)
|
|||
}
|
||||
}
|
||||
|
||||
void shell_op_cursor_move(const struct shell *shell, s16_t val)
|
||||
void shell_op_cursor_move(const struct shell *shell, int16_t val)
|
||||
{
|
||||
struct shell_multiline_cons *cons = &shell->ctx->vt100_ctx.cons;
|
||||
u16_t new_pos = shell->ctx->cmd_buff_pos + val;
|
||||
s32_t row_span;
|
||||
s32_t col_span;
|
||||
uint16_t new_pos = shell->ctx->cmd_buff_pos + val;
|
||||
int32_t row_span;
|
||||
int32_t col_span;
|
||||
|
||||
shell_multiline_data_calc(cons, shell->ctx->cmd_buff_pos,
|
||||
shell->ctx->cmd_buff_len);
|
||||
|
@ -98,11 +98,11 @@ void shell_op_cursor_move(const struct shell *shell, s16_t val)
|
|||
shell->ctx->cmd_buff_pos = new_pos;
|
||||
}
|
||||
|
||||
static u16_t shift_calc(const char *str, u16_t pos, u16_t len, s16_t sign)
|
||||
static uint16_t shift_calc(const char *str, uint16_t pos, uint16_t len, int16_t sign)
|
||||
{
|
||||
bool found = false;
|
||||
u16_t ret = 0U;
|
||||
u16_t idx;
|
||||
uint16_t ret = 0U;
|
||||
uint16_t idx;
|
||||
|
||||
while (1) {
|
||||
idx = pos + ret * sign;
|
||||
|
@ -123,10 +123,10 @@ static u16_t shift_calc(const char *str, u16_t pos, u16_t len, s16_t sign)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void shell_op_cursor_word_move(const struct shell *shell, s16_t val)
|
||||
void shell_op_cursor_word_move(const struct shell *shell, int16_t val)
|
||||
{
|
||||
s16_t shift;
|
||||
s16_t sign;
|
||||
int16_t shift;
|
||||
int16_t sign;
|
||||
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
|
@ -147,7 +147,7 @@ void shell_op_word_remove(const struct shell *shell)
|
|||
{
|
||||
char *str = &shell->ctx->cmd_buff[shell->ctx->cmd_buff_pos - 1];
|
||||
char *str_start = &shell->ctx->cmd_buff[0];
|
||||
u16_t chars_to_delete;
|
||||
uint16_t chars_to_delete;
|
||||
|
||||
/* Line must not be empty and cursor must not be at 0 to continue. */
|
||||
if ((shell->ctx->cmd_buff_len == 0) ||
|
||||
|
@ -209,7 +209,7 @@ void shell_op_right_arrow(const struct shell *shell)
|
|||
}
|
||||
}
|
||||
|
||||
static void reprint_from_cursor(const struct shell *shell, u16_t diff,
|
||||
static void reprint_from_cursor(const struct shell *shell, uint16_t diff,
|
||||
bool data_removed)
|
||||
{
|
||||
/* Clear eos is needed only when newly printed command is shorter than
|
||||
|
@ -236,9 +236,9 @@ static void reprint_from_cursor(const struct shell *shell, u16_t diff,
|
|||
shell_op_cursor_move(shell, -diff);
|
||||
}
|
||||
|
||||
static void data_insert(const struct shell *shell, const char *data, u16_t len)
|
||||
static void data_insert(const struct shell *shell, const char *data, uint16_t len)
|
||||
{
|
||||
u16_t after = shell->ctx->cmd_buff_len - shell->ctx->cmd_buff_pos;
|
||||
uint16_t after = shell->ctx->cmd_buff_len - shell->ctx->cmd_buff_pos;
|
||||
char *curr_pos = &shell->ctx->cmd_buff[shell->ctx->cmd_buff_pos];
|
||||
|
||||
if ((shell->ctx->cmd_buff_len + len) >= CONFIG_SHELL_CMD_BUFF_SIZE) {
|
||||
|
@ -295,7 +295,7 @@ void shell_op_char_backspace(const struct shell *shell)
|
|||
|
||||
void shell_op_char_delete(const struct shell *shell)
|
||||
{
|
||||
u16_t diff = shell->ctx->cmd_buff_len - shell->ctx->cmd_buff_pos;
|
||||
uint16_t diff = shell->ctx->cmd_buff_len - shell->ctx->cmd_buff_pos;
|
||||
char *str = &shell->ctx->cmd_buff[shell->ctx->cmd_buff_pos];
|
||||
|
||||
if (diff == 0U) {
|
||||
|
@ -317,7 +317,7 @@ void shell_op_delete_from_cursor(const struct shell *shell)
|
|||
|
||||
void shell_op_completion_insert(const struct shell *shell,
|
||||
const char *compl,
|
||||
u16_t compl_len)
|
||||
uint16_t compl_len)
|
||||
{
|
||||
data_insert(shell, compl, compl_len);
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ void shell_write(const struct shell *shell, const void *data,
|
|||
|
||||
while (length) {
|
||||
int err = shell->iface->api->write(shell->iface,
|
||||
&((const u8_t *) data)[offset], length,
|
||||
&((const uint8_t *) data)[offset], length,
|
||||
&tmp_cnt);
|
||||
(void)err;
|
||||
__ASSERT_NO_MSG(err == 0);
|
||||
|
@ -408,7 +408,7 @@ static void vt100_bgcolor_set(const struct shell *shell,
|
|||
}
|
||||
|
||||
/* -1 because default value is first in enum */
|
||||
u8_t cmd[] = SHELL_VT100_BGCOLOR(bgcolor - 1);
|
||||
uint8_t cmd[] = SHELL_VT100_BGCOLOR(bgcolor - 1);
|
||||
|
||||
shell->ctx->vt100_ctx.col.bgcol = bgcolor;
|
||||
shell_raw_fprintf(shell->fprintf_ctx, "%s", cmd);
|
||||
|
@ -427,11 +427,11 @@ void shell_vt100_color_set(const struct shell *shell,
|
|||
|
||||
if (color != SHELL_NORMAL) {
|
||||
|
||||
u8_t cmd[] = SHELL_VT100_COLOR(color - 1);
|
||||
uint8_t cmd[] = SHELL_VT100_COLOR(color - 1);
|
||||
|
||||
shell_raw_fprintf(shell->fprintf_ctx, "%s", cmd);
|
||||
} else {
|
||||
static const u8_t cmd[] = SHELL_VT100_MODESOFF;
|
||||
static const uint8_t cmd[] = SHELL_VT100_MODESOFF;
|
||||
|
||||
shell_raw_fprintf(shell->fprintf_ctx, "%s", cmd);
|
||||
}
|
||||
|
|
|
@ -141,18 +141,18 @@ static inline void flag_cmd_ctx_set(const struct shell *shell, bool val)
|
|||
shell->ctx->internal.flags.cmd_ctx = val ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline u8_t flag_last_nl_get(const struct shell *shell)
|
||||
static inline uint8_t flag_last_nl_get(const struct shell *shell)
|
||||
{
|
||||
return shell->ctx->internal.flags.last_nl;
|
||||
}
|
||||
|
||||
static inline void flag_last_nl_set(const struct shell *shell, u8_t val)
|
||||
static inline void flag_last_nl_set(const struct shell *shell, uint8_t val)
|
||||
{
|
||||
shell->ctx->internal.flags.last_nl = val;
|
||||
}
|
||||
|
||||
void shell_op_cursor_vert_move(const struct shell *shell, s32_t delta);
|
||||
void shell_op_cursor_horiz_move(const struct shell *shell, s32_t delta);
|
||||
void shell_op_cursor_vert_move(const struct shell *shell, int32_t delta);
|
||||
void shell_op_cursor_horiz_move(const struct shell *shell, int32_t delta);
|
||||
|
||||
void shell_op_cond_next_line(const struct shell *shell);
|
||||
|
||||
|
@ -163,14 +163,14 @@ void shell_op_cond_next_line(const struct shell *shell);
|
|||
*/
|
||||
void shell_op_cursor_position_synchronize(const struct shell *shell);
|
||||
|
||||
void shell_op_cursor_move(const struct shell *shell, s16_t val);
|
||||
void shell_op_cursor_move(const struct shell *shell, int16_t val);
|
||||
|
||||
void shell_op_left_arrow(const struct shell *shell);
|
||||
|
||||
void shell_op_right_arrow(const struct shell *shell);
|
||||
|
||||
/* Moves cursor by defined number of words left (val negative) or right. */
|
||||
void shell_op_cursor_word_move(const struct shell *shell, s16_t val);
|
||||
void shell_op_cursor_word_move(const struct shell *shell, int16_t val);
|
||||
|
||||
/*
|
||||
* Removes the "word" to the left of the cursor:
|
||||
|
@ -198,7 +198,7 @@ void shell_op_delete_from_cursor(const struct shell *shell);
|
|||
|
||||
void shell_op_completion_insert(const struct shell *shell,
|
||||
const char *compl,
|
||||
u16_t compl_len);
|
||||
uint16_t compl_len);
|
||||
|
||||
bool shell_cursor_in_empty_line(const struct shell *shell);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ static int write(const struct shell_transport *transport,
|
|||
const void *data, size_t length, size_t *cnt)
|
||||
{
|
||||
struct shell_rtt *sh_rtt = (struct shell_rtt *)transport->ctx;
|
||||
const u8_t *data8 = (const u8_t *)data;
|
||||
const uint8_t *data8 = (const uint8_t *)data;
|
||||
|
||||
if (rtt_blocking) {
|
||||
*cnt = SEGGER_RTT_WriteNoLock(0, data8, length);
|
||||
|
@ -107,7 +107,7 @@ static int enable_shell_rtt(struct device *arg)
|
|||
{
|
||||
ARG_UNUSED(arg);
|
||||
bool log_backend = CONFIG_SHELL_RTT_INIT_LOG_LEVEL > 0;
|
||||
u32_t level = (CONFIG_SHELL_RTT_INIT_LOG_LEVEL > LOG_LEVEL_DBG) ?
|
||||
uint32_t level = (CONFIG_SHELL_RTT_INIT_LOG_LEVEL > LOG_LEVEL_DBG) ?
|
||||
CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_RTT_INIT_LOG_LEVEL;
|
||||
|
||||
shell_init(&shell_rtt, NULL, true, log_backend, level);
|
||||
|
|
|
@ -60,7 +60,7 @@ static void telnet_sent_cb(struct net_context *client,
|
|||
}
|
||||
}
|
||||
|
||||
static void telnet_command_send_reply(u8_t *msg, u16_t len)
|
||||
static void telnet_command_send_reply(uint8_t *msg, uint16_t len)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -80,7 +80,7 @@ static void telnet_reply_ay_command(void)
|
|||
{
|
||||
static const char alive[] = "Zephyr at your service\r\n";
|
||||
|
||||
telnet_command_send_reply((u8_t *)alive, strlen(alive));
|
||||
telnet_command_send_reply((uint8_t *)alive, strlen(alive));
|
||||
}
|
||||
|
||||
static void telnet_reply_do_command(struct telnet_simple_command *cmd)
|
||||
|
@ -94,7 +94,7 @@ static void telnet_reply_do_command(struct telnet_simple_command *cmd)
|
|||
break;
|
||||
}
|
||||
|
||||
telnet_command_send_reply((u8_t *)cmd,
|
||||
telnet_command_send_reply((uint8_t *)cmd,
|
||||
sizeof(struct telnet_simple_command));
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ static void telnet_send_prematurely(struct k_work *work)
|
|||
static inline bool telnet_handle_command(struct net_pkt *pkt)
|
||||
{
|
||||
/* Commands are two or three bytes. */
|
||||
NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(cmd_access, u16_t);
|
||||
NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(cmd_access, uint16_t);
|
||||
struct telnet_simple_command *cmd;
|
||||
|
||||
cmd = (struct telnet_simple_command *)net_pkt_get_data(pkt,
|
||||
|
@ -372,7 +372,7 @@ static int write(const struct shell_transport *transport,
|
|||
struct shell_telnet_line_buf *lb;
|
||||
size_t copy_len;
|
||||
int err;
|
||||
u32_t timeout;
|
||||
uint32_t timeout;
|
||||
|
||||
if (sh_telnet == NULL) {
|
||||
*cnt = 0;
|
||||
|
@ -399,7 +399,7 @@ static int write(const struct shell_transport *transport,
|
|||
copy_len = length - *cnt;
|
||||
}
|
||||
|
||||
memcpy(lb->buf + lb->len, (u8_t *)data + *cnt, copy_len);
|
||||
memcpy(lb->buf + lb->len, (uint8_t *)data + *cnt, copy_len);
|
||||
lb->len += copy_len;
|
||||
|
||||
/* Send the data immediately if the buffer is full or line feed
|
||||
|
@ -490,7 +490,7 @@ static int enable_shell_telnet(struct device *arg)
|
|||
ARG_UNUSED(arg);
|
||||
|
||||
bool log_backend = CONFIG_SHELL_TELNET_INIT_LOG_LEVEL > 0;
|
||||
u32_t level = (CONFIG_SHELL_TELNET_INIT_LOG_LEVEL > LOG_LEVEL_DBG) ?
|
||||
uint32_t level = (CONFIG_SHELL_TELNET_INIT_LOG_LEVEL > LOG_LEVEL_DBG) ?
|
||||
CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_TELNET_INIT_LOG_LEVEL;
|
||||
|
||||
return shell_init(&shell_telnet, NULL, true, log_backend, level);
|
||||
|
|
|
@ -107,11 +107,11 @@
|
|||
/** Describes a telnet command */
|
||||
struct telnet_simple_command {
|
||||
/** Mandatory IAC code */
|
||||
u8_t iac;
|
||||
uint8_t iac;
|
||||
/** Type of operation (see Telnet commands above) */
|
||||
u8_t op;
|
||||
uint8_t op;
|
||||
/** Option code */
|
||||
u8_t opt;
|
||||
uint8_t opt;
|
||||
};
|
||||
|
||||
static inline void telnet_command_cpy(struct telnet_simple_command *dst,
|
||||
|
|
|
@ -29,9 +29,9 @@ SHELL_DEFINE(shell_uart, CONFIG_SHELL_PROMPT_UART, &shell_transport_uart,
|
|||
#ifdef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
|
||||
static void uart_rx_handle(const struct shell_uart *sh_uart)
|
||||
{
|
||||
u8_t *data;
|
||||
u32_t len;
|
||||
u32_t rd_len;
|
||||
uint8_t *data;
|
||||
uint32_t len;
|
||||
uint32_t rd_len;
|
||||
bool new_data = false;
|
||||
|
||||
do {
|
||||
|
@ -57,7 +57,7 @@ static void uart_rx_handle(const struct shell_uart *sh_uart)
|
|||
rd_len -= i;
|
||||
new_data = true;
|
||||
if (rd_len) {
|
||||
for (u32_t j = 0; j < rd_len; j++) {
|
||||
for (uint32_t j = 0; j < rd_len; j++) {
|
||||
data[j] = data[i + j];
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ static void uart_rx_handle(const struct shell_uart *sh_uart)
|
|||
(void)err;
|
||||
__ASSERT_NO_MSG(err == 0);
|
||||
} else {
|
||||
u8_t dummy;
|
||||
uint8_t dummy;
|
||||
|
||||
/* No space in the ring buffer - consume byte. */
|
||||
LOG_WRN("RX ring buffer full.");
|
||||
|
@ -96,11 +96,11 @@ static void uart_rx_handle(const struct shell_uart *sh_uart)
|
|||
static void uart_tx_handle(const struct shell_uart *sh_uart)
|
||||
{
|
||||
struct device *dev = sh_uart->ctrl_blk->dev;
|
||||
u32_t len;
|
||||
uint32_t len;
|
||||
int err;
|
||||
const u8_t *data;
|
||||
const uint8_t *data;
|
||||
|
||||
len = ring_buf_get_claim(sh_uart->tx_ringbuf, (u8_t **)&data,
|
||||
len = ring_buf_get_claim(sh_uart->tx_ringbuf, (uint8_t **)&data,
|
||||
sh_uart->tx_ringbuf->size);
|
||||
if (len) {
|
||||
len = uart_fifo_fill(dev, data, len);
|
||||
|
@ -144,7 +144,7 @@ static void uart_irq_init(const struct shell_uart *sh_uart)
|
|||
|
||||
static void timer_handler(struct k_timer *timer)
|
||||
{
|
||||
u8_t c;
|
||||
uint8_t c;
|
||||
const struct shell_uart *sh_uart = k_timer_user_data_get(timer);
|
||||
|
||||
while (uart_poll_in(sh_uart->ctrl_blk->dev, &c) == 0) {
|
||||
|
@ -215,7 +215,7 @@ static int write(const struct shell_transport *transport,
|
|||
const void *data, size_t length, size_t *cnt)
|
||||
{
|
||||
const struct shell_uart *sh_uart = (struct shell_uart *)transport->ctx;
|
||||
const u8_t *data8 = (const u8_t *)data;
|
||||
const uint8_t *data8 = (const uint8_t *)data;
|
||||
|
||||
if (IS_ENABLED(CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN) &&
|
||||
!sh_uart->ctrl_blk->blocking_tx) {
|
||||
|
@ -270,7 +270,7 @@ static int enable_shell_uart(struct device *arg)
|
|||
struct device *dev =
|
||||
device_get_binding(CONFIG_UART_SHELL_ON_DEV_NAME);
|
||||
bool log_backend = CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > 0;
|
||||
u32_t level =
|
||||
uint32_t level =
|
||||
(CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > LOG_LEVEL_DBG) ?
|
||||
CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL;
|
||||
|
||||
|
|
|
@ -10,44 +10,44 @@
|
|||
extern const struct shell_cmd_entry __shell_root_cmds_start[0];
|
||||
extern const struct shell_cmd_entry __shell_root_cmds_end[0];
|
||||
|
||||
static inline const struct shell_cmd_entry *shell_root_cmd_get(u32_t id)
|
||||
static inline const struct shell_cmd_entry *shell_root_cmd_get(uint32_t id)
|
||||
{
|
||||
return &__shell_root_cmds_start[id];
|
||||
}
|
||||
|
||||
/* Calculates relative line number of given position in buffer */
|
||||
static u32_t line_num_with_buffer_offset_get(struct shell_multiline_cons *cons,
|
||||
u16_t buffer_pos)
|
||||
static uint32_t line_num_with_buffer_offset_get(struct shell_multiline_cons *cons,
|
||||
uint16_t buffer_pos)
|
||||
{
|
||||
return ((buffer_pos + cons->name_len) / cons->terminal_wid);
|
||||
}
|
||||
|
||||
/* Calculates column number of given position in buffer */
|
||||
static u32_t col_num_with_buffer_offset_get(struct shell_multiline_cons *cons,
|
||||
u16_t buffer_pos)
|
||||
static uint32_t col_num_with_buffer_offset_get(struct shell_multiline_cons *cons,
|
||||
uint16_t buffer_pos)
|
||||
{
|
||||
/* columns are counted from 1 */
|
||||
return (1 + ((buffer_pos + cons->name_len) % cons->terminal_wid));
|
||||
}
|
||||
|
||||
s32_t column_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
u16_t offset1,
|
||||
u16_t offset2)
|
||||
int32_t column_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
uint16_t offset1,
|
||||
uint16_t offset2)
|
||||
{
|
||||
return col_num_with_buffer_offset_get(cons, offset2)
|
||||
- col_num_with_buffer_offset_get(cons, offset1);
|
||||
}
|
||||
|
||||
s32_t row_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
u16_t offset1,
|
||||
u16_t offset2)
|
||||
int32_t row_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
uint16_t offset1,
|
||||
uint16_t offset2)
|
||||
{
|
||||
return line_num_with_buffer_offset_get(cons, offset2)
|
||||
- line_num_with_buffer_offset_get(cons, offset1);
|
||||
}
|
||||
|
||||
void shell_multiline_data_calc(struct shell_multiline_cons *cons,
|
||||
u16_t buff_pos, u16_t buff_len)
|
||||
uint16_t buff_pos, uint16_t buff_len)
|
||||
{
|
||||
/* Current cursor position in command.
|
||||
* +1 -> because home position is (1, 1)
|
||||
|
@ -60,7 +60,7 @@ void shell_multiline_data_calc(struct shell_multiline_cons *cons,
|
|||
cons->cur_x_end = (buff_len + cons->name_len) % cons->terminal_wid + 1;
|
||||
}
|
||||
|
||||
static char make_argv(char **ppcmd, u8_t c)
|
||||
static char make_argv(char **ppcmd, uint8_t c)
|
||||
{
|
||||
char *cmd = *ppcmd;
|
||||
char quote = 0;
|
||||
|
@ -108,8 +108,8 @@ static char make_argv(char **ppcmd, u8_t c)
|
|||
}
|
||||
|
||||
if (t == '0') {
|
||||
u8_t i;
|
||||
u8_t v = 0U;
|
||||
uint8_t i;
|
||||
uint8_t v = 0U;
|
||||
|
||||
for (i = 2U; i < (2 + 3); i++) {
|
||||
t = *(cmd + i);
|
||||
|
@ -130,8 +130,8 @@ static char make_argv(char **ppcmd, u8_t c)
|
|||
}
|
||||
|
||||
if (t == 'x') {
|
||||
u8_t i;
|
||||
u8_t v = 0U;
|
||||
uint8_t i;
|
||||
uint8_t v = 0U;
|
||||
|
||||
for (i = 2U; i < (2 + 2); i++) {
|
||||
t = *(cmd + i);
|
||||
|
@ -169,7 +169,7 @@ static char make_argv(char **ppcmd, u8_t c)
|
|||
}
|
||||
|
||||
|
||||
char shell_make_argv(size_t *argc, const char **argv, char *cmd, u8_t max_argc)
|
||||
char shell_make_argv(size_t *argc, const char **argv, char *cmd, uint8_t max_argc)
|
||||
{
|
||||
char quote = 0;
|
||||
char c;
|
||||
|
@ -198,11 +198,11 @@ char shell_make_argv(size_t *argc, const char **argv, char *cmd, u8_t max_argc)
|
|||
return quote;
|
||||
}
|
||||
|
||||
void shell_pattern_remove(char *buff, u16_t *buff_len, const char *pattern)
|
||||
void shell_pattern_remove(char *buff, uint16_t *buff_len, const char *pattern)
|
||||
{
|
||||
char *pattern_addr = strstr(buff, pattern);
|
||||
u16_t shift;
|
||||
u16_t pattern_len = shell_strlen(pattern);
|
||||
uint16_t shift;
|
||||
uint16_t pattern_len = shell_strlen(pattern);
|
||||
|
||||
if (!pattern_addr) {
|
||||
return;
|
||||
|
@ -221,10 +221,10 @@ void shell_pattern_remove(char *buff, u16_t *buff_len, const char *pattern)
|
|||
memmove(pattern_addr, pattern_addr + pattern_len, shift);
|
||||
}
|
||||
|
||||
static inline u32_t shell_root_cmd_count(void)
|
||||
static inline uint32_t shell_root_cmd_count(void)
|
||||
{
|
||||
return ((u8_t *)__shell_root_cmds_end -
|
||||
(u8_t *)__shell_root_cmds_start)/
|
||||
return ((uint8_t *)__shell_root_cmds_end -
|
||||
(uint8_t *)__shell_root_cmds_start)/
|
||||
sizeof(struct shell_cmd_entry);
|
||||
}
|
||||
|
||||
|
@ -357,12 +357,12 @@ int shell_set_root_cmd(const char *cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int shell_command_add(char *buff, u16_t *buff_len,
|
||||
int shell_command_add(char *buff, uint16_t *buff_len,
|
||||
const char *new_cmd, const char *pattern)
|
||||
{
|
||||
u16_t cmd_len = shell_strlen(new_cmd);
|
||||
uint16_t cmd_len = shell_strlen(new_cmd);
|
||||
char *cmd_source_addr;
|
||||
u16_t shift;
|
||||
uint16_t shift;
|
||||
|
||||
/* +1 for space */
|
||||
if ((*buff_len + cmd_len + 1) > CONFIG_SHELL_CMD_BUFF_SIZE) {
|
||||
|
@ -389,16 +389,16 @@ int shell_command_add(char *buff, u16_t *buff_len,
|
|||
|
||||
void shell_spaces_trim(char *str)
|
||||
{
|
||||
u16_t len = shell_strlen(str);
|
||||
u16_t shift = 0U;
|
||||
uint16_t len = shell_strlen(str);
|
||||
uint16_t shift = 0U;
|
||||
|
||||
if (!str) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (u16_t i = 0; i < len - 1; i++) {
|
||||
for (uint16_t i = 0; i < len - 1; i++) {
|
||||
if (isspace((int)str[i])) {
|
||||
for (u16_t j = i + 1; j < len; j++) {
|
||||
for (uint16_t j = i + 1; j < len; j++) {
|
||||
if (isspace((int)str[j])) {
|
||||
shift++;
|
||||
continue;
|
||||
|
@ -422,9 +422,9 @@ void shell_spaces_trim(char *str)
|
|||
/** @brief Remove white chars from beginning and end of command buffer.
|
||||
*
|
||||
*/
|
||||
static void buffer_trim(char *buff, u16_t *buff_len)
|
||||
static void buffer_trim(char *buff, uint16_t *buff_len)
|
||||
{
|
||||
u16_t i = 0U;
|
||||
uint16_t i = 0U;
|
||||
|
||||
/* no command in the buffer */
|
||||
if (buff[0] == '\0') {
|
||||
|
|
|
@ -15,20 +15,20 @@ extern "C" {
|
|||
|
||||
#define SHELL_MSG_SPECIFY_SUBCOMMAND "Please specify a subcommand.\n"
|
||||
|
||||
s32_t row_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
u16_t offset1,
|
||||
u16_t offset2);
|
||||
int32_t row_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
uint16_t offset1,
|
||||
uint16_t offset2);
|
||||
|
||||
s32_t column_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
u16_t offset1,
|
||||
u16_t offset2);
|
||||
int32_t column_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
|
||||
uint16_t offset1,
|
||||
uint16_t offset2);
|
||||
|
||||
void shell_multiline_data_calc(struct shell_multiline_cons *cons,
|
||||
u16_t buff_pos, u16_t buff_len);
|
||||
uint16_t buff_pos, uint16_t buff_len);
|
||||
|
||||
static inline u16_t shell_strlen(const char *str)
|
||||
static inline uint16_t shell_strlen(const char *str)
|
||||
{
|
||||
return str == NULL ? 0U : (u16_t)strlen(str);
|
||||
return str == NULL ? 0U : (uint16_t)strlen(str);
|
||||
}
|
||||
|
||||
char shell_make_argv(size_t *argc, const char **argv,
|
||||
|
@ -37,7 +37,7 @@ char shell_make_argv(size_t *argc, const char **argv,
|
|||
/** @brief Removes pattern and following space
|
||||
*
|
||||
*/
|
||||
void shell_pattern_remove(char *buff, u16_t *buff_len, const char *pattern);
|
||||
void shell_pattern_remove(char *buff, uint16_t *buff_len, const char *pattern);
|
||||
|
||||
/** @brief Get subcommand with given index from the root.
|
||||
*
|
||||
|
@ -77,7 +77,7 @@ const struct shell_static_entry *shell_get_last_command(
|
|||
struct shell_static_entry *dloc,
|
||||
bool only_static);
|
||||
|
||||
int shell_command_add(char *buff, u16_t *buff_len,
|
||||
int shell_command_add(char *buff, uint16_t *buff_len,
|
||||
const char *new_cmd, const char *pattern);
|
||||
|
||||
const struct shell_static_entry *shell_root_cmd_find(const char *syntax);
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include "shell_utils.h"
|
||||
#include "shell_ops.h"
|
||||
|
||||
static enum shell_wildcard_status command_add(char *buff, u16_t *buff_len,
|
||||
static enum shell_wildcard_status command_add(char *buff, uint16_t *buff_len,
|
||||
char const *cmd,
|
||||
char const *pattern)
|
||||
{
|
||||
u16_t cmd_len = shell_strlen(cmd);
|
||||
uint16_t cmd_len = shell_strlen(cmd);
|
||||
char *completion_addr;
|
||||
u16_t shift;
|
||||
uint16_t shift;
|
||||
|
||||
/* +1 for space */
|
||||
if ((*buff_len + cmd_len + 1) > CONFIG_SHELL_CMD_BUFF_SIZE) {
|
||||
|
@ -107,7 +107,7 @@ static enum shell_wildcard_status commands_expand(const struct shell *shell,
|
|||
|
||||
bool shell_wildcard_character_exist(const char *str)
|
||||
{
|
||||
u16_t str_len = shell_strlen(str);
|
||||
uint16_t str_len = shell_strlen(str);
|
||||
|
||||
for (size_t i = 0; i < str_len; i++) {
|
||||
if ((str[i] == '?') || (str[i] == '*')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue