+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Main code for the bootloader
+//-----------------------------------------------------------------------------
+
#include <proxmark3.h>
struct common_area common_area __attribute__((section(".commonarea")));
for(;;);
}
-void UsbPacketReceived(BYTE *packet, int len)
+void UsbPacketReceived(uint8_t *packet, int len)
{
int i, dont_ack=0;
UsbCommand *c = (UsbCommand *)packet;
- volatile DWORD *p;
+ volatile uint32_t *p;
if(len != sizeof(*c)) {
Fatal();
/* The temporary write buffer of the embedded flash controller is mapped to the
* whole memory region, only the last 8 bits are decoded.
*/
- p = (volatile DWORD *)&_flash_start;
+ p = (volatile uint32_t *)&_flash_start;
for(i = 0; i < 12; i++) {
p[i+c->arg[0]] = c->d.asDwords[i];
}
break;
case CMD_FINISH_WRITE:
- p = (volatile DWORD *)&_flash_start;
+ p = (volatile uint32_t *)&_flash_start;
for(i = 0; i < 4; i++) {
p[i+60] = c->d.asDwords[i];
}
LED_B_OFF();
LED_A_OFF();
- // if 512K FLASH part - TODO make some defines :)
- if ((AT91C_BASE_DBGU->DBGU_CIDR | 0xf00) == 0xa00) {
- AT91C_BASE_EFC0->EFC_FMR =
- MC_FLASH_MODE_FLASH_WAIT_STATES(1) |
- MC_FLASH_MODE_MASTER_CLK_IN_MHZ(0x48);
- AT91C_BASE_EFC1->EFC_FMR =
- MC_FLASH_MODE_FLASH_WAIT_STATES(1) |
- MC_FLASH_MODE_MASTER_CLK_IN_MHZ(0x48);
- } else {
- AT91C_BASE_EFC0->EFC_FMR =
- MC_FLASH_MODE_FLASH_WAIT_STATES(0) |
- MC_FLASH_MODE_MASTER_CLK_IN_MHZ(48);
- }
+ AT91C_BASE_EFC0->EFC_FMR =
+ MC_FLASH_MODE_FLASH_WAIT_STATES(1) |
+ MC_FLASH_MODE_MASTER_CLK_IN_MHZ(48);
// Initialize all system clocks
ConfigClocks();