added further exit function, so the board restarts after reset
[pyfrprog.git] / pkernel / main.c
index 78ca2dc6851ba8ca9e93fc149f0b355aa72dfd97..8852877433a882dc458d29d55851a5aea253f1d2 100644 (file)
@@ -1,15 +1,12 @@
 #include "mb91465k.h"
 #include "flash.h"
 
-#pragma section CODE=IRAM,attr=CODE
-
 #define BUFSIZE 0x20
 #define cleardata() memset(data,0,BUFSIZE)
 
 static void increaseled(void)
 {
        PDR14 = ~(((~PDR14)+1)%256);
-       HWWD_CL = 0;
 }
 
 static unsigned char recvbyte(void)
@@ -108,13 +105,11 @@ void main(void)
                                size = recvword();
                                increaseled();
 
-                               Putch4(0x04); //Received Metadata.
                                PDR14 = 0xff;
                                for(i=0; i<size; i++) { /* get data */
                                        increaseled();
                                        data[i] = recvbyte();
                                }
-                               Putch4(0x08); //Received Data.
 
                                PDR14 = 0xff;
                                for(i=0; i<size; i+=2) { /* flash the data */
@@ -127,6 +122,11 @@ void main(void)
                                Putch4(0x28); //Flashing done.
                                break;
 
+                       case 0x97: /* exit and restart (let do this by the watchdog!) */
+                               while(1) {
+                                       increaseled();
+                               }
+
                        case 0x99: /* exit */
                                running = 0;
                                break;