You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/08/24 18:56:15 UTC
[14/14] incubator-mynewt-core git commit: stm32f4 uart;
work with uart_hal driver.
stm32f4 uart; work with uart_hal driver.
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/a60fd2fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a60fd2fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a60fd2fc
Branch: refs/heads/sterly_refactor
Commit: a60fd2fc252beafa0e7ead6742d8b979fb91072e
Parents: 6535f44
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Aug 24 11:46:51 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Aug 24 11:46:51 2016 -0700
----------------------------------------------------------------------
hw/mcu/stm/stm32f4xx/src/hal_uart.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a60fd2fc/hw/mcu/stm/stm32f4xx/src/hal_uart.c
----------------------------------------------------------------------
diff --git a/hw/mcu/stm/stm32f4xx/src/hal_uart.c b/hw/mcu/stm/stm32f4xx/src/hal_uart.c
index 6c8d433..f7057ed 100644
--- a/hw/mcu/stm/stm32f4xx/src/hal_uart.c
+++ b/hw/mcu/stm/stm32f4xx/src/hal_uart.c
@@ -40,6 +40,7 @@ struct hal_uart {
hal_uart_tx_char u_tx_func;
hal_uart_tx_done u_tx_done;
void *u_func_arg;
+ const struct stm32f4_uart_cfg *u_cfg;
};
static struct hal_uart uarts[UART_CNT];
@@ -271,7 +272,7 @@ hal_uart_config(int port, int32_t baudrate, uint8_t databits, uint8_t stopbits,
if (u->u_open) {
return -1;
}
- cfg = bsp_uart_config(port);
+ cfg = u->u_cfg;
assert(cfg);
/*
@@ -374,6 +375,20 @@ hal_uart_config(int port, int32_t baudrate, uint8_t databits, uint8_t stopbits,
}
int
+hal_uart_init(int port, void *arg)
+{
+ struct hal_uart *u;
+
+ if (port >= UART_CNT) {
+ return -1;
+ }
+ u = &uarts[port];
+ u->u_cfg = (const struct stm32f4_uart_cfg *)arg;
+
+ return 0;
+}
+
+int
hal_uart_close(int port)
{
struct hal_uart *u;