ADuCM302x Device Drivers API Reference Manual
Release 3.1.2.0
|
Modules | |
RNG Driver Configuration | |
Macros | |
#define | ADI_RNG_MEMORY_SIZE (12u) |
Typedefs | |
typedef void * | ADI_RNG_HANDLE |
Functions | |
ADI_RNG_RESULT | adi_rng_Open (uint32_t const nDeviceNum, void *const pMemory, uint32_t const MemorySize, ADI_RNG_HANDLE *const phDevice) |
Opena a Random Number Generator Device. More... | |
ADI_RNG_RESULT | adi_rng_Close (ADI_RNG_HANDLE hDevice) |
Uninitializes and deallocates the RNG device. More... | |
ADI_RNG_RESULT | adi_rng_Enable (ADI_RNG_HANDLE const hDevice, bool const bFlag) |
Enables/Disables the RNG device. More... | |
ADI_RNG_RESULT | adi_rng_EnableBuffering (ADI_RNG_HANDLE const hDevice, bool const bFlag) |
Enables/Disables Buffering for RNG. More... | |
ADI_RNG_RESULT | adi_rng_SetSampleLen (ADI_RNG_HANDLE const hDevice, uint16_t const nLenPrescaler, uint16_t const nLenReload) |
Sets the reload and prescale value for the sample counter. The Sample Length will be nLenReload*2^nLenPrescaler. More... | |
ADI_RNG_RESULT | adi_rng_GetRdyStatus (ADI_RNG_HANDLE const hDevice, bool *const pbFlag) |
Retrieves the current state of RNG data/CRC accumulator register. More... | |
ADI_RNG_RESULT | adi_rng_GetStuckStatus (ADI_RNG_HANDLE const hDevice, bool *const pbFlag) |
Retrieve whether the RNG oscillator output is stuck at a constant value. More... | |
ADI_RNG_RESULT | adi_rng_GetRngData (ADI_RNG_HANDLE const hDevice, uint32_t *const pRegData) |
Retrieve the current value of the RNG data register. More... | |
ADI_RNG_RESULT | adi_rng_GetOscCount (ADI_RNG_HANDLE const hDevice, uint32_t *const pOscCount) |
Retrieve the current RNG Oscillator count. More... | |
ADI_RNG_RESULT | adi_rng_GetOscDiff (ADI_RNG_HANDLE const hDevice, uint32_t const nIndex, uint8_t *const pOscDiff) |
Retrieve the current RNG Oscillator difference value for the given index. More... | |
ADI_RNG_RESULT | adi_rng_RegisterCallback (ADI_RNG_HANDLE hDevice, ADI_CALLBACK cbFunc, void *pCBParam) |
RNG Application callback registration API. More... | |
ADI_RNG_RESULT | adi_rng_GetSampleLen (ADI_RNG_HANDLE const hDevice, uint16_t *const pLenPrescaler, uint16_t *const pLenReload) |
Retrieve the current RNG sample length prescale and reload value configured in the device. More... | |
Random Number Generator Driver
#define ADI_RNG_MEMORY_SIZE (12u) |
The amount of application supplied memory required by the RNG driver
Definition at line 104 of file adi_rng.h.
Referenced by adi_rng_Open().
typedef void* ADI_RNG_HANDLE |
enum ADI_RNG_RESULT |
Random Number Generator API return codes
enum ADI_RNG_EVENT |
ADI_RNG_RESULT adi_rng_Open | ( | uint32_t const | nDeviceNum, |
void *const | pMemory, | ||
uint32_t const | MemorySize, | ||
ADI_RNG_HANDLE *const | phDevice | ||
) |
Opena a Random Number Generator Device.
[in] | nDeviceNum | Device number to be opened. |
[in] | pMemory | Pointer to the memory to be used by the driver. Size of the memory should be at least ADI_RNG_MEMORY_SIZE bytes. |
[in] | MemorySize | Size of the memory passed in pMemory parameter. |
[out] | phDevice | Pointer to a location in the calling function memory space to which the device handle will be written upon successful driver initialization. |
Initialize and allocate a RNG device for other use. The core NVIC RNG interrupt is enabled. This API must preceed all other RNG API calls and the handle returned must be passed to all other RNG API calls.
ADI_RNG_RESULT adi_rng_Close | ( | ADI_RNG_HANDLE | hDevice | ) |
Uninitializes and deallocates the RNG device.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
Uninitialize and release an allocated RNG device for other use. The core NVIC RNG interrupt is disabled.
ADI_RNG_RESULT adi_rng_Enable | ( | ADI_RNG_HANDLE const | hDevice, |
bool const | bFlag | ||
) |
Enables/Disables the RNG device.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[in] | bFlag | Flag to specify whether to enable or disable RNG device. |
ADI_RNG_RESULT adi_rng_EnableBuffering | ( | ADI_RNG_HANDLE const | hDevice, |
bool const | bFlag | ||
) |
Enables/Disables Buffering for RNG.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[in] | bFlag | Flag to specify whether to enable or disable buffering for RNG device. When buffering is enabled, adi_rng_GetRngData returns 32-bit values. When buffering is disabled the API returns 8-bit values. |
ADI_RNG_RESULT adi_rng_SetSampleLen | ( | ADI_RNG_HANDLE const | hDevice, |
uint16_t const | nLenPrescaler, | ||
uint16_t const | nLenReload | ||
) |
Sets the reload and prescale value for the sample counter. The Sample Length will be nLenReload*2^nLenPrescaler.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[in] | nLenPrescaler | Prescaler value for the sample counter (0-10). |
[in] | nLenReload | Reload value for the sample counter (0-4095) |
ADI_RNG_RESULT adi_rng_GetRdyStatus | ( | ADI_RNG_HANDLE const | hDevice, |
bool *const | pbFlag | ||
) |
Retrieves the current state of RNG data/CRC accumulator register.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[out] | pbFlag | Pointer to an application-defined boolean variable into which to write the result:
|
Retrieve the current state of RNG data/CRC accumulator register. The register holds the final entropy value accumulated by RNG and it should to read only when the data is ready.
ADI_RNG_RESULT adi_rng_GetStuckStatus | ( | ADI_RNG_HANDLE const | hDevice, |
bool *const | pbFlag | ||
) |
Retrieve whether the RNG oscillator output is stuck at a constant value.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[out] | pbFlag | Pointer to an application-defined boolean variable into which to write the result:
|
ADI_RNG_RESULT adi_rng_GetRngData | ( | ADI_RNG_HANDLE const | hDevice, |
uint32_t *const | pRegData | ||
) |
Retrieve the current value of the RNG data register.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[in] | pRegData | Pointer to an application-defined variable into which to write the result. Only lower 8-bit is valid if buffering is not enabled |
Retrieve the current value of RNG data register. If the buffering is enabled all 32-bit of value written to pRegData is valid else only the lower 8-bit is valid.
ADI_RNG_RESULT adi_rng_GetOscCount | ( | ADI_RNG_HANDLE const | hDevice, |
uint32_t *const | pOscCount | ||
) |
Retrieve the current RNG Oscillator count.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[in] | pOscCount | Pointer to an application-defined variable into which to write the result. |
ADI_RNG_RESULT adi_rng_GetOscDiff | ( | ADI_RNG_HANDLE const | hDevice, |
uint32_t const | nIndex, | ||
uint8_t *const | pOscDiff | ||
) |
Retrieve the current RNG Oscillator difference value for the given index.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[in] | nIndex | Index of the difference register. |
[out] | pOscDiff | Pointer to an application-defined variable into which to write the oscillator difference value for the given index. |
ADI_RNG_RESULT adi_rng_RegisterCallback | ( | ADI_RNG_HANDLE | hDevice, |
ADI_CALLBACK | cbFunc, | ||
void * | pCBParam | ||
) |
RNG Application callback registration API.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[in] | cbFunc | Application callback address; the function to call on the interrupt. |
[in] | pCBParam | Application handle to be passed in the call back. |
Registers an application-defined callback cbFunc function address of type ADI_CALLBACK with the RNG device driver. Callbacks are made in response to received RNG interrupts.
The callback to the application is made in context of the originating interrupt (i.e., the RNG driver's RNG interrupt handler that is registered in the system's interrupt vector table). Extended processing during the callback (an extension of the RNG's interrupt handler) is discouraged so as to avoid lower-priority interrupt blocking. Also, any register read-modify-write operations should be protected using the ADI_ENTER_CRITICAL_REGION()/ADI_EXIT_CRITICAL_REGION() pair to prevent higher-priority interrupts from modifying said register during the read-modify-write operation.
ADI_RNG_RESULT adi_rng_GetSampleLen | ( | ADI_RNG_HANDLE const | hDevice, |
uint16_t *const | pLenPrescaler, | ||
uint16_t *const | pLenReload | ||
) |
Retrieve the current RNG sample length prescale and reload value configured in the device.
[in] | hDevice | Device handle obtained from adi_rng_Open(). |
[out] | pLenPrescaler | Pointer to an application-defined variable into which the prescaler value is written. |
[out] | pLenReload | Pointer to an application-defined variable into which the reload value for the sample counter is written. |