From d64502ed4204f313ae89aa4e2b6c554d5a9c6563 Mon Sep 17 00:00:00 2001 From: travisutk Date: Sat, 17 Oct 2009 12:29:49 +0000 Subject: [PATCH] Checkpoint. CC flash works, might break it soon. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@208 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/apps/chipcon/chipcon.c | 13 +++++++++++++ firmware/include/chipcon.h | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/firmware/apps/chipcon/chipcon.c b/firmware/apps/chipcon/chipcon.c index c585594..b2a912d 100644 --- a/firmware/apps/chipcon/chipcon.c +++ b/firmware/apps/chipcon/chipcon.c @@ -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 diff --git a/firmware/include/chipcon.h b/firmware/include/chipcon.h index 524f623..e5207cc 100644 --- a/firmware/include/chipcon.h +++ b/firmware/include/chipcon.h @@ -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 -- 2.20.1