diff options
Diffstat (limited to 'os/hal/ports/NRF51')
-rw-r--r-- | os/hal/ports/NRF51/NRF51822/rng_lld.c | 11 | ||||
-rw-r--r-- | os/hal/ports/NRF51/NRF51822/rng_lld.h | 17 |
2 files changed, 3 insertions, 25 deletions
diff --git a/os/hal/ports/NRF51/NRF51822/rng_lld.c b/os/hal/ports/NRF51/NRF51822/rng_lld.c index b22b9fc..12a75e7 100644 --- a/os/hal/ports/NRF51/NRF51822/rng_lld.c +++ b/os/hal/ports/NRF51/NRF51822/rng_lld.c @@ -124,19 +124,12 @@ msg_t rng_lld_write(RNGDriver *rngp, uint8_t *buf, size_t n, if (n == 0) return MSG_OK; - if (n == 1) - rngp->rng->SHORTS |= RNG_SHORTS_VALRDY_STOP_Msk; + NRF_RNG->EVENTS_VALRDY = 0; - - - NRF_RNG->EVENTS_VALRDY = 0; - for (i = 0 ; i < n ; i++) { - /* sleep until number is generated */ + /* wait for next byte */ while (NRF_RNG->EVENTS_VALRDY == 0) { - /* enable wake up on events for __WFE CPU sleep */ SCB->SCR |= SCB_SCR_SEVONPEND_Msk; - /* sleep until next event */ __SEV(); __WFE(); __WFE(); diff --git a/os/hal/ports/NRF51/NRF51822/rng_lld.h b/os/hal/ports/NRF51/NRF51822/rng_lld.h index a586ad4..8d4db02 100644 --- a/os/hal/ports/NRF51/NRF51822/rng_lld.h +++ b/os/hal/ports/NRF51/NRF51822/rng_lld.h @@ -27,19 +27,6 @@ #if (HAL_USE_RNG == TRUE) || defined(__DOXYGEN__) -/* - * This error check must occur outsite of RNGSW_USE_RNG1 to check if - * two LLD drivers are enabled at the same time - */ -#if (NRF51_RNG_USE_RNG1 == TRUE) && (RNGSW_USE_RNG1 == TRUE) -#error "Software RNG can't be enable with NRF51_RNG_USE_RNG1" -#endif - -/** - * Allow RNG Software override. - */ -#if RNGSW_USE_RNG1 != TRUE - /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ @@ -74,7 +61,7 @@ * @brief RNG1 interrupt priority level setting. */ #if !defined(NRF51_RNG_RNG1_IRQ_PRIORITY) || defined(__DOXYGEN__) -#define NRF51_RNG_RNG1_IRQ_PRIORITY 8 +#define NRF51_RNG_RNG1_IRQ_PRIORITY 10 #endif @@ -169,8 +156,6 @@ extern "C" { } #endif -#endif /* RNGSW_USE_RNG1 */ - #endif /* HAL_USE_RNG */ #endif /* _RNG_LLD_H_ */ |