TI CC1310 TRNG使用

头文件

#include DeviceFamily_constructPath(driverlib/trng.h)

初始化

Power_setDependency(PowerCC26XX_PERIPH_TRNG);
TRNGEnable();
while (!(TRNGStatusGet() & TRNG_NUMBER_READY))
{
    //wait for random number generator
}

读取低32位

TRNGNumberGet(TRNG_LOW_WORD)

判断是否已经启动

if (0 == (HWREG(TRNG_BASE + TRNG_O_CTL) & TRNG_CTL_TRNG_EN))
{
    //trng is disable
}

关闭

TRNGDisable();
Power_releaseDependency(PowerCC26XX_PERIPH_TRNG);