PKP
VS1000 P
ROGRAMMER
’
S
G
UIDE
VSMPG
// When USB descriptors initialized, set defaults with
// RealInitUSBDescriptors(), then install our descriptors.
void MyInitUSBDescriptors(u_int16 initDescriptors){
RealInitUSBUSBDescriptors(initDescriptors);
USB.descriptorTable[DT_VENDOR] = myVendorNameStr;
USB.descriptorTable[DT_MODEL] = myModelNameStr;
USB.descriptorTable[DT_SERIAL] = mySerialNumberStr;
USB.descriptorTable[DT_DEVICE] = myDeviceDescriptor;
}
const u_int16 bHexChar16[] = { // swapped Unicode hex characters
0x3000, 0x3100, 0x3200, 0x3300, 0x3400, 0x3500, 0x3600, 0x3700,
0x3800, 0x3900, 0x4100, 0x4200, 0x4300, 0x4400, 0x4400, 0x4500
};
void main(void) {
u_int16 i;
u_int32 mySerialNumber = 0x1234abcd; // Unique serial number
// Put unique serial number to serial number descriptor
for (i=5; i<13; i++){
mySerialNumberStr[i]=bHexChar16[mySerialNumber28];
mySerialNumber = 4;
}
// Hook in function that will load new descriptors to USB struct
SetHookFunction((u_int16)InitUSBDescriptors, MyInitUSBDescriptors);
} // Return to ROM code.
Rev. 0.20
2011-10-04
Page