📄 loopback.c
字号:
/* loopback.c - loopback backend for loader tests *//* Copyright 1995-1998 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01j,15jun98,c_c Changed the init_2 routine to initialize to be in sync with the doc.01i,16feb98,lcs Change pWdbTgtInfo->rtInfo.rtVersion=0 to NULL since the field is defined to be a char * not an int01h,21jan98,c_c Implememted argument passing to get the cpu type. Changed the init interface to conform to V2.01g,26feb96,pad Conditionally included rpc/rpc.h01f,15jan96,elp added external function addresses variable + modified loopbackInit() to initialize this variable (WIN32)01e,24jul95,pad Changed memory size to maximum (0xffffffff).01d,08jun95,pad updated loopbackInit() with new parameters.01c,24may95,p_m removed logName from loopbackInit() parameters. + tpr made compatible with new WDB backend.01b,22mar95,pad simplified (!).01a,15mar95,pad written.*//*DESCRIPTIONThis file holds the minimum backend functions required to run the Target Serverwithout any Target Agent to connect to. The Target Server runs then in loopbackmode. This loopback backend has been developped solely to provide a way to getthe original .rms files required for the loader's non regression tests. It canbe connected only via wtxtcl requests (in particular windsh can't be used).It is not intented to be used beyond this goal.Only the following routines are provided: - loopbackInitialize () - loopbackTgtConnect () - loopbackCacheTextUpdate () - loopbackMemProtect ()These routines are merely fake backend routines that do nothing or only theminimum...In particular, there is no separate memory area to simulate the target'smemory. Everything is done in the Target Memory Image.*//* includes */#include "host.h"#include "tgtlib.h"#include "checksum.h"#include "wpwrutil.h"#include "flagutil.h"#include "bkendlib.h"/* loacals */static int loopbackCpuType = -1; /* cpu number passed with -cpu option */static FLAG_DESC loopbackFlags [] = { { "-cpu", NULL, (PARSE_RTN) flagInt, &loopbackCpuType, "-cpu\t\t\tLoopback Backend CPU number to emulate (mandatory)." }, {NULL, NULL, NULL, NULL, NULL} /* End Of Record */ };/* forward */LOCAL UINT32 loopbackWdbTgtConnect (WDB_TGT_INFO *);LOCAL UINT32 loopbackWdbMemTxtUpdate (WDB_MEM_REGION *);LOCAL UINT32 loopbackWdbMemProtect (WDB_MEM_REGION *);/********************************************************************************* loopbackFlagsGet - Get the supported flags for this backend** This function is called by the target server when it wants to get the flags* which are supported by the currently attached backend.** Here we return our supported flags.**/ DLL_EXPORT FLAG_DESC * loopbackFlagsGet (void) { return (FLAG_DESC *) loopbackFlags; } /********************************************************************************* loopbackInitialize - initialize the loopbak interface**/DLL_EXPORT STATUS loopbackInitialize ( char * tgtName, /* target name to connect to */ TGT_OPS * pTgtOps, /* backend function */ BKEND_INFO *bkInfo /* Backend info and select method */ ) { pTgtOps->tgtConnected = FALSE; pTgtOps->tgtLink.name = "Loopback Mode"; pTgtOps->tgtLink.type = 0; pTgtOps->tgtLink.speed = 0; pTgtOps->tgtEventFd = NULL; pTgtOps->tgtConnectRtn = loopbackWdbTgtConnect; pTgtOps->tgtDisconnectRtn = NULL; pTgtOps->freeResultArgsRtn = NULL; pTgtOps->memChecksumRtn = NULL; pTgtOps->memReadRtn = NULL; pTgtOps->memWriteRtn = NULL; pTgtOps->memFillRtn = NULL; pTgtOps->memProtectRtn = loopbackWdbMemProtect;#if 0 pTgtOps->memWriteManyRtn = NULL; pTgtOps->memWriteManyIntsRtn = NULL;#endif pTgtOps->contextCreateRtn = NULL; pTgtOps->contextKillRtn = NULL; pTgtOps->contextSuspendRtn = NULL; pTgtOps->contextResumeRtn = NULL; pTgtOps->regsGetRtn = NULL; pTgtOps->regsSetRtn = NULL; pTgtOps->vioWriteRtn = NULL; pTgtOps->evtptAddRtn = NULL; pTgtOps->evtptDeleteRtn = NULL; pTgtOps->tgtModeSetRtn = NULL; pTgtOps->eventGetRtn = NULL; pTgtOps->contextContRtn = NULL; pTgtOps->contextStepRtn = NULL; pTgtOps->funcCallRtn = NULL; pTgtOps->directCallRtn = NULL; pTgtOps->gopherEvalRtn = NULL; pTgtOps->memTxtUpdateRtn = loopbackWdbMemTxtUpdate; pTgtOps->bkendEvtPendingRtn = NULL; pTgtOps->bkendEvtPendingClearRtn = NULL; /* tell that we have no polling method */ bkInfo->INFO.POLLING_METHOD.bkEndPollingMethod = POLL_NONE_MODE; bkInfo->INFO.POLLING_METHOD.BKEND_NOTIF_METHOD.bkEndSelectRtn = NULL; return (OK); }/********************************************************************************* loopbackWdbTgtConnect - connect routine for loopback mode**/LOCAL UINT32 loopbackWdbTgtConnect ( WDB_TGT_INFO * pWdbTgtInfo ) { wpwrLogMsg ("Using loopback mode.\n"); if (loopbackCpuType == -1) { wpwrLogErr ("Loopback backend must be used with -cpu option\n"); return (ERROR); } pWdbTgtInfo->agentInfo.agentVersion = "LPBK 1.0"; pWdbTgtInfo->agentInfo.mtu = 0; pWdbTgtInfo->agentInfo.mode = 0; pWdbTgtInfo->rtInfo.rtType = 0; pWdbTgtInfo->rtInfo.rtVersion = NULL; pWdbTgtInfo->rtInfo.cpuType = loopbackCpuType; pWdbTgtInfo->rtInfo.hasFpp = 0; pWdbTgtInfo->rtInfo.hasWriteProtect = 0; pWdbTgtInfo->rtInfo.pageSize = 0; pWdbTgtInfo->rtInfo.endian = 0; pWdbTgtInfo->rtInfo.bspName = "loopback"; pWdbTgtInfo->rtInfo.bootline = NULL; pWdbTgtInfo->rtInfo.memBase = 0; pWdbTgtInfo->rtInfo.memSize = 0xffffffff; pWdbTgtInfo->rtInfo.numRegions = 1; pWdbTgtInfo->rtInfo.memRegion = NULL; pWdbTgtInfo->rtInfo.hostPoolBase = 0; pWdbTgtInfo->rtInfo.hostPoolSize = 0xffffffff; return (OK); }/********************************************************************************* loopbackWdbMemTxtUpdate - simulate the update of an instruction cache**/LOCAL UINT32 loopbackWdbMemTxtUpdate ( WDB_MEM_REGION * pWdbMemRegion /* cache region to update */ ) { return (OK); }/********************************************************************************* loopbackWdbMemProtect - fake memory protection routine**/LOCAL UINT32 loopbackWdbMemProtect ( WDB_MEM_REGION * pWdbMemRegion /* memory region to protect */ ) { return (OK); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -