Contiki 3.x
|
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... | |
Driver for the cc2538 Hardware Random Number Generator.
void random_init | ( | unsigned short | seed | ) |
Seed the cc2538 random number generator.
Seed the cc2430 random number generator.
seed | Ignored. 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. |
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.
unsigned short random_rand | ( | void | ) |
Generates a new random number using the cc2538 RNG.
Generate the next state and return the upper part of it.
Definition at line 58 of file random.c.
References SOC_ADC_ADCCON1, SOC_ADC_ADCCON1_RCTRL0, SOC_ADC_RNDH, and SOC_ADC_RNDL.