ESOS32
ESOSOn32-bitProcessors
Files | Functions | Variables
ESOS32_Utility_Functions

Files

file  esos_utils.h
 
file  esos_hwxxx_utils.h
 This file contains routines which configure and use hardware-version of the ESOS utility functions.
 
file  esos_stm32l4_utils.h
 This file contains routines which configure and use hardware-version of the ESOS32 utility functions.
 
file  esos_stm32l4_utils.h
 This file contains routines which configure and use hardware-version of the ESOS32 utility functions.
 

Functions

uint32_t esos_GetRandomUint32 ()
 
uint16_t esos_hash_u32_to_u16 (uint32_t u32_hash)
 
uint32_t esos_string_hash_u32 (char *psz_str)
 
uint32_t esos_buffer_hash_u32 (void *buf, uint16_t len)
 
void __esos_set_PRNG_U32Seed (uint32_t u32_seed)
 
uint32_t __esos_get_PRNG_RandomUint32 (void)
 
uint32_t __esos_hw_PRNG_u32 (void)
 
void __esos_hw_config_PRNG (void)
 
void __esos_hw_set_PRNG_Seed (uint32_t u32_seed)
 

Variables

uint32_t __esos_u32FNVHash
 

Detailed Description

Function Documentation

◆ __esos_get_PRNG_RandomUint32()

uint32_t __esos_get_PRNG_RandomUint32 ( void  )

Returns a 31-bit pseudo-random number generated by the Park-Miller algorithm.

See also
__esos_setSWRNGU32Seed
Note
Visit http://www.firstpr.com.au/dsp/rand31/ for more information

Definition at line 80 of file esos_utils.c.

◆ __esos_set_PRNG_U32Seed()

void __esos_set_PRNG_U32Seed ( uint32_t  u32_seed)

Writes message data to a task's mailbox.

Parameters
pst_RcvrTaskpointer to task structure (ESOS_TASK_HANDLE) whose mailbox will be written
pst_Msgpointer to mailbox message structure that contains data to write to the task's mailbox
Note
This function ASSUMES that there is ample free space available in specified mailbox.
See also
ESOS_TASK_WAIT_ON_TASKS_MAILBOX_HAS_SPACE Sets the seed value in the ESOS pseudo-random number generator (PRNG).
Note
ESOS init code sets a seed value for the PRNG. If the application desires a sequence that is not predictable at each execution run, then the seed should be set ONCE with some value that is different with each execution. An idea is to have the user press a key during startup. The value of the ESOS tick when the user presses the key will be different each time. This number would make an ideal PRNG seed.
See also
__esos_GetSWRNGRandomUint32 See http://www.firstpr.com.au/dsp/rand31/ for more information

Definition at line 70 of file esos_utils.c.

◆ esos_buffer_hash_u32()

uint32_t esos_buffer_hash_u32 ( void *  buf,
uint16_t  len 
)

Create a 32-bit (uint32_t) hash value for a buffer of voids Routine maintains "state" in the form of variable __esos_u32FNVHash This "state" is used in all of the ESOS FNV hash functions. Based on the Fowler/Noll/Vo (FNV1a) hash algorithm and code provided at http://www.isthe.com/chongo/tech/comp/fnv/

Parameters
bufpointer to a buffer of voids
lenlength of the buffer of voids
Return values
uint32_tvalue of the resulting hash
See also
esos_string_hash_u32
esos_hash_u32_to_u16

Definition at line 140 of file esos_utils.c.

◆ esos_GetRandomUint32()

uint32_t esos_GetRandomUint32 ( void  )
inline

Returns a 32-bit pseudo-random number. Will call a "hw" RNG function to allow for HW PRNG if available. If HW is not present, the hardware specific (hwxxx or others) can simply call back to the hidden ESOS function above: __esos_GetSWRNGRandomUint32

See also
__esos_setSWRNGU32Seed
__esos_GetSWRNGRandomUint32
Note
Visit http://www.firstpr.com.au/dsp/rand31/ for more information

Definition at line 100 of file esos_utils.c.

◆ esos_string_hash_u32()

uint32_t esos_string_hash_u32 ( char *  psz_str)

Create a 32-bit (uint32_t) hash value for a provided string Routine maintains "state" in the form of variable __esos_u32FNVHash This "state" is used in all of the ESOS FNV hash functions. Based on the Fowler/Noll/Vo (FNV1a) hash algorithm and code provided at http://www.isthe.com/chongo/tech/comp/fnv/

Parameters
psz_strpointer to zero-terminated string
Return values
uint32_tvalue of the resulting hash
See also
esos_string_hash_u32
esos_hash_u32_to_u16

Definition at line 176 of file esos_utils.c.