@@ -461,3 +461,4 @@ int pinpad_getline (int msg_code, uint32_t timeout_usec);
|
||||
extern uint8_t _regnual_start, __heap_end__[];
|
||||
|
||||
int check_crc32 (const uint32_t *start_p, const uint32_t *end_p);
|
||||
uint8_t * sram_address (uint32_t offset);
|
||||
|
||||
@@ -48,3 +48,9 @@ check_crc32 (const uint32_t *start_p, const uint32_t *end_p)
|
||||
|
||||
return (rbit (CRC->DR) ^ crc32) == 0xffffffff;
|
||||
}
|
||||
|
||||
uint8_t *
|
||||
sram_address (uint32_t offset)
|
||||
{
|
||||
return ((uint8_t *)0x20000000) + offset;
|
||||
}
|
||||
|
||||
@@ -233,8 +233,7 @@ usb_setup (struct usb_dev *dev)
|
||||
}
|
||||
else /* SETUP_SET */
|
||||
{
|
||||
uint8_t *addr = (uint8_t *)(0x20000000 + arg->value * 0x100
|
||||
+ arg->index);
|
||||
uint8_t *addr = sram_address ((arg->value * 0x100) + arg->index);
|
||||
|
||||
if (arg->request == USB_FSIJ_GNUK_DOWNLOAD)
|
||||
{
|
||||
@@ -255,7 +254,7 @@ usb_setup (struct usb_dev *dev)
|
||||
if (*ccid_state_p != CCID_STATE_EXITED)
|
||||
return -1;
|
||||
|
||||
if (((uint32_t)addr & 0x03))
|
||||
if (((uintptr_t)addr & 0x03))
|
||||
return -1;
|
||||
|
||||
return download_check_crc32 (dev, (uint32_t *)addr);
|
||||
|
||||
Reference in New Issue
Block a user