📄 jtag_rdi.cpp
字号:
* OK: codes dependent on type
* Error: codes dependent on type
* Error: RDIError_UnimplementedMessage (unimplemented functions)
*/
int MyRDI_InfoProc(void *, unsigned type, ARMword *arg1, ARMword *arg2)
{
OutputDebugString("MyRDI_InfoProc");
return RDIError_UnimplementedMessage;
}
/*
* Function: RDI_PointinqProc
* Purpose: Breakpoint or watchpoint inquiry.
* Used to check before setbreak or setwatch is used.
* Returns what will happen if a corresponding call is made
* to setbreak or setwatch.
*
* Params:
* Input: mh handle identifies processor
* Input: type see setbreak or setwatch for definition
* Input: datatype 0 breakpoint
* != 0 see setwatch for definition
* InOut: *address
* In: address of point
* Out: set to actual value that will be used
* InOut: *bound
* In: upper address range
* Out: set to actual value that will be used
* @@@ MJW notes: it's not passed a ThreadHandle
* Output: none
*
* Returns:
* OK: RDIError_NoError
* Error: RDIError_NoMorePoints (if cannot set)
*/
int MyRDI_PointInquiryProc(RDI_ModuleHandle, ARMword *address, unsigned type, unsigned datatype, ARMword *bound)
{
OutputDebugString("MyRDI_PointInquiryProc");
return RDIError_NoMorePoints;
}
/*
* Function: RDI_AddConfigProc
* Purpose: Declares the size of a config block about to be loaded.
* Only use if RDIInfo_DownLoad returns no error.
*
* Params:
* Input: agent handle identifies degug agent
*
* nbytes size of configuration block to follow
*
* Returns:
* OK: RDIError_NoError
* Error: RDIError_UnimplementedMessage (unimplemented functions)
*/
int MyRDI_AddConfigProc(RDI_AgentHandle agent, unsigned32 nbytes)
{
OutputDebugString("MyRDI_AddConfigProc");
return RDIError_UnimplementedMessage;
}
/*
* Function: RDI_LoadConfigDataProc
* Purpose: Loads the config block.
* The block specifies target-dependent information to the
* debuggee. (e.g. ICEman)
* Only use if RDIInfo_DownLoad returns no error.
*
* Params:
* Input: agent handle identifies debug agent
*
* nBytes size of block (as declared in addconfig)
*
* data source of block
*
* Returns:
* OK: RDIError_NoError
* Error: RDIError_UnimplementedMessage (unimplemented functions)
*/
int MyRDI_LoadConfigDataProc(RDI_AgentHandle agent, unsigned32 nbytes, char const *data)
{
OutputDebugString("MyRDI_LoadConfigDataProc");
return RDIError_UnimplementedMessage;
}
/*
* Function: RDI_SelectConfigProc
* Purpose: Selects which of the loaded config blocks should be used
* and then reinitialises the Debuggee to use the selected
* config data.
* Only use if RDIInfo_DownLoad returns no error.
*
* Params:
* Input: mh handle identifies processor
* > ISSUE < Specification says 'processor', but
* implmentation says 'agent'. Surely processor
* is required, in case the aspect = ConfigCPU.
*
* aspect RDI_ConfigCPU or RDI_ConfigSystem
*
* name name of the configuration to be selected
*
* matchtype specifies exactly how the version number
* must be matched
* RDI_MatchAny
* RDI_MatchExactly
* RDI_MatchNoEarlier
*
* versionreq the version number requested
*
* Output: *versionp the version actually selected
*
* Returns:
* OK: RDIError_NoError
* Error: RDIError_UnimplementedMessage (unimplemented functions)
*/
int MyRDI_SelectConfigProc(RDI_AgentHandle, RDI_ConfigAspect aspect, char const *name, RDI_ConfigMatchType matchtype, unsigned versionreq, unsigned *versionp)
{
OutputDebugString("MyRDI_SelectConfigProc");
return RDIError_UnimplementedMessage;
}
/*
* Function: RDI_LoadAgentProc
* Purpose: Loads a replacement EmbeddedICE ROM image, and starts it
* (in RAM).
* Only if RDIInfo_Target returns a value with
* RDITarget_CanReloadAgent set.
*
* Params:
* Input: agent handle identifies agent
* Input: dest address in the Debuggee's memory where the new
* version will be put
* Input: size size of the new version
* Input: getb a function that can be called (with getbarg as
* the first argument) and the number of bytes to
* down load as the second argument.
* InOut: none
* Output: none
*
* Returns:
* OK: RDIError_NoError
* Error: RDIError_UnimplementedMessage (unimplemented functions)
*/
int MyRDI_LoadAgentProc(RDI_AgentHandle, ARMword dest, unsigned32 size, RDI_GetBufferProc *getb, RDI_GetBufferArg *getbarg)
{
OutputDebugString("MyRDI_LoadAgentProc");
return RDIError_UnimplementedMessage;
}
/*
* Function: RDI_TargetIsDeadProc
* Purpose: Used to inform local device drivers that a remote
* (typically hardware) debuggee is unresponsive.
*
* Params:
* Input: agent
*
* Returns:
* OK: RDIError_NoError
* Error: RDIError_UnimplementedMessage
*/
int MyRDI_TargetIsDeadProc(RDI_AgentHandle agent)
{
OutputDebugString("MyRDI_TargetIsDeadProc");
return RDIError_UnimplementedMessage;
}
/*
* Function: RDI_ErrMessProc
* Purpose: Gets an error message corresponding to the error number.
*
* Params:
* Input: agent
* Input: buflen length of the buffer
* Input: errnum the error number
* InOut: none
* Output: buf destination for the message
*
* Returns: errmessproc returns the number of bytes written,
* rather than an RDIError
*/
int MyRDI_ErrMessProc(RDI_AgentHandle agent, char *buf, int buflen, int errnum)
{
OutputDebugString("MyRDI_ErrMessProc");
strncpy(buf, "Unknown error", buflen);
return (buf[buflen-1] ? buflen : (int)strlen(buf)+1);
}
/*
* Function: RDI_CPUNamesProc and RDI_DriverNamesProc
* Purpose: Get a list of names.
* The returned structure contains the number of names
* and a list of pointers to the sz names.
* The index to the chosen name is used in RDI 1.0 only:
* RDI_ConfigBlock.procesor (RDI 1.0)
* RDI_ConfigBlock.drivertype
* This is used to select a harware driver for the target
* or a processor from a processor family.
* E.g. If the processor family was PROCESSOR_ARM
* the list would show the members of that family
* (ARM6, ARM7 etc.)
* Params:
* Input: handle handle identifies processor in cpunames
* RDI_NoHandle for drivernames
* (i.e. target hadware configuration)
* InOut: none
* Output: none
*
* Returns:
* OK: RDI_NameList
* Error: none
*/
RDI_NameList const *MyRDI_NameListProc(RDI_AgentHandle handle)
{
OutputDebugString("MyRDI_NameListProc");
static RDI_NameList nameList;
nameList.itemmax = 0;
//nameList.names[0] = "Default";
return &nameList;
}
//////////////////////////////////////////////////////////////////////////////
// InitProcVec //
//////////////////////////////////////////////////////////////////////////////
void InitProcVec()
{
strcpy(procVec.rditypename, "JTAG");
procVec.openagent = MyRDI_OpenAgentProc;
procVec.closeagent = MyRDI_CloseAgentProc;
procVec.open = MyRDI_OpenProc;
procVec.close = MyRDI_CloseProc;
procVec.read = MyRDI_ReadProc;
procVec.write = MyRDI_WriteProc;
procVec.CPUread = MyRDI_CPReadProc;
procVec.CPUwrite = MyRDI_CPUWriteProc;
procVec.CPread = MyRDI_CPReadProc;
procVec.CPwrite = MyRDI_CPWriteProc;
procVec.setbreak = MyRDI_SetBreakProc;
procVec.clearbreak = MyRDI_ClearBreakProc;
procVec.setwatch = MyRDI_SetWatchProc;
procVec.clearwatch = MyRDI_ClearWatchProc;
procVec.execute = MyRDI_ExecuteProc;
procVec.step = MyRDI_StepProc;
procVec.info = MyRDI_InfoProc;
procVec.pointinquiry = MyRDI_PointInquiryProc;
// These three useable only if RDIInfo_DownLoad returns no error
procVec.addconfig = MyRDI_AddConfigProc;
procVec.loadconfigdata = MyRDI_LoadConfigDataProc;
procVec.selectconfig = MyRDI_SelectConfigProc;
procVec.drivernames = MyRDI_NameListProc;
procVec.cpunames = MyRDI_NameListProc;
procVec.errmess = MyRDI_ErrMessProc;
// Only if RDIInfo_Target returns a value with RDITarget_LoadAgent set
procVec.loadagent = MyRDI_LoadAgentProc;
procVec.targetisdead = MyRDI_TargetIsDeadProc;
}
//////////////////////////////////////////////////////////////////////////////
// //
//////////////////////////////////////////////////////////////////////////////
BOOL WINAPI WinRDI_Valid_RDI_DLL(void)
{
OutputDebugString("WinRDI_Valid_RDI_DLL");
InitProcVec();
return TRUE;
}
int WINAPI WINAPI WinRDI_GetVersion(void)
{
OutputDebugString("WinRDI_GetVersion");
return WinRDI_Version;
}
unsigned WINAPI WinRDI_Info(toolconf config, unsigned reason, void *arg1, void *arg2)
{
OutputDebugString("WinRDI_Info");
//tag_t tag;
//const char *s = ToolConf_Lookup(config, tag);
switch (reason)
{
case WinRDIInfo_ControllerCapabilities:
{
//In: *((uint32 *)arg1) = Bitfield describing controller capabilities
int arg1i = *((unsigned int *)arg1);
if (arg1i & RDIControllerCapability_ETMModules) return RDIError_IncompatibleRDILevels;
if (arg1i & RDIControllerCapability_SelfDescribingModules) return RDIError_IncompatibleRDILevels;
if (arg1i & RDIControllerCapability_Trace) return RDIError_IncompatibleRDILevels;
return RDIError_NoError;
}
case WinRDIInfo_TargetCapabilities:
{
//Out: *((unsigned int *)arg1 Target capability bitfield
//Out: *((unsigned int *)arg2 Level of understanding bitfield
*(unsigned int *)arg1 = 0;
*(unsigned int *)arg2 = 0;
return RDIError_NoError;
}
case WinRDIInfo_ConfigInPlace:
{
// arg1(in): (WinRDIConfigInPlace_ParameterBlock *)arg1 = Parent window and rectangle information
// If (arg1 == NULL), this is simply an inquiry call
// arg2(out): *(HWND *)arg2 = Output handle of child window
return RDIError_UnimplementedMessage;
}
}
return 0;
}
char * WINAPI WinRDI_Get_DLL_Description(void)
{
OutputDebugString("WinRDI_Get_DLL_Description");
return // limited to 200 characters
"Remote Debugging Interface for JTAG in-circuit debugging"
;
}
RDI_ProcVec * WINAPI WinRDI_GetRDIProcVec(void)
{
OutputDebugString("WinRDI_GetRDIProcVec");
return &procVec;
}
int WINAPI WinRDI_Download(int *options, char const *filename)
{
OutputDebugString("WinRDI_Download");
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -