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:08 UTC
[07/14] incubator-mynewt-core git commit: nrf52dk bsp;
create uart driver at bsp_init().
nrf52dk bsp; create uart driver at bsp_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/12ce23a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/12ce23a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/12ce23a7
Branch: refs/heads/sterly_refactor
Commit: 12ce23a75631e570871047d7b2e952722d73c31f
Parents: e31bb82
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Aug 24 09:11:39 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Aug 24 09:11:39 2016 -0700
----------------------------------------------------------------------
hw/bsp/nrf52dk/pkg.yml | 1 +
hw/bsp/nrf52dk/src/os_bsp.c | 13 +++++++++++++
2 files changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ce23a7/hw/bsp/nrf52dk/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/pkg.yml b/hw/bsp/nrf52dk/pkg.yml
index b85f5d4..41b4222 100644
--- a/hw/bsp/nrf52dk/pkg.yml
+++ b/hw/bsp/nrf52dk/pkg.yml
@@ -37,6 +37,7 @@ pkg.deps:
- hw/mcu/nordic
- hw/mcu/nordic/nrf52xxx
- libs/baselibc
+ - drivers/uart/uart_hal
pkg.deps.BLE_DEVICE:
- net/nimble/drivers/nrf52
pkg.features:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/12ce23a7/hw/bsp/nrf52dk/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/src/os_bsp.c b/hw/bsp/nrf52dk/src/os_bsp.c
index 161d138..e20edd1 100644
--- a/hw/bsp/nrf52dk/src/os_bsp.c
+++ b/hw/bsp/nrf52dk/src/os_bsp.c
@@ -16,8 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
+#include <assert.h>
+
#include <hal/flash_map.h>
#include <hal/hal_bsp.h>
+#include <hal/hal_cputime.h>
+#include <uart_hal/uart_hal.h>
+#include <mcu/nrf52_hal.h>
+#include <os/os_dev.h>
static struct flash_area bsp_flash_areas[] = {
[FLASH_AREA_BOOTLOADER] = {
@@ -47,6 +53,7 @@ static struct flash_area bsp_flash_areas[] = {
.fa_size = (12 * 1024)
}
};
+static struct uart_dev hal_uart0;
void _close(int fd);
@@ -67,6 +74,8 @@ bsp_imgr_current_slot(void)
void
bsp_init(void)
{
+ int rc;
+
/*
* XXX this reference is here to keep this function in.
*/
@@ -75,4 +84,8 @@ bsp_init(void)
flash_area_init(bsp_flash_areas,
sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
+
+ rc = os_dev_create((struct os_dev *) &hal_uart0, "uart0",
+ OS_DEV_INIT_PRIMARY, 0, uart_hal_init, (void *)bsp_uart_config());
+ assert(rc == 0);
}