aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Utzig <utzig@utzig.org>2016-04-10 21:11:14 -0300
committerFabio Utzig <utzig@utzig.org>2016-04-10 21:11:14 -0300
commit16dd3d3f35dd0d6326b12a23d3e7cc54b2f1ecd5 (patch)
tree9c9f9c7aafc53cf39a3ad94f0472caef05aa0086
parentef40620f3c013f785fbd9a9043ed53a370e699ac (diff)
parentb72393fff0b6449d839b8a8464c199b7e9146159 (diff)
downloadChibiOS-Contrib-16dd3d3f35dd0d6326b12a23d3e7cc54b2f1ecd5.tar.gz
ChibiOS-Contrib-16dd3d3f35dd0d6326b12a23d3e7cc54b2f1ecd5.tar.bz2
ChibiOS-Contrib-16dd3d3f35dd0d6326b12a23d3e7cc54b2f1ecd5.zip
Merge pull request #48 from utzig/fix-nrf51-port
Fix nrf51 port
-rw-r--r--demos/NRF51/RT-WVSHARE_BLE400/Makefile12
-rw-r--r--demos/NRF51/RT-WVSHARE_BLE400/chconf.h25
-rw-r--r--demos/NRF51/RT-WVSHARE_BLE400/main.c4
-rw-r--r--demos/NRF51/RT-WVSHARE_BLE400/mcuconf.h3
-rw-r--r--os/common/ports/ARMCMx/compilers/GCC/ld/NRF51822.ld50
-rw-r--r--os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk11
-rw-r--r--os/common/startup/ARMCMx/compilers/GCC/ld/NRF51822.ld84
-rw-r--r--os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk10
-rw-r--r--os/common/startup/ARMCMx/devices/NRF51822/cmparams.h (renamed from os/common/ports/ARMCMx/devices/NRF51822/cmparams.h)0
-rw-r--r--os/hal/include/hal_rng.h2
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_adc_lld.c (renamed from os/hal/ports/NRF51/NRF51822/adc_lld.c)0
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_adc_lld.h (renamed from os/hal/ports/NRF51/NRF51822/adc_lld.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_ext_lld.c (renamed from os/hal/ports/NRF51/NRF51822/ext_lld.c)2
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_ext_lld.h (renamed from os/hal/ports/NRF51/NRF51822/ext_lld.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.c (renamed from os/hal/ports/NRF51/NRF51822/ext_lld_isr.c)2
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.h (renamed from os/hal/ports/NRF51/NRF51822/ext_lld_isr.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_gpt_lld.c (renamed from os/hal/ports/NRF51/NRF51822/gpt_lld.c)0
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_gpt_lld.h (renamed from os/hal/ports/NRF51/NRF51822/gpt_lld.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_i2c_lld.c (renamed from os/hal/ports/NRF51/NRF51822/i2c_lld.c)0
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_i2c_lld.h (renamed from os/hal/ports/NRF51/NRF51822/i2c_lld.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_lld.h10
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_pal_lld.c (renamed from os/hal/ports/NRF51/NRF51822/pal_lld.c)0
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_pal_lld.h (renamed from os/hal/ports/NRF51/NRF51822/pal_lld.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_rng_lld.c (renamed from os/hal/ports/NRF51/NRF51822/rng_lld.c)4
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_rng_lld.h (renamed from os/hal/ports/NRF51/NRF51822/rng_lld.h)10
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_serial_lld.c (renamed from os/hal/ports/NRF51/NRF51822/serial_lld.c)8
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_serial_lld.h (renamed from os/hal/ports/NRF51/NRF51822/serial_lld.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_spi_lld.c (renamed from os/hal/ports/NRF51/NRF51822/spi_lld.c)0
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_spi_lld.h (renamed from os/hal/ports/NRF51/NRF51822/spi_lld.h)6
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_st_lld.c (renamed from os/hal/ports/NRF51/NRF51822/st_lld.c)44
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_st_lld.h (renamed from os/hal/ports/NRF51/NRF51822/st_lld.h)39
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_wdg_lld.c (renamed from os/hal/ports/NRF51/NRF51822/wdg_lld.c)8
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_wdg_lld.h (renamed from os/hal/ports/NRF51/NRF51822/wdg_lld.h)20
-rw-r--r--os/hal/ports/NRF51/NRF51822/platform.mk44
-rw-r--r--testhal/NRF51/NRF51822/ADC/Makefile6
-rw-r--r--testhal/NRF51/NRF51822/ADC/chconf.h25
-rw-r--r--testhal/NRF51/NRF51822/ADC/halconf.h7
-rw-r--r--testhal/NRF51/NRF51822/EXT/Makefile6
-rw-r--r--testhal/NRF51/NRF51822/EXT/chconf.h25
-rw-r--r--testhal/NRF51/NRF51822/GPT/Makefile6
-rw-r--r--testhal/NRF51/NRF51822/GPT/chconf.h25
-rw-r--r--testhal/NRF51/NRF51822/GPT/halconf.h7
-rw-r--r--testhal/NRF51/NRF51822/I2C/Makefile6
-rw-r--r--testhal/NRF51/NRF51822/I2C/chconf.h25
-rw-r--r--testhal/NRF51/NRF51822/SPI/Makefile6
-rw-r--r--testhal/NRF51/NRF51822/SPI/chconf.h25
-rw-r--r--testhal/NRF51/NRF51822/WDG/Makefile20
-rw-r--r--testhal/NRF51/NRF51822/WDG/chconf.h25
-rw-r--r--testhal/NRF51/NRF51822/WDG/halconf.h179
-rw-r--r--testhal/NRF51/NRF51822/WDG/main.c23
-rw-r--r--testhal/NRF51/NRF51822/WDG/mcuconf.h1
51 files changed, 630 insertions, 227 deletions
diff --git a/demos/NRF51/RT-WVSHARE_BLE400/Makefile b/demos/NRF51/RT-WVSHARE_BLE400/Makefile
index ffa30f4..1b4f545 100644
--- a/demos/NRF51/RT-WVSHARE_BLE400/Makefile
+++ b/demos/NRF51/RT-WVSHARE_BLE400/Makefile
@@ -43,6 +43,12 @@ ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
+# If enabled, this option makes the build process faster by not compiling
+# modules not used in the current configuration.
+ifeq ($(USE_SMART_BUILD),)
+ USE_SMART_BUILD = yes
+endif
+
#
# Build global options
##############################################################################
@@ -83,7 +89,7 @@ PROJECT = ch
CHIBIOS = ../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -91,7 +97,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@@ -207,5 +213,5 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
diff --git a/demos/NRF51/RT-WVSHARE_BLE400/chconf.h b/demos/NRF51/RT-WVSHARE_BLE400/chconf.h
index fc9a52b..a753ec9 100644
--- a/demos/NRF51/RT-WVSHARE_BLE400/chconf.h
+++ b/demos/NRF51/RT-WVSHARE_BLE400/chconf.h
@@ -28,6 +28,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -445,6 +447,20 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
@@ -488,6 +504,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/demos/NRF51/RT-WVSHARE_BLE400/main.c b/demos/NRF51/RT-WVSHARE_BLE400/main.c
index d0b18cc..6b25a64 100644
--- a/demos/NRF51/RT-WVSHARE_BLE400/main.c
+++ b/demos/NRF51/RT-WVSHARE_BLE400/main.c
@@ -16,7 +16,7 @@
#include "ch.h"
#include "hal.h"
-#include "test.h"
+#include "ch_test.h"
static THD_WORKING_AREA(waThread1, 64);
static THD_FUNCTION(Thread1, arg) {
@@ -63,7 +63,7 @@ int main(void) {
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
- TestThread(&SD1);
+ test_execute((BaseSequentialStream *)&SD1);
while (1) {
chThdSleepMilliseconds(500);
}
diff --git a/demos/NRF51/RT-WVSHARE_BLE400/mcuconf.h b/demos/NRF51/RT-WVSHARE_BLE400/mcuconf.h
index aaf9473..cef47aa 100644
--- a/demos/NRF51/RT-WVSHARE_BLE400/mcuconf.h
+++ b/demos/NRF51/RT-WVSHARE_BLE400/mcuconf.h
@@ -21,5 +21,8 @@
* HAL driver system settings.
*/
#define NRF51_SERIAL_USE_UART0 TRUE
+#define NRF51_ST_USE_RTC0 TRUE
+#define NRF51_ST_USE_RTC1 FALSE
+#define NRF51_ST_USE_TIMER0 FALSE
#endif /* _MCUCONF_H_ */
diff --git a/os/common/ports/ARMCMx/compilers/GCC/ld/NRF51822.ld b/os/common/ports/ARMCMx/compilers/GCC/ld/NRF51822.ld
deleted file mode 100644
index b8dbc10..0000000
--- a/os/common/ports/ARMCMx/compilers/GCC/ld/NRF51822.ld
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Copyright (C) 2015 Fabio Utzig
-
- Licensed 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.
-*/
-
-/*
- * NRF51822 memory setup.
- */
-MEMORY
-{
- flash : org = 0x00000000, len = 256k
- ram0 : org = 0x20000000, len = 32k
- ram1 : org = 0x00000000, len = 0
- ram2 : org = 0x00000000, len = 0
- ram3 : org = 0x00000000, len = 0
- ram4 : org = 0x00000000, len = 0
- ram5 : org = 0x00000000, len = 0
- ram6 : org = 0x00000000, len = 0
- ram7 : org = 0x00000000, len = 0
-}
-
-/* RAM region to be used for Main stack. This stack accommodates the processing
- of all exceptions and interrupts*/
-REGION_ALIAS("MAIN_STACK_RAM", ram0);
-
-/* RAM region to be used for the process stack. This is the stack used by
- the main() function.*/
-REGION_ALIAS("PROCESS_STACK_RAM", ram0);
-
-/* RAM region to be used for data segment.*/
-REGION_ALIAS("DATA_RAM", ram0);
-
-/* RAM region to be used for BSS segment.*/
-REGION_ALIAS("BSS_RAM", ram0);
-
-/* RAM region to be used for HEAP segment.*/
-REGION_ALIAS("HEAP_RAM", ram0);
-
-INCLUDE rules.ld
diff --git a/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk b/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
deleted file mode 100644
index 2824ae7..0000000
--- a/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-# List of the ChibiOS generic NRF51 startup and CMSIS files.
-STARTUPSRC = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/crt1.c \
- $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/vectors.c
-
-STARTUPASM = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s
-
-STARTUPINC = $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/devices/NRF51822 \
- $(CHIBIOS)/os/ext/CMSIS/include
-
-STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/ld
-
diff --git a/os/common/startup/ARMCMx/compilers/GCC/ld/NRF51822.ld b/os/common/startup/ARMCMx/compilers/GCC/ld/NRF51822.ld
new file mode 100644
index 0000000..d4db7d4
--- /dev/null
+++ b/os/common/startup/ARMCMx/compilers/GCC/ld/NRF51822.ld
@@ -0,0 +1,84 @@
+/*
+ Copyright (C) 2015 Fabio Utzig
+
+ Licensed 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.
+*/
+
+/*
+ * NRF51822 memory setup.
+ */
+MEMORY
+{
+ flash0 : org = 0x00000000, len = 256k
+ flash1 : org = 0x00000000, len = 0
+ flash2 : org = 0x00000000, len = 0
+ flash3 : org = 0x00000000, len = 0
+ flash4 : org = 0x00000000, len = 0
+ flash5 : org = 0x00000000, len = 0
+ flash6 : org = 0x00000000, len = 0
+ flash7 : org = 0x00000000, len = 0
+ ram0 : org = 0x20000000, len = 32k
+ ram1 : org = 0x00000000, len = 0
+ ram2 : org = 0x00000000, len = 0
+ ram3 : org = 0x00000000, len = 0
+ ram4 : org = 0x00000000, len = 0
+ ram5 : org = 0x00000000, len = 0
+ ram6 : org = 0x00000000, len = 0
+ ram7 : org = 0x00000000, len = 0
+}
+
+/* For each data/text section two region are defined, a virtual region
+ and a load region (_LMA suffix).*/
+
+/* Flash region to be used for exception vectors.*/
+REGION_ALIAS("VECTORS_FLASH", flash0);
+REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
+
+/* Flash region to be used for constructors and destructors.*/
+REGION_ALIAS("XTORS_FLASH", flash0);
+REGION_ALIAS("XTORS_FLASH_LMA", flash0);
+
+/* Flash region to be used for code text.*/
+REGION_ALIAS("TEXT_FLASH", flash0);
+REGION_ALIAS("TEXT_FLASH_LMA", flash0);
+
+/* Flash region to be used for read only data.*/
+REGION_ALIAS("RODATA_FLASH", flash0);
+REGION_ALIAS("RODATA_FLASH_LMA", flash0);
+
+/* Flash region to be used for various.*/
+REGION_ALIAS("VARIOUS_FLASH", flash0);
+REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
+
+/* Flash region to be used for RAM(n) initialization data.*/
+REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
+
+/* RAM region to be used for Main stack. This stack accommodates the processing
+ of all exceptions and interrupts*/
+REGION_ALIAS("MAIN_STACK_RAM", ram0);
+
+/* RAM region to be used for the process stack. This is the stack used by
+ the main() function.*/
+REGION_ALIAS("PROCESS_STACK_RAM", ram0);
+
+/* RAM region to be used for data segment.*/
+REGION_ALIAS("DATA_RAM", ram0);
+REGION_ALIAS("DATA_RAM_LMA", flash0);
+
+/* RAM region to be used for BSS segment.*/
+REGION_ALIAS("BSS_RAM", ram0);
+
+/* RAM region to be used for HEAP segment.*/
+REGION_ALIAS("HEAP_RAM", ram0);
+
+INCLUDE rules.ld
diff --git a/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
new file mode 100644
index 0000000..81d53d9
--- /dev/null
+++ b/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
@@ -0,0 +1,10 @@
+# List of the ChibiOS generic NRF51 startup and CMSIS files.
+STARTUPSRC = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt1.c \
+ $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/vectors.c
+
+STARTUPASM = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.s
+
+STARTUPINC = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/devices/NRF51822 \
+ $(CHIBIOS)/os/common/ext/CMSIS/include
+
+STARTUPLD = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld
diff --git a/os/common/ports/ARMCMx/devices/NRF51822/cmparams.h b/os/common/startup/ARMCMx/devices/NRF51822/cmparams.h
index 126acf6..126acf6 100644
--- a/os/common/ports/ARMCMx/devices/NRF51822/cmparams.h
+++ b/os/common/startup/ARMCMx/devices/NRF51822/cmparams.h
diff --git a/os/hal/include/hal_rng.h b/os/hal/include/hal_rng.h
index 4730f7b..0e3c484 100644
--- a/os/hal/include/hal_rng.h
+++ b/os/hal/include/hal_rng.h
@@ -57,7 +57,7 @@ typedef enum {
RNG_READY, /* Ready. */
} rngstate_t;
-#include "rng_lld.h"
+#include "hal_rng_lld.h"
/*===========================================================================*/
diff --git a/os/hal/ports/NRF51/NRF51822/adc_lld.c b/os/hal/ports/NRF51/NRF51822/hal_adc_lld.c
index 7f3413c..7f3413c 100644
--- a/os/hal/ports/NRF51/NRF51822/adc_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_adc_lld.c
diff --git a/os/hal/ports/NRF51/NRF51822/adc_lld.h b/os/hal/ports/NRF51/NRF51822/hal_adc_lld.h
index 52d8e78..36854fb 100644
--- a/os/hal/ports/NRF51/NRF51822/adc_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_adc_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _ADC_LLD_H_
-#define _ADC_LLD_H_
+#ifndef HAL_ADC_LLD_H
+#define HAL_ADC_LLD_H
#if HAL_USE_ADC || defined(__DOXYGEN__)
@@ -224,6 +224,6 @@ extern "C" {
#endif /* HAL_USE_ADC */
-#endif /* _ADC_LLD_H_ */
+#endif /* HAL_ADC_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/ext_lld.c b/os/hal/ports/NRF51/NRF51822/hal_ext_lld.c
index b8ea34b..47736c7 100644
--- a/os/hal/ports/NRF51/NRF51822/ext_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_ext_lld.c
@@ -26,7 +26,7 @@
#if HAL_USE_EXT || defined(__DOXYGEN__)
-#include "ext_lld_isr.h"
+#include "hal_ext_lld_isr.h"
/*===========================================================================*/
/* Driver local definitions. */
diff --git a/os/hal/ports/NRF51/NRF51822/ext_lld.h b/os/hal/ports/NRF51/NRF51822/hal_ext_lld.h
index 11eae69..37ae721 100644
--- a/os/hal/ports/NRF51/NRF51822/ext_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_ext_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _EXT_LLD_H_
-#define _EXT_LLD_H_
+#ifndef HAL_EXT_LLD_H
+#define HAL_EXT_LLD_H
#if HAL_USE_EXT || defined(__DOXYGEN__)
@@ -134,6 +134,6 @@ extern "C" {
#endif /* HAL_USE_EXT */
-#endif /* _EXT_LLD_H_ */
+#endif /* HAL_EXT_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/ext_lld_isr.c b/os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.c
index bdb25da..52f07d6 100644
--- a/os/hal/ports/NRF51/NRF51822/ext_lld_isr.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.c
@@ -26,7 +26,7 @@
#if HAL_USE_EXT || defined(__DOXYGEN__)
-#include "ext_lld_isr.h"
+#include "hal_ext_lld_isr.h"
/*===========================================================================*/
/* Driver local definitions. */
diff --git a/os/hal/ports/NRF51/NRF51822/ext_lld_isr.h b/os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.h
index 5ea8763..736e55c 100644
--- a/os/hal/ports/NRF51/NRF51822/ext_lld_isr.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _EXT_LLD_ISR_H_
-#define _EXT_LLD_ISR_H_
+#ifndef HAL_EXT_LLD_ISR_H
+#define HAL_EXT_LLD_ISR_H
#if HAL_USE_EXT || defined(__DOXYGEN__)
@@ -74,6 +74,6 @@ extern "C" {
#endif /* HAL_USE_EXT */
-#endif /* _EXT_LLD_ISR_H_ */
+#endif /* HAL_EXT_LLD_ISR_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/gpt_lld.c b/os/hal/ports/NRF51/NRF51822/hal_gpt_lld.c
index f39470f..f39470f 100644
--- a/os/hal/ports/NRF51/NRF51822/gpt_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_gpt_lld.c
diff --git a/os/hal/ports/NRF51/NRF51822/gpt_lld.h b/os/hal/ports/NRF51/NRF51822/hal_gpt_lld.h
index 2c84d6c..748be0a 100644
--- a/os/hal/ports/NRF51/NRF51822/gpt_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_gpt_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _GPT_LLD_H_
-#define _GPT_LLD_H_
+#ifndef HAL_GPT_LLD_H
+#define HAL_GPT_LLD_H
#if HAL_USE_GPT || defined(__DOXYGEN__)
@@ -261,6 +261,6 @@ extern "C" {
#endif /* HAL_USE_GPT */
-#endif /* _GPT_LLD_H_ */
+#endif /* HAL_GPT_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/i2c_lld.c b/os/hal/ports/NRF51/NRF51822/hal_i2c_lld.c
index 611a004..611a004 100644
--- a/os/hal/ports/NRF51/NRF51822/i2c_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_i2c_lld.c
diff --git a/os/hal/ports/NRF51/NRF51822/i2c_lld.h b/os/hal/ports/NRF51/NRF51822/hal_i2c_lld.h
index be3ea5b..555ced1 100644
--- a/os/hal/ports/NRF51/NRF51822/i2c_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_i2c_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _I2C_LLD_H_
-#define _I2C_LLD_H_
+#ifndef HAL_I2C_LLD_H
+#define HAL_I2C_LLD_H
#if HAL_USE_I2C || defined(__DOXYGEN__)
@@ -217,6 +217,6 @@ extern "C" {
#endif /* HAL_USE_I2C */
-#endif /* _I2C_LLD_H_ */
+#endif /* HAL_I2C_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/hal_lld.h b/os/hal/ports/NRF51/NRF51822/hal_lld.h
index 283c207..e404020 100644
--- a/os/hal/ports/NRF51/NRF51822/hal_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _HAL_LLD_H_
-#define _HAL_LLD_H_
+#ifndef HAL_LLD_H
+#define HAL_LLD_H
/*===========================================================================*/
/* Driver constants. */
@@ -83,8 +83,8 @@
#include "nvic.h"
-#define NRF51_LFCLK_FREQUENCY 32768
-#define NRF51_HFCLK_FREQUENCY 16000000
+#define NRF51_LFCLK_FREQUENCY 32768
+#define NRF51_HFCLK_FREQUENCY 16000000
#ifdef __cplusplus
extern "C" {
@@ -95,7 +95,7 @@ extern "C" {
}
#endif
-#endif /* _HAL_LLD_H_ */
+#endif /* HAL_LLD_H */
/**
* @}
diff --git a/os/hal/ports/NRF51/NRF51822/pal_lld.c b/os/hal/ports/NRF51/NRF51822/hal_pal_lld.c
index 69fc9fe..69fc9fe 100644
--- a/os/hal/ports/NRF51/NRF51822/pal_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_pal_lld.c
diff --git a/os/hal/ports/NRF51/NRF51822/pal_lld.h b/os/hal/ports/NRF51/NRF51822/hal_pal_lld.h
index d2f0dfb..4425d24 100644
--- a/os/hal/ports/NRF51/NRF51822/pal_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_pal_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _PAL_LLD_H_
-#define _PAL_LLD_H_
+#ifndef HAL_PAL_LLD_H
+#define HAL_PAL_LLD_H
#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__)
@@ -303,6 +303,6 @@ extern "C" {
#endif /* HAL_USE_PAL == TRUE */
-#endif /* _PAL_LLD_H_ */
+#endif /* HAL_PAL_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/rng_lld.c b/os/hal/ports/NRF51/NRF51822/hal_rng_lld.c
index 74bba64..5e501ed 100644
--- a/os/hal/ports/NRF51/NRF51822/rng_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_rng_lld.c
@@ -34,7 +34,7 @@
* @brief RNG default configuration.
*/
static const RNGConfig default_config = {
- .digital_error_correction = 1,
+ .digital_error_correction = 1,
};
/*===========================================================================*/
@@ -119,7 +119,7 @@ void rng_lld_stop(RNGDriver *rngp) {
* @notapi
*/
msg_t rng_lld_write(RNGDriver *rngp, uint8_t *buf, size_t n,
- systime_t timeout) {
+ systime_t timeout) {
size_t i;
for (i = 0 ; i < n ; i++) {
diff --git a/os/hal/ports/NRF51/NRF51822/rng_lld.h b/os/hal/ports/NRF51/NRF51822/hal_rng_lld.h
index 8d4db02..475770b 100644
--- a/os/hal/ports/NRF51/NRF51822/rng_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_rng_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _RNG_LLD_H_
-#define _RNG_LLD_H_
+#ifndef HAL_RNG_LLD_H
+#define HAL_RNG_LLD_H
#if (HAL_USE_RNG == TRUE) || defined(__DOXYGEN__)
@@ -61,7 +61,7 @@
* @brief RNG1 interrupt priority level setting.
*/
#if !defined(NRF51_RNG_RNG1_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define NRF51_RNG_RNG1_IRQ_PRIORITY 10
+#define NRF51_RNG_RNG1_IRQ_PRIORITY 10
#endif
@@ -151,13 +151,13 @@ extern "C" {
void rng_lld_start(RNGDriver *rngp);
void rng_lld_stop(RNGDriver *rngp);
msg_t rng_lld_write(RNGDriver *rngp, uint8_t *buf, size_t n,
- systime_t timeout);
+ systime_t timeout);
#ifdef __cplusplus
}
#endif
#endif /* HAL_USE_RNG */
-#endif /* _RNG_LLD_H_ */
+#endif /* HAL_RNG_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/serial_lld.c b/os/hal/ports/NRF51/NRF51822/hal_serial_lld.c
index 550a070..029c5da 100644
--- a/os/hal/ports/NRF51/NRF51822/serial_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_serial_lld.c
@@ -167,7 +167,7 @@ static void notify1(io_queue_t *qp)
return;
if (!sdp->tx_busy) {
- msg_t b = chOQGetI(&sdp->oqueue);
+ msg_t b = oqGetI(&sdp->oqueue);
if (b < Q_OK) {
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
@@ -199,9 +199,9 @@ OSAL_IRQ_HANDLER(Vector48) {
NRF_UART0->EVENTS_RXDRDY = 0;
osalSysLockFromISR();
- if (chIQIsEmptyI(&sdp->iqueue))
+ if (iqIsEmptyI(&sdp->iqueue))
chnAddFlagsI(sdp, CHN_INPUT_AVAILABLE);
- if (chIQPutI(&sdp->iqueue, NRF_UART0->RXD) < Q_OK)
+ if (iqPutI(&sdp->iqueue, NRF_UART0->RXD) < Q_OK)
chnAddFlagsI(sdp, SD_OVERRUN_ERROR);
osalSysUnlockFromISR();
}
@@ -213,7 +213,7 @@ OSAL_IRQ_HANDLER(Vector48) {
NRF_UART0->EVENTS_TXDRDY = 0;
osalSysLockFromISR();
- b = chOQGetI(&sdp->oqueue);
+ b = oqGetI(&sdp->oqueue);
osalSysUnlockFromISR();
if (b < Q_OK) {
diff --git a/os/hal/ports/NRF51/NRF51822/serial_lld.h b/os/hal/ports/NRF51/NRF51822/hal_serial_lld.h
index 5fc5e87..304c07d 100644
--- a/os/hal/ports/NRF51/NRF51822/serial_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_serial_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _SERIAL_LLD_H_
-#define _SERIAL_LLD_H_
+#ifndef HAL_SERIAL_LLD_H
+#define HAL_SERIAL_LLD_H
#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)
@@ -145,6 +145,6 @@ extern "C" {
#endif /* HAL_USE_SERIAL == TRUE */
-#endif /* _SERIAL_LLD_H_ */
+#endif /* HAL_SERIAL_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/spi_lld.c b/os/hal/ports/NRF51/NRF51822/hal_spi_lld.c
index 7a70c13..7a70c13 100644
--- a/os/hal/ports/NRF51/NRF51822/spi_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_spi_lld.c
diff --git a/os/hal/ports/NRF51/NRF51822/spi_lld.h b/os/hal/ports/NRF51/NRF51822/hal_spi_lld.h
index 4deb4c7..d339a91 100644
--- a/os/hal/ports/NRF51/NRF51822/spi_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_spi_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _SPI_LLD_H_
-#define _SPI_LLD_H_
+#ifndef HAL_SPI_LLD_H
+#define HAL_SPI_LLD_H
#if HAL_USE_SPI || defined(__DOXYGEN__)
@@ -223,6 +223,6 @@ extern "C" {
#endif /* HAL_USE_SPI */
-#endif /* _SPI_LLD_H_ */
+#endif /* HAL_SPI_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/st_lld.c b/os/hal/ports/NRF51/NRF51822/hal_st_lld.c
index f65117b..181bc06 100644
--- a/os/hal/ports/NRF51/NRF51822/st_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_st_lld.c
@@ -65,7 +65,7 @@ OSAL_IRQ_HANDLER(Vector6C) {
OSAL_IRQ_PROLOGUE();
NRF_RTC0->EVENTS_TICK = 0;
-
+
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
@@ -87,7 +87,7 @@ OSAL_IRQ_HANDLER(Vector84) {
OSAL_IRQ_PROLOGUE();
NRF_RTC1->EVENTS_TICK = 0;
-
+
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
@@ -135,20 +135,20 @@ OSAL_IRQ_HANDLER(Vector6C) {
OSAL_IRQ_PROLOGUE();
if (NRF_RTC0->EVENTS_COMPARE[0]) {
- NRF_RTC0->EVENTS_COMPARE[0] = 0;
-
- osalSysLockFromISR();
- osalOsTimerHandlerI();
- osalSysUnlockFromISR();
+ NRF_RTC0->EVENTS_COMPARE[0] = 0;
+
+ osalSysLockFromISR();
+ osalOsTimerHandlerI();
+ osalSysUnlockFromISR();
}
#if OSAL_ST_RESOLUTION == 16
if (NRF_RTC0->EVENTS_COMPARE[1]) {
- NRF_RTC0->EVENTS_COMPARE[1] = 0;
- NRF_RTC0->TASKS_CLEAR = 1;
+ NRF_RTC0->EVENTS_COMPARE[1] = 0;
+ NRF_RTC0->TASKS_CLEAR = 1;
}
#endif
-
+
OSAL_IRQ_EPILOGUE();
}
#endif
@@ -166,20 +166,20 @@ OSAL_IRQ_HANDLER(Vector84) {
OSAL_IRQ_PROLOGUE();
if (NRF_RTC1->EVENTS_COMPARE[0]) {
- NRF_RTC1->EVENTS_COMPARE[0] = 0;
-
- osalSysLockFromISR();
- osalOsTimerHandlerI();
- osalSysUnlockFromISR();
+ NRF_RTC1->EVENTS_COMPARE[0] = 0;
+
+ osalSysLockFromISR();
+ osalOsTimerHandlerI();
+ osalSysUnlockFromISR();
}
#if OSAL_ST_RESOLUTION == 16
if (NRF_RTC1->EVENTS_COMPARE[1]) {
- NRF_RTC1->EVENTS_COMPARE[1] = 0;
- NRF_RTC1->TASKS_CLEAR = 1;
+ NRF_RTC1->EVENTS_COMPARE[1] = 0;
+ NRF_RTC1->TASKS_CLEAR = 1;
}
#endif
-
+
OSAL_IRQ_EPILOGUE();
}
#endif
@@ -211,7 +211,7 @@ void st_lld_init(void) {
NRF_RTC0->INTENSET = RTC_INTENSET_COMPARE1_Msk;
#endif
NRF_RTC0->TASKS_CLEAR = 1;
-
+
/* Start timer */
nvicEnableVector(RTC0_IRQn, NRF51_ST_PRIORITY);
NRF_RTC0->TASKS_START = 1;
@@ -231,8 +231,8 @@ void st_lld_init(void) {
NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE1_Msk;
#endif
NRF_RTC1->TASKS_CLEAR = 1;
-
- /* Start timer */
+
+ /* Start timer */
nvicEnableVector(RTC1_IRQn, NRF51_ST_PRIORITY);
NRF_RTC1->TASKS_START = 1;
#endif /* NRF51_ST_USE_RTC1 == TRUE */
@@ -285,7 +285,7 @@ void st_lld_init(void) {
nvicEnableVector(TIMER0_IRQn, NRF51_ST_PRIORITY);
NRF_TIMER0->TASKS_START = 1;
#endif /* NRF51_ST_USE_TIMER0 == TRUE */
-
+
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC */
}
diff --git a/os/hal/ports/NRF51/NRF51822/st_lld.h b/os/hal/ports/NRF51/NRF51822/hal_st_lld.h
index ab25dbb..bde9950 100644
--- a/os/hal/ports/NRF51/NRF51822/st_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_st_lld.h
@@ -24,8 +24,8 @@
* @{
*/
-#ifndef _ST_LLD_H_
-#define _ST_LLD_H_
+#ifndef HAL_ST_LLD_H
+#define HAL_ST_LLD_H
#include "halconf.h"
@@ -42,9 +42,9 @@
*/
#if !defined(NRF51_ST_USE_RTC0) || defined(__DOXYGEN__)
#if !defined(SOFTDEVICE_PRESENT)
-#define NRF51_ST_USE_RTC0 TRUE
+#define NRF51_ST_USE_RTC0 TRUE
#else
-#define NRF51_ST_USE_RTC0 FALSE
+#define NRF51_ST_USE_RTC0 FALSE
#endif
#endif
@@ -53,9 +53,9 @@
*/
#if !defined(NRF51_ST_USE_RTC1) || defined(__DOXYGEN__)
#if !defined(SOFTDEVICE_PRESENT)
-#define NRF51_ST_USE_RTC1 FALSE
+#define NRF51_ST_USE_RTC1 FALSE
#else
-#define NRF51_ST_USE_RTC1 TRUE
+#define NRF51_ST_USE_RTC1 TRUE
#endif
#endif
@@ -63,7 +63,7 @@
* @brief Use TIMER0 to generates system ticks
*/
#if !defined(NRF51_ST_USE_TIMER0) || defined(__DOXYGEN__)
-#define NRF51_ST_USE_TIMER0 FALSE
+#define NRF51_ST_USE_TIMER0 FALSE
#endif
/**
@@ -92,8 +92,8 @@
#error "One clock source is needed, enable one (RTC0, RTC1, or TIMER0)"
#endif
-#if ((NRF51_ST_USE_RTC0 == TRUE ? 1 : 0) + \
- (NRF51_ST_USE_RTC1 == TRUE ? 1 : 0) + \
+#if ((NRF51_ST_USE_RTC0 == TRUE ? 1 : 0) + \
+ (NRF51_ST_USE_RTC1 == TRUE ? 1 : 0) + \
(NRF51_ST_USE_TIMER0 == TRUE ? 1 : 0)) > 1
#error "Only one clock source can be used (RTC0, RTC1, or TIMER0)"
#endif
@@ -156,10 +156,13 @@ extern "C" {
*/
static inline systime_t st_lld_get_counter(void) {
#if NRF51_ST_USE_RTC0 == TRUE
- return (systime_t)NRF_RTC0->COUNTER;
+ return (systime_t)NRF_RTC0->COUNTER;
#endif
#if NRF51_ST_USE_RTC1 == TRUE
- return (systime_t)NRF_RTC1->COUNTER;
+ return (systime_t)NRF_RTC1->COUNTER;
+#endif
+#if NRF51_ST_USE_TIMER0 == TRUE
+ return (systime_t)0;
#endif
}
@@ -183,6 +186,9 @@ static inline void st_lld_start_alarm(systime_t abstime) {
NRF_RTC1->EVENTS_COMPARE[0] = 0;
NRF_RTC1->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
#endif
+#if NRF51_ST_USE_TIMER0 == TRUE
+ (void)abstime;
+#endif
}
/**
@@ -215,6 +221,9 @@ static inline void st_lld_set_alarm(systime_t abstime) {
#if NRF51_ST_USE_RTC1 == TRUE
NRF_RTC1->CC[0] = abstime;
#endif
+#if NRF51_ST_USE_TIMER0 == TRUE
+ (void)abstime;
+#endif
}
/**
@@ -231,6 +240,9 @@ static inline systime_t st_lld_get_alarm(void) {
#if NRF51_ST_USE_RTC1 == TRUE
return (systime_t)NRF_RTC1->CC[0];
#endif
+#if NRF51_ST_USE_TIMER0 == TRUE
+ return (systime_t)0;
+#endif
}
/**
@@ -249,8 +261,11 @@ static inline bool st_lld_is_alarm_active(void) {
#if NRF51_ST_USE_RTC1 == TRUE
return NRF_RTC1->EVTEN & RTC_EVTEN_COMPARE0_Msk;
#endif
+#if NRF51_ST_USE_TIMER0 == TRUE
+ return false;
+#endif
}
-#endif /* _ST_LLD_H_ */
+#endif /* HAL_ST_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/wdg_lld.c b/os/hal/ports/NRF51/NRF51822/hal_wdg_lld.c
index 0a25ceb..0ce37ee 100644
--- a/os/hal/ports/NRF51/NRF51822/wdg_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_wdg_lld.c
@@ -30,7 +30,7 @@
/* Driver local definitions. */
/*===========================================================================*/
-#define RELOAD_REQUEST_VALUE 0x6E524635
+#define RELOAD_REQUEST_VALUE 0x6E524635
/*===========================================================================*/
/* Driver exported variables. */
@@ -68,7 +68,7 @@ OSAL_IRQ_HANDLER(Vector84) {
/* Notify */
if (WDGD1.config->callback)
WDGD1.config->callback();
-
+
/* Wait for reboot */
while (1) { /* */ }
@@ -104,12 +104,12 @@ void wdg_lld_start(WDGDriver *wdgp) {
#if WDG_USE_TIMEOUT_CALLBACK == TRUE
wdgp->wdt->INTENSET = WDT_INTENSET_TIMEOUT_Msk;
#endif
-
+
/* When to pause? (halt, sleep) */
wdgp->wdt->CONFIG =
(wdgp->config->flags.pause_on_sleep * WDT_CONFIG_SLEEP_Msk) |
(wdgp->config->flags.pause_on_halt * WDT_CONFIG_HALT_Msk );
-
+
/* Timeout in milli-seconds */
uint64_t tout = (NRF51_LFCLK_FREQUENCY * wdgp->config->timeout_ms / 1000) - 1;
osalDbgAssert(tout <= 0xFFFFFFFF, "watchdog timout value exceeded");
diff --git a/os/hal/ports/NRF51/NRF51822/wdg_lld.h b/os/hal/ports/NRF51/NRF51822/hal_wdg_lld.h
index 581c25b..8fea304 100644
--- a/os/hal/ports/NRF51/NRF51822/wdg_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_wdg_lld.h
@@ -22,8 +22,8 @@
* @{
*/
-#ifndef _WDG_LLD_H_
-#define _WDG_LLD_H_
+#ifndef HAL_WDG_LLD_H
+#define HAL_WDG_LLD_H
#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
@@ -31,7 +31,7 @@
/* Driver constants. */
/*===========================================================================*/
-#define WDG_MAX_TIMEOUT_MS \
+#define WDG_MAX_TIMEOUT_MS \
((uint32_t)(0xFFFFFFFFu * 1000 / NRF51_LFCLK_FREQUENCY))
/*===========================================================================*/
@@ -71,13 +71,13 @@ typedef struct WDGDriver WDGDriver;
* @note It could be empty on some architectures.
*/
typedef struct {
- struct {
- uint8_t pause_on_sleep : 1;
- uint8_t pause_on_halt : 1;
- } flags;
- uint32_t timeout_ms;
+ struct {
+ uint8_t pause_on_sleep : 1;
+ uint8_t pause_on_halt : 1;
+ } flags;
+ uint32_t timeout_ms;
#if WDG_USE_TIMEOUT_CALLBACK == TRUE
- void (*callback)(void);
+ void (*callback)(void);
#endif
} WDGConfig;
@@ -122,6 +122,6 @@ extern "C" {
#endif /* HAL_USE_WDG == TRUE */
-#endif /* _WDG_LLD_H_ */
+#endif /* HAL_WDG_LLD_H */
/** @} */
diff --git a/os/hal/ports/NRF51/NRF51822/platform.mk b/os/hal/ports/NRF51/NRF51822/platform.mk
index f14d7cf..fbe977e 100644
--- a/os/hal/ports/NRF51/NRF51822/platform.mk
+++ b/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -4,50 +4,50 @@ HALCONF := $(strip $(shell cat halconf.h halconf_community.h 2>/dev/null | egrep
# List of all the NRF51x platform files.
PLATFORMSRC = ${CHIBIOS}/os/hal/ports/common/ARMCMx/nvic.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/st_lld.c
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_st_lld.c
ifneq ($(findstring HAL_USE_PAL TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/pal_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_pal_lld.c
endif
ifneq ($(findstring HAL_USE_SERIAL TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/serial_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_serial_lld.c
endif
ifneq ($(findstring HAL_USE_SPI TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/spi_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_spi_lld.c
endif
ifneq ($(findstring HAL_USE_EXT TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/ext_lld_isr.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/ext_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_ext_lld.c
endif
ifneq ($(findstring HAL_USE_I2C TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/i2c_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_i2c_lld.c
endif
ifneq ($(findstring HAL_USE_ADC TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/adc_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_adc_lld.c
endif
ifneq ($(findstring HAL_USE_GPT TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/gpt_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_gpt_lld.c
endif
ifneq ($(findstring HAL_USE_WDG TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/wdg_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_wdg_lld.c
endif
ifneq ($(findstring HAL_USE_RNG TRUE,$(HALCONF)),)
-PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/rng_lld.c
+PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_rng_lld.c
endif
else
PLATFORMSRC = ${CHIBIOS}/os/hal/ports/common/ARMCMx/nvic.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/pal_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/serial_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/st_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/spi_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/ext_lld_isr.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/ext_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/i2c_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/adc_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/gpt_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/wdg_lld.c \
- ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/rng_lld.c
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_pal_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_serial_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_st_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_spi_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_ext_lld_isr.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_ext_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_i2c_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_adc_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_gpt_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_wdg_lld.c \
+ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF51/NRF51822/hal_rng_lld.c
endif
# Required include directories
diff --git a/testhal/NRF51/NRF51822/ADC/Makefile b/testhal/NRF51/NRF51822/ADC/Makefile
index ec06536..69d6e90 100644
--- a/testhal/NRF51/NRF51822/ADC/Makefile
+++ b/testhal/NRF51/NRF51822/ADC/Makefile
@@ -84,7 +84,7 @@ PROJECT = ch
CHIBIOS = ../../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -92,7 +92,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@@ -207,5 +207,5 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
diff --git a/testhal/NRF51/NRF51822/ADC/chconf.h b/testhal/NRF51/NRF51822/ADC/chconf.h
index 5b0630c..71b3bb4 100644
--- a/testhal/NRF51/NRF51822/ADC/chconf.h
+++ b/testhal/NRF51/NRF51822/ADC/chconf.h
@@ -28,6 +28,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -445,6 +447,20 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
@@ -488,6 +504,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/ADC/halconf.h b/testhal/NRF51/NRF51822/ADC/halconf.h
index c7ab1cd..dc055de 100644
--- a/testhal/NRF51/NRF51822/ADC/halconf.h
+++ b/testhal/NRF51/NRF51822/ADC/halconf.h
@@ -163,6 +163,13 @@
#define HAL_USE_USB FALSE
#endif
+/**
+ * @brief Enables the WDG subsystem.
+ */
+#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
+#define HAL_USE_WDG FALSE
+#endif
+
/*===========================================================================*/
/* ADC driver related settings. */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/EXT/Makefile b/testhal/NRF51/NRF51822/EXT/Makefile
index 9770772..564444d 100644
--- a/testhal/NRF51/NRF51822/EXT/Makefile
+++ b/testhal/NRF51/NRF51822/EXT/Makefile
@@ -83,7 +83,7 @@ PROJECT = ch
CHIBIOS = ../../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@@ -207,5 +207,5 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
diff --git a/testhal/NRF51/NRF51822/EXT/chconf.h b/testhal/NRF51/NRF51822/EXT/chconf.h
index c049f5c..50218e4 100644
--- a/testhal/NRF51/NRF51822/EXT/chconf.h
+++ b/testhal/NRF51/NRF51822/EXT/chconf.h
@@ -28,6 +28,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -445,6 +447,20 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
@@ -488,6 +504,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/GPT/Makefile b/testhal/NRF51/NRF51822/GPT/Makefile
index ec06536..69d6e90 100644
--- a/testhal/NRF51/NRF51822/GPT/Makefile
+++ b/testhal/NRF51/NRF51822/GPT/Makefile
@@ -84,7 +84,7 @@ PROJECT = ch
CHIBIOS = ../../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -92,7 +92,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@@ -207,5 +207,5 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
diff --git a/testhal/NRF51/NRF51822/GPT/chconf.h b/testhal/NRF51/NRF51822/GPT/chconf.h
index 5b0630c..71b3bb4 100644
--- a/testhal/NRF51/NRF51822/GPT/chconf.h
+++ b/testhal/NRF51/NRF51822/GPT/chconf.h
@@ -28,6 +28,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -445,6 +447,20 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
@@ -488,6 +504,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/GPT/halconf.h b/testhal/NRF51/NRF51822/GPT/halconf.h
index bf63566..6ea7ca6 100644
--- a/testhal/NRF51/NRF51822/GPT/halconf.h
+++ b/testhal/NRF51/NRF51822/GPT/halconf.h
@@ -163,6 +163,13 @@
#define HAL_USE_USB FALSE
#endif
+/**
+ * @brief Enables the WDG subsystem.
+ */
+#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
+#define HAL_USE_WDG FALSE
+#endif
+
/*===========================================================================*/
/* ADC driver related settings. */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/I2C/Makefile b/testhal/NRF51/NRF51822/I2C/Makefile
index 7615230..29a66d7 100644
--- a/testhal/NRF51/NRF51822/I2C/Makefile
+++ b/testhal/NRF51/NRF51822/I2C/Makefile
@@ -83,7 +83,7 @@ PROJECT = ch
CHIBIOS = ../../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@@ -207,5 +207,5 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
diff --git a/testhal/NRF51/NRF51822/I2C/chconf.h b/testhal/NRF51/NRF51822/I2C/chconf.h
index 9466257..3d441c6 100644
--- a/testhal/NRF51/NRF51822/I2C/chconf.h
+++ b/testhal/NRF51/NRF51822/I2C/chconf.h
@@ -28,6 +28,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -445,6 +447,20 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
@@ -488,6 +504,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/SPI/Makefile b/testhal/NRF51/NRF51822/SPI/Makefile
index e918159..92070b1 100644
--- a/testhal/NRF51/NRF51822/SPI/Makefile
+++ b/testhal/NRF51/NRF51822/SPI/Makefile
@@ -83,7 +83,7 @@ PROJECT = ch
CHIBIOS = ../../../../../ChibiOS-RT
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -91,7 +91,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/WVSHARE_BLE400/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
@@ -207,5 +207,5 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
diff --git a/testhal/NRF51/NRF51822/SPI/chconf.h b/testhal/NRF51/NRF51822/SPI/chconf.h
index 36ba803..f777f9d 100644
--- a/testhal/NRF51/NRF51822/SPI/chconf.h
+++ b/testhal/NRF51/NRF51822/SPI/chconf.h
@@ -28,6 +28,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -445,6 +447,20 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
@@ -488,6 +504,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/WDG/Makefile b/testhal/NRF51/NRF51822/WDG/Makefile
index a2df0bf..c316b35 100644
--- a/testhal/NRF51/NRF51822/WDG/Makefile
+++ b/testhal/NRF51/NRF51822/WDG/Makefile
@@ -81,13 +81,10 @@ endif
PROJECT = ch
# Imported source files and paths
-#CHIBIOS = ../../../../../ChibiOS-RT
-#CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
-CHIBIOS = /home/sdalu/ChibiOS/ChibiOS
-CHIBIOS_CONTRIB = /home/sdalu/ChibiOS/Y/ChibiOS-Contrib
-
+CHIBIOS = ../../../../../ChibiOS-RT
+CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Startup files.
-include $(CHIBIOS_CONTRIB)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
+include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_nrf51.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/NRF51/NRF51822/platform.mk
@@ -95,8 +92,7 @@ include $(CHIBIOS_CONTRIB)/os/hal/boards/NRF51-DK/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
-
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/NRF51822.ld
@@ -209,18 +205,16 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
-
# Flash
JLINK_DEVICE = nrf51422
JLINK_PRE_FLASH = w4 4001e504 1
JLINK_ERASE_ALL = w4 4001e504 2\nw4 4001e50c 1\nsleep 100
-
-include /home/sdalu/ChibiOS/W/ChibiOS-Contrib/os/various/jlink.mk
-include /home/sdalu/ChibiOS/W/ChibiOS-Contrib/os/various/gdb.mk
+include $(CHIBIOS_CONTRIB)/os/various/jlink.mk
+include $(CHIBIOS_CONTRIB)/os/various/gdb.mk
flash: all jlink-flash
debug: gdb-debug
diff --git a/testhal/NRF51/NRF51822/WDG/chconf.h b/testhal/NRF51/NRF51822/WDG/chconf.h
index 20d7b4b..4477bd5 100644
--- a/testhal/NRF51/NRF51822/WDG/chconf.h
+++ b/testhal/NRF51/NRF51822/WDG/chconf.h
@@ -28,6 +28,8 @@
#ifndef _CHCONF_H_
#define _CHCONF_H_
+#define _CHIBIOS_RT_CONF_
+
/*===========================================================================*/
/**
* @name System timers settings
@@ -445,6 +447,20 @@
}
/**
+ * @brief ISR enter hook.
+ */
+#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
+ /* IRQ prologue code here.*/ \
+}
+
+/**
+ * @brief ISR exit hook.
+ */
+#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
+ /* IRQ epilogue code here.*/ \
+}
+
+/**
* @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here.
@@ -488,6 +504,15 @@
/* System halt code here.*/ \
}
+/**
+ * @brief Trace hook.
+ * @details This hook is invoked each time a new record is written in the
+ * trace buffer.
+ */
+#define CH_CFG_TRACE_HOOK(tep) { \
+ /* Trace code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/testhal/NRF51/NRF51822/WDG/halconf.h b/testhal/NRF51/NRF51822/WDG/halconf.h
index 90cd842..a1c53f2 100644
--- a/testhal/NRF51/NRF51822/WDG/halconf.h
+++ b/testhal/NRF51/NRF51822/WDG/halconf.h
@@ -30,11 +30,6 @@
#include "mcuconf.h"
-#define HAL_USE_PAL TRUE
-#define HAL_USE_WDG TRUE
-#define WDG_USE_TIMEOUT_CALLBACK TRUE
-
-
/**
* @brief Enables the PAL subsystem.
*/
@@ -137,7 +132,7 @@
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL TRUE
+#define HAL_USE_SERIAL FALSE
#endif
/**
@@ -168,6 +163,178 @@
#define HAL_USE_USB FALSE
#endif
+/**
+ * @brief Enables the WDG subsystem.
+ */
+#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
+#define HAL_USE_WDG TRUE
+#endif
+
+/*===========================================================================*/
+/* ADC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
+#define ADC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define ADC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* CAN driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Sleep mode related APIs inclusion switch.
+ */
+#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
+#define CAN_USE_SLEEP_MODE TRUE
+#endif
+
+/*===========================================================================*/
+/* I2C driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables the mutual exclusion APIs on the I2C bus.
+ */
+#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define I2C_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
+/* MAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables an event sources for incoming packets.
+ */
+#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
+#define MAC_USE_ZERO_COPY FALSE
+#endif
+
+/**
+ * @brief Enables an event sources for incoming packets.
+ */
+#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
+#define MAC_USE_EVENTS TRUE
+#endif
+
+/*===========================================================================*/
+/* MMC_SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Delays insertions.
+ * @details If enabled this options inserts delays into the MMC waiting
+ * routines releasing some extra CPU time for the threads with
+ * lower priority, this may slow down the driver a bit however.
+ * This option is recommended also if the SPI driver does not
+ * use a DMA channel and heavily loads the CPU.
+ */
+#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
+#define MMC_NICE_WAITING TRUE
+#endif
+
+/*===========================================================================*/
+/* SDC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Number of initialization attempts before rejecting the card.
+ * @note Attempts are performed at 10mS intervals.
+ */
+#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
+#define SDC_INIT_RETRY 100
+#endif
+
+/**
+ * @brief Include support for MMC cards.
+ * @note MMC support is not yet implemented so this option must be kept
+ * at @p FALSE.
+ */
+#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
+#define SDC_MMC_SUPPORT FALSE
+#endif
+
+/**
+ * @brief Delays insertions.
+ * @details If enabled this options inserts delays into the MMC waiting
+ * routines releasing some extra CPU time for the threads with
+ * lower priority, this may slow down the driver a bit however.
+ */
+#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
+#define SDC_NICE_WAITING TRUE
+#endif
+
+/*===========================================================================*/
+/* SERIAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SERIAL_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Serial buffers size.
+ * @details Configuration parameter, you can change the depth of the queue
+ * buffers depending on the requirements of your application.
+ * @note The default is 64 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_BUFFERS_SIZE 16
+#endif
+
+/*===========================================================================*/
+/* SERIAL_USB driver related setting. */
+/*===========================================================================*/
+
+/**
+ * @brief Serial over USB buffers size.
+ * @details Configuration parameter, the buffer size must be a multiple of
+ * the USB data endpoint maximum packet size.
+ * @note The default is 64 bytes for both the transmission and receive
+ * buffers.
+ */
+#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
+#define SERIAL_USB_BUFFERS_SIZE 256
+#endif
+
+/*===========================================================================*/
+/* SPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
+#define SPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define SPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
#endif /* _HALCONF_H_ */
diff --git a/testhal/NRF51/NRF51822/WDG/main.c b/testhal/NRF51/NRF51822/WDG/main.c
index 741d84f..cdbf89b 100644
--- a/testhal/NRF51/NRF51822/WDG/main.c
+++ b/testhal/NRF51/NRF51822/WDG/main.c
@@ -16,12 +16,10 @@
#include "ch.h"
#include "hal.h"
-
-
void timeout_callback(void) {
- palTogglePad(IOPORT1, LED2);
- palTogglePad(IOPORT1, LED3);
- palTogglePad(IOPORT1, LED4);
+ palTogglePad(IOPORT1, LED2);
+ palTogglePad(IOPORT1, LED3);
+ palTogglePad(IOPORT1, LED4);
}
/*
@@ -39,27 +37,24 @@ int main(void) {
halInit();
chSysInit();
-
palSetPad(IOPORT1, LED1);
WDGConfig WDG_config = {
- .flags.pause_on_sleep = 0,
- .flags.pause_on_halt = 0,
- .timeout_ms = 5000,
- .callback = timeout_callback
+ .flags.pause_on_sleep = 0,
+ .flags.pause_on_halt = 0,
+ .timeout_ms = 5000,
+ .callback = timeout_callback
};
wdgStart(&WDGD1, &WDG_config);
-
-
/*
* Normal main() thread activity, in this demo it does nothing.
*/
while (true) {
if (palReadPad(IOPORT1, BTN1) == 0) {
- palTogglePad(IOPORT1, LED1);
- wdgReset(&WDGD1);
+ palTogglePad(IOPORT1, LED1);
+ wdgReset(&WDGD1);
}
chThdSleepMilliseconds(500);
}
diff --git a/testhal/NRF51/NRF51822/WDG/mcuconf.h b/testhal/NRF51/NRF51822/WDG/mcuconf.h
index fb3c717..b891a13 100644
--- a/testhal/NRF51/NRF51822/WDG/mcuconf.h
+++ b/testhal/NRF51/NRF51822/WDG/mcuconf.h
@@ -17,5 +17,6 @@
#ifndef _MCUCONF_H_
#define _MCUCONF_H_
+#define WDG_USE_TIMEOUT_CALLBACK TRUE
#endif /* _MCUCONF_H_ */