Add function to read 12byte HW RoT over STM32L4xx.

pull/4958/head
Boting Ren 2017-08-23 11:06:44 +09:00
parent 953b9250f1
commit 4b9b174c7f
2 changed files with 13 additions and 0 deletions

View File

@ -403,6 +403,18 @@ uint32_t HAL_GetDEVID(void)
return(DBGMCU->IDCODE & DBGMCU_IDCODE_DEV_ID); return(DBGMCU->IDCODE & DBGMCU_IDCODE_DEV_ID);
} }
/**
* @brief Return the unique device identifier (UID based on 96 bits)
* @param UID: pointer to 3 words array.
* @retval Device identifier
*/
void HAL_GetUID_12Byte(uint32_t *UID)
{
UID[0] = (uint32_t)(READ_REG(*((uint32_t *)UID_BASE)));
UID[1] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 4U))));
UID[2] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 8U))));
}
/** /**
* @brief Return the first word of the unique device identifier (UID based on 96 bits) * @brief Return the first word of the unique device identifier (UID based on 96 bits)
* @retval Device identifier * @retval Device identifier

View File

@ -582,6 +582,7 @@ void HAL_ResumeTick(void);
uint32_t HAL_GetHalVersion(void); uint32_t HAL_GetHalVersion(void);
uint32_t HAL_GetREVID(void); uint32_t HAL_GetREVID(void);
uint32_t HAL_GetDEVID(void); uint32_t HAL_GetDEVID(void);
void HAL_GetUID_12Byte(uint32_t *UID);
uint32_t HAL_GetUIDw0(void); uint32_t HAL_GetUIDw0(void);
uint32_t HAL_GetUIDw1(void); uint32_t HAL_GetUIDw1(void);
uint32_t HAL_GetUIDw2(void); uint32_t HAL_GetUIDw2(void);