Dependencies:   mbed

Revision:
0:15536fa79743
Child:
1:0872c208795f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ID.cpp	Tue Sep 27 15:44:55 2011 +0000
@@ -0,0 +1,147 @@
+#include "mbed.h"
+#include "LPC.h"
+//Function to document the relevant information on LPC chips to load onto
+int SerialBuffered::IDCheck(int idcode) {
+    switch (idcode) {
+        //Cortex M3 - LPC17xx
+        case 638664503:
+            strcpy(strChipType, "LPC1769 - Cortex M3");
+            lastSector = 29;
+            break;
+        case 637615927:
+            strcpy(strChipType, "LPC1768 - Cortex M3");
+            lastSector = 29;
+            break;
+        case 637610039:
+            strcpy(strChipType, "LPC1767 - Cortex M3");
+            lastSector = 29;
+            break;
+        case 637615923:
+            strcpy(strChipType, "LPC1766 - Cortex M3");
+            lastSector = 21;
+            break;
+        case 637613875:
+            strcpy(strChipType, "LPC1765 - Cortex M3");
+            lastSector = 21;
+            break;
+        case 637606178:
+            strcpy(strChipType, "LPC1764 - Cortex M3");
+            lastSector = 17;
+            break;
+        case 621885239:
+            strcpy(strChipType, "LPC1759 - Cortex M3");
+            lastSector = 29;
+            break;
+        case 620838711:
+            strcpy(strChipType, "LPC1758 - Cortex M3");
+            lastSector = 29;
+            break;
+        case 620828451:
+            strcpy(strChipType, "LPC1756 - Cortex M3");
+            lastSector = 21;
+            break;
+        case 620828450:
+            strcpy(strChipType, "LPC1754 - Cortex M3");
+            lastSector = 17;
+            break;
+        case 620761377:
+            strcpy(strChipType, "LPC1752 - Cortex M3");
+            lastSector = 15;
+            break;
+        case 620761368:
+            strcpy(strChipType, "LPC1751 - Cortex M3");
+            lastSector = 7;
+            break;
+        case 620761131:
+            strcpy(strChipType, "LPC1102 - Cortex M0");
+            lastSector = 7;
+            break;
+        //Cortex M0 - LPC111x 
+        case 0x041E502B:
+            strcpy(strChipType, "LPC1111FHN33/101 - Cortex M0");
+            lastSector = 1;
+            break;
+        case 0x2516D02B:
+            strcpy(strChipType, "LPC1111FHN33/102 - Cortex M0");
+            lastSector = 1;
+            break;
+        case 0x0416502B:
+            strcpy(strChipType, "LPC1111FHN33/201 - Cortex M0");
+            lastSector = 1;
+            break;
+        case 0x2516902B:
+            strcpy(strChipType, "LPC1111FHN33/202 - Cortex M0");
+            lastSector = 1;
+            break;
+        case 0x042D502B:
+            strcpy(strChipType, "LPC1112FHN33/101 - Cortex M0");
+            lastSector = 3;
+            break;
+        case 0x2524D02B:
+            strcpy(strChipType, "LPC1112FHN33/102 - Cortex M0");
+            lastSector = 3;
+            break;
+        case 0x0425502B:
+            strcpy(strChipType, "LPC1112FHN33/201 - Cortex M0");
+            lastSector = 3;
+            break;
+        case 0x2524902B:
+            strcpy(strChipType, "LPC1112FHN33/202 - Cortex M0");
+            lastSector = 3;
+            break;
+        case 0x0434502B:
+            strcpy(strChipType, "LPC1113FHN33/201 - Cortex M0");
+            lastSector = 5;
+            break;
+        case 0x2532902B:
+            strcpy(strChipType, "LPC1113FHN33/202 - Cortex M0");
+            lastSector = 5;
+            break;
+        case 0x0434102B:
+            strcpy(strChipType, "LPC1113FHN33/301 OR LPC1113FBD48/301 - Cortex M0");
+            lastSector = 5;
+            break;
+        case 0x2532102B:
+            strcpy(strChipType, "LPC1113FHN33/302 OR LPC1113FBD48/302 - Cortex M0");
+            lastSector = 5;
+            break;
+        case 0x0444502B:
+            strcpy(strChipType, "LPC1114FHN33/201 - Cortex M0");
+            lastSector = 7;
+            break;
+        case 0x2540902B:
+            strcpy(strChipType, "LPC1114FHN33/202 - Cortex M0");
+            lastSector = 7;
+            break;
+        case 0x0444102B:
+            strcpy(strChipType, "LPC1114FHN33/301 OR LPC1114FBD48/301 OR LPC1114FA44/301 - Cortex M0");
+            lastSector = 7;
+            break;
+        case 0x2540102B:
+            strcpy(strChipType, "LPC1114FHN33/302 OR LPC1114FBD48/302 OR LPC1114FA44/302 - Cortex M0");
+            lastSector = 7;
+            break;
+       //Cortex M0 - LPC11Cxx
+        case 0x1421102B:
+            strcpy(strChipType, "LPC11C12FBD48/301 - Cortex M0");
+            lastSector = 3;
+            break;
+        case 0x1440102B:
+            strcpy(strChipType, "LPC11C14FBD48/301 - Cortex M0");
+            lastSector = 7;
+            break;
+        case 0x1431102B:
+            strcpy(strChipType, "LPC11C22FBD48/301 - Cortex M0");
+            lastSector = 3;
+            break;
+        case 0x1430102B:
+            strcpy(strChipType, "LPC11C24FBD48/301 - Cortex M0");
+            lastSector = 7;
+            break;
+            
+        default:
+            strcpy(strChipType, "\n\rUnrecognised chip! Please add into the \"CheckTargetPresent\" function the chip's relevant information.\r\n\n");
+            exit(0);
+    }
+    return 0;
+}
\ No newline at end of file