|
@@ -55,9 +55,27 @@ 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));
|
|
|
|
|
|
|
|
+ //uint32_t old = *(volatile uint32_t *)(MAILBOX_BASE + 0x00);
|
|
|
|
+ //printf("Old=0x%x\n", old);
|
|
|
|
+ //*(volatile uint32_t *)(MAILBOX_BASE + 0x00) = 0x00000004;
|
|
|
|
+ //uint32_t new = *(volatile uint32_t *)(MAILBOX_BASE + 0x00);
|
|
|
|
+ //printf("New=0x%x\n", new);
|
|
|
|
+ //printf("Old=0x%x, New=0x%x\n", old, new);
|
|
|
|
+
|
|
// Print Mailbox contents just to be sure */
|
|
// Print Mailbox contents just to be sure */
|
|
- printf("Mailbox period1: %d\n", mailbox_regs->regs.period1);
|
|
|
|
- printf("Mailbox delay1: %d\n", mailbox_regs->regs.delay1);
|
|
|
|
|
|
+ //printf("Mailbox period1: %d\n", mailbox_regs->regs.period1);
|
|
|
|
+ //printf("Mailbox delay1: %d\n", mailbox_regs->regs.delay1);
|
|
|
|
+
|
|
|
|
+ //// Debug print all mailbox memory
|
|
|
|
+ //for (i = 0; i < 64; ++i) {
|
|
|
|
+ // //printf("%x ", *((int*)MAILBOX_BASE+i));
|
|
|
|
+ // printf("%x ", *((int*)MAILBOX_BASE+i));
|
|
|
|
+ // if (i != 0 && i % 16)
|
|
|
|
+ // printf("\n");
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ //mailbox_regs->regs.delay3= 0x1;
|
|
|
|
+ //printf("Mailbox delay1: %d\n", mailbox_regs->regs.delay3);
|
|
|
|
|
|
/* Testing floats TODO: test if calculation is correct
|
|
/* Testing floats TODO: test if calculation is correct
|
|
dupa = 3.1415;
|
|
dupa = 3.1415;
|
|
@@ -69,31 +87,50 @@ serial_no_init()
|
|
*/
|
|
*/
|
|
|
|
|
|
/* 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);
|
|
desc = (char*)app_stack_desc.str[1];
|
|
desc = (char*)app_stack_desc.str[1];
|
|
for (i=0; i<16; i++)
|
|
for (i=0; i<16; i++)
|
|
desc[2 + (i << 1)] = id[i];
|
|
desc[2 + (i << 1)] = id[i];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static char _printf_buf[128];
|
|
|
|
+
|
|
static void write_period1()
|
|
static void write_period1()
|
|
{
|
|
{
|
|
printf("Writing period1 0x1\n");
|
|
printf("Writing period1 0x1\n");
|
|
|
|
+ //uint8_t *strMem = (uint8_t *)&_printf_buf;
|
|
|
|
+ //for (int i=0; i<32; i++) {
|
|
|
|
+ // printf("%x ", strMem[i]);
|
|
|
|
+ //}
|
|
mailbox_regs->regs.period1 = 0x1;
|
|
mailbox_regs->regs.period1 = 0x1;
|
|
printf("Done writing\n");
|
|
printf("Done writing\n");
|
|
|
|
+ //uint8_t * strMem = (uint8_t *)&_printf_buf;
|
|
|
|
+ //for (int i=0; i<32; i++) {
|
|
|
|
+ // printf("%x ", strMem[i]);
|
|
|
|
+ //}
|
|
|
|
+ printf("\n");
|
|
}
|
|
}
|
|
|
|
|
|
static void write_period1_2()
|
|
static void write_period1_2()
|
|
{
|
|
{
|
|
printf("Writing period1 0x2\n");
|
|
printf("Writing period1 0x2\n");
|
|
|
|
+ //uint8_t *strMem = (uint8_t *)&_printf_buf;
|
|
|
|
+ //for (int i=0; i<32; i++) {
|
|
|
|
+ // printf("%x ", strMem[i]);
|
|
|
|
+ //}
|
|
mailbox_regs->regs.period1 = 0x2;
|
|
mailbox_regs->regs.period1 = 0x2;
|
|
printf("Done writing\n");
|
|
printf("Done writing\n");
|
|
|
|
+ //uint8_t * strMem = (uint8_t *)&_printf_buf;
|
|
|
|
+ //for (int i=0; i<32; i++) {
|
|
|
|
+ // printf("%x ", strMem[i]);
|
|
|
|
+ //}
|
|
}
|
|
}
|
|
|
|
|
|
static void write_period1_4()
|
|
static void write_period1_4()
|
|
{
|
|
{
|
|
printf("Writing period1 0x4\n");
|
|
printf("Writing period1 0x4\n");
|
|
- mailbox_regs->regs.period1 = 0x3;
|
|
|
|
|
|
+ mailbox_regs->regs.period1 = 0x4;
|
|
printf("Done writing\n");
|
|
printf("Done writing\n");
|
|
printf("Reading now \n");
|
|
printf("Reading now \n");
|
|
printf("value: %d\n", mailbox_regs->regs.period1);
|
|
printf("value: %d\n", mailbox_regs->regs.period1);
|
|
@@ -108,8 +145,8 @@ static void clear_period1()
|
|
|
|
|
|
static void write_delay1()
|
|
static void write_delay1()
|
|
{
|
|
{
|
|
- printf("Writing delay1 0x1\n");
|
|
|
|
- mailbox_regs->regs.delay1 = 0x1;
|
|
|
|
|
|
+ printf("Writing delay1 0x1234\n");
|
|
|
|
+ mailbox_regs->regs.delay1 = 0x1234;
|
|
printf("Done writing\n");
|
|
printf("Done writing\n");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -203,12 +240,12 @@ void main()
|
|
case 's':
|
|
case 's':
|
|
write_period1_4();
|
|
write_period1_4();
|
|
break;
|
|
break;
|
|
- //case 'o':
|
|
|
|
- // write_delay1();
|
|
|
|
- // break;
|
|
|
|
- //case 'm':
|
|
|
|
- // clear_delay1();
|
|
|
|
- // break;
|
|
|
|
|
|
+ case 'o':
|
|
|
|
+ write_delay1();
|
|
|
|
+ break;
|
|
|
|
+ case 'm':
|
|
|
|
+ clear_delay1();
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|