Contiki-NG
Loading...
Searching...
No Matches
cc2538 Random Number Generator

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.
 
void random_init (unsigned short seed)
 Seed the cc2538 random number generator.
 

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.

References CC2538_RF_CSP_ISRFOFF, CC2538_RF_CSP_ISRXON, RFCORE_XREG_FRMCTRL0, RFCORE_XREG_RFRND, RFCORE_XREG_RFRND_IRND, RFCORE_XREG_RSSISTAT, RFCORE_XREG_RSSISTAT_RSSI_VALID, SOC_ADC_ADCCON1, SOC_ADC_ADCCON1_RCTRL0, SOC_ADC_ADCCON1_RCTRL1, SOC_ADC_RNDL, and SYS_CTRL_RCGCRFC.

Referenced by platform_init_stage_two(), and platform_init_stage_two().

◆ random_rand()

unsigned short random_rand ( void )