You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/03/15 01:44:08 UTC
[06/14] incubator-mynewt-blinky git commit: update structure to
represent blinky
update structure to represent blinky
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/commit/8878610e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/tree/8878610e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/diff/8878610e
Branch: refs/heads/master
Commit: 8878610e4c2d66195cb76efeca3f0545b70da769
Parents: a9723f0
Author: Sterling Hughes <st...@apache.org>
Authored: Wed Mar 9 10:58:51 2016 -0800
Committer: Sterling Hughes <st...@apache.org>
Committed: Wed Mar 9 10:58:51 2016 -0800
----------------------------------------------------------------------
LICENSE | 15 -
app.yml | 20 -
apps/blinky/pkg.yml | 30 +
apps/blinky/src/main.c | 113 +++
compiler/sim/compiler.yml | 32 -
compiler/sim/linux-compiler.yml | 35 -
compiler/sim/osx-compiler.yml | 33 -
compiler/sim/pkg.yml | 20 -
hw/bsp/native/README.md | 22 -
hw/bsp/native/include/bsp/bsp.h | 47 -
hw/bsp/native/native_debug.sh | 34 -
hw/bsp/native/pkg.yml | 25 -
hw/bsp/native/src/hal_bsp.c | 37 -
hw/bsp/native/src/os_bsp.c | 72 --
hw/bsp/native/src/sbrk.c | 59 --
hw/hal/README.md | 22 -
hw/hal/include/hal/flash_map.h | 91 --
hw/hal/include/hal/hal_cputime.h | 187 ----
hw/hal/include/hal/hal_flash.h | 35 -
hw/hal/include/hal/hal_flash_int.h | 51 -
hw/hal/include/hal/hal_gpio.h | 144 ---
hw/hal/include/hal/hal_system.h | 33 -
hw/hal/include/hal/hal_uart.h | 100 --
hw/hal/pkg.yml | 25 -
hw/hal/src/flash_map.c | 182 ----
hw/hal/src/hal_flash.c | 168 ----
hw/hal/src/test/flash_map_test.c | 169 ----
hw/mcu/native/include/mcu/mcu_sim.h | 27 -
hw/mcu/native/include/mcu/native_bsp.h | 24 -
hw/mcu/native/pkg.yml | 23 -
hw/mcu/native/src/hal_cputime.c | 493 ---------
hw/mcu/native/src/hal_flash.c | 244 -----
hw/mcu/native/src/hal_gpio.c | 99 --
hw/mcu/native/src/hal_system.c | 73 --
hw/mcu/native/src/hal_uart.c | 357 -------
libs/os/README.md | 24 -
libs/os/include/os/arch/cortex_m0/os/os_arch.h | 77 --
libs/os/include/os/arch/cortex_m4/os/os_arch.h | 77 --
libs/os/include/os/arch/sim/os/os_arch.h | 64 --
libs/os/include/os/endian.h | 92 --
libs/os/include/os/os.h | 99 --
libs/os/include/os/os_callout.h | 56 --
libs/os/include/os/os_cfg.h | 25 -
libs/os/include/os/os_eventq.h | 50 -
libs/os/include/os/os_heap.h | 30 -
libs/os/include/os/os_malloc.h | 34 -
libs/os/include/os/os_mbuf.h | 286 ------
libs/os/include/os/os_mempool.h | 91 --
libs/os/include/os/os_mutex.h | 62 --
libs/os/include/os/os_sanity.h | 47 -
libs/os/include/os/os_sched.h | 36 -
libs/os/include/os/os_sem.h | 55 --
libs/os/include/os/os_task.h | 121 ---
libs/os/include/os/os_test.h | 25 -
libs/os/include/os/os_time.h | 42 -
libs/os/include/os/queue.h | 514 ----------
libs/os/pkg.yml | 33 -
libs/os/src/arch/cortex_m0/m0/HAL_CM0.s | 258 -----
libs/os/src/arch/cortex_m0/m0/SVC_Table.s | 56 --
libs/os/src/arch/cortex_m0/os_arch_arm.c | 338 -------
libs/os/src/arch/cortex_m0/os_fault.c | 87 --
libs/os/src/arch/cortex_m4/m4/HAL_CM4.s | 224 -----
libs/os/src/arch/cortex_m4/m4/SVC_Table.s | 56 --
libs/os/src/arch/cortex_m4/os_arch_arm.c | 351 -------
libs/os/src/arch/cortex_m4/os_fault.c | 88 --
libs/os/src/arch/sim/os_arch_sim.c | 384 --------
libs/os/src/arch/sim/os_fault.c | 34 -
libs/os/src/os.c | 74 --
libs/os/src/os_callout.c | 133 ---
libs/os/src/os_eventq.c | 110 ---
libs/os/src/os_heap.c | 79 --
libs/os/src/os_mbuf.c | 987 -------------------
libs/os/src/os_mempool.c | 205 ----
libs/os/src/os_mutex.c | 298 ------
libs/os/src/os_priv.h | 29 -
libs/os/src/os_sanity.c | 230 -----
libs/os/src/os_sched.c | 314 ------
libs/os/src/os_sem.c | 275 ------
libs/os/src/os_task.c | 180 ----
libs/os/src/os_time.c | 63 --
.../src/test/arch/cortex_m4/os_test_arch_arm.c | 27 -
libs/os/src/test/arch/sim/os_test_arch_sim.c | 52 -
libs/os/src/test/mbuf_test.c | 227 -----
libs/os/src/test/mempool_test.c | 227 -----
libs/os/src/test/mutex_test.c | 409 --------
libs/os/src/test/os_test.c | 50 -
libs/os/src/test/os_test_priv.h | 30 -
libs/os/src/test/sem_test.c | 414 --------
libs/testutil/README.md | 22 -
libs/testutil/design.txt | 476 ---------
libs/testutil/include/testutil/testutil.h | 162 ---
libs/testutil/pkg.yml | 24 -
.../src/arch/cortex_m4/testutil_arch_arm.c | 27 -
libs/testutil/src/arch/sim/testutil_arch_sim.c | 30 -
libs/testutil/src/case.c | 243 -----
libs/testutil/src/suite.c | 43 -
libs/testutil/src/testutil.c | 49 -
libs/testutil/src/testutil_priv.h | 29 -
libs/util/include/util/base64.h | 30 -
libs/util/include/util/cbmem.h | 66 --
libs/util/include/util/tpq.h | 67 --
libs/util/include/util/util.h | 22 -
libs/util/pkg.yml | 25 -
libs/util/src/base64.c | 168 ----
libs/util/src/cbmem.c | 272 -----
libs/util/src/test/cbmem_test.c | 176 ----
libs/util/src/test/util_test.c | 45 -
libs/util/src/test/util_test_priv.h | 25 -
libs/util/src/tpq.c | 88 --
project.yml | 32 +
targets/blinky_sim/pkg.yml | 9 +
targets/blinky_sim/target.yml | 6 +
targets/unittest/pkg.yml | 9 +
targets/unittest/target.yml | 6 +
114 files changed, 205 insertions(+), 13316 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index 6c7df4f..8dada3e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -199,18 +199,3 @@
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.
-
-This product bundles queue.h 8.5, which is available under the "3-clause BSD"
-license. For details, see libs/os/include/os/queue.h.
-
-This product partly derives from FreeBSD, which is available under the
-"3-clause BSD" license. For details, see:
- * libs/os/src/os_mbuf.c
- * libs/util/src/base64.c
-
-This product bundles parts of CMSIS-CORE, which is available under the
-"3-clause BSD" license. Bundled files are:
- * libs/os/src/arch/cortex_m0/m0/HAL_CM0.s
- * libs/os/src/arch/cortex_m0/m0/SVC_Table.s
- * libs/os/src/arch/cortex_m4/m4/HAL_CM4.s
- * libs/os/src/arch/cortex_m4/m4/SVC_Table.s
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/app.yml
----------------------------------------------------------------------
diff --git a/app.yml b/app.yml
deleted file mode 100644
index 7e81eba..0000000
--- a/app.yml
+++ /dev/null
@@ -1,20 +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.
-#
-
-app.name: "larva"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/apps/blinky/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/blinky/pkg.yml b/apps/blinky/pkg.yml
new file mode 100644
index 0000000..834f86f
--- /dev/null
+++ b/apps/blinky/pkg.yml
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+pkg.name: apps/blinky
+pkg.vers: 0.8.0
+pkg.description: Basic example application which blinks an LED.
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.repository:
+pkg.keywords:
+
+pkg.deps:
+ - "@apache-mynewt-core/libs/os"
+ - "@apache-mynewt-core/hw/hal"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/apps/blinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/blinky/src/main.c b/apps/blinky/src/main.c
new file mode 100755
index 0000000..a9c38c2
--- /dev/null
+++ b/apps/blinky/src/main.c
@@ -0,0 +1,113 @@
+/**
+ * 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.
+ */
+#include "os/os.h"
+#include "bsp/bsp.h"
+#include "hal/hal_gpio.h"
+#include <assert.h>
+#include <string.h>
+#ifdef ARCH_sim
+#include <mcu/mcu_sim.h>
+#endif
+
+/* Init all tasks */
+volatile int tasks_initialized;
+int init_tasks(void);
+
+/* Task 1 */
+#define BLINKY_TASK_PRIO (1)
+#define BLINKY_STACK_SIZE OS_STACK_ALIGN(1024)
+
+struct os_task blinky_task;
+os_stack_t blinky_stack[BLINKY_STACK_SIZE];
+static volatile int g_task1_loops;
+
+/* For LED toggling */
+int g_led_pin;
+
+void
+blinky_task_handler(void *arg)
+{
+ struct os_task *t;
+
+ /* Set the led pin for the E407 devboard */
+ g_led_pin = LED_BLINK_PIN;
+ hal_gpio_init_out(g_led_pin, 1);
+
+ while (1) {
+ t = os_sched_get_current_task();
+ assert(t->t_func == blinky_task_handler);
+
+ ++g_task1_loops;
+
+ /* Wait one second */
+ os_time_delay(1000);
+
+ /* Toggle the LED */
+ hal_gpio_toggle(g_led_pin);
+ }
+}
+
+/**
+ * init_tasks
+ *
+ * Called by main.c after os_init(). This function performs initializations
+ * that are required before tasks are running.
+ *
+ * @return int 0 success; error otherwise.
+ */
+int
+init_tasks(void)
+{
+ os_task_init(&blinky_task, "blinky", blinky_task_handler, NULL,
+ BLINKY_TASK_PRIO, OS_WAIT_FOREVER, blinky_stack, BLINKY_STACK_SIZE);
+
+ tasks_initialized = 1;
+
+ return 0;
+}
+
+/**
+ * main
+ *
+ * The main function for the project. This function initializes the os, calls
+ * init_tasks to initialize tasks (and possibly other objects), then starts the
+ * OS. We should not return from os start.
+ *
+ * @return int NOTE: this function should never return!
+ */
+int
+main(int argc, char **argv)
+{
+ int rc;
+
+#ifdef ARCH_sim
+ mcu_sim_parse_args(argc, argv);
+#endif
+
+ os_init();
+
+ rc = init_tasks();
+ os_start();
+
+ /* os start should never return. If it does, this should be an error */
+ assert(0);
+
+ return rc;
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/compiler/sim/compiler.yml
----------------------------------------------------------------------
diff --git a/compiler/sim/compiler.yml b/compiler/sim/compiler.yml
deleted file mode 100644
index d888621..0000000
--- a/compiler/sim/compiler.yml
+++ /dev/null
@@ -1,32 +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.
-#
-
-compiler.path.cc: "/usr/local/bin/gcc-5"
-compiler.path.archive: "ar"
-compiler.path.objdump: "gobjdump"
-compiler.path.objsize: "objsize"
-compiler.path.objcopy: "gobjcopy"
-
-compiler.flags.base: >
- -m32 -Wall -Werror -ggdb -O0 -DMN_OSX
-
-compiler.flags.default: [compiler.flags.base]
-compiler.flags.debug: [compiler.flags.base, -ggdb -O0]
-
-compiler.ld.mapfile: false
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/compiler/sim/linux-compiler.yml
----------------------------------------------------------------------
diff --git a/compiler/sim/linux-compiler.yml b/compiler/sim/linux-compiler.yml
deleted file mode 100644
index 3dbc00c..0000000
--- a/compiler/sim/linux-compiler.yml
+++ /dev/null
@@ -1,35 +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.
-#
-
-
-compiler.path.cc: "gcc"
-compiler.path.archive: "ar"
-compiler.path.objdump: "objdump"
-compiler.path.objsize: "size"
-compiler.path.objcopy: "objcopy"
-
-compiler.flags.base: >
- -m32 -Wall -Werror -ggdb -O0 -DMN_LINUX
-
-compiler.flags.default: [compiler.flags.base]
-compiler.flags.debug: [compiler.flags.base, -ggdb -O0]
-
-compiler.ld.mapfile: false
-compiler.ld.resolve_circular_deps: true
-compiler.ld.flags: -lutil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/compiler/sim/osx-compiler.yml
----------------------------------------------------------------------
diff --git a/compiler/sim/osx-compiler.yml b/compiler/sim/osx-compiler.yml
deleted file mode 100644
index e1e2d2a..0000000
--- a/compiler/sim/osx-compiler.yml
+++ /dev/null
@@ -1,33 +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.
-#
-
-
-compiler.path.cc: "/usr/local/bin/gcc-5"
-compiler.path.archive: "ar"
-compiler.path.objdump: "gobjdump"
-compiler.path.objsize: "objsize"
-compiler.path.objcopy: "gobjcopy"
-
-compiler.flags.base: >
- -m32 -Wall -Werror -ggdb -O0 -DMN_OSX
-
-compiler.flags.default: [compiler.flags.base]
-compiler.flags.debug: [compiler.flags.base, -ggdb -O0]
-
-compiler.ld.mapfile: false
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/compiler/sim/pkg.yml
----------------------------------------------------------------------
diff --git a/compiler/sim/pkg.yml b/compiler/sim/pkg.yml
deleted file mode 100644
index 44d01a7..0000000
--- a/compiler/sim/pkg.yml
+++ /dev/null
@@ -1,20 +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.
-#
-pkg.name: compiler/sim
-pkg.vers: 0.8.0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/bsp/native/README.md
----------------------------------------------------------------------
diff --git a/hw/bsp/native/README.md b/hw/bsp/native/README.md
deleted file mode 100644
index 48ec416..0000000
--- a/hw/bsp/native/README.md
+++ /dev/null
@@ -1,22 +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.
-#
--->
-
-# Native BSP
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/bsp/native/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/native/include/bsp/bsp.h b/hw/bsp/native/include/bsp/bsp.h
deleted file mode 100644
index e14b02d..0000000
--- a/hw/bsp/native/include/bsp/bsp.h
+++ /dev/null
@@ -1,47 +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 __NATIVE_BSP_H
-#define __NATIVE_BSP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Define special stackos sections */
-#define sec_data_core
-#define sec_bss_core
-#define sec_bss_nz_core
-
-/* More convenient section placement macros. */
-#define bssnz_t
-
-/* LED pins */
-#define LED_BLINK_PIN (0x1)
-
-/* Logical UART ports */
-#define UART_CNT 2
-#define CONSOLE_UART 0
-
-int bsp_imgr_current_slot(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __NATIVE_BSP_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/bsp/native/native_debug.sh
----------------------------------------------------------------------
diff --git a/hw/bsp/native/native_debug.sh b/hw/bsp/native/native_debug.sh
deleted file mode 100755
index 75b948b..0000000
--- a/hw/bsp/native/native_debug.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-# 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.
-#
-# Called $0 <binary> [identities ...]
-# - binary is the path to prefix to target binary, .elf appended to name is
-# the ELF file
-# - identities is the project identities string.
-#
-#
-if [ $# -lt 1 ]; then
- echo "Need binary to debug"
- exit 1
-fi
-
-FILE_NAME=$1.elf
-
-echo "Debugging" $FILE_NAME
-
-gdb $FILE_NAME
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/bsp/native/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/native/pkg.yml b/hw/bsp/native/pkg.yml
deleted file mode 100644
index 6983b42..0000000
--- a/hw/bsp/native/pkg.yml
+++ /dev/null
@@ -1,25 +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.
-#
-
-pkg.name: "hw/bsp/native"
-pkg.deps:
- - hw/mcu/native
-pkg.deps.BLE_DEVICE:
- - net/nimble/drivers/native
-pkg.debugscript: "native_debug.sh"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/bsp/native/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/native/src/hal_bsp.c b/hw/bsp/native/src/hal_bsp.c
deleted file mode 100644
index 6d7c187..0000000
--- a/hw/bsp/native/src/hal_bsp.c
+++ /dev/null
@@ -1,37 +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.
- */
-
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include <inttypes.h>
-#include "hal/hal_flash_int.h"
-#include "mcu/native_bsp.h"
-
-const struct hal_flash *
-bsp_flash_dev(uint8_t id)
-{
- /*
- * Just one to start with
- */
- if (id != 0) {
- return NULL;
- }
- return &native_flash_dev;
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/bsp/native/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/native/src/os_bsp.c b/hw/bsp/native/src/os_bsp.c
deleted file mode 100644
index 0764ee5..0000000
--- a/hw/bsp/native/src/os_bsp.c
+++ /dev/null
@@ -1,72 +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.
- */
-#include <hal/flash_map.h>
-#include <mcu/native_bsp.h>
-
-static struct flash_area bsp_flash_areas[] = {
- [FLASH_AREA_BOOTLOADER] = {
- .fa_flash_id = 0, /* internal flash */
- .fa_off = 0x00000000, /* beginning */
- .fa_size = (32 * 1024)
- },
- /* 2 * 16K and 1*64K sectors here */
- [FLASH_AREA_IMAGE_0] = {
- .fa_flash_id = 0,
- .fa_off = 0x00020000,
- .fa_size = (384 * 1024)
- },
- [FLASH_AREA_IMAGE_1] = {
- .fa_flash_id = 0,
- .fa_off = 0x00080000,
- .fa_size = (384 * 1024)
- },
- [FLASH_AREA_IMAGE_SCRATCH] = {
- .fa_flash_id = 0,
- .fa_off = 0x000e0000,
- .fa_size = (128 * 1024)
- },
- [FLASH_AREA_NFFS] = {
- .fa_flash_id = 0,
- .fa_off = 0x00008000,
- .fa_size = (32 * 1024)
- }
-
-};
-
-/*
- * Returns the flash map slot where the currently active image is located.
- * If executing from internal flash from fixed location, that slot would
- * be easy to find.
- * If images are in external flash, and copied to RAM for execution, then
- * this routine would have to figure out which one of those slots is being
- * used.
- */
-int
-bsp_imgr_current_slot(void)
-{
- return FLASH_AREA_IMAGE_0;
-}
-
-void
-os_bsp_init(void)
-{
- flash_area_init(bsp_flash_areas,
- sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/bsp/native/src/sbrk.c
----------------------------------------------------------------------
diff --git a/hw/bsp/native/src/sbrk.c b/hw/bsp/native/src/sbrk.c
deleted file mode 100644
index 64000b7..0000000
--- a/hw/bsp/native/src/sbrk.c
+++ /dev/null
@@ -1,59 +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.
- */
-
-#include <sys/mman.h>
-#include <unistd.h>
-#include <errno.h>
-
-extern int getpagesize(void);
-
-static void *cont;
-static int sys_pagesize;
-static int cont_left;
-
-void *
-_sbrk(int incr)
-{
- void *result;
-
- if (!sys_pagesize) {
- sys_pagesize = getpagesize();
- }
- if (cont && incr <= cont_left) {
- result = cont;
- cont_left -= incr;
- if (cont_left) {
- cont = (char *)cont + incr;
- } else {
- cont = NULL;
- }
- return result;
- }
- result = mmap(NULL, incr, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED,
- -1, 0);
- if (result) {
- cont_left = sys_pagesize - (incr % sys_pagesize);
- if (cont_left) {
- cont = (char *)result + incr;
- } else {
- cont = NULL;
- }
- }
- return result;
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/README.md
----------------------------------------------------------------------
diff --git a/hw/hal/README.md b/hw/hal/README.md
deleted file mode 100644
index 88f5cbe..0000000
--- a/hw/hal/README.md
+++ /dev/null
@@ -1,22 +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.
-#
--->
-
-# hal
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/include/hal/flash_map.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/flash_map.h b/hw/hal/include/hal/flash_map.h
deleted file mode 100644
index a75c54d..0000000
--- a/hw/hal/include/hal/flash_map.h
+++ /dev/null
@@ -1,91 +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 H_UTIL_FLASH_MAP_
-#define H_UTIL_FLASH_MAP_
-
-/**
- *
- * Provides abstraction of flash regions for type of use.
- * I.e. dude where's my image?
- *
- * System will contain a map which contains flash areas. Every
- * region will contain flash identifier, offset within flash and length.
- *
- * 1. This system map could be in a file within filesystem (Initializer
- * must know/figure out where the filesystem is at).
- * 2. Map could be at fixed location for project (compiled to code)
- * 3. Map could be at specific place in flash (put in place at mfg time).
- *
- * Note that the map you use must be valid for BSP it's for,
- * match the linker scripts when platform executes from flash,
- * and match the target offset specified in download script.
- */
-#include <inttypes.h>
-
-struct flash_area {
- uint8_t fa_flash_id;
- uint8_t _pad[3];
- uint32_t fa_off;
- uint32_t fa_size;
-};
-
-/*
- * Flash area types
- */
-#define FLASH_AREA_BOOTLOADER 0
-#define FLASH_AREA_IMAGE_0 1
-#define FLASH_AREA_IMAGE_1 2
-#define FLASH_AREA_IMAGE_SCRATCH 3
-#define FLASH_AREA_NFFS 4
-
-/*
- * Initializes flash map. Memory will be referenced by flash_map code
- * from this on.
- */
-void flash_area_init(const struct flash_area *map, int map_entries);
-
-/*
- * Start using flash area.
- */
-int flash_area_open(int idx, const struct flash_area **);
-
-void flash_area_close(const struct flash_area *);
-
-/*
- * Read/write/erase. Offset is relative from beginning of flash area.
- */
-int flash_area_read(const struct flash_area *, uint32_t off, void *dst,
- uint32_t len);
-int flash_area_write(const struct flash_area *, uint32_t off, void *src,
- uint32_t len);
-int flash_area_erase(const struct flash_area *, uint32_t off, uint32_t len);
-
-/*
- * Given flash map index, return info about sectors within the area.
- */
-int flash_area_to_sectors(int idx, int *cnt, struct flash_area *ret);
-
-/*
- * Given flash map index, return sector info in NFFS area desc format.
- */
-struct nffs_area_desc;
-int flash_area_to_nffs_desc(int idx, int *cnt, struct nffs_area_desc *nad);
-
-#endif /* H_UTIL_FLASH_MAP_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/include/hal/hal_cputime.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_cputime.h b/hw/hal/include/hal/hal_cputime.h
deleted file mode 100644
index 99662ca..0000000
--- a/hw/hal/include/hal/hal_cputime.h
+++ /dev/null
@@ -1,187 +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 H_HAL_CPUTIME_
-#define H_HAL_CPUTIME_
-
-#include "os/queue.h"
-
-/* CPU timer callback function */
-struct cpu_timer;
-typedef void (*cputimer_func)(void *arg);
-
-/* CPU timer */
-struct cpu_timer
-{
- cputimer_func cb;
- void *arg;
- uint32_t cputime;
- TAILQ_ENTRY(cpu_timer) link;
-};
-
-/**
- * cputime init
- *
- * Initialize the cputime module. This must be called after os_init is called
- * and before any other timer API are used. This should be called only once
- * and should be called before the hardware timer is used.
- *
- * @param clock_freq The desired cputime frequency, in hertz (Hz).
- *
- * @return int 0 on success; -1 on error.
- */
-int cputime_init(uint32_t clock_freq);
-
-/**
- * cputime get64
- *
- * Returns cputime as a 64-bit number.
- *
- * @return uint64_t The 64-bit representation of cputime.
- */
-uint64_t cputime_get64(void);
-
-/**
- * cputime get32
- *
- * Returns the low 32 bits of cputime.
- *
- * @return uint32_t The lower 32 bits of cputime
- */
-uint32_t cputime_get32(void);
-
-/**
- * cputime nsecs to ticks
- *
- * Converts the given number of nanoseconds into cputime ticks.
- *
- * @param usecs The number of nanoseconds to convert to ticks
- *
- * @return uint32_t The number of ticks corresponding to 'nsecs'
- */
-uint32_t cputime_nsecs_to_ticks(uint32_t nsecs);
-
-/**
- * cputime ticks to nsecs
- *
- * Convert the given number of ticks into nanoseconds.
- *
- * @param ticks The number of ticks to convert to nanoseconds.
- *
- * @return uint32_t The number of nanoseconds corresponding to 'ticks'
- */
-uint32_t cputime_ticks_to_nsecs(uint32_t ticks);
-
-/**
- * cputime usecs to ticks
- *
- * Converts the given number of microseconds into cputime ticks.
- *
- * @param usecs The number of microseconds to convert to ticks
- *
- * @return uint32_t The number of ticks corresponding to 'usecs'
- */
-uint32_t cputime_usecs_to_ticks(uint32_t usecs);
-
-/**
- * cputime ticks to usecs
- *
- * Convert the given number of ticks into microseconds.
- *
- * @param ticks The number of ticks to convert to microseconds.
- *
- * @return uint32_t The number of microseconds corresponding to 'ticks'
- */
-uint32_t cputime_ticks_to_usecs(uint32_t ticks);
-
-/**
- * cputime delay ticks
- *
- * Wait until the number of ticks has elapsed. This is a blocking delay.
- *
- * @param ticks The number of ticks to wait.
- */
-void cputime_delay_ticks(uint32_t ticks);
-
-/**
- * cputime delay nsecs
- *
- * Wait until 'nsecs' nanoseconds has elapsed. This is a blocking delay.
- *
- * @param nsecs The number of nanoseconds to wait.
- */
-void cputime_delay_nsecs(uint32_t nsecs);
-
-/**
- * cputime delay usecs
- *
- * Wait until 'usecs' microseconds has elapsed. This is a blocking delay.
- *
- * @param usecs The number of usecs to wait.
- */
-void cputime_delay_usecs(uint32_t usecs);
-
-/**
- * cputime timer init
- *
- *
- * @param timer The timer to initialize. Cannot be NULL.
- * @param fp The timer callback function. Cannot be NULL.
- * @param arg Pointer to data object to pass to timer.
- */
-void cputime_timer_init(struct cpu_timer *timer, cputimer_func fp, void *arg);
-
-/**
- * cputime timer start
- *
- * Start a cputimer that will expire at 'cputime'. If cputime has already
- * passed, the timer callback will still be called (at interrupt context).
- *
- * @param timer Pointer to timer to start. Cannot be NULL.
- * @param cputime The cputime at which the timer should expire.
- */
-void cputime_timer_start(struct cpu_timer *timer, uint32_t cputime);
-
-/**
- * cputimer timer relative
- *
- * Sets a cpu timer that will expire 'usecs' microseconds from the current
- * cputime.
- *
- * @param timer Pointer to timer. Cannot be NULL.
- * @param usecs The number of usecs from now at which the timer will expire.
- */
-void cputime_timer_relative(struct cpu_timer *timer, uint32_t usecs);
-
-/**
- * cputime timer stop
- *
- * Stops a cputimer from running. The timer is removed from the timer queue
- * and interrupts are disabled if no timers are left on the queue. Can be
- * called even if timer is not running.
- *
- * @param timer Pointer to cputimer to stop. Cannot be NULL.
- */
-void cputime_timer_stop(struct cpu_timer *timer);
-
-#define CPUTIME_LT(__t1, __t2) ((int32_t) ((__t1) - (__t2)) < 0)
-#define CPUTIME_GT(__t1, __t2) ((int32_t) ((__t1) - (__t2)) > 0)
-#define CPUTIME_GEQ(__t1, __t2) ((int32_t) ((__t1) - (__t2)) >= 0)
-#define CPUTIME_LEQ(__t1, __t2) ((int32_t) ((__t1) - (__t2)) <= 0)
-
-#endif /* H_HAL_CPUTIMER_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/include/hal/hal_flash.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_flash.h b/hw/hal/include/hal/hal_flash.h
deleted file mode 100644
index 6f024b7..0000000
--- a/hw/hal/include/hal/hal_flash.h
+++ /dev/null
@@ -1,35 +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 H_HAL_FLASH_
-#define H_HAL_FLASH_
-
-#include <inttypes.h>
-
-int hal_flash_read(uint8_t flash_id, uint32_t address, void *dst,
- uint32_t num_bytes);
-int hal_flash_write(uint8_t flash_id, uint32_t address, const void *src,
- uint32_t num_bytes);
-int hal_flash_erase_sector(uint8_t flash_id, uint32_t sector_address);
-int hal_flash_erase(uint8_t flash_id, uint32_t address, uint32_t num_bytes);
-uint8_t hal_flash_align(uint8_t flash_id);
-int hal_flash_init(void);
-
-#endif
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/include/hal/hal_flash_int.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_flash_int.h b/hw/hal/include/hal/hal_flash_int.h
deleted file mode 100644
index f3a6602..0000000
--- a/hw/hal/include/hal/hal_flash_int.h
+++ /dev/null
@@ -1,51 +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 H_HAL_FLASH_INT
-#define H_HAL_FLASH_INT
-
-#include <inttypes.h>
-/*
- * API that flash driver has to implement.
- */
-struct hal_flash_funcs {
- int (*hff_read)(uint32_t address, void *dst, uint32_t num_bytes);
- int (*hff_write)(uint32_t address, const void *src, uint32_t num_bytes);
- int (*hff_erase_sector)(uint32_t sector_address);
- int (*hff_sector_info)(int idx, uint32_t *address, uint32_t *size);
- int (*hff_init)(void);
-};
-
-struct hal_flash {
- const struct hal_flash_funcs *hf_itf;
- uint32_t hf_base_addr;
- uint32_t hf_size;
- int hf_sector_cnt;
- int hf_align; /* Alignment requirement. 1 if unrestricted. */
-};
-
-/*
- * Return size of the flash sector. sec_idx is index to hf_sectors array.
- */
-uint32_t hal_flash_sector_size(const struct hal_flash *hf, int sec_idx);
-
-/* External function prototype supplied by BSP */
-const struct hal_flash *bsp_flash_dev(uint8_t flash_id);
-
-#endif /* H_HAL_FLASH_INT */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/include/hal/hal_gpio.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_gpio.h b/hw/hal/include/hal/hal_gpio.h
deleted file mode 100644
index 810279c..0000000
--- a/hw/hal/include/hal/hal_gpio.h
+++ /dev/null
@@ -1,144 +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 H_HAL_GPIO_
-#define H_HAL_GPIO_
-
-/*
- * The "mode" of the gpio. The gpio is either an input, output, or it is
- * "not connected" (the pin specified is not functioning as a gpio)
- */
-enum gpio_mode_e
-{
- GPIO_MODE_NC = -1,
- GPIO_MODE_IN = 0,
- GPIO_MODE_OUT = 1
-};
-typedef enum gpio_mode_e gpio_mode_t;
-
-/*
- * The "pull" of the gpio. This is either an input or an output.
- */
-enum gpio_pull
-{
- GPIO_PULL_NONE = 0, /* pull-up/down not enabled */
- GPIO_PULL_UP = 1, /* pull-up enabled */
- GPIO_PULL_DOWN = 2 /* pull-down enabled */
-};
-typedef enum gpio_pull gpio_pull_t;
-
-/*
- * IRQ trigger type.
- */
-enum gpio_irq_trigger
-{
- GPIO_TRIG_NONE = 0,
- GPIO_TRIG_RISING = 1, /* IRQ occurs on rising edge */
- GPIO_TRIG_FALLING = 2, /* IRQ occurs on falling edge */
- GPIO_TRIG_BOTH = 3, /* IRQ occurs on either edge */
- GPIO_TRIG_LOW = 4, /* IRQ occurs when line is low */
- GPIO_TRIG_HIGH = 5 /* IRQ occurs when line is high */
-};
-typedef enum gpio_irq_trigger gpio_irq_trig_t;
-
-/* Function proto for GPIO irq handler functions */
-typedef void (*gpio_irq_handler_t)(void *arg);
-
-/**
- * gpio init in
- *
- * Initializes the specified pin as an input
- *
- * @param pin Pin number to set as input
- * @param pull pull type
- *
- * @return int 0: no error; -1 otherwise.
- */
-int gpio_init_in(int pin, gpio_pull_t pull);
-
-/**
- * gpio init out
- *
- * Initialize the specified pin as an output, setting the pin to the specified
- * value.
- *
- * @param pin Pin number to set as output
- * @param val Value to set pin
- *
- * @return int 0: no error; -1 otherwise.
- */
-int gpio_init_out(int pin, int val);
-
-/**
- * gpio set
- *
- * Sets specified pin to 1 (high)
- *
- * @param pin
- */
-void gpio_set(int pin);
-
-/**
- * gpio clear
- *
- * Sets specified pin to 0 (low).
- *
- * @param pin
- */
-void gpio_clear(int pin);
-
-/**
- * gpio write
- *
- * Write a value (either high or low) to the specified pin.
- *
- * @param pin Pin to set
- * @param val Value to set pin (0:low 1:high)
- */
-void gpio_write(int pin, int val);
-
-/**
- * gpio read
- *
- * Reads the specified pin.
- *
- *
- * @param pin Pin number to read
- *
- * @return int 0: low, 1: high
- */
-int gpio_read(int pin);
-
-/**
- * gpio toggle
- *
- * Toggles the specified pin
- *
- * @param pin Pin number to toggle
- */
-void gpio_toggle(int pin);
-
-int gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
- gpio_irq_trig_t trig, gpio_pull_t pull);
-void gpio_irq_release(int pin);
-void gpio_irq_enable(int pin);
-void gpio_irq_disable(int pin);
-
-
-#endif /* H_HAL_GPIO_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/include/hal/hal_system.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_system.h b/hw/hal/include/hal/hal_system.h
deleted file mode 100644
index 2a6a3a0..0000000
--- a/hw/hal/include/hal/hal_system.h
+++ /dev/null
@@ -1,33 +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 H_HAL_SYSTEM_
-#define H_HAL_SYSTEM_
-
-/*
- * System reset.
- */
-void system_reset(void) __attribute((noreturn));
-
-/*
- * Called by bootloader to start loaded program.
- */
-void system_start(void *img_start) __attribute((noreturn));
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/include/hal/hal_uart.h
----------------------------------------------------------------------
diff --git a/hw/hal/include/hal/hal_uart.h b/hw/hal/include/hal/hal_uart.h
deleted file mode 100644
index 041bc4a..0000000
--- a/hw/hal/include/hal/hal_uart.h
+++ /dev/null
@@ -1,100 +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 H_HAL_UART_H_
-#define H_HAL_UART_H_
-
-#include <inttypes.h>
-
-/*
- * Function prototype for UART driver to ask for more data to send.
- * Returns -1 if no more data is available for TX.
- * Driver must call this with interrupts disabled.
- */
-typedef int (*hal_uart_tx_char)(void *arg);
-
-/*
- * Function prototype for UART driver to report that transmission is
- * complete. This should be called when transmission of last byte is
- * finished.
- * Driver must call this with interrupts disabled.
- */
-typedef void (*hal_uart_tx_done)(void *arg);
-
-/*
- * Function prototype for UART driver to report incoming byte of data.
- * Returns -1 if data was dropped.
- * Driver must call this with interrupts disabled.
- */
-typedef int (*hal_uart_rx_char)(void *arg, uint8_t byte);
-
-/**
- * hal uart init cbs
- *
- * Initializes given uart. Mapping of logical UART number to physical
- * UART/GPIO pins is in BSP.
- */
-int hal_uart_init_cbs(int uart, hal_uart_tx_char tx_func,
- hal_uart_tx_done tx_done, hal_uart_rx_char rx_func, void *arg);
-
-enum hal_uart_parity {
- HAL_UART_PARITY_NONE = 0, /* no parity */
- HAL_UART_PARITY_ODD = 1, /* odd parity bit */
- HAL_UART_PARITY_EVEN = 2 /* even parity bit */
-};
-
-enum hal_uart_flow_ctl {
- HAL_UART_FLOW_CTL_NONE = 0, /* no flow control */
- HAL_UART_FLOW_CTL_RTS_CTS = 1 /* RTS/CTS */
-};
-
-/**
- * hal uart config
- *
- * Applies given configuration to UART.
- */
-int hal_uart_config(int uart, int32_t speed, uint8_t databits, uint8_t stopbits,
- enum hal_uart_parity parity, enum hal_uart_flow_ctl flow_ctl);
-
-/**
- * hal uart start tx
- *
- * More data queued for transmission. UART driver will start asking for that
- * data.
- */
-void hal_uart_start_tx(int uart);
-
-/**
- * hal uart start rx
- *
- * Upper layers have consumed some data, and are now ready to receive more.
- * This is meaningful after uart_rx_char callback has returned -1 telling
- * that no more data can be accepted.
- */
-void hal_uart_start_rx(int uart);
-
-/**
- * hal uart blocking tx
- *
- * This is type of write where UART has to block until character has been sent.
- * Used when printing diag output from system crash.
- * Must be called with interrupts disabled.
- */
-void hal_uart_blocking_tx(int uart, uint8_t byte);
-
-#endif /* H_HAL_UART_H_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/hal/pkg.yml b/hw/hal/pkg.yml
deleted file mode 100644
index 2110ed1..0000000
--- a/hw/hal/pkg.yml
+++ /dev/null
@@ -1,25 +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.
-#
-
-pkg.name: hw/hal
-pkg.vers: 0.8.0
-pkg.deps: libs/os
-pkg.deps.NFFS:
- - fs/nffs
-pkg.cflags.NFFS: -DNFFS_PRESENT
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/src/flash_map.c
----------------------------------------------------------------------
diff --git a/hw/hal/src/flash_map.c b/hw/hal/src/flash_map.c
deleted file mode 100644
index f2f8016..0000000
--- a/hw/hal/src/flash_map.c
+++ /dev/null
@@ -1,182 +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.
- */
-#include <string.h>
-
-#include "hal/hal_flash.h"
-#include "hal/hal_flash_int.h"
-#ifdef NFFS_PRESENT
-#include <nffs/nffs.h>
-#endif
-#include "hal/flash_map.h"
-
-static const struct flash_area *flash_map;
-static int flash_map_entries;
-
-void
-flash_area_init(const struct flash_area *map, int map_entries)
-{
- flash_map = map;
- flash_map_entries = map_entries;
- /*
- * XXX should we validate this against current flashes?
- */
-}
-
-int
-flash_area_open(int idx, const struct flash_area **fap)
-{
- if (!flash_map || idx >= flash_map_entries) {
- return -1;
- }
- *fap = &flash_map[idx];
- return 0;
-}
-
-void
-flash_area_close(const struct flash_area *fa)
-{
- /* nothing to do for now */
-}
-
-int
-flash_area_to_sectors(int idx, int *cnt, struct flash_area *ret)
-{
- int i;
- const struct hal_flash *hf;
- const struct flash_area *fa;
- uint32_t start, size;
-
- if (!flash_map || idx >= flash_map_entries) {
- return -1;
- }
- *cnt = 0;
- fa = &flash_map[idx];
-
- hf = bsp_flash_dev(fa->fa_flash_id);
- for (i = 0; i < hf->hf_sector_cnt; i++) {
- hf->hf_itf->hff_sector_info(i, &start, &size);
- if (start >= fa->fa_off && start < fa->fa_off + fa->fa_size) {
- if (ret) {
- ret->fa_flash_id = fa->fa_flash_id;
- ret->fa_off = start;
- ret->fa_size = size;
- ret++;
- }
- *cnt = *cnt + 1;
- }
- }
- return 0;
-}
-
-#ifdef NFFS_PRESENT
-/*
- * Turn flash region into a set of areas for NFFS use.
- *
- * Limit the number of regions we return to be less than *cnt.
- * If sector count within region exceeds that, collect multiple sectors
- * to a region.
- */
-int
-flash_area_to_nffs_desc(int idx, int *cnt, struct nffs_area_desc *nad)
-{
- int i, j;
- const struct hal_flash *hf;
- const struct flash_area *fa;
- int max_cnt, move_on;
- int first_idx, last_idx;
- uint32_t start, size;
- uint32_t min_size;
-
- if (!flash_map || idx >= flash_map_entries) {
- return -1;
- }
- first_idx = last_idx = -1;
- max_cnt = *cnt;
- *cnt = 0;
-
- fa = &flash_map[idx];
-
- hf = bsp_flash_dev(fa->fa_flash_id);
- for (i = 0; i < hf->hf_sector_cnt; i++) {
- hf->hf_itf->hff_sector_info(i, &start, &size);
- if (start >= fa->fa_off && start < fa->fa_off + fa->fa_size) {
- if (first_idx == -1) {
- first_idx = i;
- }
- last_idx = i;
- *cnt = *cnt + 1;
- }
- }
- if (*cnt > max_cnt) {
- min_size = fa->fa_size / max_cnt;
- } else {
- min_size = 0;
- }
- *cnt = 0;
-
- move_on = 1;
- for (i = first_idx, j = 0; i < last_idx + 1; i++) {
- hf->hf_itf->hff_sector_info(i, &start, &size);
- if (move_on) {
- nad[j].nad_flash_id = fa->fa_flash_id;
- nad[j].nad_offset = start;
- nad[j].nad_length = size;
- *cnt = *cnt + 1;
- move_on = 0;
- } else {
- nad[j].nad_length += size;
- }
- if (nad[j].nad_length >= min_size) {
- j++;
- move_on = 1;
- }
- }
- nad[*cnt].nad_length = 0;
- return 0;
-}
-#endif /* NFFS_PRESENT */
-
-int
-flash_area_read(const struct flash_area *fa, uint32_t off, void *dst,
- uint32_t len)
-{
- if (off > fa->fa_size || off + len > fa->fa_size) {
- return -1;
- }
- return hal_flash_read(fa->fa_flash_id, fa->fa_off + off, dst, len);
-}
-
-int
-flash_area_write(const struct flash_area *fa, uint32_t off, void *src,
- uint32_t len)
-{
- if (off > fa->fa_size || off + len > fa->fa_size) {
- return -1;
- }
- return hal_flash_write(fa->fa_flash_id, fa->fa_off + off, src, len);
-}
-
-int
-flash_area_erase(const struct flash_area *fa, uint32_t off, uint32_t len)
-{
- if (off > fa->fa_size || off + len > fa->fa_size) {
- return -1;
- }
- return hal_flash_erase(fa->fa_flash_id, fa->fa_off + off, len);
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/src/hal_flash.c
----------------------------------------------------------------------
diff --git a/hw/hal/src/hal_flash.c b/hw/hal/src/hal_flash.c
deleted file mode 100644
index 8d360c5..0000000
--- a/hw/hal/src/hal_flash.c
+++ /dev/null
@@ -1,168 +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.
- */
-#include <inttypes.h>
-#include <assert.h>
-#include <bsp/bsp.h>
-
-#include "hal/hal_flash.h"
-#include "hal/hal_flash_int.h"
-
-int
-hal_flash_init(void)
-{
- const struct hal_flash *hf;
- uint8_t i;
- int rc = 0;
-
- for (i = 0; ; i++) {
- hf = bsp_flash_dev(i);
- if (!hf) {
- break;
- }
- if (hf->hf_itf->hff_init()) {
- rc = -1;
- }
- }
- return rc;
-}
-
-uint8_t
-hal_flash_align(uint8_t flash_id)
-{
- const struct hal_flash *hf;
-
- hf = bsp_flash_dev(flash_id);
- if (!hf) {
- return 1;
- }
- return hf->hf_align;
-}
-
-uint32_t
-hal_flash_sector_size(const struct hal_flash *hf, int sec_idx)
-{
- uint32_t size;
- uint32_t start;
-
- if (hf->hf_itf->hff_sector_info(sec_idx, &start, &size)) {
- return 0;
- }
- return size;
-}
-
-static int
-hal_flash_check_addr(const struct hal_flash *hf, uint32_t addr)
-{
- if (addr < hf->hf_base_addr || addr > hf->hf_base_addr + hf->hf_size) {
- return -1;
- }
- return 0;
-}
-
-int
-hal_flash_read(uint8_t id, uint32_t address, void *dst, uint32_t num_bytes)
-{
- const struct hal_flash *hf;
-
- hf = bsp_flash_dev(id);
- if (!hf) {
- return -1;
- }
- if (hal_flash_check_addr(hf, address) ||
- hal_flash_check_addr(hf, address + num_bytes)) {
- return -1;
- }
- return hf->hf_itf->hff_read(address, dst, num_bytes);
-}
-
-int
-hal_flash_write(uint8_t id, uint32_t address, const void *src,
- uint32_t num_bytes)
-{
- const struct hal_flash *hf;
-
- hf = bsp_flash_dev(id);
- if (!hf) {
- return -1;
- }
- if (hal_flash_check_addr(hf, address) ||
- hal_flash_check_addr(hf, address + num_bytes)) {
- return -1;
- }
- return hf->hf_itf->hff_write(address, src, num_bytes);
-}
-
-int
-hal_flash_erase_sector(uint8_t id, uint32_t sector_address)
-{
- const struct hal_flash *hf;
-
- hf = bsp_flash_dev(id);
- if (!hf) {
- return -1;
- }
- if (hal_flash_check_addr(hf, sector_address)) {
- return -1;
- }
- return hf->hf_itf->hff_erase_sector(sector_address);
-}
-
-int
-hal_flash_erase(uint8_t id, uint32_t address, uint32_t num_bytes)
-{
- const struct hal_flash *hf;
- uint32_t start, size;
- uint32_t end;
- uint32_t end_area;
- int i;
- int rc;
-
- hf = bsp_flash_dev(id);
- if (!hf) {
- return -1;
- }
- if (hal_flash_check_addr(hf, address) ||
- hal_flash_check_addr(hf, address + num_bytes)) {
- return -1;
- }
-
- end = address + num_bytes;
- if (end <= address) {
- /*
- * Check for wrap-around.
- */
- return -1;
- }
-
- for (i = 0; i < hf->hf_sector_cnt; i++) {
- rc = hf->hf_itf->hff_sector_info(i, &start, &size);
- assert(rc == 0);
- end_area = start + size;
- if (address < end_area && end > start) {
- /*
- * If some region of eraseable area falls inside sector,
- * erase the sector.
- */
- if (hf->hf_itf->hff_erase_sector(start)) {
- return -1;
- }
- }
- }
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/hal/src/test/flash_map_test.c
----------------------------------------------------------------------
diff --git a/hw/hal/src/test/flash_map_test.c b/hw/hal/src/test/flash_map_test.c
deleted file mode 100644
index b733f16..0000000
--- a/hw/hal/src/test/flash_map_test.c
+++ /dev/null
@@ -1,169 +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.
- */
-#include <stdio.h>
-#include <string.h>
-
-#include <os/os.h>
-#include <testutil/testutil.h>
-#include "hal/flash_map.h"
-
-#include "hal/hal_flash.h"
-#include "hal/hal_flash_int.h"
-
-/*
- * Test flash_area_to_sectors()
- */
-TEST_CASE(flash_map_test_case_1)
-{
- const struct flash_area *fa;
- int areas_checked = 0;
- int i, j, rc;
- const struct hal_flash *hf;
- struct flash_area my_secs[32];
- int my_sec_cnt;
- uint32_t end;
-
- os_init();
-
- for (i = 0; i < 8; i++) {
- rc = flash_area_open(i, &fa);
- if (rc) {
- continue;
- }
-
- hf = bsp_flash_dev(fa->fa_flash_id);
- TEST_ASSERT_FATAL(hf != NULL, "bsp_flash_dev");
-
- rc = flash_area_to_sectors(i, &my_sec_cnt, my_secs);
- TEST_ASSERT_FATAL(rc == 0, "flash_area_to_sectors failed");
-
- end = fa->fa_off;
- for (j = 0; j < my_sec_cnt; j++) {
- TEST_ASSERT_FATAL(end == my_secs[j].fa_off, "Non contiguous area");
- TEST_ASSERT_FATAL(my_secs[j].fa_flash_id == fa->fa_flash_id,
- "Sectors not in same flash?");
- end = my_secs[j].fa_off + my_secs[j].fa_size;
- }
- if (my_sec_cnt) {
- areas_checked++;
- TEST_ASSERT_FATAL(my_secs[my_sec_cnt - 1].fa_off +
- my_secs[my_sec_cnt - 1].fa_size == fa->fa_off + fa->fa_size,
- "Last sector not in the end");
- }
- }
- TEST_ASSERT_FATAL(areas_checked != 0, "No flash map areas to check!");
-}
-
-/*
- * Test flash_erase
- */
-TEST_CASE(flash_map_test_case_2)
-{
- const struct flash_area *fa;
- struct flash_area secs[32];
- int sec_cnt;
- int i;
- int rc;
- uint32_t off;
- uint8_t wd[256];
- uint8_t rd[256];
-
- os_init();
-
- rc = flash_area_open(FLASH_AREA_IMAGE_0, &fa);
- TEST_ASSERT_FATAL(rc == 0, "flash_area_open() fail");
-
- rc = flash_area_to_sectors(FLASH_AREA_IMAGE_0, &sec_cnt, secs);
- TEST_ASSERT_FATAL(rc == 0, "flash_area_to_sectors failed");
-
- /*
- * First erase the area so it's ready for use.
- */
- for (i = 0; i < sec_cnt; i++) {
- rc = hal_flash_erase_sector(secs[i].fa_flash_id, secs[i].fa_off);
- TEST_ASSERT_FATAL(rc == 0, "hal_flash_erase_sector() failed");
- }
- TEST_ASSERT_FATAL(rc == 0, "read data != write data");
-
- memset(wd, 0xa5, sizeof(wd));
-
- /* write stuff to beginning of every sector */
- off = 0;
- for (i = 0; i < sec_cnt; i++) {
- rc = flash_area_write(fa, off, wd, sizeof(wd));
- TEST_ASSERT_FATAL(rc == 0, "flash_area_write() fail");
-
- /* read it back via hal_flash_Read() */
- rc = hal_flash_read(fa->fa_flash_id, fa->fa_off + off, rd, sizeof(rd));
- TEST_ASSERT_FATAL(rc == 0, "hal_flash_read() fail");
-
- rc = memcmp(wd, rd, sizeof(wd));
- TEST_ASSERT_FATAL(rc == 0, "read data != write data");
-
- /* write stuff to end of area */
- rc = hal_flash_write(fa->fa_flash_id,
- fa->fa_off + off + secs[i].fa_size - sizeof(wd), wd, sizeof(wd));
- TEST_ASSERT_FATAL(rc == 0, "hal_flash_write() fail");
-
- /* and read it back */
- memset(rd, 0, sizeof(rd));
- rc = flash_area_read(fa, off + secs[i].fa_size - sizeof(rd),
- rd, sizeof(rd));
- TEST_ASSERT_FATAL(rc == 0, "hal_flash_read() fail");
-
- rc = memcmp(wd, rd, sizeof(rd));
- TEST_ASSERT_FATAL(rc == 0, "read data != write data");
-
- off += secs[i].fa_size;
- }
- /* erase it */
- rc = flash_area_erase(fa, 0, fa->fa_size);
- TEST_ASSERT_FATAL(rc == 0, "read data != write data");
-
- /* should read back ff all throughout*/
- memset(wd, 0xff, sizeof(wd));
- for (off = 0; off < fa->fa_size; off += sizeof(rd)) {
- rc = flash_area_read(fa, off, rd, sizeof(rd));
- TEST_ASSERT_FATAL(rc == 0, "hal_flash_read() fail");
-
- rc = memcmp(wd, rd, sizeof(rd));
- TEST_ASSERT_FATAL(rc == 0, "area not erased");
- }
-}
-
-TEST_SUITE(flash_map_test_suite)
-{
- flash_map_test_case_1();
- flash_map_test_case_2();
-}
-
-#ifdef PKG_TEST
-
-int
-main(int argc, char **argv)
-{
- tu_config.tc_print_results = 1;
- tu_init();
-
- flash_map_test_suite();
-
- return tu_any_failed;
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/mcu/native/include/mcu/mcu_sim.h
----------------------------------------------------------------------
diff --git a/hw/mcu/native/include/mcu/mcu_sim.h b/hw/mcu/native/include/mcu/mcu_sim.h
deleted file mode 100644
index 15ff8da..0000000
--- a/hw/mcu/native/include/mcu/mcu_sim.h
+++ /dev/null
@@ -1,27 +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 __MCU_SIM_H__
-#define __MCU_SIM_H__
-
-extern char *native_flash_file;
-extern char *native_uart_log_file;
-
-void mcu_sim_parse_args(int argc, char **argv);
-
-#endif /* __MCU_SIM_H__ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/mcu/native/include/mcu/native_bsp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/native/include/mcu/native_bsp.h b/hw/mcu/native/include/mcu/native_bsp.h
deleted file mode 100644
index 9a4850f..0000000
--- a/hw/mcu/native/include/mcu/native_bsp.h
+++ /dev/null
@@ -1,24 +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 H_NATIVE_BSP_
-#define H_NATIVE_BSP_
-
-extern const struct hal_flash native_flash_dev;
-
-#endif /* H_NATIVE_BSP_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/mcu/native/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/mcu/native/pkg.yml b/hw/mcu/native/pkg.yml
deleted file mode 100644
index ac19c21..0000000
--- a/hw/mcu/native/pkg.yml
+++ /dev/null
@@ -1,23 +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.
-#
-
-pkg.name: "hw/mcu/native"
-pkg.deps:
- - hw/hal
- - compiler/sim
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-blinky/blob/8878610e/hw/mcu/native/src/hal_cputime.c
----------------------------------------------------------------------
diff --git a/hw/mcu/native/src/hal_cputime.c b/hw/mcu/native/src/hal_cputime.c
deleted file mode 100644
index fb40c48..0000000
--- a/hw/mcu/native/src/hal_cputime.c
+++ /dev/null
@@ -1,493 +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.
- */
-#include <stdint.h>
-#include <assert.h>
-#include "os/os.h"
-#include "hal/hal_cputime.h"
-
-/* CPUTIME data */
-struct cputime_data
-{
- uint32_t ticks_per_usec; /* number of ticks per usec */
- uint32_t timer_isrs; /* Number of timer interrupts */
- uint32_t ocmp_ints; /* Number of ocmp interrupts */
- uint32_t uif_ints; /* Number of overflow interrupts */
- uint32_t last_ostime;
- uint64_t cputime; /* 64-bit cputime */
-};
-struct cputime_data g_cputime;
-
-/* Queue for timers */
-TAILQ_HEAD(cputime_qhead, cpu_timer) g_cputimer_q;
-
-/* For native cpu implementation */
-#define NATIVE_CPUTIME_STACK_SIZE (1024)
-os_stack_t g_native_cputime_stack[NATIVE_CPUTIME_STACK_SIZE];
-struct os_task g_native_cputime_task;
-
-struct os_callout_func g_native_cputimer;
-struct os_eventq g_native_cputime_evq;
-static uint32_t g_native_cputime_cputicks_per_ostick;
-
-
-/**
- * Convert cpu time ticks to os ticks.
- *
- *
- * @param cputicks
- *
- * @return uint32_t
- */
-static uint32_t
-native_cputime_ticks_to_osticks(uint32_t cputicks)
-{
- uint32_t osticks;
-
- osticks = cputicks / g_native_cputime_cputicks_per_ostick;
- return osticks;
-}
-
-/**
- * cputime set ocmp
- *
- * Set the OCMP used by the cputime module to the desired cputime.
- *
- * @param timer Pointer to timer.
- */
-static void
-cputime_set_ocmp(struct cpu_timer *timer)
-{
- uint32_t curtime;
- uint32_t osticks;
-
- curtime = cputime_get32();
- if ((int32_t)(timer->cputime - curtime) < 0) {
- osticks = 0;
- } else {
- osticks = native_cputime_ticks_to_osticks(timer->cputime - curtime);
- }
-
- /* Re-start the timer */
- os_callout_reset(&g_native_cputimer.cf_c, osticks);
-}
-
-/**
- * cputime chk expiration
- *
- * Iterates through the cputimer queue to determine if any timers have expired.
- * If the timer has expired the timer is removed from the queue and the timer
- * callback function is executed.
- *
- */
-static void
-cputime_chk_expiration(void)
-{
- os_sr_t sr;
- struct cpu_timer *timer;
-
- OS_ENTER_CRITICAL(sr);
- while ((timer = TAILQ_FIRST(&g_cputimer_q)) != NULL) {
- if ((int32_t)(cputime_get32() - timer->cputime) >= 0) {
- TAILQ_REMOVE(&g_cputimer_q, timer, link);
- timer->cb(timer->arg);
- } else {
- break;
- }
- }
-
- /* Any timers left on queue? If so, we need to set OCMP */
- timer = TAILQ_FIRST(&g_cputimer_q);
- if (timer) {
- cputime_set_ocmp(timer);
- } else {
- os_callout_stop(&g_native_cputimer.cf_c);
- }
- OS_EXIT_CRITICAL(sr);
-}
-
-/**
- * This is the function called when the cputimer fires off.
- *
- * @param arg
- */
-void
-native_cputimer_cb(void *arg)
-{
- /* Count # of interrupts */
- ++g_cputime.ocmp_ints;
-
- /* Execute the timer */
- cputime_chk_expiration();
-}
-
-void
-native_cputime_task_handler(void *arg)
-{
- struct os_event *ev;
- struct os_callout_func *cf;
-
- while (1) {
- ev = os_eventq_get(&g_native_cputime_evq);
- switch (ev->ev_type) {
- case OS_EVENT_T_TIMER:
- cf = (struct os_callout_func *)ev;
- assert(cf->cf_func);
- cf->cf_func(cf->cf_arg);
- break;
- default:
- assert(0);
- break;
- }
- }
-}
-
-/**
- * cputime init
- *
- * Initialize the cputime module. This must be called after os_init is called
- * and before any other timer API are used. This should be called only once
- * and should be called before the hardware timer is used.
- *
- * @param clock_freq The desired cputime frequency, in hertz (Hz).
- *
- * @return int 0 on success; -1 on error.
- */
-int
-cputime_init(uint32_t clock_freq)
-{
- /* Clock frequency must be at least 1 MHz */
- if (clock_freq < 1000000U) {
- return -1;
- }
-
- /* Initialize the timer queue */
- TAILQ_INIT(&g_cputimer_q);
-
- /* Set the clock frequency */
- g_cputime.ticks_per_usec = clock_freq / 1000000U;
- g_native_cputime_cputicks_per_ostick = clock_freq / OS_TICKS_PER_SEC;
-
- os_task_init(&g_native_cputime_task,
- "native_cputimer",
- native_cputime_task_handler,
- NULL,
- OS_TASK_PRI_HIGHEST,
- OS_WAIT_FOREVER,
- g_native_cputime_stack,
- NATIVE_CPUTIME_STACK_SIZE);
-
- /* Initialize the eventq and task */
- os_eventq_init(&g_native_cputime_evq);
-
- /* Initialize the callout function */
- os_callout_func_init(&g_native_cputimer,
- &g_native_cputime_evq,
- native_cputimer_cb,
- NULL);
-
- return 0;
-}
-
-/**
- * cputime get64
- *
- * Returns cputime as a 64-bit number.
- *
- * @return uint64_t The 64-bit representation of cputime.
- */
-uint64_t
-cputime_get64(void)
-{
- cputime_get32();
- return g_cputime.cputime;
-}
-
-/**
- * cputime get32
- *
- * Returns the low 32 bits of cputime.
- *
- * @return uint32_t The lower 32 bits of cputime
- */
-uint32_t
-cputime_get32(void)
-{
- os_sr_t sr;
- uint32_t ostime;
- uint32_t delta_osticks;
-
- OS_ENTER_CRITICAL(sr);
- ostime = os_time_get();
- delta_osticks = (uint32_t)(ostime - g_cputime.last_ostime);
- if (delta_osticks) {
- g_cputime.last_ostime = ostime;
- g_cputime.cputime +=
- (uint64_t)g_native_cputime_cputicks_per_ostick * delta_osticks;
-
- }
- OS_EXIT_CRITICAL(sr);
-
- return (uint32_t)g_cputime.cputime;
-}
-
-/**
- * cputime nsecs to ticks
- *
- * Converts the given number of nanoseconds into cputime ticks.
- *
- * @param usecs The number of nanoseconds to convert to ticks
- *
- * @return uint32_t The number of ticks corresponding to 'nsecs'
- */
-uint32_t
-cputime_nsecs_to_ticks(uint32_t nsecs)
-{
- uint32_t ticks;
-
- ticks = ((nsecs * g_cputime.ticks_per_usec) + 999) / 1000;
- return ticks;
-}
-
-/**
- * cputime ticks to nsecs
- *
- * Convert the given number of ticks into nanoseconds.
- *
- * @param ticks The number of ticks to convert to nanoseconds.
- *
- * @return uint32_t The number of nanoseconds corresponding to 'ticks'
- */
-uint32_t
-cputime_ticks_to_nsecs(uint32_t ticks)
-{
- uint32_t nsecs;
-
- nsecs = ((ticks * 1000) + (g_cputime.ticks_per_usec - 1)) /
- g_cputime.ticks_per_usec;
-
- return nsecs;
-}
-
-/**
- * cputime usecs to ticks
- *
- * Converts the given number of microseconds into cputime ticks.
- *
- * @param usecs The number of microseconds to convert to ticks
- *
- * @return uint32_t The number of ticks corresponding to 'usecs'
- */
-uint32_t
-cputime_usecs_to_ticks(uint32_t usecs)
-{
- uint32_t ticks;
-
- ticks = (usecs * g_cputime.ticks_per_usec);
- return ticks;
-}
-
-/**
- * cputime ticks to usecs
- *
- * Convert the given number of ticks into microseconds.
- *
- * @param ticks The number of ticks to convert to microseconds.
- *
- * @return uint32_t The number of microseconds corresponding to 'ticks'
- */
-uint32_t
-cputime_ticks_to_usecs(uint32_t ticks)
-{
- uint32_t us;
-
- us = (ticks + (g_cputime.ticks_per_usec - 1)) / g_cputime.ticks_per_usec;
- return us;
-}
-
-/**
- * cputime delay ticks
- *
- * Wait until the number of ticks has elapsed. This is a blocking delay.
- *
- * @param ticks The number of ticks to wait.
- */
-void
-cputime_delay_ticks(uint32_t ticks)
-{
- uint32_t until;
-
- until = cputime_get32() + ticks;
- while ((int32_t)(cputime_get32() - until) < 0) {
- /* Loop here till finished */
- }
-}
-
-/**
- * cputime delay nsecs
- *
- * Wait until 'nsecs' nanoseconds has elapsed. This is a blocking delay.
- *
- * @param nsecs The number of nanoseconds to wait.
- */
-void
-cputime_delay_nsecs(uint32_t nsecs)
-{
- uint32_t ticks;
-
- ticks = cputime_nsecs_to_ticks(nsecs);
- cputime_delay_ticks(ticks);
-}
-
-/**
- * cputime delay usecs
- *
- * Wait until 'usecs' microseconds has elapsed. This is a blocking delay.
- *
- * @param usecs The number of usecs to wait.
- */
-void
-cputime_delay_usecs(uint32_t usecs)
-{
- uint32_t ticks;
-
- ticks = cputime_usecs_to_ticks(usecs);
- cputime_delay_ticks(ticks);
-}
-
-/**
- * cputime timer init
- *
- *
- * @param timer The timer to initialize. Cannot be NULL.
- * @param fp The timer callback function. Cannot be NULL.
- * @param arg Pointer to data object to pass to timer.
- */
-void
-cputime_timer_init(struct cpu_timer *timer, cputimer_func fp, void *arg)
-{
- assert(timer != NULL);
- assert(fp != NULL);
-
- timer->cb = fp;
- timer->arg = arg;
- timer->link.tqe_prev = (void *) NULL;
-}
-
-/**
- * cputime timer start
- *
- * Start a cputimer that will expire at 'cputime'. If cputime has already
- * passed, the timer callback will still be called (at interrupt context).
- *
- * @param timer Pointer to timer to start. Cannot be NULL.
- * @param cputime The cputime at which the timer should expire.
- */
-void
-cputime_timer_start(struct cpu_timer *timer, uint32_t cputime)
-{
- struct cpu_timer *entry;
- os_sr_t sr;
-
- assert(timer != NULL);
-
- /* XXX: should this use a mutex? not sure... */
- OS_ENTER_CRITICAL(sr);
-
- timer->cputime = cputime;
- if (TAILQ_EMPTY(&g_cputimer_q)) {
- TAILQ_INSERT_HEAD(&g_cputimer_q, timer, link);
- } else {
- TAILQ_FOREACH(entry, &g_cputimer_q, link) {
- if ((int32_t)(timer->cputime - entry->cputime) < 0) {
- TAILQ_INSERT_BEFORE(entry, timer, link);
- break;
- }
- }
- if (!entry) {
- TAILQ_INSERT_TAIL(&g_cputimer_q, timer, link);
- }
- }
-
- /* If this is the head, we need to set new OCMP */
- if (timer == TAILQ_FIRST(&g_cputimer_q)) {
- cputime_set_ocmp(timer);
- }
-
- OS_EXIT_CRITICAL(sr);
-}
-
-/**
- * cputimer timer relative
- *
- * Sets a cpu timer that will expire 'usecs' microseconds from the current
- * cputime.
- *
- * @param timer Pointer to timer. Cannot be NULL.
- * @param usecs The number of usecs from now at which the timer will expire.
- */
-void
-cputime_timer_relative(struct cpu_timer *timer, uint32_t usecs)
-{
- uint32_t cputime;
-
- assert(timer != NULL);
-
- cputime = cputime_get32() + cputime_usecs_to_ticks(usecs);
- cputime_timer_start(timer, cputime);
-}
-
-/**
- * cputime timer stop
- *
- * Stops a cputimer from running. The timer is removed from the timer queue
- * and interrupts are disabled if no timers are left on the queue. Can be
- * called even if timer is running.
- *
- * @param timer Pointer to cputimer to stop. Cannot be NULL.
- */
-void
-cputime_timer_stop(struct cpu_timer *timer)
-{
- os_sr_t sr;
- int reset_ocmp;
- struct cpu_timer *entry;
-
- assert(timer != NULL);
-
- OS_ENTER_CRITICAL(sr);
-
- /* If first on queue, we will need to reset OCMP */
- if (timer->link.tqe_prev != NULL) {
- reset_ocmp = 0;
- if (timer == TAILQ_FIRST(&g_cputimer_q)) {
- entry = TAILQ_NEXT(timer, link);
- reset_ocmp = 1;
- }
- TAILQ_REMOVE(&g_cputimer_q, timer, link);
- if (reset_ocmp) {
- if (entry) {
- cputime_set_ocmp(entry);
- } else {
- os_callout_stop(&g_native_cputimer.cf_c);
- }
- }
- }
-
- OS_EXIT_CRITICAL(sr);
-}