|
@@ -32,6 +32,7 @@
|
|
#include <no2usb/usb.h>
|
|
#include <no2usb/usb.h>
|
|
#include <no2usb/usb_dfu_rt.h>
|
|
#include <no2usb/usb_dfu_rt.h>
|
|
#include "utils.h"
|
|
#include "utils.h"
|
|
|
|
+#include "registers.h"
|
|
|
|
|
|
|
|
|
|
extern const struct usb_stack_descriptors app_stack_desc;
|
|
extern const struct usb_stack_descriptors app_stack_desc;
|
|
@@ -49,6 +50,9 @@ serial_no_init()
|
|
flash_unique_id(buf);
|
|
flash_unique_id(buf);
|
|
printf("Flash Unique ID : %s\n", hexstr(buf, 8, true));
|
|
printf("Flash Unique ID : %s\n", hexstr(buf, 8, true));
|
|
|
|
|
|
|
|
+ // Print Mailbox contents just to be sure */
|
|
|
|
+ printf("Mailbox period1: %d\n", mailbox_regs->regs.period1);
|
|
|
|
+
|
|
/* Overwrite descriptor string */
|
|
/* Overwrite descriptor string */
|
|
/* In theory in rodata ... but nothing is ro here */
|
|
/* In theory in rodata ... but nothing is ro here */
|
|
id = hexstr(buf, 8, false);
|
|
id = hexstr(buf, 8, false);
|
|
@@ -57,6 +61,27 @@ serial_no_init()
|
|
desc[2 + (i << 1)] = id[i];
|
|
desc[2 + (i << 1)] = id[i];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void write_period1()
|
|
|
|
+{
|
|
|
|
+ printf("Writing period1 0x1\n");
|
|
|
|
+ mailbox_regs->regs.period1 = 0x1;
|
|
|
|
+ printf("Done writing\n");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void write_period1_2()
|
|
|
|
+{
|
|
|
|
+ printf("Writing period1 0x2\n");
|
|
|
|
+ mailbox_regs->regs.period1 = 0x2;
|
|
|
|
+ printf("Done writing\n");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void clear_period1()
|
|
|
|
+{
|
|
|
|
+ printf("Clearing period1 current val: %d\n", mailbox_regs->regs.period1);
|
|
|
|
+ mailbox_regs->regs.period1 = 0x0;
|
|
|
|
+ printf("Done clearing\n");
|
|
|
|
+}
|
|
|
|
+
|
|
static void
|
|
static void
|
|
boot_dfu(void)
|
|
boot_dfu(void)
|
|
{
|
|
{
|
|
@@ -128,6 +153,15 @@ void main()
|
|
case 'd':
|
|
case 'd':
|
|
usb_disconnect();
|
|
usb_disconnect();
|
|
break;
|
|
break;
|
|
|
|
+ case 'w':
|
|
|
|
+ write_period1();
|
|
|
|
+ break;
|
|
|
|
+ case 'k':
|
|
|
|
+ clear_period1();
|
|
|
|
+ break;
|
|
|
|
+ case 'a':
|
|
|
|
+ write_period1_2();
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|