⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rdi100.h

📁 做ARM仿真器和调试器的厂商需要RDI协议
💻 H
📖 第 1 页 / 共 2 页
字号:
/* RDI 1.0 defintions
   Copyright (C) 2001 Free Software Foundation, Inc.


This file is part of GDB.


GDB is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.


GDB is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.


You should have received a copy of the GNU General Public License
along with GDB; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.  */


/*
 * RCS $Revision: 1.10 $
 * Checkin $Date: 2000/09/12 10:09:53 $
 * Revising $Author: hbullman $
 */

#ifndef rdi100_h
#define rdi100_h

#if RDI_VERSION == 100
#  define RDI100_OpenProc RDI_OpenProc
#  define RDI100_CloseProc RDI_CloseProc
#  define RDI100_ReadProc RDI_ReadProc
#  define RDI100_WriteProc RDI_WriteProc
#  define RDI100_CPUReadProc RDI_CPUReadProc
#  define RDI100_CPUWriteProc RDI_CPUWriteProc
#  define RDI100_CPReadProc RDI_CPReadProc
#  define RDI100_CPWriteProc RDI_CPWriteProc
#  define RDI100_SetBreakProc RDI_SetBreakProc
#  define RDI100_ClearBreakProc RDI_ClearBreakProc
#  define RDI100_SetWatchProc RDI_SetWatchProc
#  define RDI100_ClearWatchProc RDI_ClearWatchProc
#  define RDI100_ExecuteProc RDI_ExecuteProc
#  define RDI100_StepProc RDI_StepProc
#  define RDI100_InfoProc RDI_InfoProc
#  define RDI100_PointInquiryProc RDI_PointInquiryProc
#  define RDI100_AddConfigProc RDI_AddConfigProc
#  define RDI100_LoadConfigDataProc RDI_LoadConfigDataProc
#  define RDI100_SelectConfigProc RDI_SelectConfigProc
#  define RDI100_NameListProc RDI_NameListProc
#  define RDI100_ErrMessProc RDI_ErrMessProc
#  define RDI100_LoadAgentProc RDI_LoadAgentProc
#  define RDI100_TargetIsDeadProc RDI_TargetIsDeadProc
#  define RDI100_ProcVec RDI_ProcVec
#  define RDI100_ConfigPointer RDI_ConfigPointer
#endif

/*
 * RDI Implementation Prototypes
 */


/*
 * Function:    RDI_OpenProc
 *  Purpose:    This is the Initialization routine and as such is the first
 *              call made to the RDI. It allows the program to set up the
 *              initial debuggee working environment. It will be called
 *              later if the emulator is to be reset. There are hot and
 *              cold calls. On the very first cold call is equivalent to a
 *              constructor when memory should be claimed.
 *              The initialization also provides a console window for
 *              reading and writing text. This can be used now and in the
 *              future for messages. The call provides information on the
 *              settings on the debugger.
 *
 *  Pre-conditions:
 *
 *  Params:
 *      Input:  type
 *                  b0          0   cold start
 *                              1   warm start
 *                  b1          1   reset the comms link
 *                  b2          0/1 little/big endian
 *                  b3          1   return endian
 *
 *              config          structure containing configuration
 *                              information
 *
 *              hostif          used for reading/writing to a console
 *
 *              dbg_state       handle to identify the current Debugger
 *                              state
 *
 *  Returns:                                 b3     b2
 *      Error:  RDIError_SoftInitialiseError X      X   If things go wrong!
 *      Error:  RDIError_WrongByteSex        0      E   bad match
 *      OK:     RDIError_NoError             0      E   match
 *      OK:     RDIError_LittleEndian        1      X
 *      OK:     RDIError_BigEndian           1      X
 */

typedef struct RDI_ConfigBlock *RDI100_ConfigPointer;

typedef int RDI100_OpenProc(
    unsigned type, struct RDI_ConfigBlock const *config,
    struct RDI_HostosInterface const *i, RDI_DbgState *dbg_state);


/*
 * Function:    RDI_CloseProc
 *  Purpose:    Close down
 *
 *  Params:     
 *
 *  Returns:    RDIError_NoError
 */
typedef int RDI100_CloseProc(void);


