📄 acecpu32.cpp
字号:
/* acecpu32.cpp - back end for ACE's CPU32 BDM emulator *//* Copyright 1996 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01j,13nov96,bss clean up.01i,03oct96,bss fixed clash between WRS's ERROR and MSVC's ERROR macros.01h,23jul96,bss Added support for constructor failure.01g,11jul96,bss WIN32 port. Added EXT_FUNC support.01f,01may96,bss tweaked comments.01e,30apr96,bss moved the back end connect/disconnect functionality into Ace_T.01d,26apr96,bss coding convention cleanup.01c,16apr96,bss minor changes for Backend_T interface change.01b,07mar96,bss revised for ACE API.01a,06dec95,bss written.*//*DESCRIPTIONacecpu32.cpp is the "main" file for Tornado back end support of ACE's SuperBDM emulator for Motorola CPU32 processors.By using this back end, the Tornado target server canuse ACE's SuperBDM emulator to provide debug agency forthe other Tornado tools. This scheme provides a powerful, system-level debugging capability, while consuming no target memory or I/O resources.This module is effectively the "main" of the back end:it is called by the target server to create the back endobject which performs the real work necessary to operate the ACE emulator. This vendor-specific, Ace_T back end class is defined in acecpu32Backend.h. Ace_T specializes the generic back end framework which is provided by the back end abstract base class, Backend_T, and ACE's C API to implementthe required back end services. Backend_T is defined in backend.h.The architecture of this module conforms to the following environment:when the target server is invoked, it loads a user-specifiedback end. After loading the back end, the target serverinvokes the back end's initialization function.This function must be named <backendName>Init.In the case of the acecpu32 back end, acecpu32Init()merely creates a single instance of the Ace_T back end object,which provides all other back end services.To use this back end, install the back end dynamically-linkedlibrary in ${WIND_BASE}/host/${WIND_HOST_TYPE}/lib/backend,and invoke the target server with the '-B' option to specifywhich back end to use: % tgtsvr ... -B acecpu32 <emulatorHostName> &where acecpu32 is the name of this back end, and <emulatorHostName> is the host name assigned tothe SuperBDM emulator.Caveats:The back end will not function correctly unlessthe emulator has been correctly configured withthe emulator's 'cf' and 'cs' commands. In particular,you must configure the chip-selects, and enable the locking of interrupts when single-stepping. For more information, see the _SuperICE and SuperBDM User's Manual_ from ACE and the application note,_Background Mode Debugging with ACE's SuperBDMEmulator_, provided with the back end.*//* includes */#ifdef WIN32/* fix clash between Wind River's ERROR and MSVC's ERROR macros. */#ifdef ERROR#undef ERROR#endif#include <windows.h>#endif /* #ifdef WIN32 */#include <fcntl.h>#include <signal.h>#ifndef WIN32#include <sys/filio.h>#include <sys/time.h>#endif/* re-enable Wind River's ERROR macro. */#ifdef WIN32#ifdef ERROR#undef ERROR#endif /* #ifdef ERROR */#define ERROR (-1)#endif /* #ifdef WIN32 */#include "host.h"#include "tgtlib.h"#include "wpwrutil.h"#include "checksum.h"#include "acecpu32Backend.h"/* forwards */// C linkage is needed so that the target server will// know the name of the initialization function.extern "C" STATUS acecpu32Init (char * tgtName, u_int timeout, u_int retryNum, char * devName, u_int param, TGT_OPS * pTgtOps, EXT_FUNCS * pExtFuncs);#ifndef WIN32/********************************************************************************* acecpu32SigInit - perform extra signal initialization needed by back end.** Masks SIGALRM which is sent by FlexLM. If SIGALRM is not masked,* select () calls in ACE API are aborted causing ACE_Service () to* fail. This is SPR 6343.*/LOCAL void acecpu32SigInit () { sigset_t ss; // set of signals to mask. // mask SIGALRM which is due to FlexLM. sigemptyset (&ss); sigaddset (&ss, SIGALRM); sigprocmask (SIG_BLOCK, &ss, NULL); }#endif /* #ifndef WIN32 *//********************************************************************************* acecpu32Init - initialize the acecpu32 interface.** The target server calls this function after loading the back end * in order to initialize the back end. This function allocates the back * end object, and initializes the TGT_OPS structure, which provides the* information the target server needs to operate the back end. The * back end objects's constructors do all of the actual work. This function* must have the name <backendName>Init, or acecpu32Init in the case* of the acecpu32 back end.*/STATUS acecpu32Init ( char * tgtName, /* target name to connect to */ u_int timeout, /* the default timeout value in second */ u_int recallNum, /* nb of time a request is send before timeout*/ char * pTtyDevName, /* serial line device name (unused) */ u_int baudRate, /* serial line baud rate (unused) */ TGT_OPS * pTgtOps, /* backend function */ EXT_FUNCS * pExtFuncs /* external functions addresses (WIN32)*/ ) { Backend_T * pTheBkEnd; // Signal Initialization. // // This is a work-around for SPR 6343: that FlexLM periodically // generates SIGALRMs, causing the ACE API's select() call // to abort. #ifndef WIN32 acecpu32SigInit (); #endif // Create Backend pTheBkEnd = new Ace_T (tgtName, timeout, recallNum, pTtyDevName, baudRate, pTgtOps, pExtFuncs); if (pTheBkEnd == NULL) { WPWR_LOG_ERR ("acecpu32Init(): new() failed.\n"); return (ERROR); } if ( ! pTheBkEnd->isValid_m ()) { WPWR_LOG_ERR ("acecpu32Init(): back end initialization failed.\n"); return (ERROR); } return (OK); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -