You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ju...@apache.org on 2017/05/16 14:35:37 UTC

[1/2] incubator-mynewt-core git commit: moved the contents os_bsp.c to hal_bsp.c for the pic32 based BSPs to fit in with the rest of the boards

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/master dd4baa28e -> b2a367eb0


moved the contents os_bsp.c to hal_bsp.c for the pic32 based BSPs to fit in with the rest of the boards


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

Branch: refs/heads/master
Commit: bd1ac71814af1d11129a264c341262ffe7371efc
Parents: 5c343f5
Author: julian <ju...@imgtec.com>
Authored: Wed May 10 15:17:58 2017 +0100
Committer: julian <ju...@imgtec.com>
Committed: Wed May 10 15:17:58 2017 +0100

----------------------------------------------------------------------
 hw/bsp/pic32mx470_6lp_clicker/src/hal_bsp.c  |  66 +++++++++++-
 hw/bsp/pic32mx470_6lp_clicker/src/os_bsp.c   |  85 ----------------
 hw/bsp/pic32mz2048_wi-fire/src/hal_bsp.c     | 100 ++++++++++++++++++-
 hw/bsp/pic32mz2048_wi-fire/src/os_bsp.c      | 116 ----------------------
 kernel/os/include/os/arch/pic32/os/os_arch.h |   2 +-
 5 files changed, 162 insertions(+), 207 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bd1ac718/hw/bsp/pic32mx470_6lp_clicker/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/pic32mx470_6lp_clicker/src/hal_bsp.c b/hw/bsp/pic32mx470_6lp_clicker/src/hal_bsp.c
index 87fcfa6..90ca298 100644
--- a/hw/bsp/pic32mx470_6lp_clicker/src/hal_bsp.c
+++ b/hw/bsp/pic32mx470_6lp_clicker/src/hal_bsp.c
@@ -16,12 +16,74 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-#include "hal/hal_bsp.h"
-#include "bsp/bsp.h"
 #include <assert.h>
 
+#include <hal/hal_bsp.h>
+#include <syscfg/syscfg.h>
+
+#if MYNEWT_VAL(UART_0) || MYNEWT_VAL(UART_1)
+#include <uart/uart.h>
+#include <uart_hal/uart_hal.h>
+#endif
+
+#include <xc.h>
+
+#pragma config CP=1, FWDTEN=0, FCKSM=1, FPBDIV=1, OSCIOFNC=1, POSCMOD=1
+/* PLL conf div in: 2, mul: 20, div out: 1 8->4->80->80 */
+#pragma config FNOSC=3, FPLLODIV=0, UPLLEN=1, FPLLMUL=5, FPLLIDIV=1, FSRSSEL=7
+/* PGEC2/PGED2 pair is used */
+#pragma config ICESEL=2
+
+#if MYNEWT_VAL(UART_0)
+static struct uart_dev os_bsp_uart0;
+#endif
+
+#if MYNEWT_VAL(UART_1)
+static struct uart_dev os_bsp_uart1;
+#endif
+
+#if MYNEWT_VAL(UART_2)
+static struct uart_dev os_bsp_uart2;
+#endif
+
+#if MYNEWT_VAL(UART_3)
+static struct uart_dev os_bsp_uart3;
+#endif
+
 const struct hal_flash *
 hal_bsp_flash_dev(uint8_t id)
 {
     return 0;
 }
