switch usb device serial to unique cpu id

This commit is contained in:
Nicolas Reinecke
2016-01-16 17:17:26 +01:00
parent 13fe7e6266
commit 80462e3122
2 changed files with 10 additions and 15 deletions

View File

@@ -53,9 +53,7 @@
#define USB_SIZ_DEVICE_DESC 18
#define USB_SIZ_STRING_LANGID 4
#define DEVICE_ID1 (0x1FFFF7E8)
#define DEVICE_ID2 (0x1FFFF7EA)
#define DEVICE_ID3 (0x1FFFF7EC)
#define DEVICE_ID ((__IO uint32_t *)0x1FFF7A10)
#define USB_SIZ_STRING_SERIAL 0x1A

View File

@@ -301,18 +301,15 @@ uint8_t *USBD_USR_InterfaceStrDescriptor(uint8_t speed, uint16_t *length)
*/
static void Get_SerialNum(void)
{
uint32_t deviceserial0, deviceserial1, deviceserial2;
uint32_t deviceserial;
deviceserial0 = *(uint32_t*)DEVICE_ID1;
deviceserial1 = *(uint32_t*)DEVICE_ID2;
deviceserial2 = *(uint32_t*)DEVICE_ID3;
deviceserial = DEVICE_ID[0];
deviceserial += DEVICE_ID[2];
deviceserial0 += deviceserial2;
if (deviceserial0 != 0)
if (deviceserial != 0)
{
IntToUnicode (deviceserial0, &USBD_StringSerial[2] ,8);
IntToUnicode (deviceserial1, &USBD_StringSerial[18] ,4);
IntToUnicode (deviceserial, &USBD_StringSerial[2] ,8);
IntToUnicode (DEVICE_ID[1], &USBD_StringSerial[18] ,4);
}
}