boot_uart: mynewt; option for faster speed with serial.
Make RX buffer size configurable for UART. Allow incoming
interrupts while copying data out of that buffer.
Signed-off-by: Marko Kiiskila <marko@apache.org>
diff --git a/boot/mynewt/boot_uart/src/boot_uart.c b/boot/mynewt/boot_uart/src/boot_uart.c
index ad6d772..7593e33 100644
--- a/boot/mynewt/boot_uart/src/boot_uart.c
+++ b/boot/mynewt/boot_uart/src/boot_uart.c
@@ -30,9 +30,9 @@
#define CONSOLE_TAIL_INC(cr) (((cr)->tail + 1) & (sizeof((cr)->buf) - 1))
struct {
- uint8_t head;
- uint8_t tail;
- uint8_t buf[16];
+ uint16_t head;
+ uint16_t tail;
+ uint8_t buf[MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE)];
} bs_uart_rx;
struct {
@@ -119,6 +119,11 @@
*newline = 1;
break;
}
+ /*
+ * Unblock interrupts allowing more incoming data.
+ */
+ OS_EXIT_CRITICAL(sr);
+ OS_ENTER_CRITICAL(sr);
*str++ = ch;
}
OS_EXIT_CRITICAL(sr);
diff --git a/boot/mynewt/boot_uart/syscfg.yml b/boot/mynewt/boot_uart/syscfg.yml
new file mode 100644
index 0000000..29f4b53
--- /dev/null
+++ b/boot/mynewt/boot_uart/syscfg.yml
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ CONSOLE_UART_RX_BUF_SIZE:
+ description: >
+ UART console receive buffer size; must be power of 2.
+ value: 32
+