aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
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 /os/hal
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
Diffstat (limited to 'os/hal')
-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
25 files changed, 128 insertions, 113 deletions
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