You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/11/05 13:36:41 UTC
[mynewt-nimble] 02/03: [linux] Cleanup npl layer in linux port.
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 22e1e79295e3c045e100e889738cbf7f3a8e17b6
Author: Martin Turon <mt...@nestlabs.com>
AuthorDate: Thu Aug 23 18:39:33 2018 -0700
[linux] Cleanup npl layer in linux port.
---
porting/npl/linux/include/nimble/nimble_npl_os.h | 6 +----
porting/npl/linux/src/npl_osal.h | 29 ------------------------
porting/npl/linux/src/os_atomic.c | 2 +-
porting/npl/linux/src/os_callout.c | 3 +--
porting/npl/linux/src/os_eventq.cc | 2 +-
porting/npl/linux/src/os_mutex.c | 1 +
porting/npl/linux/src/os_sem.c | 1 +
porting/npl/linux/src/os_task.c | 6 +++++
porting/npl/linux/src/os_time.c | 1 +
porting/npl/linux/src/os_types.h | 4 ++--
10 files changed, 15 insertions(+), 40 deletions(-)
diff --git a/porting/npl/linux/include/nimble/nimble_npl_os.h b/porting/npl/linux/include/nimble/nimble_npl_os.h
index 15f7820..bdd3988 100644
--- a/porting/npl/linux/include/nimble/nimble_npl_os.h
+++ b/porting/npl/linux/include/nimble/nimble_npl_os.h
@@ -24,7 +24,7 @@
#include <stdint.h>
#include <string.h>
-#include "npl_osal.h"
+#include "os_types.h"
#ifdef __cplusplus
extern "C" {
@@ -34,10 +34,6 @@ extern "C" {
#define BLE_NPL_TIME_FOREVER INT32_MAX
-/* This should be compatible with TickType_t */
-typedef uint32_t ble_npl_time_t;
-typedef int32_t ble_npl_stime_t;
-
#define SYSINIT_PANIC_MSG(msg) __assert_fail(msg, __FILE__, __LINE__, __func__)
#define SYSINIT_PANIC_ASSERT_MSG(rc, msg) do \
diff --git a/porting/npl/linux/src/npl_osal.h b/porting/npl/linux/src/npl_osal.h
deleted file mode 100644
index 2d6efed..0000000
--- a/porting/npl/linux/src/npl_osal.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _NPL_OSAL_H
-#define _NPL_OSAL_H
-
-#include "os_types.h"
-
-#include "nimble/nimble_npl.h"
-
-#include "os/os.h"
-
-#endif // _NPL_OSAL_H
\ No newline at end of file
diff --git a/porting/npl/linux/src/os_atomic.c b/porting/npl/linux/src/os_atomic.c
index 5704707..3aaec08 100644
--- a/porting/npl/linux/src/os_atomic.c
+++ b/porting/npl/linux/src/os_atomic.c
@@ -20,7 +20,7 @@
#include <stdint.h>
#include <pthread.h>
-#include "npl_osal.h"
+#include "nimble/nimble_npl.h"
static pthread_mutex_t s_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
diff --git a/porting/npl/linux/src/os_callout.c b/porting/npl/linux/src/os_callout.c
index ead7ff1..1804705 100644
--- a/porting/npl/linux/src/os_callout.c
+++ b/porting/npl/linux/src/os_callout.c
@@ -25,7 +25,7 @@
#include <time.h>
#include <signal.h>
-#include "npl_osal.h"
+#include "nimble/nimble_npl.h"
static void
ble_npl_callout_timer_cb(union sigval sv)
@@ -40,7 +40,6 @@ ble_npl_callout_timer_cb(union sigval sv)
}
}
-
void ble_npl_callout_init(struct ble_npl_callout *c,
struct ble_npl_eventq *evq,
ble_npl_event_fn *ev_cb,
diff --git a/porting/npl/linux/src/os_eventq.cc b/porting/npl/linux/src/os_eventq.cc
index a1459bd..0415836 100644
--- a/porting/npl/linux/src/os_eventq.cc
+++ b/porting/npl/linux/src/os_eventq.cc
@@ -21,7 +21,7 @@
#include <stdint.h>
#include <string.h>
-#include "npl_osal.h"
+#include "nimble/nimble_npl.h"
#include "wqueue.h"
extern "C" {
diff --git a/porting/npl/linux/src/os_mutex.c b/porting/npl/linux/src/os_mutex.c
index f4bcf65..bdc254c 100644
--- a/porting/npl/linux/src/os_mutex.c
+++ b/porting/npl/linux/src/os_mutex.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <string.h>
#include "os/os.h"
+#include "nimble/nimble_npl.h"
#include <pthread.h>
diff --git a/porting/npl/linux/src/os_sem.c b/porting/npl/linux/src/os_sem.c
index 46701ac..bec0039 100644
--- a/porting/npl/linux/src/os_sem.c
+++ b/porting/npl/linux/src/os_sem.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <string.h>
#include "os/os.h"
+#include "nimble/nimble_npl.h"
#include <errno.h>
#include <pthread.h>
diff --git a/porting/npl/linux/src/os_task.c b/porting/npl/linux/src/os_task.c
index 959ab0e..2ba7432 100644
--- a/porting/npl/linux/src/os_task.c
+++ b/porting/npl/linux/src/os_task.c
@@ -18,6 +18,7 @@
*/
#include "os/os.h"
+#include "nimble/nimble_npl.h"
#ifdef __cplusplus
extern "C" {
@@ -105,6 +106,11 @@ bool ble_npl_os_started(void)
return true;
}
+void ble_npl_task_yield(void)
+{
+ pthread_yield();
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/porting/npl/linux/src/os_time.c b/porting/npl/linux/src/os_time.c
index 55cbb61..613e299 100644
--- a/porting/npl/linux/src/os_time.c
+++ b/porting/npl/linux/src/os_time.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <string.h>
#include "os/os.h"
+#include "nimble/nimble_npl.h"
#include <time.h>
diff --git a/porting/npl/linux/src/os_types.h b/porting/npl/linux/src/os_types.h
index 5b978af..c88a3e8 100644
--- a/porting/npl/linux/src/os_types.h
+++ b/porting/npl/linux/src/os_types.h
@@ -38,8 +38,6 @@ typedef int32_t ble_npl_stime_t;
//typedef int os_sr_t;
typedef int ble_npl_stack_t;
-struct ble_npl_event;
-typedef void ble_npl_event_fn(struct ble_npl_event *ev);
struct ble_npl_event {
uint8_t ev_queued;
@@ -82,4 +80,6 @@ int ble_npl_task_remove(struct ble_npl_task *t);
uint8_t ble_npl_task_count(void);
+void ble_npl_task_yield(void);
+
#endif // _NPL_OS_TYPES_H