aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/NRF51/NRF51822/rng_lld.c
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-02-09 00:55:35 +0100
committerStephane D'Alu <sdalu@sdalu.com>2016-02-09 00:55:35 +0100
commitd27b4471063fa4ad1e4d1717ff0c88346b43ec21 (patch)
treec9a7aee1714d988a5fd3d3a5049a399ef0ce0e96 /os/hal/ports/NRF51/NRF51822/rng_lld.c
parentd9a3d8493cf1df85a7690737755e295de80e8578 (diff)
downloadChibiOS-Contrib-d27b4471063fa4ad1e4d1717ff0c88346b43ec21.tar.gz
ChibiOS-Contrib-d27b4471063fa4ad1e4d1717ff0c88346b43ec21.tar.bz2
ChibiOS-Contrib-d27b4471063fa4ad1e4d1717ff0c88346b43ec21.zip
cleanup
Diffstat (limited to 'os/hal/ports/NRF51/NRF51822/rng_lld.c')
-rw-r--r--os/hal/ports/NRF51/NRF51822/rng_lld.c11
1 files changed, 2 insertions, 9 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();