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/10/11 16:25:58 UTC

[39/45] incubator-mynewt-core git commit: mcu: MK64F12: add system HAL

mcu: MK64F12: add system HAL

copied mostly from nordic devices

Signed-off-by: Michael Scott <mi...@linaro.org>


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

Branch: refs/heads/develop
Commit: 877d710a3181cf27ed1dee7a92302c3a9bcb6b9f
Parents: 65e6a3b
Author: Michael Scott <mi...@linaro.org>
Authored: Fri Oct 7 16:35:35 2016 -0700
Committer: Michael Scott <mi...@linaro.org>
Committed: Mon Oct 10 23:59:41 2016 -0700

----------------------------------------------------------------------
 hw/mcu/nxp/MK64F12/src/hal_system.c | 39 ++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/877d710a/hw/mcu/nxp/MK64F12/src/hal_system.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nxp/MK64F12/src/hal_system.c b/hw/mcu/nxp/MK64F12/src/hal_system.c
new file mode 100644
index 0000000..f364efd
--- /dev/null
+++ b/hw/mcu/nxp/MK64F12/src/hal_system.c
@@ -0,0 +1,39 @@
+/**
+ * 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 <mcu/cortex_m4.h>
+#include "hal/hal_system.h"
+
+int system_debugger_connected(void)
+{
+    return CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk;
+}
+
+void system_reset(void)
+{
+    while (1) {
+        if (system_debugger_connected()) {
+            /*
+             * If debugger is attached, breakpoint here.
+             */
+            asm("bkpt");
+        }
+        NVIC_SystemReset();
+    }
+}