1 .globl jtag430_tclk_flashpulses
2 .type jtag430_tclk_flashpulses,@function //for linking
4 #define _GNU_ASSEMBLER_
7 //This detects model, chooses appropriate timing.
8 jtag430_tclk_flashpulses:
10 cmp #0x6cf1, r14 ;Is the chip an MSP430F1xx?
11 jz jtag430_tclk_flashpulses_3mhz
12 jmp jtag430_tclk_flashpulses_16mhz
14 // At 3.68MHz, 7 to 14 cycles/loop are allowed for 257 to 475kHz.
15 // At 16MHz, 33 to 62 cycles/loop are allowed.
16 jtag430_tclk_flashpulses_3mhz:
19 bis.b #2, @r14 ;SETTCLK, 3 cycles
21 ;; 1+3+3+1+2=10, within limits
26 bic.b #2, @r14 ;CLRTCLK, 3 cycles
28 jnz pulseloop3 ; 2 cycles
31 jtag430_tclk_flashpulses_16mhz:
34 bis.b #2, @r14 ;SETTCLK, 3 cycles
36 ;; 1+3+3+1+2=10, beneath limits,
38 ;; +3+2=5, repeat 8 times to get 10+40=50, within limits
57 bic.b #2, @r14 ;CLRTCLK, 3 cycles
59 jnz pulseloop16 ; 2 cycles