/*
 * Function:    RDI_ReadProc
 *  Purpose:    Read memory contents in byte format from the debuggee.
 *              read *nbytes of data from source address and write to dest
 *              in the caller's address space using the processor specified.
 *
 *              Assuming nothing went wrong with the transfer, the debuggee
 *              will normally return RDIError_NoError.  However, if the
 *              debuggee has changed its byte sex, it should return a
 *              notification of this change, i.e. either RDIError_BigEndian
 *              or RDI_ErrorLittleEndian; the caller must then acknowledge
 *              this notification by calling RDI_Info RDIInfo_AckByteSex.
 *              The debuggee will keep returning this notification until an
 *              acknowledgement has been received.
 *
 *  Params:
 *      Input:  source      address
 *
 *      In/Out: *nbytes     In:  number of bytes to read
 *                          Out: number of bytes actually read
 *
 *      Output: *dest       destination buffer
 *
 *  Returns:
 *      OK:     RDIError_NoError
 *              RDIError_BigEndian
 *              RDIError_LittleEndian
 *      Error:  RDIError_DataAbort  (if a memory exception occurs)
 */
typedef int RDI100_ReadProc(ARMword source, void *dest, unsigned *nbytes);


/*
 * Function:    RDI_WriteProc
 *  Purpose:    Write memory contents in byte format to the debuggee.
 *              read *nbytes of data from source address in the caller's
 *              address space, and write to dest using the processor specified.
 *
 *              Assuming nothing went wrong with the transfer, the debuggee
 *              will normally return RDIError_NoError.  However, if the
 *              debuggee has changed its byte sex, it should return a
 *              notification of this change, i.e. either RDIError_BigEndian
 *              or RDI_ErrorLittleEndian; the caller must then acknowledge
 *              this notification by calling RDI_Info RDIInfo_AckByteSex.
 *              The debuggee will keep returning this notification until an
 *              acknowledgement has been received.
 *
 *  Params:
 *      Input:  source      source buffer
 *
 *              dest        destination address
 *
 *      In/Out: *nbytes     In:  number of bytes to write
 *                          Out: number of bytes actually written
 *
 *  Returns:
 *      OK:     RDIError_NoError
 *              RDIError_BigEndian
 *              RDIError_LittleEndian
 *      Error:  RDIError_DataAbort  (if a memory exception occurs)
 */
typedef int RDI100_WriteProc(
    const void *source, ARMword dest, unsigned *nbytes);

/*
 * Function:    RDI_CPUreadProc
 *  Purpose:    Read the register content from the specified processor.
 *              The mask specifies which register(s) are to be transferred
 *              as 32-bit ARMwords.
 *              The mask has been extended to support more than 32 registers
 *  Params:
 *      Input:  mode        mode defines register context
 *                          ARM
 *                              RDIMode_Curr    use the current mode
 *                              Other values match the mode bits of the PSR.
 *                          PICCOLO *** Use of Piccolo is obsolete ***
 *                              RDIModeBankX    Transfer registers
 *                                              from bankX
 *
 *      Input:  mask[]      bits defining which registers are to be
 *                          transferred. These bits can be ORed to read any
 *                          combination of registers.
 *                          ARM
 *                              b0 - b14    r0 - r14
 *                              b15         Reserved.  Targets must ignore b15.
 *                                          Controllers must not set b15
 *                              RDIReg_PC   Just the program counter
 *                              RDIReg_CPSR CPSR register
 *                              RDIReg_SPSR SPSR register
 *
 *      Output: state[]     destination array of ARMwords
 *
 *  Returns:
 *      OK:     RDIError_NoError
 *      Error:  error code
 */
typedef int RDI100_CPUReadProc(unsigned mode, unsigned32 mask, ARMword *state);


/*
 * Function:    RDI_CPUwriteProc
 *  Purpose:    Write the register content to the specified processor.
 *              The mask specifies which register(s) are to be transferred
 *              as 32-bit ARMwords. The mask has been extended to support
 *              more than 32 registers in RDI2.
 *
 *  Params:
 *      Input:  mode        mode defines register context
 *                          ARM
 *                              RDIMode_Curr    use the current mode
 *                              Other values match the mode bits of the PSR.
 *      Input:  mask[]      bits defining which registers are to be
 *                          transferred. These bits can be ORed to read any
 *                          combination of registers.
 *                          ARM
 *                              b0 - b14    r0 - r14
 *                              b15         Reserved.  Targets must ignore b15.
 *                                          Controllers must not set b15
 *                              RDIReg_PC   Just the program counter
 *                              RDIReg_CPSR CPSR register
 *                              RDIReg_SPSR SPSR register
 *      Input:  state[]     source array of ARMwords
 *      InOut:  none
 *      Output: none
 *
 *  Returns:
 *         OK:  RDIError_NoError
 *     Not OK:  RDIError_ReadOnly - if writing is not allowed at this time
 *      Error:  error code
 */
