#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "dbg_msg.h"
#include "jt_tap.h"
#include "jt_instr.h"
#include "jt_arm.h"
#include "jt_flash.h"
#include "jedec_vendorID.h"
Intructions send to the TAP Controller
Support functions to access the JTAG interface via parallel port
int jtag_exchange_instr | ( | const char * | cmd_out, | |
char * | cmd_in | |||
) |
Place a command into the JTAG instruction register (IR) of the active device.
Each bit value is held within a single char.
It must be either 0 or 1 (but not '0' nor '1').
Note this function is called in an more or less "human readable notation" with
MSB shiftet in first and MSB shifted out first
while Hardware makes in real live;
LSB shifted in first and LSB shifted out first
So the bit order of the send data is swapped
cmd_out | pointer to string of bits sent to the IR. | |
cmd_in | pointer to string of bits received from the IR. |
References active_jtag_device, DBG_LEVEL_JTAG_INSTR, IF_DBG, chain_info::instr_len, chain_info::prev, tap_instr(), transactionActivate(), transactionCreate(), transactionErase(), transactionGet(), and transaction::uplevel.
Referenced by jtag_identify_devices().
int jtag_exchange_data | ( | int | len, | |
char * | data_out, | |||
char * | data_in | |||
) |
Place a value into the JTAG data register (DR) of the active device.
Each bit value is held within a single char.
It must be either 0 or 1 (but not '0' nor '1').
Note this function is called in an more or less "human readable notation" with
MSB shiftet in first and MSB shifted out first
while Hardware makes in real live;
LSB shifted in first and LSB shifted out first
So the bit order of the send and received data is swapped
len | number of data bit to send and receive | |
data_out | pointer to string of bits send to the DR. | |
data_in | pointer to string of bits received from the DR. |
References active_jtag_device, DBG_LEVEL_JTAG_INSTR, IF_DBG, transaction::parameter, tap_data(), transactionActivate(), transactionCreate(), transactionErase(), transactionGet(), and transaction::uplevel.
Referenced by jt_str91xflash_EraseSector(), jt_str91xflash_GetConfig(), jt_str91xflash_ReadSector(), jt_str91xflash_SectorBlankCheck(), jt_str91xflash_WriteSector(), jtag_arm720_CP15DataExchange(), jtag_arm720_CP15InstrReg(), jtag_arm7_mov_chain1_data(), jtag_arm920_CP15Interpret(), jtag_arm920_CP15PhysRegRead(), jtag_arm920_CP15PhysRegWrite(), jtag_arm926_CP15RegRead(), jtag_arm926_CP15RegWrite(), jtag_arm966_CP15RegRead(), jtag_arm966_CP15RegWrite(), jtag_arm9_mov_chain1_data(), jtag_arm_IceRT_RegRead(), jtag_arm_IceRT_RegRead_Once(), jtag_arm_IceRT_RegWrite(), jtag_arm_IceRT_RegWrite_getPrevData(), jtag_arm_set_chain(), jtag_cortex_apacc_RegRead(), jtag_cortex_apacc_RegWrite(), jtag_cortex_dpacc_RegRead(), jtag_cortex_dpacc_RegWrite(), and jtag_identify_devices().
static int jt_info_idcode | ( | int | val | ) | [static] |
Extract all kind of informations located inside of the IDCODE and show them.
1 | if it is a valid idcode | |
0 | otherwise |
References ARM_CAP_E_HC, ARM_CAP_E_SC, ARM_CAP_HC, ARM_CAP_J_HC, ARM_CAP_J_SC, ARM_CAP_SC, ARM_DEV_NUM_CORE_ONLY, ARM_DEV_NUM_WITH_MMU, ARM_DEV_NUM_WITH_MMU_HALFSIZE_CACHE, ARM_DEV_NUM_WITH_MMU_TIGHTLY_COUP_MEM, ARM_DEV_NUM_WITH_MMU_V6, ARM_DEV_NUM_WITH_MPU, ARM_DEV_NUM_WITH_MPU_TIGHTLY_COUP_MEM, ARM_DEV_NUM_WITH_TIGHTLY_COUP_MEM, ARM_FAMILY_ARM10, ARM_FAMILY_ARM11, ARM_FAMILY_ARM7, ARM_FAMILY_ARM9, ARM_PART_ARM7_OR_ARM9, ARM_PART_ARM7_SOFT_CORE, ARM_PART_CORTEX_M3, translateID::armJtagID, DBG_LEVEL_GDB_ARM_INFO, dbgPrintf(), jedec_unknown, LAST_JEDEC_VENDOR, translateID::realJtagID, string_description::string, and unknown_description.
Referenced by jtag_identify_devices().
int jtag_identify_devices | ( | void | ) |
Try to identify the devices in the JTAG chain.
Currently the first ARM-device will be the active device in the chain.
References active_jtag_device, data_length_of_IDCODE, DBG_LEVEL_GDB_ARM_INFO, DBG_LEVEL_GDB_ARM_WARN, DBG_LEVEL_JTAG_INSTR, dbgPrintf(), chain_info::has_idcode, chain_info::idcode, IF_DBG, instr_idcode, chain_info::instr_len, instr_length, instr_stm32F10xTMC_length, instr_str91xFlash_idcode, instr_str91xFlash_length, jt_info_idcode(), jt_str91xflash_GetConfig(), jtag_data_IDcode, jtag_exchange_data(), jtag_exchange_instr(), jtag_send_instr(), jtag_supp_bitstr2int_MSB_First(), chain_info::next, chain_info::prev, STM32F10XXX_TMC_IDCODE_MSK, STM32F10XXX_TMC_IDCODE_PART, STR91X_ARM_IDCODE, STR91X_FLASH_IDCODE, STR91X_IR_SECURITY, tap_discover_chain(), tap_hard_reset(), tap_idle(), and tap_reset().
Referenced by jtag_arm_identify().
void jtag_eos | ( | int | now | ) |
End Of Sequence
This Signal set TAP controller into run/idle state.
Step from RESET, Update-DR, Update-IR or Run/Idle state into Run/Idle state
e.g. this indicates an end of a debug communication and releases the CPU to work in non blocking normal mode.
now | set 1 to enter TAP Run/Idle state now |
References tap_idle().
Referenced by gdb_restart(), jt_str91xflash_EraseSector(), jt_str91xflash_ReadSector(), jt_str91xflash_SectorBlankCheck(), jt_str91xflash_WriteSector(), jtag_arm720_CP15_FlushCache(), jtag_arm720_CP15_ReadFCSEpidReg(), jtag_arm720_CP15_ReadMMUcontrolReg(), jtag_arm720_CP15_ReadTTB(), jtag_arm720_CP15_WriteMMUcontrolReg(), jtag_arm720_CP15_WriteTTB(), jtag_arm7_mov_chain1_data(), jtag_arm7_ReadCP15Info(), jtag_arm7_ReadCpuRegs(), jtag_arm9_mov_chain1_data(), jtag_arm9_ReadCpuRegs(), jtag_arm_chain1_sysspeed_restart(), jtag_arm_FinalExitDebug(), jtag_arm_IceRT_PutAnyBreakPoint(), jtag_arm_iceRT_StopRunningProgram(), jtag_arm_Mointor2DebugMode(), jtag_arm_RunProgram(), jtag_arm_Step(), jtag_cortex_AHB_WriteByte(), jtag_cortex_AHB_WriteHalfword(), jtag_cortex_AHB_WriteMemoryBuf(), jtag_cortex_AHB_WriteWord(), jtag_cortex_apacc_RegRead(), jtag_cortex_apacc_RegWrite(), jtag_cortex_core_ApplicationInterruptResetControl_ReadRegister(), jtag_cortex_core_BusFaultAddress_ReadRegister(), jtag_cortex_core_ConfigurationControl_ReadRegister(), jtag_cortex_core_CPUID_ReadRegister(), jtag_cortex_core_debugExceptionMonitorControl_ReadRegister(), jtag_cortex_core_DebugFaultStatus_ReadRegister(), jtag_cortex_core_debugHaltingControlStatus_ReadRegister(), jtag_cortex_core_HardFaultStatus_ReadRegister(), jtag_cortex_core_MemManageAddress_ReadRegister(), jtag_cortex_core_PollDbgState(), jtag_cortex_core_ReadCpuRegs(), jtag_cortex_core_ReadDebugReg(), jtag_cortex_core_restart(), jtag_cortex_core_RunProgram(), jtag_cortex_core_StopRunningProgram(), jtag_cortex_core_WriteCpuRegs(), jtag_cortex_dwt_comp_RegRead(), jtag_cortex_dwt_ctrl_RegRead(), jtag_cortex_dwt_function_RegRead(), jtag_cortex_dwt_mask_RegRead(), jtag_cortex_fpb_comp_RegRead(), jtag_cortex_fpb_ctrl_RegRead(), and jtag_test().
void jtag_start | ( | void | ) |
Power on to adapter at LPT-driver cable.
Issue TAP - Reset.
Enter Run/idle state
- |
References tap_start().
Referenced by gdb_restart().
void jtag_reset | ( | void | ) |
run trough tap states until reaching RESET state
- |
References tap_reset().
Referenced by gdb_restart(), and jtag_test().
void jtag_hard_reset | ( | void | ) |
grant TRESET and SRESET lines (if exists)
grant Sytem reset for timeline of tap_grant_sreset_timout
continue after tap_settle_system_timeout
- |
References tap_hard_reset().
Referenced by gdb_restart(), and jtag_test().
void jtag_linger | ( | int | delay | ) |
Call tap_delay a number of times.
Delay by reading value from LPT status port (using inb())
delay | number |
References tap_delay().
Referenced by jtag_arm_chain1_sysspeed_restart().
char jedec_unknown[] = "vendor unknown" [static] |
Referenced by jt_info_idcode().
const char instr_extest[] = {0,0,0,0,'$'} |
const char instr_scan_n[] = {0,0,1,0,'$'} |
Referenced by jtag_arm_set_chain().
const char instr_sample[] = {0,0,1,1,'$'} |
const char instr_restart[] = {0,1,0,0,'$'} |
Referenced by jtag_arm_chain1_sysspeed_restart(), jtag_arm_FinalExitDebug(), jtag_arm_RunProgram(), and jtag_arm_Step().
const char instr_clamp[] = {0,1,0,1,'$'} |
const char instr_highz[] = {0,1,1,1,'$'} |
const char instr_dapabort[] = {1,0,0,0,'$'} |
const char instr_clampz[] = {1,0,0,1,'$'} |
const char instr_dpacc[] = {1,0,1,0,'$'} |
Referenced by jtag_cortex_dpacc_RegRead(), and jtag_cortex_dpacc_RegWrite().
const char instr_apacc[] = {1,0,1,1,'$'} |
Referenced by jtag_cortex_apacc_RegRead(), and jtag_cortex_apacc_RegWrite().
const char instr_intest[] = {1,1,0,0,'$'} |
Referenced by jt_amdflashProgByte_faster(), jt_amdflashProgHalfword_faster(), jt_amdflashProgWord_faster(), jtag_arm720_CP15DataExchange(), jtag_arm720_CP15InstrReg(), jtag_arm920_CP15_CleanDcache(), jtag_arm920_CP15_DrainWriteBuffer(), jtag_arm920_CP15_InvalidateICache(), jtag_arm920_CP15_InvalidateTLB(), jtag_arm920_CP15_ReadDTTB(), jtag_arm920_CP15_ReadITTB(), jtag_arm920_CP15Interpret(), jtag_arm920_CP15PhysRegRead(), jtag_arm920_CP15PhysRegWrite(), jtag_arm926_CP15RegRead(), jtag_arm926_CP15RegWrite(), jtag_arm966_CP15RegRead(), jtag_arm966_CP15RegWrite(), jtag_arm_chain1_sysspeed_restart(), jtag_arm_IceRT_RegRead(), jtag_arm_IceRT_RegRead_Once(), jtag_arm_IceRT_RegWrite(), jtag_arm_IceRT_RegWrite_getPrevData(), jtag_arm_PrepareExitDebug(), jtag_arm_ReadByte(), jtag_arm_ReadCpuRegs(), jtag_arm_ReadHalfword(), jtag_arm_ReadWord(), jtag_arm_ReadWordMemory(), jtag_arm_ResynchStep(), jtag_arm_RunProgram(), jtag_arm_Step(), jtag_arm_WriteByte(), jtag_arm_WriteCpuRegs(), jtag_arm_WriteHalfword(), jtag_arm_WriteMemoryBuf(), and jtag_arm_WriteWord().
const char instr_idcode[] = {1,1,1,0,'$'} |
Referenced by jtag_identify_devices().
const char instr_bypass[] = {1,1,1,1,'$'} |
const int instr_length = 4 |
Referenced by jtag_identify_devices().
char jtag_data_IDcode[32] [static] |
Referenced by jtag_identify_devices().
const int data_length_of_IDCODE = 32 [static] |
Referenced by jtag_identify_devices().
int active_jtag_device = 0 |
chain number of active JTAG device
Referenced by jt_str91xflash_EraseSector(), jt_str91xflash_GetConfig(), jt_str91xflash_ReadSector(), jt_str91xflash_SectorBlankCheck(), jt_str91xflash_WriteSector(), jtag_exchange_data(), jtag_exchange_instr(), and jtag_identify_devices().
const char instr_str91xFlash_bypass[] = {1,1,1,1, 1,1,1,1, '$'} |
0xFF Bypass 1 bit len
const char instr_str91xFlash_idcode[] = {1,1,1,1, 1,1,1,0, '$'} |
0xFE Idcode 32 bit len
Referenced by jtag_identify_devices().
const char instr_str91xFlash_usercode[] = {0,0,0,0, 0,1,1,0, '$'} |
0x06 Usercode 32 bit len
const char instr_str91xFlash_isc_configuration[] = {0,0,0,0, 0,1,1,1, '$'} |
0x07 Sector-Protect 64 bit len
Referenced by jt_str91xflash_GetConfig().
const char instr_str91xFlash_isc_enable[] = {0,0,0,0, 1,1,0,0, '$'} |
0x0C ISC_Enable 8 bit len
Referenced by jt_str91xflash_EraseSector(), jt_str91xflash_ReadSector(), jt_str91xflash_SectorBlankCheck(), and jt_str91xflash_WriteSector().
const char instr_str91xFlash_isc_disable[] = {0,0,0,0, 1,1,1,1, '$'} |
0x0F ISC_Default 8 bit len
Referenced by jt_str91xflash_EraseSector(), jt_str91xflash_ReadSector(), jt_str91xflash_SectorBlankCheck(), and jt_str91xflash_WriteSector().
const char instr_str91xFlash_isc_noop[] = {0,0,0,1, 0,0,0,0, '$'} |
0x10 ISC_Default 8 bit len
Referenced by jt_str91xflash_EraseSector(), jt_str91xflash_ReadSector(), jt_str91xflash_SectorBlankCheck(), and jt_str91xflash_WriteSector().
const char instr_str91xFlash_isc_address_shift[] = {0,0,0,1, 0,0,0,1, '$'} |
0x11 ISC_Address 8 bit len
Referenced by jt_str91xflash_ReadSector(), and jt_str91xflash_WriteSector().
const char instr_str91xFlash_isc_clr_status[] = {0,0,0,1, 0,0,1,1, '$'} |
0x13 ISC_Default 8 bit len
Referenced by jt_str91xflash_EraseSector(), jt_str91xflash_ReadSector(), jt_str91xflash_SectorBlankCheck(), and jt_str91xflash_WriteSector().
const char instr_str91xFlash_isc_program[] = {0,0,1,0, 0,0,0,0, '$'} |
0x20 ISC_Data 64 bit len
Referenced by jt_str91xflash_WriteSector().
const char instr_str91xFlash_isc_program_security[] = {0,0,1,0, 0,0,1,0, '$'} |
0x22 ISC_Default 8 bit len
const char instr_str91xFlash_isc_program_uc[] = {0,0,1,0, 0,0,1,1, '$'} |
0x23 Usercode 32 bit len
const char instr_str91xFlash_isc_erase[] = {0,0,1,1, 0,0,0,0, '$'} |
0x30 ISC_Sector 64 bit len
Referenced by jt_str91xflash_EraseSector().
const char instr_str91xFlash_isc_read[] = {0,1,0,1, 0,0,0,0, '$'} |
0x50 ISC_Data 64 bit len
Referenced by jt_str91xflash_ReadSector().
const char instr_str91xFlash_isc_blank_check[] = {0,1,1,0, 0,0,0,0, '$'} |
0x60 ISC_Sector 64 bit len
Referenced by jt_str91xflash_EraseSector(), and jt_str91xflash_SectorBlankCheck().
const int instr_str91xFlash_length = 8 |
Referenced by jtag_identify_devices().
const int instr_stm32F10xTMC_length = 5 |
Referenced by jtag_identify_devices().
struct string_description dev_description[] [static] |
struct string_description cap_description[] [static] |
char unknown_description[] = "unknown" [static] |
Referenced by jt_info_idcode().
struct translateID translateID[] [static] |