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/29 21:39:06 UTC

incubator-mynewt-core git commit: nrf52pdk; create uart0 os device in bsp_hal_init().

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/sterly_refactor 1465cf4c9 -> d25895d2e


nrf52pdk; create uart0 os device in bsp_hal_init().


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/d25895d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d25895d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d25895d2

Branch: refs/heads/sterly_refactor
Commit: d25895d2edfc39734520994d0c072c8e7cc81a3c
Parents: 1465cf4
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Mon Aug 29 14:38:03 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Aug 29 14:38:03 2016 -0700

----------------------------------------------------------------------
 hw/bsp/nrf52pdk/include/bsp/bsp.h |  3 ++-
 hw/bsp/nrf52pdk/pkg.yml           |  1 +
 hw/bsp/nrf52pdk/src/hal_bsp.c     | 24 ++++++++++++++++++------
 hw/bsp/nrf52pdk/src/os_bsp.c      |  3 +++
 4 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d25895d2/hw/bsp/nrf52pdk/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/include/bsp/bsp.h b/hw/bsp/nrf52pdk/include/bsp/bsp.h
index 4c94916..27786b0 100644
--- a/hw/bsp/nrf52pdk/include/bsp/bsp.h
+++ b/hw/bsp/nrf52pdk/include/bsp/bsp.h
@@ -44,7 +44,8 @@ extern uint8_t _code_ram_start;
 #define LED_BLINK_PIN   (17)
 
 /* UART info */
-#define CONSOLE_UART    0
+#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/d25895d2/hw/bsp/nrf52pdk/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/pkg.yml b/hw/bsp/nrf52pdk/pkg.yml
index 61afde8..6bc7ef4 100644
--- a/hw/bsp/nrf52pdk/pkg.yml
+++ b/hw/bsp/nrf52pdk/pkg.yml
@@ -37,5 +37,6 @@ pkg.deps:
     - hw/mcu/nordic
     - hw/mcu/nordic/nrf52xxx
     - libs/baselibc
+    - drivers/uart/uart_hal
 pkg.deps.BLE_DEVICE:
     - net/nimble/drivers/nrf52

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d25895d2/hw/bsp/nrf52pdk/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/src/hal_bsp.c b/hw/bsp/nrf52pdk/src/hal_bsp.c
index 328c408..5a0ecdc 100644
--- a/hw/bsp/nrf52pdk/src/hal_bsp.c
+++ b/hw/bsp/nrf52pdk/src/hal_bsp.c
@@ -6,7 +6,7 @@
  * 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,
@@ -18,10 +18,16 @@
  */
 #include <stdint.h>
 #include <stddef.h>
+#include <assert.h>
 
 #include <hal/hal_bsp.h>
 #include <mcu/nrf52_hal.h>
 
+#include <os/os_dev.h>
+
+#include <uart/uart.h>
+#include <uart_hal/uart_hal.h>
+
 #include "bsp/bsp.h"
 
 static const struct nrf52_uart_cfg uart_cfg = {
@@ -42,11 +48,7 @@ static const struct bsp_mem_dump dump_cfg[] = {
     }
 };
 
-const struct nrf52_uart_cfg *
-bsp_uart_config(void)
-{
-    return &uart_cfg;
-}
+static struct uart_dev hal_uart0;
 
 const struct hal_flash *
 bsp_flash_dev(uint8_t id)
@@ -66,3 +68,13 @@ bsp_core_dump(int *area_cnt)
     *area_cnt = sizeof(dump_cfg) / sizeof(dump_cfg[0]);
     return dump_cfg;
 }
+
+void
+bsp_hal_init(void)
+{
+    int rc;
+
+    rc = os_dev_create((struct os_dev *) &hal_uart0, "uart0",
+      OS_DEV_INIT_PRIMARY, 0, uart_hal_init, (void *)&uart_cfg);
+    assert(rc == 0);
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d25895d2/hw/bsp/nrf52pdk/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/src/os_bsp.c b/hw/bsp/nrf52pdk/src/os_bsp.c
index c485dcf..34c611b 100644
--- a/hw/bsp/nrf52pdk/src/os_bsp.c
+++ b/hw/bsp/nrf52pdk/src/os_bsp.c
@@ -50,6 +50,8 @@ static struct flash_area bsp_flash_areas[] = {
 
 void _close(int fd);
 
+void bsp_hal_init(void);
+
 /*
  * Returns the flash map slot where the currently active image is located.
  * If executing from internal flash from fixed location, that slot would
@@ -75,4 +77,5 @@ bsp_init(void)
 
     flash_area_init(bsp_flash_areas,
       sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
+    bsp_hal_init();
 }