📄 bkenddoc.c
字号:
* .iP WDB_ERR_NO_RT_PROC* Task creation is not supported on target.** SEE ALSO* .I "API Programmer's Guide: Target Server Back End"**/UINT32 bkendFuncCall ( WDB_CTX_CREATE_DESC * pWdbContext, /* function call parameters */ UINT32 * pCid /* context ID */ ) { ... }/********************************************************************************* bkendGopherEval - evaluate a Gopher string** This function executes a Gopher string pointed to by <pWdbString>. More* information about the Gopher language can be found in the * .I "API Programmer's Guide: WTX Protocol".* The result of the execution is returned via a WDB_MEM_XFER structure* pointed to by <pWdbMemXfer>.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_XFER** When the procedure returns, the host buffer pointed to by* `destination' is filled with the Gopher result.* If `destination' is originally NULL, this routine must allocate memory* to hold the result and set `destination' to this location.** RETURNS* OK on success or one of the following error codes:* .iP WDB_ERR_COMMUNICATION* The connection to the target has died.* .iP WDB_ERR_GOPHER_SYNTAX* This is a malformed Gopher string.* .iP WDB_ERR_GOPHER_FAULT* A memory fault occurred while executing the string.* .iP WDB_ERR_GOPHER_TRUNCATED * The Gopher result is too large.* .iP WDB_ERR_MEM_ACCES* Invalid memory region.** SEE ALSO* .I "API Programmer's Guide: Target Server Back End"* and* .I "WTX Protocol"* and* .I "API Reference Manual: WTX Protocol".**/UINT32 bkendGopherEval ( WDB_STRING_T * pWdbString, /* gopher string to evaluate */ WDB_MEM_XFER * pWdbMemXfer /* gopher result */ ) { ... }/********************************************************************************* bkendInitialize - initialize the back end ** This function is called by the target server to attach this back end. This* function is the first back-end function called by the target server and the* only one that is called directly. Other back-end functions are called via a* TGT_OPS structure pointed to by <pTgtOps> and filled by this function.* The BKEND_INFO structure is also set up by this routine. The target server* will handle the asynchronous events according to the value set in this * structure pointed to by <pBkinfo>. A detailed description of back-end* initialization routines can be found in the* .I "API Programmer's Guide: Target Server Back End".** RETURNS: OK or ERROR if an error is detected in the back-end initialization.** SEE ALSO* .I "API Programmer's Guide: Target Server Back End"**/STATUS bkendInitialize ( char * tgtName, /* target name to connect to */ TGT_OPS * pTgtOps, /* back end functions */ BKEND_INFO * pBkInfo /* Backend related informations */ ) { ... }/********************************************************************************* bkendMemChecksum - perform a checksum on target memory** This function checksums a block of target memory. The block is* described by the WDB_MEM_REGION structure pointed to by <pWdbMemRegion>.* The checksum value is returned at the memory pointed to by <pChecksumValue>.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_REGION** The region of target memory to checksum is described by the `baseAddr'* and `numBytes' fields. The `param' field is not used.** The checksum can be computed using the following code stub:* .CS* UINT32 cksum* (* uint16_t * pAddr, /@ start of buffer @/* int len /@ size of buffer in bytes @/* )* {* UINT32 sum = 0;* BOOL swap = FALSE;* * /@ take care of unaligned buffer address @/* * if ((UINT32)pAddr & 0x1)* {* sum += *((unsigned char *) pAddr) ++;* len--;* swap = TRUE;* }* * /@ evaluate checksum @/* * while (len > 1)* {* sum += *(uint16_t *) pAddr ++;* len -= 2;* }* * /@ take care of last byte @/* * if (len > 0)* sum = sum + ((*(unsigned char *) pAddr) << 8);* * /@ fold to 16 bits @/* * sum = (sum & 0xffff) + (sum >> 16);* sum = (sum & 0xffff) + (sum >> 16);* * /@ swap if we started on unaligned address @/* * if (swap)* sum = ((sum & 0x00ff) << 8) | ((sum & 0xff00) >> 8);* * return (~sum);* }* .CE* * RETURNS* OK on success or one of the following error codes:* .iP WDB_ERR_COMMUNICATION* The connection to the target has died.* .iP WDB_ERR_MEM_ACCES* Invalid memory region.** SEE ALSO* .I "API Programmer's Guide: Object Module Loader"**/UINT32 bkendMemChecksum ( WDB_MEM_REGION * pWdbMemRegion, /* memory block to checksum */ UINT32 * pChecksumValue /* checksum value */ ) { ... }/********************************************************************************* bkendMemProtect - write protect (or write enable) target memory** This function turns on or off write protection of a target memory* region. The memory region is described by a WDB_MEM_REGION structure* pointed to by <pWdbMemRegion>. ** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_REGION** The region of target memory to protect is described by the `baseAddr'* `numBytes' fields. If the `param' field is equal to zero the* memory region is write enabled. Otherwise the region is write protected.** RETURNS* OK on success or one of the following error codes:* .iP WDB_ERR_COMMUNICATION* The connection to the target has died.* .iP WDB_ERR_MEM_ACCES* Invalid memory region.* .iP WDB_ERR_NO_RT_PROC* There is no runtime support for this operation.** SEE ALSO* .I "API Programmer's Guide: Object Module Loader"**/UINT32 bkendMemProtect ( WDB_MEM_REGION * pWdbMemRegion /* memory region to protect */ ) { ... }/********************************************************************************* bkendMemFill - fill target memory with a pattern** This function fills a target memory region with a pattern.* The memory region to fill is described by a WDB_MEM_REGION structure* pointed to by <pWdbMemRegion>.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_REGION** The region of target memory to fill is described by the `baseAddr'* and `numBytes' fields. The four-byte fill pattern is contained in* the `param' field.** RETURNS* OK on success or one of the following error codes:* .iP WDB_ERR_COMMUNICATION* The connection to the target has died.* .iP WDB_ERR_MEM_ACCES* Invalid memory region.** SEE ALSO* .I "API Programmer's Guide: Object Module Loader"**/UINT32 bkendMemFill ( WDB_MEM_REGION * pWdbMemRegion /* memory region to fill */ ) { ... }/********************************************************************************* bkendMemMove - move a block of target memory** This function moves a block of target memory from one location to another.* It handles the case where source and destination blocks overlap.* The memory move is described by a WDB_MEM_REGION structure* pointed to by <pWdbMemRegion>.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_REGION** The region of target memory to move is described by the `baseAddr'* and `numBytes' fields. The destination address is given in the* `param' field.** RETURNS* OK on success or one of the following error codes:* .iP WDB_ERR_COMMUNICATION* The connection to the target has died.* .iP WDB_ERR_MEM_ACCES* Invalid memory region.** SEE ALSO* .I "API Programmer's Guide: Object Module Loader"**/UINT32 bkendMemMove ( WDB_MEM_REGION * pWdbMemRegion /* memory region to copy */ ) { ... }/********************************************************************************* bkendMemRead - read target memory* * This function reads the target memory region described by a WDB_MEM_XFER* structure pointed to by <pWdbMemRegion>.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_REGION* * The target start address and the number of bytes to read are in the* `baseAddr' and `numBytes' fields. The data will be copied to the host memory* address pointed to by `param'.** When this routine returns, it fills in the WDB_MEM_XFER structure pointed* to by <pWdbMemXfer> with information about the memory transfer.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_XFER** It sets `source' equal to `baseAddr', `numBytes' for WDB_MEM_XFER* equal to `numBytes' for WDB_MEM_REGION,* and `destination' equal to `param'.** If the data transfer is too large to be done at once (in other words,* larger than the MTU of the target connection), the back end must break up* the transfer into a series of smaller transfers.** RETURNS* OK on success or one of the following error codes:* .iP WDB_ERR_COMMUNICATION* The connection to the target has died.* .iP WDB_ERR_MEM_ACCES* Invalid memory region.** SEE ALSO* .I "API Programmer's Guide: Target Server Back End"**/UINT32 bkendMemRead ( WDB_MEM_REGION * pWdbMemRegion, /* memory to read description */ WDB_MEM_XFER * pWdbMemXfer /* area to save the data read */ ) { ... } /********************************************************************************* bkendMemScan - scan target memory for a pattern** This function scans target memory for a specified pattern.* The target memory region and the pattern are described by a* WDB_MEM_SCAN_DESC structure pointed to by <pWdbMemScan>.* If the pattern is found in the target memory region, the pattern start* address is pointed to by <pAdrs>. Otherwise <pAdrs> is set to -1.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_SCAN_DESC** The `memRegion' field describes the memory region to search.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_REGION** The `baseAddr' field describes where to start the search. If `numBytes'* is positive, a forward search is performed; otherwise a backward search is* performed. If `param' is NULL, the search tries to match the pattern.* Otherwise, the search stops at the first location where the pattern doesn't* match.** The `memXfer' field describes the pattern to look for.** EXPAND ../../../../../share/src/agents/wdb/wdb.h WDB_MEM_XFER** The `source' and `numBytes' fields point to a host buffer containing* the pattern. The `destination' field is unused.* * RETURNS* OK on success or one of the following error codes:* .iP WDB_ERR_COMMUNICATION* The connection to the target has died.* .iP WDB_ERR_MEM_ACCES* Invalid memory region.* .iP WDB_ERR_NOT_FOUND* No match was detected.** SEE ALSO* .I "API Programmer's Guide: Target Server Back End"**/UINT32 bkendMemScan ( WDB_MEM_SCAN_DESC * pWdbMemScan, /* scan descriptor */ TGT_ADDR_T * pAdrs /* addr found or -1 */ ) { ... }/********************************************************************************* bkendMemWrite - write target memory
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -