Checkpoint. CC flash works, might break it soon.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sat, 17 Oct 2009 12:29:49 +0000 (12:29 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sat, 17 Oct 2009 12:29:49 +0000 (12:29 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@208 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/apps/chipcon/chipcon.c
firmware/include/chipcon.h

index c585594..b2a912d 100644 (file)
@@ -174,6 +174,9 @@ void cchandle(unsigned char app,
     cc_get_pc();
     txdata(app,verb,2);
     break;
+  case CC_LOCKCHIP:
+    cc_lockchip();
+    //no break, return status
   case CC_READ_STATUS:
     cc_read_status();
     txdata(app,verb,1);
@@ -349,6 +352,16 @@ const u8 flash_routine[] = {
   0xA5                                                       //                 DB 0xA5; 
 }; 
 
+
+//! Locks the chip.
+void cc_lockchip(){
+  debugstr("Locking chip.");
+  cc_wr_config(1);//Select Info Flash 
+  cc_debug(3, 0x75, 0xAF, 0x00);//MOV FWDATA, #00H
+  //cc_debug(2, 0xF5, 0xAF, 0); //MOV FWDATA, A
+  
+}
+
 //! Copies flash buffer to flash.
 void cc_write_flash_page(u32 adr){
   //Assumes that page has already been written to XDATA 0xF000
index 524f623..e5207cc 100644 (file)
@@ -61,6 +61,8 @@ void cc_halt();
 void cc_resume();
 //! Step an instruction
 void cc_step_instr();
+//! Locks the chip.
+void cc_lockchip();
 
 #define CC_STATUS_ERASED 0x80
 #define CC_STATUS_PCONIDLE 0x40
@@ -95,4 +97,4 @@ void cc_step_instr();
 #define CC_MASS_ERASE_FLASH 0x97
 #define CC_PROGRAM_FLASH 0x98
 #define CC_WIPEFLASHBUFFER 0x99
-
+#define CC_LOCKCHIP 0x9A