You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/08/09 07:35:53 UTC

[GitHub] mkiiskila closed pull request #1306: sys/console; rename global variables to make them more identifiable

mkiiskila closed pull request #1306: sys/console; rename global variables to make them more identifiable
URL: https://github.com/apache/mynewt-core/pull/1306
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sys/console/full/include/console/console.h b/sys/console/full/include/console/console.h
index ab1af6ed67..ddec12e613 100644
--- a/sys/console/full/include/console/console.h
+++ b/sys/console/full/include/console/console.h
@@ -43,7 +43,7 @@ struct console_input {
 
 typedef void (*console_rx_cb)(void);
 typedef int (*console_append_char_cb)(char *line, uint8_t byte);
-typedef void (*completion_cb)(char *str, console_append_char_cb cb);
+typedef void (*console_completion_cb)(char *str, console_append_char_cb cb);
 
 int console_init(console_rx_cb rx_cb);
 int console_is_init(void);
@@ -58,7 +58,7 @@ void console_echo(int on);
 int console_printf(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2)));;
 
-void console_set_completion_cb(completion_cb cb);
+void console_set_completion_cb(console_completion_cb cb);
 int console_handle_char(uint8_t byte);
 
 /* Set queue to send console line events to */
diff --git a/sys/console/full/src/console.c b/sys/console/full/src/console.c
index 78bf9cc89c..2d76eb3105 100644
--- a/sys/console/full/src/console.c
+++ b/sys/console/full/src/console.c
@@ -65,23 +65,23 @@ int console_is_midline;
 
 #if MYNEWT_VAL(CONSOLE_COMPAT)
 #define CONSOLE_COMPAT_MAX_CMD_QUEUED 1
-static struct console_input buf[CONSOLE_COMPAT_MAX_CMD_QUEUED];
-static struct os_event shell_console_ev[CONSOLE_COMPAT_MAX_CMD_QUEUED];
-static console_rx_cb console_compat_rx_cb; /* callback that input is ready */
+static struct console_input cons_buf[CONSOLE_COMPAT_MAX_CMD_QUEUED];
+static struct os_event cons_shell_ev[CONSOLE_COMPAT_MAX_CMD_QUEUED];
+static console_rx_cb cons_compat_rx_cb; /* callback that input is ready */
 static struct os_eventq compat_avail_queue;
 static struct os_eventq compat_lines_queue;
 #endif
 
-static int esc_state;
-static int nlip_state;
-static int echo = MYNEWT_VAL(CONSOLE_ECHO);
-static unsigned int ansi_val, ansi_val_2;
-static bool rx_stalled;
+static int cons_esc_state;
+static int cons_nlip_state;
+static int cons_echo = MYNEWT_VAL(CONSOLE_ECHO);
+static unsigned int cons_ansi_val, cons_ansi_val_2;
+static bool cons_rx_stalled;
 
-static uint16_t cur, end;
-static struct os_eventq avail_queue;
-static struct os_eventq *lines_queue;
-static completion_cb completion;
+static uint16_t cons_cur, cons_end;
+static struct os_eventq cons_avail_queue;
+static struct os_eventq *cons_lines_queue;
+static console_completion_cb cons_completion;
 
 /*
  * Default implementation in case all consoles are disabled - we just ignore any
@@ -96,7 +96,7 @@ console_out(int c)
 void
 console_echo(int on)
 {
-    echo = on;
+    cons_echo = on;
 }
 
 void
@@ -120,7 +120,7 @@ console_read(char *str, int cnt, int *newline)
     size_t len;
 
     *newline = 0;
-    ev = os_eventq_get_no_wait(lines_queue);
+    ev = os_eventq_get_no_wait(cons_lines_queue);
     if (!ev) {
         return 0;
     }
@@ -204,16 +204,16 @@ insert_char(char *pos, char c, uint16_t end)
 {
     char tmp;
 
-    if (cur + end >= MYNEWT_VAL(CONSOLE_MAX_INPUT_LEN) - 1) {
+    if (cons_cur + end >= MYNEWT_VAL(CONSOLE_MAX_INPUT_LEN) - 1) {
         return;
     }
 
-    if (echo) {
+    if (cons_echo) {
         /* Echo back to console */
         console_out(c);
     }
 
-    ++cur;
+    ++cons_cur;
 
     if (end == 0) {
         *pos = c;
@@ -419,11 +419,11 @@ console_hist_add(char *line)
 static void
 console_clear_line(void)
 {
-    if (cur) {
-        cursor_backward(cur);
+    if (cons_cur) {
+        cursor_backward(cons_cur);
     }
-    cur = 0;
-    end = 0;
+    cons_cur = 0;
+    cons_end = 0;
 
     cursor_clear_line();
 }
@@ -449,7 +449,7 @@ console_hist_move(char *line, uint8_t direction)
     console_clear_line();
     str = sh->lines[sh->curr];
     while (str && *str != '\0') {
-        insert_char(&line[cur], *str, end);
+        insert_char(&line[cons_cur], *str, cons_end);
         ++str;
     }
 }
@@ -458,39 +458,39 @@ console_hist_move(char *line, uint8_t direction)
 static void
 handle_ansi(uint8_t byte, char *line)
 {
-    if (esc_state & ESC_ANSI_FIRST) {
-        esc_state &= ~ESC_ANSI_FIRST;
+    if (cons_esc_state & ESC_ANSI_FIRST) {
+        cons_esc_state &= ~ESC_ANSI_FIRST;
         if (!isdigit(byte)) {
-            ansi_val = 1;
+            cons_ansi_val = 1;
             goto ansi_cmd;
         }
 
-        esc_state |= ESC_ANSI_VAL;
-        ansi_val = byte - '0';
-        ansi_val_2 = 0;
+        cons_esc_state |= ESC_ANSI_VAL;
+        cons_ansi_val = byte - '0';
+        cons_ansi_val_2 = 0;
         return;
     }
 
-    if (esc_state & ESC_ANSI_VAL) {
+    if (cons_esc_state & ESC_ANSI_VAL) {
         if (isdigit(byte)) {
-            if (esc_state & ESC_ANSI_VAL_2) {
-                ansi_val_2 *= 10;
-                ansi_val_2 += byte - '0';
+            if (cons_esc_state & ESC_ANSI_VAL_2) {
+                cons_ansi_val_2 *= 10;
+                cons_ansi_val_2 += byte - '0';
             } else {
-                ansi_val *= 10;
-                ansi_val += byte - '0';
+                cons_ansi_val *= 10;
+                cons_ansi_val += byte - '0';
             }
             return;
         }
 
         /* Multi value sequence, e.g. Esc[Line;ColumnH */
-        if (byte == ';' && !(esc_state & ESC_ANSI_VAL_2)) {
-            esc_state |= ESC_ANSI_VAL_2;
+        if (byte == ';' && !(cons_esc_state & ESC_ANSI_VAL_2)) {
+            cons_esc_state |= ESC_ANSI_VAL_2;
             return;
         }
 
-        esc_state &= ~ESC_ANSI_VAL;
-        esc_state &= ~ESC_ANSI_VAL_2;
+        cons_esc_state &= ~ESC_ANSI_VAL;
+        cons_esc_state &= ~ESC_ANSI_VAL_2;
     }
 
 ansi_cmd:
@@ -504,77 +504,77 @@ handle_ansi(uint8_t byte, char *line)
         break;
 #endif
     case ANSI_BACKWARD:
-        if (ansi_val > cur) {
+        if (cons_ansi_val > cons_cur) {
             break;
         }
 
-        end += ansi_val;
-        cur -= ansi_val;
-        cursor_backward(ansi_val);
+        cons_end += cons_ansi_val;
+        cons_cur -= cons_ansi_val;
+        cursor_backward(cons_ansi_val);
         break;
     case ANSI_FORWARD:
-        if (ansi_val > end) {
+        if (cons_ansi_val > cons_end) {
             break;
         }
 
-        end -= ansi_val;
-        cur += ansi_val;
-        cursor_forward(ansi_val);
+        cons_end -= cons_ansi_val;
+        cons_cur += cons_ansi_val;
+        cursor_forward(cons_ansi_val);
         break;
     case ANSI_HOME:
-        if (!cur) {
+        if (!cons_cur) {
             break;
         }
 
-        cursor_backward(cur);
-        end += cur;
-        cur = 0;
+        cursor_backward(cons_cur);
+        cons_end += cons_cur;
+        cons_cur = 0;
         break;
     case ANSI_END:
-        if (!end) {
+        if (!cons_end) {
             break;
         }
 
-        cursor_forward(end);
-        cur += end;
-        end = 0;
+        cursor_forward(cons_end);
+        cons_cur += cons_end;
+        cons_end = 0;
         break;
     case ANSI_DEL:
-        if (!end) {
+        if (!cons_end) {
             break;
         }
 
         cursor_forward(1);
-        del_char(&line[cur], --end);
+        del_char(&line[cons_cur], --cons_end);
         break;
     default:
         break;
     }
 
-    esc_state &= ~ESC_ANSI;
+    cons_esc_state &= ~ESC_ANSI;
 }
 
 static int
 handle_nlip(uint8_t byte)
 {
-    if (((nlip_state & NLIP_PKT_START1) &&
-         (nlip_state & NLIP_PKT_START2)) ||
-        ((nlip_state & NLIP_DATA_START1) &&
-         (nlip_state & NLIP_DATA_START2)))
+    if (((cons_nlip_state & NLIP_PKT_START1) &&
+         (cons_nlip_state & NLIP_PKT_START2)) ||
+        ((cons_nlip_state & NLIP_DATA_START1) &&
+         (cons_nlip_state & NLIP_DATA_START2)))
     {
         return 1;
     }
 
-    if ((nlip_state & NLIP_PKT_START1) &&
+    if ((cons_nlip_state & NLIP_PKT_START1) &&
         (byte == CONSOLE_NLIP_PKT_START2)) {
-        nlip_state |= NLIP_PKT_START2;
+        cons_nlip_state |= NLIP_PKT_START2;
         return 1;
-    } else if ((nlip_state & NLIP_DATA_START1) &&
+    } else if ((cons_nlip_state & NLIP_DATA_START1) &&
                (byte == CONSOLE_NLIP_DATA_START2)) {
-        nlip_state |= NLIP_DATA_START2;
+        cons_nlip_state |= NLIP_DATA_START2;
         return 1;
     } else {
-        nlip_state = 0;
+        cons_nlip_state = 0;
         return 0;
     }
 }
@@ -582,21 +582,21 @@ handle_nlip(uint8_t byte)
 static int
 console_append_char(char *line, uint8_t byte)
 {
-    if (cur + end >= MYNEWT_VAL(CONSOLE_MAX_INPUT_LEN) - 1) {
+    if (cons_cur + cons_end >= MYNEWT_VAL(CONSOLE_MAX_INPUT_LEN) - 1) {
         return 0;
     }
 
-    line[cur + end] = byte;
+    line[cons_cur + cons_end] = byte;
 
     if (byte == '\0') {
         return 1;
     }
 
-    if (echo) {
+    if (cons_echo) {
         /* Echo back to console */
         console_out(byte);
     }
-    ++cur;
+    ++cons_cur;
     return 1;
 }
 
@@ -611,14 +611,14 @@ console_handle_char(uint8_t byte)
     static struct console_input *input;
     static char prev_endl = '\0';
 
-    if (!lines_queue) {
+    if (!cons_lines_queue) {
         return 0;
     }
 
     if (!ev) {
-        ev = os_eventq_get_no_wait(&avail_queue);
+        ev = os_eventq_get_no_wait(&cons_avail_queue);
         if (!ev) {
-            rx_stalled = true;
+            cons_rx_stalled = true;
             return -1;
         }
         input = ev->ev_arg;
@@ -626,16 +626,16 @@ console_handle_char(uint8_t byte)
 
     if (handle_nlip(byte))  {
         if (byte == '\n') {
-            insert_char(&input->line[cur], byte, end);
-            input->line[cur] = '\0';
-            cur = 0;
-            end = 0;
-            os_eventq_put(lines_queue, ev);
-            nlip_state = 0;
+            insert_char(&input->line[cons_cur], byte, cons_end);
+            input->line[cons_cur] = '\0';
+            cons_cur = 0;
+            cons_end = 0;
+            os_eventq_put(cons_lines_queue, ev);
+            cons_nlip_state = 0;
 
 #if MYNEWT_VAL(CONSOLE_COMPAT)
-            if (console_compat_rx_cb) {
-                console_compat_rx_cb();
+            if (cons_compat_rx_cb) {
+                cons_compat_rx_cb();
             }
 #endif
 
@@ -647,32 +647,32 @@ console_handle_char(uint8_t byte)
         } else if (byte == CONSOLE_NLIP_PKT_START2) {
             /* Disable echo to not flood the UART */
             console_echo(0);
-            insert_char(&input->line[cur], CONSOLE_NLIP_PKT_START1, end);
+            insert_char(&input->line[cons_cur], CONSOLE_NLIP_PKT_START1, cons_end);
         } else if (byte == CONSOLE_NLIP_DATA_START2) {
             /* Disable echo to not flood the UART */
             console_echo(0);
-            insert_char(&input->line[cur], CONSOLE_NLIP_DATA_START1, end);
+            insert_char(&input->line[cons_cur], CONSOLE_NLIP_DATA_START1, cons_end);
         }
 
-        insert_char(&input->line[cur], byte, end);
+        insert_char(&input->line[cons_cur], byte, cons_end);
 
         return 0;
     }
 
     /* Handle ANSI escape mode */
-    if (esc_state & ESC_ANSI) {
+    if (cons_esc_state & ESC_ANSI) {
         handle_ansi(byte, input->line);
         return 0;
     }
 
     /* Handle escape mode */
-    if (esc_state & ESC_ESC) {
-        esc_state &= ~ESC_ESC;
+    if (cons_esc_state & ESC_ESC) {
+        cons_esc_state &= ~ESC_ESC;
         handle_ansi(byte, input->line);
         switch (byte) {
         case ANSI_ESC:
-            esc_state |= ESC_ANSI;
-            esc_state |= ESC_ANSI_FIRST;
+            cons_esc_state |= ESC_ANSI;
+            cons_esc_state |= ESC_ANSI_FIRST;
             break;
         default:
             break;
@@ -686,22 +686,22 @@ console_handle_char(uint8_t byte)
         handle_ansi(byte, input->line);
         switch (byte) {
         case CONSOLE_NLIP_PKT_START1:
-            nlip_state |= NLIP_PKT_START1;
+            cons_nlip_state |= NLIP_PKT_START1;
             break;
         case CONSOLE_NLIP_DATA_START1:
-            nlip_state |= NLIP_DATA_START1;
+            cons_nlip_state |= NLIP_DATA_START1;
             break;
         case DEL:
         case BS:
-            if (cur > 0) {
-                del_char(&input->line[--cur], end);
+            if (cons_cur > 0) {
+                del_char(&input->line[--cons_cur], cons_end);
             }
             break;
         case ESC:
-            esc_state |= ESC_ESC;
+            cons_esc_state |= ESC_ESC;
             break;
         default:
-            insert_char(&input->line[cur], byte, end);
+            insert_char(&input->line[cons_cur], byte, cons_end);
             /* Falls through. */
         case '\r':
             /* Falls through. */
@@ -712,19 +712,19 @@ console_handle_char(uint8_t byte)
                 break;
             }
             prev_endl = byte;
-            input->line[cur + end] = '\0';
+            input->line[cons_cur + cons_end] = '\0';
             console_out('\r');
             console_out('\n');
-            cur = 0;
-            end = 0;
-            os_eventq_put(lines_queue, ev);
+            cons_cur = 0;
+            cons_end = 0;
+            os_eventq_put(cons_lines_queue, ev);
 #if MYNEWT_VAL(CONSOLE_HISTORY_SIZE) > 0
             console_hist_add(input->line);
 #endif
 
 #if MYNEWT_VAL(CONSOLE_COMPAT)
-            if (console_compat_rx_cb) {
-                console_compat_rx_cb();
+            if (cons_compat_rx_cb) {
+                cons_compat_rx_cb();
             }
 #endif
 
@@ -732,11 +732,11 @@ console_handle_char(uint8_t byte)
             ev = NULL;
             break;
         case '\t':
-            if (completion && !end) {
+            if (cons_completion && !cons_end) {
 #if MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE) == 0
                 console_blocking_mode();
 #endif
-                completion(input->line, console_append_char);
+                cons_completion(input->line, console_append_char);
 #if MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE) == 0
                 console_non_blocking_mode();
 #endif
@@ -747,7 +747,7 @@ console_handle_char(uint8_t byte)
         return 0;
     }
 
-    insert_char(&input->line[cur], byte, end);
+    insert_char(&input->line[cons_cur], byte, cons_end);
     return 0;
 }
 
@@ -769,24 +769,24 @@ console_is_init(void)
 void
 console_line_queue_set(struct os_eventq *evq)
 {
-    lines_queue = evq;
+    cons_lines_queue = evq;
 }
 
 void
 console_line_event_put(struct os_event *ev)
 {
-    os_eventq_put(&avail_queue, ev);
+    os_eventq_put(&cons_avail_queue, ev);
 
-    if (rx_stalled) {
-        rx_stalled = false;
+    if (cons_rx_stalled) {
+        cons_rx_stalled = false;
         console_rx_restart();
     }
 }
 
 void
-console_set_completion_cb(completion_cb cb)
+console_set_completion_cb(console_completion_cb cb)
 {
-    completion = cb;
+    cons_completion = cb;
 }
 
 #if MYNEWT_VAL(CONSOLE_COMPAT)
@@ -800,10 +800,10 @@ console_init(console_rx_cb rx_cb)
     console_line_queue_set(&compat_lines_queue);
 
     for (i = 0; i < CONSOLE_COMPAT_MAX_CMD_QUEUED; i++) {
-        shell_console_ev[i].ev_arg = &buf[i];
-        console_line_event_put(&shell_console_ev[i]);
+        cons_shell_ev[i].ev_arg = &cons_buf[i];
+        console_line_event_put(&cons_shell_ev[i]);
     }
-    console_compat_rx_cb = rx_cb;
+    cons_compat_rx_cb = rx_cb;
     return 0;
 }
 #endif
@@ -816,7 +816,7 @@ console_pkg_init(void)
     /* Ensure this function only gets called by sysinit. */
     SYSINIT_ASSERT_ACTIVE();
 
-    os_eventq_init(&avail_queue);
+    os_eventq_init(&cons_avail_queue);
 
 #if MYNEWT_VAL(CONSOLE_HISTORY_SIZE) > 0
     console_hist_init();
diff --git a/sys/console/full/src/rtt_console.c b/sys/console/full/src/rtt_console.c
index fa3c6929c5..b9e6330b35 100644
--- a/sys/console/full/src/rtt_console.c
+++ b/sys/console/full/src/rtt_console.c
@@ -30,7 +30,7 @@
 static struct hal_timer rtt_timer;
 #endif
 
-static const char CR = '\r';
+static const char rtt_CR = '\r';
 
 int
 console_out(int character)
@@ -38,7 +38,7 @@ console_out(int character)
     char c = (char)character;
 
     if ('\n' == c) {
-        SEGGER_RTT_WriteWithOverwriteNoLock(0, &CR, 1);
+        SEGGER_RTT_WriteWithOverwriteNoLock(0, &rtt_CR, 1);
         console_is_midline = 0;
     } else {
         console_is_midline = 1;
diff --git a/sys/console/full/src/uart_console.c b/sys/console/full/src/uart_console.c
index aa25790521..7897d07c89 100644
--- a/sys/console/full/src/uart_console.c
+++ b/sys/console/full/src/uart_console.c
@@ -36,17 +36,17 @@ struct console_ring {
     uint8_t *buf;
 };
 
-static struct uart_dev *uart_dev;
-static struct console_ring cr_tx;
-static uint8_t cr_tx_buf[MYNEWT_VAL(CONSOLE_UART_TX_BUF_SIZE)];
+static struct uart_dev *cons_uart_dev;
+static struct console_ring cons_cr_tx;
+static uint8_t cons_cr_tx_buf[MYNEWT_VAL(CONSOLE_UART_TX_BUF_SIZE)];
 typedef void (*console_write_char)(struct uart_dev*, uint8_t);
 static console_write_char write_char_cb;
 
 #if MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE) > 0
-static struct console_ring cr_rx;
-static uint8_t cr_rx_buf[MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE)];
+static struct console_ring cons_cr_rx;
+static uint8_t cons_cr_rx_buf[MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE)];
 
-struct os_event rx_ev;
+struct os_event cons_rx_ev;
 #endif
 
 static inline int
@@ -94,7 +94,7 @@ uart_console_queue_char(struct uart_dev *uart_dev, uint8_t ch)
     }
 
     OS_ENTER_CRITICAL(sr);
-    while (uart_console_ring_is_full(&cr_tx)) {
+    while (uart_console_ring_is_full(&cons_cr_tx)) {
         /* TX needs to drain */
         uart_start_tx(uart_dev);
         OS_EXIT_CRITICAL(sr);
@@ -103,7 +103,7 @@ uart_console_queue_char(struct uart_dev *uart_dev, uint8_t ch)
         }
         OS_ENTER_CRITICAL(sr);
     }
-    uart_console_ring_add_char(&cr_tx, ch);
+    uart_console_ring_add_char(&cons_cr_tx, ch);
     OS_EXIT_CRITICAL(sr);
 }
 
@@ -117,11 +117,11 @@ uart_console_tx_flush(int cnt)
     uint8_t byte;
 
     for (i = 0; i < cnt; i++) {
-        if (uart_console_ring_is_empty(&cr_tx)) {
+        if (uart_console_ring_is_empty(&cons_cr_tx)) {
             break;
         }
-        byte = uart_console_ring_pull_char(&cr_tx);
-        uart_blocking_tx(uart_dev, byte);
+        byte = uart_console_ring_pull_char(&cons_cr_tx);
+        uart_blocking_tx(cons_uart_dev, byte);
     }
 }
 
@@ -162,13 +162,13 @@ console_out(int c)
     }
 
     if ('\n' == c) {
-        write_char_cb(uart_dev, '\r');
+        write_char_cb(cons_uart_dev, '\r');
         console_is_midline = 0;
     } else {
         console_is_midline = 1;
     }
-    write_char_cb(uart_dev, c);
-    uart_start_tx(uart_dev);
+    write_char_cb(cons_uart_dev, c);
+    uart_start_tx(cons_uart_dev);
 
     return c;
 }
@@ -177,9 +177,9 @@ void
 console_rx_restart(void)
 {
 #if MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE) > 0
-    os_eventq_put(os_eventq_dflt_get(), &rx_ev);
+    os_eventq_put(os_eventq_dflt_get(), &cons_rx_ev);
 #else
-    uart_start_rx(uart_dev);
+    uart_start_rx(cons_uart_dev);
 #endif
 }
 
@@ -190,10 +190,10 @@ console_rx_restart(void)
 static int
 uart_console_tx_char(void *arg)
 {
-    if (uart_console_ring_is_empty(&cr_tx)) {
+    if (uart_console_ring_is_empty(&cons_cr_tx)) {
         return -1;
     }
-    return uart_console_ring_pull_char(&cr_tx);
+    return uart_console_ring_pull_char(&cons_cr_tx);
 }
 
 /*
@@ -203,14 +203,14 @@ static int
 uart_console_rx_char(void *arg, uint8_t byte)
 {
 #if MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE) > 0
-    if (uart_console_ring_is_full(&cr_rx)) {
+    if (uart_console_ring_is_full(&cons_cr_rx)) {
         return -1;
     }
 
-    uart_console_ring_add_char(&cr_rx, byte);
+    uart_console_ring_add_char(&cons_cr_rx, byte);
 
-    if (!rx_ev.ev_queued) {
-        os_eventq_put(os_eventq_dflt_get(), &rx_ev);
+    if (!cons_rx_ev.ev_queued) {
+        os_eventq_put(os_eventq_dflt_get(), &cons_rx_ev);
     }
 
     return 0;
@@ -238,12 +238,12 @@ uart_console_rx_char_event(struct os_event *ev)
          * It is possible that UART RX was stalled in the meantime since we were
          * not consuming data from ring buffer - make sure RX is started.
          */
-        uart_start_rx(uart_dev);
+        uart_start_rx(cons_uart_dev);
     }
 
-    while (!uart_console_ring_is_empty(&cr_rx)) {
+    while (!uart_console_ring_is_empty(&cons_cr_rx)) {
         OS_ENTER_CRITICAL(sr);
-        b = uart_console_ring_pull_char(&cr_rx);
+        b = uart_console_ring_pull_char(&cons_cr_rx);
         OS_EXIT_CRITICAL(sr);
 
         ret = console_handle_char(b);
@@ -259,7 +259,7 @@ uart_console_rx_char_event(struct os_event *ev)
 int
 uart_console_is_init(void)
 {
-    return uart_dev != NULL;
+    return cons_uart_dev != NULL;
 }
 
 int
@@ -275,21 +275,22 @@ uart_console_init(void)
         .uc_rx_char = uart_console_rx_char,
     };
 
-    cr_tx.size = MYNEWT_VAL(CONSOLE_UART_TX_BUF_SIZE);
-    cr_tx.buf = cr_tx_buf;
+    cons_cr_tx.size = MYNEWT_VAL(CONSOLE_UART_TX_BUF_SIZE);
+    cons_cr_tx.buf = cons_cr_tx_buf;
     write_char_cb = uart_console_queue_char;
 
 #if MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE) > 0
-    cr_rx.size = MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE);
-    cr_rx.buf = cr_rx_buf;
+    cons_cr_rx.size = MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE);
+    cons_cr_rx.buf = cons_cr_rx_buf;
 
-    rx_ev.ev_cb = uart_console_rx_char_event;
+    cons_rx_ev.ev_cb = uart_console_rx_char_event;
 #endif
 
-    if (!uart_dev) {
-        uart_dev = (struct uart_dev *)os_dev_open(MYNEWT_VAL(CONSOLE_UART_DEV),
-          OS_TIMEOUT_NEVER, &uc);
-        if (!uart_dev) {
+    if (!cons_uart_dev) {
+        cons_uart_dev =
+          (struct uart_dev *)os_dev_open(MYNEWT_VAL(CONSOLE_UART_DEV),
+                                         OS_TIMEOUT_NEVER, &uc);
+        if (!cons_uart_dev) {
             return -1;
         }
     }
diff --git a/sys/console/stub/include/console/console.h b/sys/console/stub/include/console/console.h
index f1e27a3b38..cd91fdf03d 100644
--- a/sys/console/stub/include/console/console.h
+++ b/sys/console/stub/include/console/console.h
@@ -34,7 +34,7 @@ struct console_input {
 
 typedef void (*console_rx_cb)(void);
 typedef int (*console_append_char_cb)(char *line, uint8_t byte);
-typedef void (*completion_cb)(char *str, console_append_char_cb cb);
+typedef void (*console_completion_cb)(char *str, console_append_char_cb cb);
 
 static int inline
 console_is_init(void)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services