aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-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
30 files changed, 222 insertions, 174 deletions
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