make install && README
[pyfrprog.git] / pkernel / main.c
index c40924f4b3c9c3c39e484a486734bba55491b5bb..74d1659ee066accd8f347946e4e05cc78a57b34c 100644 (file)
@@ -7,7 +7,6 @@
 static void increaseled(void)
 {
        PDR14 = ~(((~PDR14)+1)%256);
-       HWWD_CL = 0;
 }
 
 static unsigned char recvbyte(void)
@@ -56,8 +55,6 @@ void main(void)
        unsigned short i, size, next;
        unsigned char running = 1, data[BUFSIZE] = {0};
        
-       PORTEN = 0x3; /* enable I/O Ports */
-
        /*Enable LEDs*/
        DDR14 = 0xFF;
        PDR14 = 0xff;
@@ -78,24 +75,6 @@ void main(void)
                                Putch4(0x23);
                                break;
 
-                       case 0x12: //erase
-                               Putch4(0x11);
-                               address = recvdword();
-                               increaseled();
-
-                               size = recvword();
-                               increaseled();
-
-                               PDR14 = 0xff;
-                               for(i=0; i<(size+4); i+=4) { /* erase */
-                                       if(FLASH_SectorErase(address + i) != 1) {
-                                               panic();
-                                       }
-                                       increaseled();
-                               }
-                               Putch4(0x18); //Erasing done.
-                               break;
-
                        case 0x13: //receive
                                Putch4(0x37);
                                increaseled();
@@ -106,13 +85,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 */
@@ -125,6 +102,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;