78 lines
2.7 KiB
C
78 lines
2.7 KiB
C
|
|
#include "jtaglib.h"
|
|
#include "eem_defs.h"
|
|
|
|
/* Flash erasing modes */
|
|
#define JTAG_ERASE_MASS 0xA506
|
|
#define JTAG_ERASE_MAIN 0xA504
|
|
#define JTAG_ERASE_SGMT 0xA502
|
|
|
|
#define JTAG_ID_IS_XV2(x) ((x)==0x91||(x)==0x95||(x)==0x98||(x)==0x99)
|
|
|
|
/* Instructions for the JTAG control signal register in reverse bit order
|
|
*/
|
|
#define IR_CNTRL_SIG_16BIT 0xC8 /* 0x13 */
|
|
#define IR_CNTRL_SIG_CAPTURE 0x28 /* 0x14 */
|
|
#define IR_CNTRL_SIG_RELEASE 0xA8 /* 0x15 */
|
|
#define IR_COREIP_ID 0xE8 /* 0x17 */
|
|
/* Instructions for the JTAG data register */
|
|
#define IR_DATA_16BIT 0x82 /* 0x41 */
|
|
#define IR_DATA_CAPTURE 0x42 /* 0x42 */
|
|
#define IR_DATA_QUICK 0xC2 /* 0x43 */
|
|
/* Instructions for the JTAG address register */
|
|
#define IR_ADDR_16BIT 0xC1 /* 0x83 */
|
|
#define IR_ADDR_CAPTURE 0x21 /* 0x84 */
|
|
#define IR_DATA_TO_ADDR 0xA1 /* 0x85 */
|
|
#define IR_DEVICE_ID 0xE1 /* 0x87 */
|
|
/* Instructions for the JTAG PSA mode */
|
|
#define IR_DATA_PSA 0x22 /* 0x44 */
|
|
#define IR_SHIFT_OUT_PSA 0x62 /* 0x46 */
|
|
/* Instructions for the JTAG Fuse */
|
|
#define IR_PREPARE_BLOW 0x44 /* 0x22 */
|
|
#define IR_EX_BLOW 0x24 /* 0x24 */
|
|
/* Instructions for the JTAG mailbox */
|
|
#define IR_TEST_REG 0x54 /* 0x2A */
|
|
/* Instructions for the Configuration Fuse */
|
|
#define IR_CONFIG_FUSES 0x94
|
|
/* Bypass instruction */
|
|
#define IR_BYPASS 0xFF /* 0xFF */
|
|
/* Instructions for the EEM */
|
|
#define IR_EMEX_DATA_EXCHANGE 0x90 /* 0x09 */
|
|
#define IR_EMEX_WRITE_CONTROL 0x30 /* 0x0C */
|
|
#define IR_EMEX_READ_CONTROL 0xD0 /* 0x0B */
|
|
|
|
/* EEM stuff */
|
|
#define EEM_STOPPED 0x0080
|
|
#define EEM_EN 0x0001
|
|
#define CLEAR_STOP 0x0002
|
|
#define EMU_CLK_EN 0x0004
|
|
|
|
#define CNTRL_SIG_CPUSUSP (1<<8)
|
|
|
|
#define jtag_tms_set(p) p->f->jtdev_tms(p, 1)
|
|
#define jtag_tms_clr(p) p->f->jtdev_tms(p, 0)
|
|
#define jtag_tck_set(p) p->f->jtdev_tck(p, 1)
|
|
#define jtag_tck_clr(p) p->f->jtdev_tck(p, 0)
|
|
#define jtag_tdi_set(p) p->f->jtdev_tdi(p, 1)
|
|
#define jtag_tdi_clr(p) p->f->jtdev_tdi(p, 0)
|
|
#define jtag_tclk_set(p) p->f->jtdev_tclk(p, 1)
|
|
#define jtag_tclk_clr(p) p->f->jtdev_tclk(p, 0)
|
|
#define jtag_rst_set(p) p->f->jtdev_rst(p, 1)
|
|
#define jtag_rst_clr(p) p->f->jtdev_rst(p, 0)
|
|
#define jtag_tst_set(p) p->f->jtdev_tst(p, 1)
|
|
#define jtag_tst_clr(p) p->f->jtdev_tst(p, 0)
|
|
|
|
#define jtag_led_green_on(p) p->f->jtdev_led_green(p, 1)
|
|
#define jtag_led_green_off(p) p->f->jtdev_led_green(p, 0)
|
|
#define jtag_led_red_on(p) p->f->jtdev_led_red(p, 1)
|
|
#define jtag_led_red_off(p) p->f->jtdev_led_red(p, 0)
|
|
|
|
#define jtag_ir_shift(p, ir) p->f->jtdev_ir_shift(p, ir)
|
|
#define jtag_dr_shift_8(p, dr) p->f->jtdev_dr_shift_8(p, dr)
|
|
#define jtag_dr_shift_16(p, dr) p->f->jtdev_dr_shift_16(p, dr)
|
|
#define jtag_dr_shift_20(p, dr) p->f->jtdev_dr_shift_20(p, dr)
|
|
#define jtag_tms_sequence(p, bits, tms) p->f->jtdev_tms_sequence(p, bits, tms)
|
|
#define jtag_init_dap(p) p->f->jtdev_init_dap(p)
|
|
|
|
|