📄 estcpu32backend.h
字号:
#ifndef TGT_LINK_BDM_EST // Should be defined in tgtlib.h#define TGT_LINK_BDM_EST (0x201) /* EST BDM support */#endif////////////////////////////////////////////////////////////////////////////////// Declare back end class Est_T to operate EST's visionNET emulator.class Est_T;class Est_T : public Backend_T { public: // Constructors and Destructors. Est_T (char * tgtName, u_int timeout, u_int retryNum, char * devName, u_int param, TGT_OPS * pTgtOps, EXT_FUNCS * pExtFunc); virtual ~Est_T (); //////////////////////////////////////////////////////////////////////////// // Declare back end member functions which need to be overridden in // the vendor-specific back end. // Declaration of mandatory member functions. UINT32 tgtPing_m (void); UINT32 tgtConnect_m (WDB_TGT_INFO * pTgtInfo); UINT32 tgtDisconnect_m (void); UINT32 memRead_m (WDB_MEM_REGION * pMemRegion, WDB_MEM_XFER * pMemXfer); UINT32 memWrite_m (WDB_MEM_XFER * pMemXfer); UINT32 regsGet_m (WDB_REG_READ_DESC * pRegRead, WDB_MEM_XFER * pMemXfer); UINT32 regsSet_m (WDB_REG_WRITE_DESC * pRegWrite); UINT32 contextSuspend_m (WDB_CTX * pContext); UINT32 contextResume_m (WDB_CTX * pContext); UINT32 eventpointAdd_m (WDB_EVTPT_ADD_DESC * pEventPoint, UINT32 * pEvtptNum); UINT32 eventpointDelete_m (WDB_EVTPT_DEL_DESC * pEventpoint); UINT32 eventGet_m (WDB_EVT_DATA * pEvtData); UINT32 contextCont_m (WDB_CTX * pContext); UINT32 contextStep_m (WDB_CTX_STEP_DESC * pContextStep); BOOL evtPending_m (void); void evtPendingClear_m (void); UINT32 serviceCall_m (u_long procNum, FUNCPTR inProc, char * in, FUNCPTR outProc, char * out); BOOL freeResultArgs_m (void); // optional member functions#if 0 // the following methods should be supported when // EST's API supports them. UINT32 memScan_m (WDB_MEM_SCAN_DESC * pMemScan, TGT_ADDR_T * pAdrs); UINT32 memFill_m (WDB_MEM_REGION * pMemRegion); UINT32 memMove_m (WDB_MEM_REGION * pMemRegion);#endif UINT32 cacheTxtUpdate_m (WDB_MEM_REGION * pMemRegion); // Backend_T::memChecksum_m() is overridden only because // the EST API has low-bandwidth when reading target memory. UINT32 memChecksum_m (WDB_MEM_REGION * pMemRegion, UINT32 * pChecksumValue); //////////////////////////////////////////////////////////////////////////// // Helper Methods // mandatory helper methods virtual int fdGet_m (); // State management virtual UINT32 halt_m (); virtual UINT32 unhalt_m (); // vendor-specific helper methods // Special EST helper methods improve performance // by only accessing one register instead of the entire // register set. virtual UINT32 regGetOne_m (uint16 estRegNum, void * regValue); virtual UINT32 regSetOne_m (uint16 estRegNum, void * regValue); static Est_T * pTheEstBkEnd_s (); // handles asynchronous events in the EST API static void eventCallBack (EST_ConnectionHandle, EST_Event *, void *); // Exception state management UINT32 excStateEnter_m (BDM_EXC_INFO * pExcInfo); UINT32 excStateExit_m (BOOL doStep = TRUE); UINT32 excRegsGet_m (WDB_REG_READ_DESC * pRegRead, WDB_MEM_XFER * pMemXfer); BOOL isExcState_m (); //////////////////////////////////////////////////////////////////////////// // special types for dealing with target struct REG_SET_68K; // WRS's REG_SET definition for 68k // special constants for dealing with target // MaxMtu specifies the maximum number of bytes which the // EST back end will attempt to read or write with one call // to EST's API. // // XXX - 4096 is actual the maximum allowed by Ethernet, however // attempts to access more than 256 bytes per transaction cause the // API to fail. enum {MaxMtu = 256}; //////////////////////////////////////////////////////////////////////////// protected: UINT32 wdbErrFigure_m (const char * pStr, int status, UINT32 wdbDefaultCode); virtual void bpEventGen_m (); // Generate dummy BP event. // Converts a WRS register specification into EST's // enum value for the associated register. virtual UINT32 whichEstRegGet_m (UINT32 regSetOffset, EST_Register * pWhichEstReg, uint32 * pEstRegSize); UINT32 stateBKM_m (EST_OperatingMode & oldState); // Enter BKM mode UINT32 stateRestore_m (EST_OperatingMode oldState); // Return to old mode void eventQueuePut_m (Event_T * pEvent); void eventQueueGet_m (WDB_EVT_DATA * pWdbEvent); //////////////////////////////////////////////////////////////////////////// // Est_T member data static Est_T * pTheEstBkEnd_; // ptr to back end object. EST_ConnectionHandle emulator_; // specifies a connection via EST's API EST_OperatingMode oldTgtState_; // State of Target before halt_m (). // Event handling data int eventFd_; // file descriptor to wake target server on events. BOOL isEvent_; // True if there is an event on target. RWSlistCollectablesQueue eventQueue_; // FIFO Queue of emulator events // Exception state management data REG_SET_68K * pExcRegSet_; // IU Register Set of task causing exception. UINT excCount_; // counts levels of nested exceptions. };// End of class Est_T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// WRS's type definitions for the 68k's register set.//// This information must agree with the definition in// ${WIND_BASE}/target/h/regs.h which just// #includes the architecture-specific definition in// ${WIND_BASE}/target/h/arch/<cpuFamily>/regs<cpuFamily>.h.//// For example, this information comes from:// ${WIND_BASE}/target/h/arch/mc68k/regsMc68k.h.typedef unsigned short INSTR;struct Est_T::REG_SET_68K { ULONG dataReg[8]; /* data registers */ ULONG addrReg[8]; /* address registers */ USHORT pad; /* pad SR to a long */ USHORT sr; /* status register (must be second to last) */ INSTR *pc; /* program counter (must be last) */ }; #ifdef WIN32typedef struct wrs_reg_set_68k { ULONG dataReg[8]; /* data registers */ ULONG addrReg[8]; /* address registers */ USHORT pad; /* pad SR to a long */ USHORT sr; /* status register (must be second to last) */ INSTR *pc; /* program counter (must be last) */ } WRS_REG_SET_68K;#endif////////////////////////////////////////////////////////////////////////////////// Inline methodsinline Est_T * Est_T::pTheEstBkEnd_s () { return (pTheEstBkEnd_); }inline BOOL Est_T::isExcState_m () { return ((excCount_ > 0) ? TRUE : FALSE); }#endif /* #ifndef __INCestcpu32Backendh */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -