Contiki-NG
Files | Functions
cc2538 Random Number Generator

Driver for the cc2538 Hardware Random Number Generator. More...

Files

file  random.c
 Random number generator routines exploiting the cc2538 hardware capabilities.
 

Functions

unsigned short random_rand (void)
 Generates a new random number using the cc2538 RNG. More...
 
void random_init (unsigned short seed)
 Seed the cc2538 random number generator. More...
 

Detailed Description

Driver for the cc2538 Hardware Random Number Generator.

Function Documentation

◆ random_init()

void random_init ( unsigned short  seed)

Seed the cc2538 random number generator.

Parameters
seedIgnored. It's here because the function prototype is in core.
        We form a seed for the RNG by sampling IF_ADC as
        discussed in the user guide.
        Seeding with this method should not be done during
        normal radio operation. Thus, use this function before
        initialising the network.
Note
Must not be called after the RF driver has been initialised and is in normal operation. If it is absolutely necessary to do so, the radio will need re-initialised.

Definition at line 84 of file random.c.

Referenced by platform_init_stage_two().

◆ random_rand()

unsigned short random_rand ( void  )

Generates a new random number using the cc2538 RNG.

Returns
The random number.

Definition at line 58 of file random.c.