+
+void
+hal_bsp_init(void)
+{
+    int rc;
+
+#if MYNEWT_VAL(UART_0)
+    rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
+        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(UART_1)
+    rc = os_dev_create((struct os_dev *) &os_bsp_uart1, "uart1",
+        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(UART_2)
+    rc = os_dev_create((struct os_dev *) &os_bsp_uart2, "uart2",
+        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(UART_3)
+    rc = os_dev_create((struct os_dev *) &os_bsp_uart3, "uart3",
+        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+    assert(rc == 0);
+#endif
+
+    (void)rc;
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bd1ac718/hw/bsp/pic32mx470_6lp_clicker/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/pic32mx470_6lp_clicker/src/os_bsp.c b/hw/bsp/pic32mx470_6lp_clicker/src/os_bsp.c
deleted file mode 100644
index 8add7e2..0000000
--- a/hw/bsp/pic32mx470_6lp_clicker/src/os_bsp.c
+++ /dev/null
@@ -1,85 +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/hal_bsp.h"
-#include "syscfg/syscfg.h"
-#include "uart/uart.h"
-#if MYNEWT_VAL(UART_0) || MYNEWT_VAL(UART_1)
-#include "uart_hal/uart_hal.h"
-#endif
-
-#include <xc.h>
-
-#include <assert.h>
-
-#pragma config CP=1, FWDTEN=0, FCKSM=1, FPBDIV=1, OSCIOFNC=1, POSCMOD=1
-/* PLL conf div in: 2, mul: 20, div out: 1 8->4->80->80 */
-#pragma config FNOSC=3, FPLLODIV=0, UPLLEN=1, FPLLMUL=5, FPLLIDIV=1, FSRSSEL=7
-/* PGEC2/PGED2 pair is used */
-#pragma config ICESEL=2
-
-#if MYNEWT_VAL(UART_0)
-static struct uart_dev os_bsp_uart0;
-#endif
-
-#if MYNEWT_VAL(UART_1)
-static struct uart_dev os_bsp_uart1;
-#endif
-
-#if MYNEWT_VAL(UART_2)
-static struct uart_dev os_bsp_uart2;
-#endif
-
-#if MYNEWT_VAL(UART_3)
-static struct uart_dev os_bsp_uart3;
-#endif
-
-void _close(int fd);
-
-void
-hal_bsp_init(void)
-{
-    int rc;
-
-#if MYNEWT_VAL(UART_0)
-    rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
-        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-    assert(rc == 0);
-#endif
-
-#if MYNEWT_VAL(UART_1)
-    rc = os_dev_create((struct os_dev *) &os_bsp_uart1, "uart1",
-        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-    assert(rc == 0);
-#endif
-
-#if MYNEWT_VAL(UART_2)
-    rc = os_dev_create((struct os_dev *) &os_bsp_uart2, "uart2",
-        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-    assert(rc == 0);
-#endif
-
-#if MYNEWT_VAL(UART_3)
-    rc = os_dev_create((struct os_dev *) &os_bsp_uart3, "uart3",
-        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-    assert(rc == 0);
-#endif
-
-    (void)rc;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bd1ac718/hw/bsp/pic32mz2048_wi-fire/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/pic32mz2048_wi-fire/src/hal_bsp.c b/hw/bsp/pic32mz2048_wi-fire/src/hal_bsp.c
index ae78a1d..33fabab 100644
--- a/hw/bsp/pic32mz2048_wi-fire/src/hal_bsp.c
+++ b/hw/bsp/pic32mz2048_wi-fire/src/hal_bsp.c
@@ -16,17 +16,111 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-#include "hal/hal_bsp.h"
-#include "bsp/bsp.h"
 #include <assert.h>
+
+#include <syscfg/syscfg.h>
+
+#include <hal/hal_bsp.h>
+#include <mcu/mips_hal.h>
+
+#if MYNEWT_VAL(UART_0) || MYNEWT_VAL(UART_1) || MYNEWT_VAL(UART_2) || \
+    MYNEWT_VAL(UART_3) || MYNEWT_VAL(UART_4) || MYNEWT_VAL(UART_5)
+#include <uart/uart.h>
+#include <uart_hal/uart_hal.h>
+#endif
+
+#include <bsp/bsp.h>
+
 #include <xc.h>
 
+/* JTAG on, WDT off */
+#pragma config JTAGEN=1, FWDTEN=0
+/* DMT off, primary oscilator EC mode, PLL */
+#pragma config FDMTEN=0, POSCMOD=0, FNOSC=1, DMTCNT=1
+/* 24MHz posc input to pll, div by 3, multiply by 50, div by 2 -> 200mhz*/
+#pragma config FPLLODIV=1, FPLLMULT=49, FPLLICLK=0, FPLLRNG=1, FPLLIDIV=2
+/* USB off */
+#pragma config FUSBIDIO=0
+
+
+#if MYNEWT_VAL(UART_0)
+static struct uart_dev os_bsp_uart0;
+#endif
+
+#if MYNEWT_VAL(UART_1)
+static struct uart_dev os_bsp_uart1;
+#endif
+
+#if MYNEWT_VAL(UART_2)
+static struct uart_dev os_bsp_uart2;
+#endif
+
+#if MYNEWT_VAL(UART_3)
+static struct uart_dev os_bsp_uart3;
+#endif
+
+#if MYNEWT_VAL(UART_4)
+static struct uart_dev os_bsp_uart4;
+static const struct mips_uart_cfg uart4_cfg = {
+    .tx = MCU_GPIO_PORTF(8),
+    .rx = MCU_GPIO_PORTF(2)
+};
+#endif
+
+#if MYNEWT_VAL(UART_5)
+static struct uart_dev os_bsp_uart5;
+#endif
+
 const struct hal_flash *
 hal_bsp_flash_dev(uint8_t id)
 {
     return 0;
 }
 
+void
+hal_bsp_init(void)
+{
+    int rc;
+
+    #if MYNEWT_VAL(UART_0)
+        rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
+            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+        assert(rc == 0);
+    #endif
+
+    #if MYNEWT_VAL(UART_1)
+        rc = os_dev_create((struct os_dev *) &os_bsp_uart1, "uart1",
+            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+        assert(rc == 0);
+    #endif
+
+    #if MYNEWT_VAL(UART_2)
+        rc = os_dev_create((struct os_dev *) &os_bsp_uart2, "uart2",
+            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+        assert(rc == 0);
+    #endif
+
+    #if MYNEWT_VAL(UART_3)
+        rc = os_dev_create((struct os_dev *) &os_bsp_uart3, "uart3",
+            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, &uart4_cfg);
+        assert(rc == 0);
+    #endif
+
+    #if MYNEWT_VAL(UART_4)
+        rc = os_dev_create((struct os_dev *) &os_bsp_uart4, "uart4",
+            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+        assert(rc == 0);
+    #endif
+
+    #if MYNEWT_VAL(UART_5)
+        rc = os_dev_create((struct os_dev *) &os_bsp_uart5, "uart5",
+            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
+        assert(rc == 0);
+    #endif
+
+    (void)rc;
+}
+
 int
 hal_bsp_hw_id(uint8_t *id, int max_len)
 {
@@ -36,4 +130,4 @@ hal_bsp_hw_id(uint8_t *id, int max_len)
 
     memcpy(id, &DEVID, max_len);
     return max_len;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bd1ac718/hw/bsp/pic32mz2048_wi-fire/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/pic32mz2048_wi-fire/src/os_bsp.c b/hw/bsp/pic32mz2048_wi-fire/src/os_bsp.c
deleted file mode 100644
index ccf5645..0000000
--- a/hw/bsp/pic32mz2048_wi-fire/src/os_bsp.c
+++ /dev/null
@@ -1,116 +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/hal_bsp.h"
-#include "mcu/mcu.h"
-#include "mcu/mips_hal.h"
-#include "syscfg/syscfg.h"
-#include "uart/uart.h"
-#if MYNEWT_VAL(UART_0) || MYNEWT_VAL(UART_1) || MYNEWT_VAL(UART_2) || \
-    MYNEWT_VAL(UART_3) || MYNEWT_VAL(UART_4) || MYNEWT_VAL(UART_5)
-#include "uart_hal/uart_hal.h"
-#endif
-
-#include <xc.h>
-
-#include <assert.h>
-
-/* JTAG on, WDT off */
-#pragma config JTAGEN=1, FWDTEN=0
-/* DMT off, primary oscilator EC mode, PLL */
-#pragma config FDMTEN=0, POSCMOD=0, FNOSC=1, DMTCNT=1
-/* 24MHz posc input to pll, div by 3, multiply by 50, div by 2 -> 200mhz*/
-#pragma config FPLLODIV=1, FPLLMULT=49, FPLLICLK=0, FPLLRNG=1, FPLLIDIV=2
-/* USB off */
-#pragma config FUSBIDIO=0
-
-
-#if MYNEWT_VAL(UART_0)
-static struct uart_dev os_bsp_uart0;
-#endif
-
-#if MYNEWT_VAL(UART_1)
-static struct uart_dev os_bsp_uart1;
-#endif
-
-#if MYNEWT_VAL(UART_2)
-static struct uart_dev os_bsp_uart2;
-#endif
-
-#if MYNEWT_VAL(UART_3)
-static struct uart_dev os_bsp_uart3;
-#endif
-
-#if MYNEWT_VAL(UART_4)
-static struct uart_dev os_bsp_uart4;
-static const struct mips_uart_cfg uart4_cfg = {
-    .tx = MCU_GPIO_PORTF(8),
-    .rx = MCU_GPIO_PORTF(2)
-};
-#endif
-
-#if MYNEWT_VAL(UART_5)
-static struct uart_dev os_bsp_uart5;
-#endif
-
-void _close(int fd);
-
-void
-hal_bsp_init(void)
-{
-    int rc;
-
-    #if MYNEWT_VAL(UART_0)
-        rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
-            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-        assert(rc == 0);
-    #endif
-
-    #if MYNEWT_VAL(UART_1)
-        rc = os_dev_create((struct os_dev *) &os_bsp_uart1, "uart1",
-            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-        assert(rc == 0);
-    #endif
-
-    #if MYNEWT_VAL(UART_2)
-        rc = os_dev_create((struct os_dev *) &os_bsp_uart2, "uart2",
-            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-        assert(rc == 0);
-    #endif
-
-    #if MYNEWT_VAL(UART_3)
-        rc = os_dev_create((struct os_dev *) &os_bsp_uart3, "uart3",
-            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, &uart4_cfg);
-        assert(rc == 0);
-    #endif
-
-    #if MYNEWT_VAL(UART_4)
-        rc = os_dev_create((struct os_dev *) &os_bsp_uart4, "uart4",
-            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-        assert(rc == 0);
-    #endif
-
-    #if MYNEWT_VAL(UART_5)
-        rc = os_dev_create((struct os_dev *) &os_bsp_uart5, "uart5",
-            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, 0);
-        assert(rc == 0);
-    #endif
-
-    (void)rc;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bd1ac718/kernel/os/include/os/arch/pic32/os/os_arch.h
----------------------------------------------------------------------
diff --git a/kernel/os/include/os/arch/pic32/os/os_arch.h b/kernel/os/include/os/arch/pic32/os/os_arch.h
index 6bc20b2..8e74319 100644
--- a/kernel/os/include/os/arch/pic32/os/os_arch.h
+++ b/kernel/os/include/os/arch/pic32/os/os_arch.h
@@ -59,7 +59,7 @@ typedef uint32_t os_stack_t;
 /* Exit a critical section, restore processor state and unblock interrupts */
 #define OS_EXIT_CRITICAL(__os_sr) __builtin_set_isr_state(__os_sr)
 /*  This is not the only way interrupts can be disabled */
-#define OS_IS_CRITICAL() ((__builtin_get_isr_state() & 1) == 0)
+#define OS_IS_CRITICAL() ((_CP0_GET_STATUS() & 1) == 0)
 #define OS_ASSERT_CRITICAL() assert(OS_IS_CRITICAL())
 
 os_stack_t *os_arch_task_stack_init(struct os_task *, os_stack_t *, int);


[2/2] incubator-mynewt-core git commit: This closes pull request #272

Posted by ju...@apache.org.
This closes pull request #272


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

Branch: refs/heads/master
Commit: b2a367eb03aeea7c98cf103cbac0661a0bfa63d7
Parents: dd4baa2 bd1ac71
Author: julian <ju...@imgtec.com>
Authored: Tue May 16 15:26:47 2017 +0100
Committer: julian <ju...@imgtec.com>
Committed: Tue May 16 15:26:47 2017 +0100

----------------------------------------------------------------------
 hw/bsp/pic32mx470_6lp_clicker/src/hal_bsp.c  |  66 +++++++++++-
 hw/bsp/pic32mx470_6lp_clicker/src/os_bsp.c   |  85 ----------------
 hw/bsp/pic32mz2048_wi-fire/src/hal_bsp.c     | 100 ++++++++++++++++++-
 hw/bsp/pic32mz2048_wi-fire/src/os_bsp.c      | 116 ----------------------
 kernel/os/include/os/arch/pic32/os/os_arch.h |   2 +-
 5 files changed, 162 insertions(+), 207 deletions(-)
----------------------------------------------------------------------