📄 rpccore.c
字号:
( WDB_CTX_STEP_DESC * pWdbContextStep /* context to step */ ) { /* * call the WDB_CONTEXT_STEP service via the backend client in order * to step a context pointed to by pContextStep. */ return (rpcCoreClntCall (WDB_CONTEXT_STEP, xdr_WDB_CTX_STEP_DESC, (char *) pWdbContextStep, xdr_void, NULL)); }/********************************************************************************* rpcCoreRegsGet - get target register value(s)** This function gets target cpu register value(s). The register values to* obtain are described by a REG_READ structure pointed to by <pRegRead>. The* WDB_REGS_GET service is called via the backend client. The WDB target agent* replies by a MEM_XFER structure. If an error occurs or the RPC request fails* the MEM_XFER errCode field will handle the error number.** RETURNS: Always a pointer to a MEM_XFER structure.*/LOCAL UINT32 rpcCoreRegsGet ( WDB_REG_READ_DESC * pWdbRegRead, /* register to get */ WDB_MEM_XFER * pWdbMemXfer /* area to save reg values */ ) { UINT32 status; /* client call result status */ /* clear the memory that will be used to save the ouput arguments */ memset ((void *) pWdbMemXfer, 0, sizeof (WDB_MEM_XFER)); /* * call the WDB_REGS_GET service via the backend client in order * to get cpu register values pointed to by pContextStep. */ status = rpcCoreClntCall (WDB_REGS_GET, xdr_WDB_REG_READ_DESC, (char *) pWdbRegRead, xdr_WDB_MEM_XFER, (char *) pWdbMemXfer); return (status); }/********************************************************************************* rpcCoreRegsSet - set target register value(s)** This function sets the target cpu register value. The cpu registers to set are* described by a REG_WRITE structure pointed to by <pRegWrite>. The* WDB_REGS_SET service is called via the backend client. The WDB target agent* replies by a STATUS. This status is equal to ERROR if registers can't be set* or the RPC request fails. Otherwise OK is returned.** RETURNS: ERROR if cpu registers can't be set or the RPC request fails. In* this case the errno global variable handles the error number.* Otherwise OK is returned.*/LOCAL UINT32 rpcCoreRegsSet ( WDB_REG_WRITE_DESC * pWdbRegWrite /* register to set */ ) { /* * call the WDB_REGS_SET service via the backend client in order * to set the cpu register pointed to by pContextStep. */ return (rpcCoreClntCall (WDB_REGS_SET, xdr_WDB_REG_WRITE_DESC, (char *) pWdbRegWrite, xdr_void, NULL)); }/********************************************************************************* rpcCoreVIOWrite - write data to a target virtual I/O channel** This function writes data to a virtual I/O channel. The data to write and* the VIO channel are describe by a VIO_COPY structure pointed to by the* <pVIOCopy>. The WDB_VIO_WRITE service is called via the backend client. The* WDB target agent replies by a RESULT_STATUS structure. The val field of* this structure handes the number of bytes written in the VIO channel. The* errCode field handles the error number if an error is detected or the RPC* request fails.** RETURNS: Always a pointer to a RESULT_STATUS structure.*/LOCAL UINT32 rpcCoreVIOWrite ( WDB_MEM_XFER * pWdbMemXfer, /* virtual I/O to write to */ UINT32 * pNumBytes /* number of bytes written */ ) { /* * If the number of byte to write is bigger that the * Maximun Transmit Unit (MTU) allowed by the UDP trame then * attempt to write only MTU bytes. * Note that the maximum number of bytes accepted by the Virtual * I/O device driver is 512 bytes but the rpcCoreMtu can be * smaller than that. */ pWdbMemXfer->numBytes = min (pWdbMemXfer->numBytes, (int)rpcCoreMtu); /* * call the WDB_VIO_WRITE service via the backend client in order * to write data in the virtual I/O channel pointed to by pWdbMemXfer. */ return (rpcCoreClntCall (WDB_VIO_WRITE, xdr_WDB_MEM_XFER, (char *) pWdbMemXfer, xdr_UINT32, (char *) pNumBytes)); }/******************************************************************************** rpcCoreEventpointAdd - add an eventpoint.** This function adds an eventpoint on the target board. The eventpoint * description is handed by an EVENT_POINT structure pointed to by <pEventPoint>.* The WDB_EVENTPOINT_ADD service is called via the backend client. The WDB* target agent replies by a RESULT_STATUS structure. The val field of this * structure handles the eventpoint number. If an error occurs or the RPC request* fails the errCode field will handle the error number.** RETURNS: Always a pointer to a RESULT_STATUS structure.*/LOCAL UINT32 rpcCoreEventpointAdd ( WDB_EVTPT_ADD_DESC * pWdbEventPoint, /* event point to add */ UINT32 * pEvtptNum /* event point number */ ) { /* reset the event point number */ *pEvtptNum = 0; /* * call the WDB_EVENTPOINT_ADD service via the backend client in order * to add the eventpoint pointed to by pEventPoint. */ return (rpcCoreClntCall (WDB_EVENTPOINT_ADD, xdr_WDB_EVTPT_ADD_DESC, (char *) pWdbEventPoint, xdr_UINT32, (char *) pEvtptNum)); }/********************************************************************************* rpcCoreEventpointDelete - delete an eventpoint** This function deletes an eventpoint on the target board. The eventpoint* number to delete is pointed to by <pEventpointNum>. The WDB_EVENTPOINT_DELETE* service is called via the backend client. The WDB target agent replies by a* STATUS. This status is equal to ERROR if the eventpoint can't be removed or* the RPC request fails. Otherwise Ok is returned.** RETURNS: ERROR if the eventpoint can't be removed or the RPC request fails.* In this case the global variable errno handles the error number.* Otherwise OK is returned.*/LOCAL UINT32 rpcCoreEventpointDelete ( WDB_EVTPT_DEL_DESC * pWdbEventpoint /* eventpoint to delete */ ) { /* * call the WDB_EVENTPOINT_DELETE service via the backend client in order * to removed the eventpoint pointed to by pEventpointNum. */ return (rpcCoreClntCall (WDB_EVENTPOINT_DELETE, (xdrproc_t) xdr_WDB_EVTPT_DEL_DESC, (char *) pWdbEventpoint, xdr_void, NULL)); }/********************************************************************************* rpcCoreModeSet - Set the agent mode** This function sets the agent mode on the target.** RETURNS: OK, or ERROR.*/LOCAL UINT32 rpcCoreModeSet ( u_int * pMode /* agent mode to set */ ) { /* call the WDB_TARGET_MODE_SET service */ return (rpcCoreClntCall (WDB_TARGET_MODE_SET, (xdrproc_t) xdr_u_int, (char *) pMode, xdr_void, NULL)); }/********************************************************************************* rpcCoreModeGet - Get the agent mode** This function returns the agent mode on the target.** RETURNS: OK, or ERROR.*/LOCAL UINT32 rpcCoreModeGet ( u_int * pMode /* where to return agent mode */ ) { /* call the WDB_TARGET_MODE_GET service */ return (rpcCoreClntCall (WDB_TARGET_MODE_GET, (xdrproc_t) xdr_void, NULL, xdr_u_int, (char *) pMode)); }/******************************************************************************** * rpcCoreEventGet - get an asynchrounous event from the target** The target server calls this function when the WDB target agent has* wake up the target server via the file descriptor saved in the tgtEventFd* field of the TGT_OPS structure or the rpcCoreEvtPending () return value is* TRUE.* This function gets an event description detected by the target board by* calling the WDB_EVENT_GET service via the backend client. The agent replies* by a EVENT_MSG structure. This structure handles the event type detected* and its description according its type. The input argument <lastEvtNum> * is the last event number handled by the target server. The event description* returned is always the event that handles an event number corresponding to* next number of lastEvtNum. It's not obligatory the event that has waked up* the target server. It's the case when namy events are stacked by the WDB* target agent. * If the event description can't be read or the RPC request fails the errCode* field will handle the error number.** RETURNS: Always a pointer to a EVENT_MSG structure.*/LOCAL UINT32 rpcCoreEventGet ( WDB_EVT_DATA * pWdbEvtData /* event description */ ) { /* clear the memory used by the WDB_TGT_INFO structure */ memset ((void *) pWdbEvtData, 0, sizeof (WDB_EVT_DATA)); /* * call the WDB_EVENT_GET service via the backend client in order * to call a function describe by the pCallParams pointer. */ return (rpcCoreClntCall (WDB_EVENT_GET, (xdrproc_t) xdr_void, (char *) NULL, xdr_WDB_EVT_DATA, (char *) pWdbEvtData)); }/********************************************************************************* rpcCoreFuncCall - call a function ** This function calls a function on the target board. The function type and* input arguments are handles by a CALL_PARAMS structure pointed to by * <pCallParams>. The WDB_FUNC_CALL service is called via the backend client.* The WDB target agent replies by a RESULT_STATUS structure. The val field* of this structure handles the context ID used to execute the function.* The function exit is considered as an event. The return value is one of* the event description information.* If the function context can't be created or the RPC request fails the* errCode of the returned structure will handle the error number.* * RETURNS: Always a pointer to a RESULT_STATUS structure.*/LOCAL UINT32 rpcCoreFuncCall ( WDB_CTX_CREATE_DESC * pWdbContext, /* function call parameters */ UINT32 * pCid /* context ID */ ) { /* clear the memory used to save the context ID */ *pCid = 0; /* * call the WDB_FUNC_CALL service via the backend client in order * to call a function describe by the pCallParams pointer. */ return (rpcCoreClntCall (WDB_FUNC_CALL, xdr_WDB_CTX_CREATE_DESC, (char *) pWdbContext, xdr_UINT32, (char *) pCid)); }/********************************************************************************* rpcCoreDirectCall - call a function inside the agent** This function call a function inside the WDB target agent context. The * function address and input arguments are handled by a structure CALL_PARAMS* pointed to by <pCallParams>. The WDB_DIRECT_CALL service is called via * the backend client. The WDB target agent replies by a RESULT_STATUS structure.* The val field of this structure handles the return value of the called* function. * If the function or the RPC request fails the errCode field of the* returned structure will handle the error number.** RETURNS: Always a pointer to a RESULT_STATUS structure.*/LOCAL UINT32 rpcCoreDirectCall ( WDB_CTX_CREATE_DESC * pWdbContext, /* function call parameters */ UINT32 * pCid /* context ID */ ) { /* clear the memory used to save the context ID */ *pCid = 0; /* * call the WDB_DIRECT_CALL service via the backend client in order * to call a function describe by the pCallParams pointer inside the target * agent context. */ return (rpcCoreClntCall (WDB_DIRECT_CALL, xdr_WDB_CTX_CREATE_DESC, (char *) pWdbContext, xdr_UINT32, (char *) pCid)); }/********************************************************************************* rpcCoreGopherEval - evaluate a gopher string** This function evaluates a gopher string. The string is pointed to by* <ppGopherString>. The WDB_EVALUATE_GOPHER service is called via the backend* client. The WDB target agent replies by a GOPHER_TAPE structure. If the * string evaluation or the RPC request fails the errCode of the returned* structure will handle the error number.** RETURNS: Always a pointer to a GOPHER_TAPE structure.*/LOCAL UINT32 rpcCoreGopherEval ( WDB_STRING_T * pWdbString, /* gopher string to evaluate */ WDB_MEM_XFER * pWdbMemXfer /* gopher result */ ) { /* clear the memory used by the WDB_MEM_XFER structure */ memset ((void *) pWdbMemXfer, 0, sizeof (WDB_MEM_XFER)); /* * call the WDB_EVALUATE_GOPHER service via the backend client in order * to evaluate by the gopher the string pointed to by ppGopherString. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -