You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/10/13 03:39:18 UTC
incubator-mynewt-core git commit: console: Add UART settings to syscfg
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 4f69b161c -> 00d3fe110
console: Add UART settings to syscfg
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/00d3fe11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/00d3fe11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/00d3fe11
Branch: refs/heads/develop
Commit: 00d3fe1104a5f0b1c04ed82a66f3f0760f3c6c9e
Parents: 4f69b16
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Oct 12 20:34:06 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Oct 12 20:34:06 2016 -0700
----------------------------------------------------------------------
hw/bsp/arduino_primo_nrf52/include/bsp/bsp.h | 1 -
hw/bsp/arduino_primo_nrf52/syscfg.yml | 2 ++
hw/bsp/bmd300eval/include/bsp/bsp.h | 1 -
hw/bsp/frdm-k64f/include/bsp/bsp.h | 1 -
hw/bsp/native/include/bsp/bsp.h | 1 -
hw/bsp/nrf51-blenano/include/bsp/bsp.h | 1 -
hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h | 1 -
hw/bsp/nrf51dk/include/bsp/bsp.h | 1 -
hw/bsp/nrf52dk/include/bsp/bsp.h | 1 -
.../include/bsp/bsp.h | 1 -
hw/bsp/rb-nano2/include/bsp/bsp.h | 1 -
sys/console/full/src/cons_tty.c | 31 +++++++++++---------
sys/console/full/syscfg.yml | 13 ++++++++
13 files changed, 32 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/arduino_primo_nrf52/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/include/bsp/bsp.h b/hw/bsp/arduino_primo_nrf52/include/bsp/bsp.h
index b580031..c68b44a 100644
--- a/hw/bsp/arduino_primo_nrf52/include/bsp/bsp.h
+++ b/hw/bsp/arduino_primo_nrf52/include/bsp/bsp.h
@@ -42,7 +42,6 @@ extern uint8_t _ram_start;
/* UART info */
#define CONSOLE_UART "uart1"
-#define CONSOLE_UART_SPEED 9600
#define ESPDUINO_UART "uart0"
#define ESPDUINO_UART_SPEED 9600
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/arduino_primo_nrf52/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/syscfg.yml b/hw/bsp/arduino_primo_nrf52/syscfg.yml
index 8f2c137..8d3cd98 100644
--- a/hw/bsp/arduino_primo_nrf52/syscfg.yml
+++ b/hw/bsp/arduino_primo_nrf52/syscfg.yml
@@ -105,3 +105,5 @@ syscfg.vals:
REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
NFFS_FLASH_AREA: FLASH_AREA_REBOOT_LOG
COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
+
+ CONSOLE_BAUD: 9600
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/bmd300eval/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/include/bsp/bsp.h b/hw/bsp/bmd300eval/include/bsp/bsp.h
index f009898..d63dcc2 100644
--- a/hw/bsp/bmd300eval/include/bsp/bsp.h
+++ b/hw/bsp/bmd300eval/include/bsp/bsp.h
@@ -46,7 +46,6 @@ extern uint8_t _ram_start;
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/frdm-k64f/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/frdm-k64f/include/bsp/bsp.h b/hw/bsp/frdm-k64f/include/bsp/bsp.h
index 3eab87e..e70a21d 100644
--- a/hw/bsp/frdm-k64f/include/bsp/bsp.h
+++ b/hw/bsp/frdm-k64f/include/bsp/bsp.h
@@ -33,7 +33,6 @@ extern uint8_t __DATA_ROM;
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
/* This defines the maximum NFFS areas (block) are in the BSPs NFS file
* system space. This in conjunction with flash map determines how
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/native/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/native/include/bsp/bsp.h b/hw/bsp/native/include/bsp/bsp.h
index e8f2b42..7fd0651 100644
--- a/hw/bsp/native/include/bsp/bsp.h
+++ b/hw/bsp/native/include/bsp/bsp.h
@@ -36,7 +36,6 @@ extern "C" {
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 9600
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/nrf51-blenano/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/include/bsp/bsp.h b/hw/bsp/nrf51-blenano/include/bsp/bsp.h
index 16a3c45..6f7b721 100644
--- a/hw/bsp/nrf51-blenano/include/bsp/bsp.h
+++ b/hw/bsp/nrf51-blenano/include/bsp/bsp.h
@@ -36,7 +36,6 @@ extern "C" {
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h b/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
index 88a6cde..a8257ff 100644
--- a/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
+++ b/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
@@ -45,7 +45,6 @@ extern uint8_t _ram_start;
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/nrf51dk/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/include/bsp/bsp.h b/hw/bsp/nrf51dk/include/bsp/bsp.h
index 185ee65..dca4b7c 100644
--- a/hw/bsp/nrf51dk/include/bsp/bsp.h
+++ b/hw/bsp/nrf51dk/include/bsp/bsp.h
@@ -45,7 +45,6 @@ extern uint8_t _ram_start;
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/nrf52dk/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/include/bsp/bsp.h b/hw/bsp/nrf52dk/include/bsp/bsp.h
index f009898..d63dcc2 100644
--- a/hw/bsp/nrf52dk/include/bsp/bsp.h
+++ b/hw/bsp/nrf52dk/include/bsp/bsp.h
@@ -46,7 +46,6 @@ extern uint8_t _ram_start;
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
index 4cda2c7..c124bf4 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
+++ b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
@@ -45,7 +45,6 @@ extern uint8_t _ccram_start;
/* UART */
#define UART_CNT 1
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
#define SPI_SS_PIN (4)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/hw/bsp/rb-nano2/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/rb-nano2/include/bsp/bsp.h b/hw/bsp/rb-nano2/include/bsp/bsp.h
index a1a7455..9d2f380 100644
--- a/hw/bsp/rb-nano2/include/bsp/bsp.h
+++ b/hw/bsp/rb-nano2/include/bsp/bsp.h
@@ -42,7 +42,6 @@ extern uint8_t _ram_start;
/* UART info */
#define CONSOLE_UART "uart0"
-#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/sys/console/full/src/cons_tty.c
----------------------------------------------------------------------
diff --git a/sys/console/full/src/cons_tty.c b/sys/console/full/src/cons_tty.c
index 157ed48..fb9f355 100644
--- a/sys/console/full/src/cons_tty.c
+++ b/sys/console/full/src/cons_tty.c
@@ -31,8 +31,6 @@
/** Indicates whether the previous line of output was completed. */
int console_is_midline;
-#define CONSOLE_TX_BUF_SZ 32 /* IO buffering, must be power of 2 */
-#define CONSOLE_RX_BUF_SZ 128
#define CONSOLE_RX_CHUNK 16
#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
@@ -62,10 +60,15 @@ struct console_ring {
struct console_tty {
struct uart_dev *ct_dev;
+
struct console_ring ct_tx;
- uint8_t ct_tx_buf[CONSOLE_TX_BUF_SZ]; /* must be after console_ring */
+ /* must be after console_ring */
+ uint8_t ct_tx_buf[MYNEWT_VAL(CONSOLE_TX_BUF_SIZE)];
+
struct console_ring ct_rx;
- uint8_t ct_rx_buf[CONSOLE_RX_BUF_SZ]; /* must be after console_ring */
+ /* must be after console_ring */
+ uint8_t ct_rx_buf[MYNEWT_VAL(CONSOLE_RX_BUF_SIZE)];
+
console_rx_cb ct_rx_cb; /* callback that input is ready */
console_write_char ct_write_char;
uint8_t ct_echo_off:1;
@@ -78,7 +81,7 @@ struct console_hist {
uint8_t ch_tail;
uint8_t ch_size;
uint8_t ch_curr;
- uint8_t ch_buf[CONSOLE_HIST_SZ][CONSOLE_RX_BUF_SZ];
+ uint8_t ch_buf[CONSOLE_HIST_SZ][MYNEWT_VAL(CONSOLE_RX_BUF_SIZE)];
} console_hist;
#endif
@@ -165,7 +168,7 @@ console_hist_add(struct console_ring *rx)
break;
}
str++;
- tail = (tail + 1) % CONSOLE_RX_BUF_SZ;
+ tail = (tail + 1) % MYNEWT_VAL(CONSOLE_RX_BUF_SIZE);
}
ch->ch_head = (ch->ch_head + 1) & (ch->ch_size - 1);
@@ -203,7 +206,7 @@ console_hist_move(struct console_ring *rx, uint8_t *tx_buf, uint8_t direction)
}
str = ch->ch_buf[ch->ch_curr];
- for (i = 0; i < CONSOLE_RX_BUF_SZ; ++i) {
+ for (i = 0; i < MYNEWT_VAL(CONSOLE_RX_BUF_SIZE); ++i) {
if (str[i] == '\0') {
break;
}
@@ -255,7 +258,7 @@ console_blocking_mode(void)
if (ct->ct_write_char) {
ct->ct_write_char = console_blocking_tx;
- console_tx_flush(ct, CONSOLE_TX_BUF_SZ);
+ console_tx_flush(ct, MYNEWT_VAL(CONSOLE_TX_BUF_SIZE));
}
OS_EXIT_CRITICAL(sr);
}
@@ -371,7 +374,7 @@ console_rx_char(void *arg, uint8_t data)
int tx_space = 0;
int i;
#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
- uint8_t tx_buf[CONSOLE_RX_BUF_SZ];
+ uint8_t tx_buf[MYNEWT_VAL(CONSOLE_RX_BUF_SIZE)];
#else
uint8_t tx_buf[3];
#endif
@@ -440,7 +443,7 @@ console_rx_char(void *arg, uint8_t data)
}
if (!ct->ct_echo_off) {
/* HACK: clean line by backspacing up to maximum possible space */
- for (i = 0; i < CONSOLE_TX_BUF_SZ; i++) {
+ for (i = 0; i < MYNEWT_VAL(CONSOLE_TX_BUF_SIZE); i++) {
if (console_buf_space(tx) < 3) {
console_tx_flush(ct, 3);
}
@@ -518,11 +521,11 @@ console_init(console_rx_cb rx_cb)
{
struct console_tty *ct = &console_tty;
struct uart_conf uc = {
- .uc_speed = CONSOLE_UART_SPEED,
+ .uc_speed = MYNEWT_VAL(CONSOLE_BAUD),
.uc_databits = 8,
.uc_stopbits = 1,
.uc_parity = UART_PARITY_NONE,
- .uc_flow_ctl = UART_FLOW_CTL_NONE,
+ .uc_flow_ctl = MYNEWT_VAL(CONSOLE_FLOW_CONTROL),
.uc_tx_char = console_tx_char,
.uc_rx_char = console_rx_char,
.uc_cb_arg = ct
@@ -530,9 +533,9 @@ console_init(console_rx_cb rx_cb)
ct->ct_rx_cb = rx_cb;
if (!ct->ct_dev) {
- ct->ct_tx.cr_size = CONSOLE_TX_BUF_SZ;
+ ct->ct_tx.cr_size = MYNEWT_VAL(CONSOLE_TX_BUF_SIZE);
ct->ct_tx.cr_buf = ct->ct_tx_buf;
- ct->ct_rx.cr_size = CONSOLE_RX_BUF_SZ;
+ ct->ct_rx.cr_size = MYNEWT_VAL(CONSOLE_RX_BUF_SIZE);
ct->ct_rx.cr_buf = ct->ct_rx_buf;
ct->ct_write_char = console_queue_char;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/00d3fe11/sys/console/full/syscfg.yml
----------------------------------------------------------------------
diff --git a/sys/console/full/syscfg.yml b/sys/console/full/syscfg.yml
index 9e7a124..cd58944 100644
--- a/sys/console/full/syscfg.yml
+++ b/sys/console/full/syscfg.yml
@@ -1,6 +1,19 @@
# Package: sys/console/full
syscfg.defs:
+ CONSOLE_BAUD:
+ description: 'Console UART baud rate.'
+ value: '115200'
+ CONSOLE_FLOW_CONTROL:
+ description: 'Console UART flow control.'
+ value: 'UART_FLOW_CTL_NONE'
+ CONSOLE_TX_BUF_SIZE:
+ description: 'Console transmit buffer size; must be power of 2.'
+ value: 32
+ CONSOLE_RX_BUF_SIZE:
+ description: 'Console receive buffer size.'
+ value: 128
+
CONSOLE_PROMPT:
description: 'Default console prompt '
value: '0'