jtag.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define dJTAG_REGISTER_ADDRESS   0x08
#define dJTAG_REGISTER_ALL   0x0B
#define dJTAG_REGISTER_BYPASS   0x1F
#define dJTAG_REGISTER_CONTROL   0x0A
#define dJTAG_REGISTER_DATA   0x09
#define dJTAG_REGISTER_DBDX   0x1D
#define dJTAG_REGISTER_DBTX   0x1C
#define dJTAG_REGISTER_EJTAG_BOOT   0x0C
#define dJTAG_REGISTER_EJWATCH   0x1C
#define dJTAG_REGISTER_EXTEST   0x00
#define dJTAG_REGISTER_FASTDATA   0x0E
#define dJTAG_REGISTER_IDCODE   0x01
#define dJTAG_REGISTER_IMPCODE   0x03
#define dJTAG_REGISTER_NORMAL_BOOT   0x0D
#define dJTAG_REGISTER_SAMPLE   0x02

Functions

unsigned int fJTAG_Data (unsigned int ui_data_out)
void fJTAG_Init (void)
unsigned char fJTAG_Instruction (unsigned char uc_data_out)


Define Documentation

#define dJTAG_REGISTER_ADDRESS   0x08

Definition at line 57 of file jtag.h.

Referenced by fMIPS32_ExecuteDebugModule(), fMIPS32_Transfer(), get_acc(), and wait_address().

#define dJTAG_REGISTER_ALL   0x0B

Definition at line 60 of file jtag.h.

#define dJTAG_REGISTER_BYPASS   0x1F

Definition at line 67 of file jtag.h.

#define dJTAG_REGISTER_CONTROL   0x0A

#define dJTAG_REGISTER_DATA   0x09

#define dJTAG_REGISTER_DBDX   0x1D

Definition at line 66 of file jtag.h.

#define dJTAG_REGISTER_DBTX   0x1C

Definition at line 64 of file jtag.h.

#define dJTAG_REGISTER_EJTAG_BOOT   0x0C

Definition at line 61 of file jtag.h.

Referenced by fMIPS32_ExecuteDebugModule().

#define dJTAG_REGISTER_EJWATCH   0x1C

Definition at line 65 of file jtag.h.

#define dJTAG_REGISTER_EXTEST   0x00

Definition at line 53 of file jtag.h.

#define dJTAG_REGISTER_FASTDATA   0x0E

#define dJTAG_REGISTER_IDCODE   0x01

Definition at line 54 of file jtag.h.

#define dJTAG_REGISTER_IMPCODE   0x03

Definition at line 56 of file jtag.h.

#define dJTAG_REGISTER_NORMAL_BOOT   0x0D

Definition at line 62 of file jtag.h.

#define dJTAG_REGISTER_SAMPLE   0x02

Definition at line 55 of file jtag.h.


Function Documentation

unsigned int fJTAG_Data ( unsigned int  ui_data_out  ) 

Definition at line 148 of file jtag.c.

Referenced by __jtagreg_syscall1(), __jtagreg_syscall2(), check_ejtag(), feed_acc(), fJTAG_Init(), fMIPS32_EJTAG_Machine(), fMIPS32_ExecuteDebugModule(), fMIPS32_ExitDebugMode(), fMIPS32_Transfer(), force_acc(), get_acc(), get_DR(), get_DR2(), wait_address(), and waitreg().

00149 {
00150   unsigned int  ui_data_in;
00151   unsigned char uc_index;
00152   unsigned char uc_result;
00153   
00154   fJTAG_Wiggle(1, 0);  // enter select-dr-scan
00155   fJTAG_Wiggle(0, 0);  // enter capture-dr
00156   fJTAG_Wiggle(0, 0);  // enter shift-dr
00157 
00158   ui_data_in = 0x00;
00159 
00160   // Clock all but last bit out
00161   for (uc_index=0; uc_index<31; uc_index++)
00162     {
00163       uc_result   = fJTAG_Wiggle(0, (ui_data_out & 0x01));
00164       ui_data_out = ui_data_out >> 1;
00165       ui_data_in  = ui_data_in | (uc_result << uc_index);
00166     }
00167   // On last bit set the TAP_MS
00168   uc_result   = fJTAG_Wiggle(1, (ui_data_out & 0x01));
00169   ui_data_in  = ui_data_in | (uc_result << uc_index);
00170 
00171   fJTAG_Wiggle(1, 0);  // enter update-dr
00172   fJTAG_Wiggle(0, 0);  // enter runtest-idle
00173 
00174   return(ui_data_in);
00175 }

void fJTAG_Init ( void   ) 

Definition at line 86 of file jtag.c.

Referenced by fMIPS32_Init().

00087 {
00088   // First we need to init the parallel port
00089   fPARPORT_Init();
00090   
00091   // Wiggle the TAP_RESET bit - Be mindful of the target reset bit
00092 //  fPARPORT_Write((unsigned char)mPARPORT_RST_BIT(1)|mPARPORT_TRS_BIT(0));
00093 //  fPARPORT_Write((unsigned char)mPARPORT_RST_BIT(1)|mPARPORT_TRS_BIT(1));
00094 
00095   // Run through a handful of clock cycles with TMS high to make sure
00096   // we are in the TEST-LOGIC-RESET state.
00097   fJTAG_Wiggle(1,0);
00098   fJTAG_Wiggle(1,0);
00099   fJTAG_Wiggle(1,0);
00100   fJTAG_Wiggle(1,0);
00101   fJTAG_Wiggle(1,0);
00102   fJTAG_Wiggle(1,0);
00103   
00104   // Enter the RUN-TEST-IDLE state
00105   fJTAG_Wiggle(0,0);
00106 
00107 
00108   fJTAG_Instruction(1);
00109   printf("IDCODE=0x%08x\n",fJTAG_Data(1));
00110   fJTAG_Instruction(3);
00111   printf("IMPCODE=0x%08x\n",fJTAG_Data(3));
00112 
00113   return;
00114 }

unsigned char fJTAG_Instruction ( unsigned char  uc_data_out  ) 

Definition at line 354 of file jtag.c.

Referenced by __jtagreg_syscall1(), __jtagreg_syscall2(), check_ejtag(), feed_acc(), fJTAG_Init(), fMIPS32_EJTAG_Machine(), fMIPS32_ExecuteDebugModule(), fMIPS32_ExitDebugMode(), fMIPS32_Transfer(), fMIPS32_USB_DownloadModule(), force_acc(), get_acc(), get_DR(), get_DR2(), USB_UPLOAD_FAST(), wait_address(), and waitreg().

00355 {
00356   unsigned char uc_data_in;
00357   unsigned char uc_result;
00358   unsigned char uc_index;
00359 
00360   fJTAG_Wiggle(1, 0);  // enter select-dr-scan
00361   fJTAG_Wiggle(1, 0);  // enter select-ir-scan
00362   fJTAG_Wiggle(0, 0);  // enter capture-ir
00363   fJTAG_Wiggle(0, 0);  // enter shift-ir (dummy)
00364 
00365   uc_data_in=0;
00366   
00367   // Clock all but last bit out
00368   for (uc_index=0; uc_index<4; uc_index++)
00369     {
00370       uc_result   = fJTAG_Wiggle(0, (uc_data_out & 0x01));
00371       uc_data_out = uc_data_out >> 1;
00372       uc_data_in  = uc_data_in | (uc_result << uc_index);
00373     }
00374   // On last bit set the TAP_MS
00375   uc_result   = fJTAG_Wiggle(1, (uc_data_out & 0x01));
00376   uc_data_in  = uc_data_in | (uc_result << uc_index);
00377   
00378   fJTAG_Wiggle(1, 0);  // enter update-ir
00379   fJTAG_Wiggle(0, 0);  // enter runtest-idle
00380 
00381   return(uc_data_in);
00382 }


Generated on Fri Nov 5 07:24:47 2010 for ejtag debug tools for loongson 232 cpu by  doxygen 1.5.6