From a05528f44a36773d3bb3cf642dcb77bca79c5a33 Mon Sep 17 00:00:00 2001 From: travisutk Date: Mon, 1 Mar 2010 02:22:55 +0000 Subject: [PATCH] Chipcon entry in ASM. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@378 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/Makefile | 2 +- firmware/apps/chipcon/chipcon.c | 20 +++++++++++++++++++ firmware/apps/chipcon/chipconasm.S | 32 ++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 firmware/apps/chipcon/chipconasm.S diff --git a/firmware/Makefile b/firmware/Makefile index 531f3d1..443d016 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -26,7 +26,7 @@ CC=msp430-gcc -Wall -Os -g -mmcu=$(mcu) -D$(mcu) -DGCC $(GCCINC) -I include $(CC moreapps?=apps/i2c/i2c.o apps/chipcon/chipcon.o apps/glitch/glitch.o apps/jtag/sbw.o apps/smartcard/smartcard.o apps= $(moreapps) apps/monitor/monitor.o apps/spi/spi.o apps/jtag/jtag.o apps/jtag/jtag430.o apps/jtag/jtag430x2.o apps/avr/avr.o apps/jtag/ejtag.o -libs= lib/$(mcu).o lib/command.o apps/jtag/jtag430asm.o +libs= lib/$(mcu).o lib/command.o apps/jtag/jtag430asm.o apps/chipcon/chipconasm.o app= goodfet all: $(app).hex diff --git a/firmware/apps/chipcon/chipcon.c b/firmware/apps/chipcon/chipcon.c index 1f4b3d4..ce0a9ff 100644 --- a/firmware/apps/chipcon/chipcon.c +++ b/firmware/apps/chipcon/chipcon.c @@ -56,6 +56,22 @@ void ccsetup(){ //P5REN=0xFF; } + +/* 33 cycle critical region +0000000e : + e: f2 d0 0d 00 bis.b #13, &0x0031 ;5 cycles + 12: 31 00 + 14: f2 c2 31 00 bic.b #8, &0x0031 ;4 cycles + 18: d2 c3 31 00 bic.b #1, &0x0031 ;4 + 1c: f2 e2 31 00 xor.b #8, &0x0031 ;4 + 20: f2 e2 31 00 xor.b #8, &0x0031 ;4 + 24: f2 e2 31 00 xor.b #8, &0x0031 ;4 + 28: f2 e2 31 00 xor.b #8, &0x0031 ;4 + 2c: d2 d3 31 00 bis.b #1, &0x0031 ;4 + 30: 30 41 ret +*/ + +/* //! Initialize the debugger void ccdebuginit(){ //Port output BUT NOT DIRECTION is set at start. @@ -78,6 +94,10 @@ void ccdebuginit(){ //Raise !RST. P5OUT|=RST; } +*/ + +//! Initialize the debugger. +void ccdebuginit(); //! Read and write a CC bit. unsigned char cctrans8(unsigned char byte){ diff --git a/firmware/apps/chipcon/chipconasm.S b/firmware/apps/chipcon/chipconasm.S new file mode 100644 index 0000000..09e8683 --- /dev/null +++ b/firmware/apps/chipcon/chipconasm.S @@ -0,0 +1,32 @@ +.globl ccdebuginit +.type ccdebuginit,@function //for linking + +#define _GNU_ASSEMBLER_ +#include "gfports.h" + + +//In assembly for cycle-counting, not for efficiency. +// +ccdebuginit: + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + nop ;1 cycle + + bis.b #13, &0x0031 ;5 cycles + bic.b #8, &0x0031 ;4 cycles + bic.b #1, &0x0031 ;4 + xor.b #8, &0x0031 ;4 + xor.b #8, &0x0031 ;4 + xor.b #8, &0x0031 ;4 +;; xor.b #8, &0x0031 ;4 + bis.b #1, &0x0031 ;4 + ret -- 2.20.1