typedef int RDI100_CPUWriteProc(
    unsigned mode, unsigned32 mask, ARMword const *state);


/*
 * Function:    RDI_CPreadProc
 *  Purpose:    Read the register content from the specified coprocessor.
 *              The mask specifies which register(s) are to be transferred
 *              as 32-bit ARMwords.
 *
 *              Each coprocessor will have its own register set defined in
 *              another header file. The actual registers transferred, and
 *              their size is dependent on the coprocessor specified.
 *
 *  Params:
 *      Input:  CPnum       coprocessor number for this processor
 *      Input   mask[]      bits define which registers are to be transferred
 *      InOut:  none
 *      Output: state[]     destination array for register values
 *
 *  Returns:
 *      OK:     RDIError_NoError
 *      Error:  error code
 */
typedef int RDI100_CPReadProc(unsigned CPnum, unsigned32 mask, ARMword *state);

/*
 * Function:    RDI_CPwriteProc
 *  Purpose:    Write the register content to the specified coprocessor.
 *              The mask specifies which register(s) are to be transferred
 *              as 32-bit ARMwords.
 *
 *              Each coprocessor will have its own register set defined in
 *              another header file. The actual registers transferred, and
 *              their size is dependent on the coprocessor specified.
 *
 *  Params:
 *      Input:  CPnum       coprocessor number for this processor
 *      Input   mask[]      bits define which registers are to be transferred
 *      Input:  state[]     source array of register values
 *      InOut:  none
 *      Output: none
 *
 *  Returns:
 *      OK:     RDIError_NoError
 *      Error:  error code
 */
typedef int RDI100_CPWriteProc(
    unsigned CPnum, unsigned32 mask, ARMword const *state);


/*
 * Function:    RDI_SetBreakProc
 *  Purpose:    Set a breakpoint in the debuggee.
 *
 *  Params:
 *      Input:  address     address of breakpoint
 *      Input:  type        one of RDIPoint_ types
 *
 *   RDIPoint_EQ          equal to address
 *   RDIPoint_GT          greater than address
 *   RDIPoint_GE          greater than or equal to address
 *   RDIPoint_LT          less than address
 *   RDIPoint_LE          less than or equal to address
 *   RDIPoint_IN          in the range from address to bound, inclusive
 *   RDIPoint_OUT         not in the range from address to bound, inclusive
 *   RDIPoint_MASK        halt execution if (pc & bound) = address
 *   RDIPoint_16Bit       if set breakpoint is on 16-bit (Thumb) instruction
 *   RDIPoint_Conditional if set breakpoint only occurs when the
 *                        instructions condition is true.
 *
 *      Input:  bound       upper address range
 *      InOut:  none
 *      Output: *handle     A handle to identify the breakpoint
 *
 *  Returns:
 *      OK:     RDIError_NoError
 *      OK:     RDIError_NoMorePoints - successful,
 *                                      but no more points available
 *      Error:  RDIError_CantSetPoint
 */
typedef int RDI100_SetBreakProc(
    ARMword address, unsigned type, ARMword bound, RDI_PointHandle *handle);


/*
 * Function:    RDI_ClearBreakProc
 *  Purpose:    Clear a breakpoint in the debuggee.
 *
 *  Params:
 *      Input:  handle      identifies breakpoint
 *      InOut:  none
 *      Output: none
 *
 *  Returns:
 *      OK:     RDIError_NoError
 *      Error:  RDIError_NoSuchPoint
 */
typedef int RDI100_ClearBreakProc(RDI_PointHandle handle);


/*
 * Function:    RDI_SetWatchProc
 *  Purpose:    Set a watchpoint in the debuggee.
 *
 *  Params:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -