cleanup
This commit is contained in:
parent
d9a3d8493c
commit
d27b447106
|
@ -44,10 +44,6 @@
|
||||||
/* Derived constants and error checks. */
|
/* Derived constants and error checks. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if NRF51_RNG_USE_RNG1 != TRUE && RNGSW_USE_RNG1 != TRUE
|
|
||||||
#error "RNG requires at least one LLD driver."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver data structures and types. */
|
/* Driver data structures and types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -62,7 +58,6 @@ typedef enum {
|
||||||
} rngstate_t;
|
} rngstate_t;
|
||||||
|
|
||||||
#include "rng_lld.h"
|
#include "rng_lld.h"
|
||||||
//#include "rngsw.h" /* Include software LL driver */
|
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
@ -124,19 +124,12 @@ msg_t rng_lld_write(RNGDriver *rngp, uint8_t *buf, size_t n,
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return MSG_OK;
|
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++) {
|
for (i = 0 ; i < n ; i++) {
|
||||||
/* sleep until number is generated */
|
/* wait for next byte */
|
||||||
while (NRF_RNG->EVENTS_VALRDY == 0) {
|
while (NRF_RNG->EVENTS_VALRDY == 0) {
|
||||||
/* enable wake up on events for __WFE CPU sleep */
|
|
||||||
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
|
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
|
||||||
/* sleep until next event */
|
|
||||||
__SEV();
|
__SEV();
|
||||||
__WFE();
|
__WFE();
|
||||||
__WFE();
|
__WFE();
|
||||||
|
|
|
@ -27,19 +27,6 @@
|
||||||
|
|
||||||
#if (HAL_USE_RNG == TRUE) || defined(__DOXYGEN__)
|
#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. */
|
/* Driver constants. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -74,7 +61,7 @@
|
||||||
* @brief RNG1 interrupt priority level setting.
|
* @brief RNG1 interrupt priority level setting.
|
||||||
*/
|
*/
|
||||||
#if !defined(NRF51_RNG_RNG1_IRQ_PRIORITY) || defined(__DOXYGEN__)
|
#if !defined(NRF51_RNG_RNG1_IRQ_PRIORITY) || defined(__DOXYGEN__)
|
||||||
#define NRF51_RNG_RNG1_IRQ_PRIORITY 8
|
#define NRF51_RNG_RNG1_IRQ_PRIORITY 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,8 +156,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* RNGSW_USE_RNG1 */
|
|
||||||
|
|
||||||
#endif /* HAL_USE_RNG */
|
#endif /* HAL_USE_RNG */
|
||||||
|
|
||||||
#endif /* _RNG_LLD_H_ */
|
#endif /* _RNG_LLD_H_ */
|
||||||
|
|
|
@ -109,14 +109,13 @@ void rngStop(RNGDriver *rngp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs a RNG calculation.
|
* @brief Write random bytes
|
||||||
* @details This synchronous function performs a rng calculation operation.
|
* @details Write the request number of bytes..
|
||||||
* @pre In order to use this function the driver must have been configured
|
|
||||||
* without callbacks (@p end_cb = @p NULL).
|
|
||||||
*
|
*
|
||||||
* @param[in] rngp pointer to the @p RNGDriver object
|
* @param[in] rngp pointer to the @p RNGDriver object
|
||||||
* @param[in] n number of bytes to send
|
|
||||||
* @param[in] buf the pointer to the buffer
|
* @param[in] buf the pointer to the buffer
|
||||||
|
* @param[in] n number of bytes to send
|
||||||
|
* @param[in] timeout timeout value
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
@ -129,15 +128,13 @@ msg_t rngWrite(RNGDriver *rngp, uint8_t *buf, size_t n, systime_t timeout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs a RNG calculation.
|
* @brief Write random bytes
|
||||||
* @details This synchronous function performs a rng calcuation operation.
|
* @details Write the request number of bytes..
|
||||||
* @pre In order to use this function the driver must have been configured
|
|
||||||
* without callbacks (@p end_cb = @p NULL).
|
|
||||||
* @post At the end of the operation the configured callback is invoked.
|
|
||||||
*
|
*
|
||||||
* @param[in] rngp pointer to the @p RNGDriver object
|
* @param[in] rngp pointer to the @p RNGDriver object
|
||||||
* @param[in] n number of bytes to send
|
|
||||||
* @param[in] buf the pointer to the buffer
|
* @param[in] buf the pointer to the buffer
|
||||||
|
* @param[in] n number of bytes to send
|
||||||
|
* @param[in] timeout timeout value
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue