;; control the jtag interface ;; The JTD bit in the MCUCSR register is set to disable the jtag ;; interface. The JTD bit in the MCUCSR register is cleared to enable the ;; jtag interface. To change the JTD bit, the register must be written ;; two times in 4 cycles ;; ;; 20090315 tomdean - initial version ;; ;; $Id$ #include .file "jtag_ctl.S" .text .global jtag_on .type jtag_on, @function ;; ;; This only changes the Z and R24 registers. ;; Both protected by avr-gcc for function calls. ;; jtag_on: ldi r30,lo8(MCUCSR) ldi r31,hi8(MCUCSR) ld r24,Z andi r24,~_BV(JTD) ;; ;; CAUTION, do not put instructions between the next two ;; st X,r24 ; write the bit the first time st X,r24 ; write the bit the second time ret .size jtag_on, .-jtag_on .global jtag_off .type jtag_off, @function jtag_off: ldi r30,lo8(MCUCSR) ldi r31,hi8(MCUCSR) ld r24,Z ori r24,_BV(JTD) ;; ;; CAUTION, do not put instructions between the next two ;; st X,r24 ; write the bit the first time st X,r24 ; write the bit the second time ret .size jtag_off, .-jtag_off