I am trying write jlink script for sifive device.
Any one has sample script?
I'm able to read JTAG ID and DTMCS.
But I'm facing problem with DMI register. it is 66 bits long. how to send 66 bits of data.
my script
Display All
Any one has sample script?
I'm able to read JTAG ID and DTMCS.
But I'm facing problem with DMI register. it is 66 bits long. how to send 66 bits of data.
my script
C Source Code
- void Read_JTAGID(void) {
- int v;
- int BitPos;
- JTAG_WriteIR(0x1);
- BitPos = JTAG_WriteDR(0x00000000, 32);
- v = JTAG_GetU32(BitPos);
- MessageBox1("Read_JTAGID value: ", v);
- }
- void Read_DTMCS(void) {
- int BitPos;
- int v;
- JTAG_WriteIR(0x10);
- BitPos = JTAG_WriteDR(0x00000000, 32);
- v = JTAG_GetU32(BitPos);
- MessageBox1("Read_DTMCS : ", v);
- }
- void settings(void) {
- int Speed;
- JTAG_Reset();
- JTAG_IRLen = 5;
- Speed = JTAG_Speed;
- JTAG_Speed = 50;
- }
- void JTAG_DMI_WRITE(unsigned int addr, unsigned int val) {
- int BitPos;
- JTAG_WriteIR(0x11);
- JLINK_JTAG_StartDR();
- JLINK_JTAG_WriteDRCont(2, 2);
- BitPos = JLINK_JTAG_WriteDRCont(val, 32);
- JLINK_JTAG_WriteDREnd(addr, 32);
- MessageBox1("JTAG_DMI_WRITE BitPos ", BitPos);
- MessageBox1("JTAG_DMI_WRITE addr : ", addr);
- }
- unsigned int JTAG_DMI_READ(unsigned int addr) {
- int BitPos;
- unsigned int val0;
- unsigned int val1;
- unsigned int val2;
- JTAG_WriteIR(0x11);
- JLINK_JTAG_StartDR();
- BitPos = JLINK_JTAG_WriteDRCont(1, 2);
- JLINK_JTAG_WriteDRCont(0, 32);
- JLINK_JTAG_WriteDREnd(addr, 32);
- val0 = JTAG_GetU32(BitPos);
- val1 = JTAG_GetU32(BitPos+32);
- val2 = JTAG_GetU32(BitPos+64);
- MessageBox1("JTAG_DMI_READ addr ", addr);
- MessageBox1("JTAG_DMI_READ BitPos ", BitPos);
- MessageBox1("JTAG_DMI_READ val 1 ", val0);
- MessageBox1("JTAG_DMI_READ val 2 ", val1);
- MessageBox1("JTAG_DMI_READ val 3 ", val2);
- return val0;
- }