updates from make style

This commit is contained in:
Henry Gabryjelski 2023-02-17 17:27:07 -08:00
commit 48ca513a96
8 changed files with 16 additions and 63 deletions

View file

@ -367,7 +367,7 @@ void Flashmem_print_status(void) {
uint8_t uid[8] = {0, 0, 0, 0, 0, 0, 0, 0};
Flash_UniqueID(uid);
Dbprintf( " Unique ID............... " _YELLOW_("0x%02X%02X%02X%02X%02X%02X%02X%02X"),
Dbprintf(" Unique ID............... " _YELLOW_("0x%02X%02X%02X%02X%02X%02X%02X%02X"),
uid[7], uid[6], uid[5], uid[4],
uid[3], uid[2], uid[1], uid[0]
);

View file

@ -112,56 +112,10 @@ uint16_t FlashSendLastByte(uint32_t data);
#ifndef AS_BOOTROM
// Bootrom does not require these functions.
// Wrap in #ifndef to avoid accidental bloat of bootrom
// Bootrom needs only enough to get uniqueID from flash.
// It calls three functions. Full call trees listed:
//
// FlashInit()
// |
// \____ FlashSetup()
// | \____ leaf
// |
// \____ StartTicks()
// | \____ leaf
// |
// \____ Flash_CheckBusy() [*]
// | \____ WaitUS()
// | | \____ WaitTicks()
// | | \____ leaf
// | |
// | \____ StartCountUS()
// | | \____ leaf
// | |
// | \____ GetCountUS()
// | | \____ leaf
// | |
// | \____ Flash_ReadStat1()
// | \____ FlashSendByte()
// | | \____ leaf
// | |
// | \____ FlashSendLastByte()
// | \____ FlashSendByte()
// | \____ leaf
// |
// \____ StopTicks()
// \____ leaf
//
// Flash_UniqueID()
// \____ FlashCheckBusy() (see FlashInit)
// \____ FlashSendByteByte() (see FlashInit)
// \____ FlashSendByteLastByte() (see FlashInit)
//
//
// FlashStop() [*]
void FlashmemSetSpiBaudrate(uint32_t baudrate);
bool Flash_WaitIdle(void);
void Flash_TransferAdresse(uint32_t address);
void Flash_WriteEnable(void);
bool Flash_WipeMemoryPage(uint8_t page);
bool Flash_WipeMemory(void);

View file

@ -20,7 +20,7 @@
#include "proxmark3_arm.h"
#ifndef AS_BOOTROM
#include "dbprint.h"
#include "dbprint.h"
#endif

View file

@ -405,16 +405,16 @@ void usb_update_serial(uint64_t newSerialNumber) {
// Descriptor is, effectively, initially identical to non-unique serial
// number because it reports the shorter length in the first byte.
// Convert uniqueID's eight bytes to 16 unicode characters in the
// descriptor and, finally, update the descriptor's length, which
// descriptor and, finally, update the descriptor's length, which
// causes the serial number to become visible.
for (uint8_t i = 0; i < 8; i++) {
// order of nibbles chosen to match display order from `hw status`
uint8_t nibble1 = (newSerialNumber >> ((8*i) + 4)) & 0xFu; // bitmasks [0xF0, 0xF000, 0xF00000, ... 0xF000000000000000]
uint8_t nibble2 = (newSerialNumber >> ((8*i) + 0)) & 0xFu; // bitmasks [0x0F, 0x0F00, 0x0F0000, ... 0x0F00000000000000]
char c1 = nibble1 < 10 ? '0' + nibble1 : 'A' + (nibble1-10);
char c2 = nibble2 < 10 ? '0' + nibble2 : 'A' + (nibble2-10);
StrSerialNumber[46-(4*i)] = c1; // [ 46, 42, .., 22, 18 ]
StrSerialNumber[48-(4*i)] = c2; // [ 48, 44, .., 24, 20 ]
uint8_t nibble1 = (newSerialNumber >> ((8 * i) + 4)) & 0xFu; // bitmasks [0xF0, 0xF000, 0xF00000, ... 0xF000000000000000]
uint8_t nibble2 = (newSerialNumber >> ((8 * i) + 0)) & 0xFu; // bitmasks [0x0F, 0x0F00, 0x0F0000, ... 0x0F00000000000000]
char c1 = nibble1 < 10 ? '0' + nibble1 : 'A' + (nibble1 - 10);
char c2 = nibble2 < 10 ? '0' + nibble2 : 'A' + (nibble2 - 10);
StrSerialNumber[46 - (4 * i)] = c1; // [ 46, 42, .., 22, 18 ]
StrSerialNumber[48 - (4 * i)] = c2; // [ 48, 44, .., 24, 20 ]
}
StrSerialNumber[0] = USB_STRING_DESCRIPTOR_SERIAL_NUMBER_LENGTH;
}