freemyipod r92 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r91‎ | r92 | r93 >
Date:04:36, 11 August 2010
Author:theseven
Status:new
Tags:
Comment:
Expose execimage() via USB
Modified paths:
  • /embios/trunk/execimage.c (modified) (history)
  • /embios/trunk/usb/usb.c (modified) (history)

Diff [purge]

Index: embios/trunk/execimage.c
@@ -24,6 +24,7 @@
2525 #include "global.h"
2626 #include "console.h"
2727 #include "execimage.h"
 28+#include "mmu.h"
2829
2930
3031 int execimage(void* image)
@@ -49,6 +50,8 @@
5051 "(expected: %08X, got: %08X)\n", header->baseaddr, image);
5152 return -3;
5253 }
 54+ clean_dcache();
 55+ invalidate_icache();
5356 return thread_create(header->threadname, header->entrypoint, header->stackaddr,
5457 header->stacksize, header->threadtype, header->threadpriority, true);
5558 }
Index: embios/trunk/usb/usb.c
@@ -33,6 +33,7 @@
3434 #include "power.h"
3535 #include "mmu.h"
3636 #include "shutdown.h"
 37+#include "execimage.h"
3738 #ifdef HAVE_I2C
3839 #include "i2c.h"
3940 #endif
@@ -53,7 +54,8 @@
5455 DBGACTION_POWEROFF,
5556 DBGACTION_CWRITE,
5657 DBGACTION_CREAD,
57 - DBGACTION_CFLUSH
 58+ DBGACTION_CFLUSH,
 59+ DBGACTION_EXECIMAGE
5860 };
5961
6062 static uint32_t dbgstack[0x100] STACK_ATTR;
@@ -507,6 +509,10 @@
508510 dbgsendbuf[0] = 1;
509511 size = 16;
510512 break;
 513+ case 21: // EXECIMAGE
 514+ if (set_dbgaction(DBGACTION_EXECIMAGE, 0)) break;
 515+ dbgactionaddr = dbgrecvbuf[1];
 516+ break;
511517 default:
512518 dbgsendbuf[0] = 2;
513519 size = 16;
@@ -590,6 +596,11 @@
591597 dbgasyncsendbuf[0] = 1;
592598 usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16);
593599 break;
 600+ case DBGACTION_EXECIMAGE:
 601+ dbgasyncsendbuf[0] = 1;
 602+ dbgasyncsendbuf[1] = execimage((void*)dbgactionaddr);
 603+ usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16);
 604+ break;
594605 }
595606 dbgaction = DBGACTION_IDLE;
596607 }