📄 bkenddoc.html
字号:
</blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine calls a target function and returns its result asynchronously.This is done by spawning a new task on the target according toa <b>WDB_CTX_CREATE_DESC</b> structure pointed to by <i>pWdbContext</i>.<p><pre>typedef struct wdb_ctx_create_desc /* how to create a context */ { WDB_CTX_TYPE contextType; /* task or system context */ /* the following are used for task and system contexts */ TGT_ADDR_T stackBase; /* bottom of stack (NULL = malloc) */ UINT32 stackSize; /* stack size */ TGT_ADDR_T entry; /* context entry point */ TGT_INT_T args[10]; /* arguments */ /* the following are only used for task contexts */ WDB_STRING_T name; /* name */ TGT_INT_T priority; /* priority */ TGT_INT_T options; /* options */ TGT_INT_T redirIn; /* redirect input file (or 0) */ TGT_INT_T redirOut; /* redirect output file (or 0) */ TGT_INT_T redirErr; /* redirect error output file (or 0) */ } WDB_CTX_CREATE_DESC;</pre><p>The spawned task is a wrapper which invokes the function and returns itsresults asynchronously via an event of type <b>WDB_EVT_CALL_RET</b>. The eventcontains a result of type <b>double</b>, if the <b>WDB_FP_RETURN</b> option bit is setin the <b>options</b> field; otherwise, the result type is <b>int</b>. Thisprocedure returns the ID of the newly spawned task in the address pointedto by <i>pCid</i>.<p></blockquote><h4>NOTE</h4><blockquote><p>If <b>stackSize</b> is 0, the application should set an appropriate default,preferably <b>WDB_SPAWN_STACK_SIZE</b>, which is defined in <b>configAll.h</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK on success or one of the following error codes:<dl><dt><b>WDB_ERR_COMMUNICATION</b><dd>The connection to the target has died.<p><dt><b>WDB_ERR_AGENT_MODE</b><dd>The system mode agent can't spawn a task.<p><dt><b>WDB_ERR_RT_ERROR</b><dd>Task creation failed on target.<p><dt><b>WDB_ERR_NO_RT_PROC</b><dd> Task creation is not supported on target.<p></dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bkendDoc.html#top">bkendDoc</a></b>, * .I "API Programmer's Guide: Target Server Back End"<hr><a name="bkendGopherEval"></a><p align=right><a href="rtnIndex.html"><i>Target Server Back End Interface : Routines</i></a></p></blockquote><h1><i>bkendGopherEval</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>bkendGopherEval</i>( )</strong> - evaluate a Gopher string</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>UINT32 bkendGopherEval ( WDB_STRING_T * pWdbString, /* gopher string to evaluate */ WDB_MEM_XFER * pWdbMemXfer /* gopher result */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function executes a Gopher string pointed to by <i>pWdbString</i>. Moreinformation about the Gopher language can be found in the <i>API Programmer's Guide: WTX Protocol </i>.The result of the execution is returned via a <b>WDB_MEM_XFER</b> structurepointed to by <i>pWdbMemXfer</i>.<p><pre>typedef struct wdb_mem_xfer /* transfer a block of memory */ { WDB_OPQ_DATA_T source; /* data to transfer */ TGT_ADDR_T destination; /* requested destination */ TGT_INT_T numBytes; /* number of bytes transferred */ } WDB_MEM_XFER;</pre><p>When the procedure returns, the host buffer pointed to by<b>destination</b> is filled with the Gopher result.If <b>destination</b> is originally NULL, this routine must allocate memoryto hold the result and set <b>destination</b> to this location.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK on success or one of the following error codes:<dl><dt><b>WDB_ERR_COMMUNICATION</b><dd>The connection to the target has died.<p><dt><b>WDB_ERR_GOPHER_SYNTAX</b><dd>This is a malformed Gopher string.<p><dt><b>WDB_ERR_GOPHER_FAULT</b><dd>A memory fault occurred while executing the string.<p><dt><b>WDB_ERR_GOPHER_TRUNCATED</b><dd>The Gopher result is too large.<p><dt><b>WDB_ERR_MEM_ACCES</b><dd> Invalid memory region.<p></dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bkendDoc.html#top">bkendDoc</a></b>, * .I "API Programmer's Guide: Target Server Back End"and<i>WTX Protocol </i>and<i>API Reference Manual: WTX Protocol </i>.<hr><a name="bkendInitialize"></a><p align=right><a href="rtnIndex.html"><i>Target Server Back End Interface : Routines</i></a></p></blockquote><h1><i>bkendInitialize</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>bkendInitialize</i>( )</strong> - initialize the back end </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS bkendInitialize ( char * tgtName, /* target name to connect to */ TGT_OPS * pTgtOps, /* back end functions */ BKEND_INFO * pBkInfo /* Backend related informations */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function is called by the target server to attach this back end. Thisfunction is the first back-end function called by the target server and theonly one that is called directly. Other back-end functions are called via a<b>TGT_OPS</b> structure pointed to by <i>pTgtOps</i> and filled by this function.The <b>BKEND_INFO</b> structure is also set up by this routine. The target serverwill handle the asynchronous events according to the value set in this structure pointed to by <i>pBkinfo</i>. A detailed description of back-endinitialization routines can be found in the<i>API Programmer's Guide: Target Server Back End </i>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR if an error is detected in the back-end initialization.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bkendDoc.html#top">bkendDoc</a></b>, <i>API Programmer's Guide: Target Server Back End </i><hr><a name="bkendMemChecksum"></a><p align=right><a href="rtnIndex.html"><i>Target Server Back End Interface : Routines</i></a></p></blockquote><h1><i>bkendMemChecksum</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>bkendMemChecksum</i>( )</strong> - perform a checksum on target memory</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>UINT32 bkendMemChecksum ( WDB_MEM_REGION * pWdbMemRegion, /* memory block to checksum */ UINT32 * pChecksumValue /* checksum value */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function checksums a block of target memory. The block isdescribed by the <b>WDB_MEM_REGION</b> structure pointed to by <i>pWdbMemRegion</i>.The checksum value is returned at the memory pointed to by <i>pChecksumValue</i>.<p><pre>typedef struct wdb_mem_region /* a region of target memory */ { TGT_ADDR_T baseAddr; /* memory region base address */ TGT_INT_T numBytes; /* memory region size */ UINT32 param; /* proc dependent parameter */ } WDB_MEM_REGION;</pre><p>The region of target memory to checksum is described by the <b>baseAddr</b>and <b>numBytes</b> fields. The <b>param</b> field is not used.<p>The checksum can be computed using the following code stub:<pre> 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); }</pre></blockquote><h4>RETURNS</h4><blockquote><p>OK on success or one of the following error codes:<dl><dt><b>WDB_ERR_COMMUNICATION</b><dd>The connection to the target has died.<p><dt><b>WDB_ERR_MEM_ACCES</b><dd> Invalid memory region.<p></dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bkendDoc.html#top">bkendDoc</a></b>, * .I "API Programmer's Guide: Object Module Loader"<hr><a name="bkendMemProtect"></a><p align=right><a href="rtnIndex.html"><i>Target Server Back End Interface : Routines</i></a></p></blockquote><h1><i>bkendMemProtect</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>bkendMemProtect</i>( )</strong> - write protect (or write enable) target memory</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>UINT32 bkendMemProtect ( WDB_MEM_REGION * pWdbMemRegion /* memory region to protect */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function turns on or off write protection of a target memoryregion. The memory region is described by a <b>WDB_MEM_REGION</b> structurepointed to by <i>pWdbMemRegion</i>. <p><pre>typedef struct wdb_mem_region /* a region of target memory */ { TGT_ADDR_T baseAddr; /* memory region base address */ TGT_INT_T numBytes; /* memory region size */ UINT32 param; /* proc dependent parameter */ } WDB_MEM_REGION;</pre><p>The region of target memory to protect is described by the <b>baseAddr</b><b>numBytes</b> fields. If the <b>param</b> field is equal to zero thememory region is write enabled. Otherwise the region is write protected.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK on success or one of the following error codes:<dl><dt><b>WDB_ERR_COMMUNICATION</b><dd>The connection to the target has died.<p><dt><b>WDB_ERR_MEM_ACCES</b><dd>Invalid memory region.<p><dt><b>WDB_ERR_NO_RT_PROC</b><dd> There is no runtime support for this operation.<p></dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bkendDoc.html#top">bkendDoc</a></b>, * .I "API Programmer's Guide: Object Module Loader"<hr><a name="bkendMemFill"></a><p align=right><a href="rtnIndex.html"><i>Target Server Back End Interface : Routines</i></a></p></blockquote><h1><i>bkendMemFill</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>bkendMemFill</i>( )</strong> - fill target memory with a pattern</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>UINT32 bkendMemFill ( WDB_MEM_REGION * pWdbMemRegion /* memory region to fill */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function fills a target memory region with a pattern.The memory region to fill is described by a <b>WDB_MEM_REGION</b> structurepointed to by <i>pWdbMemRegion</i>.<p><pre>typedef struct wdb_mem_region /* a region of target memory */ { TGT_ADDR_T baseAddr; /* memory region base address */ TGT_INT_T numBytes; /* memory region size */ UINT32 param; /* proc dependent parameter */ } WDB_MEM_REGION;</pre><p>The region of target memory to fill is described by the <b>baseAddr</b>and <b>numBytes</b> fields. The four-byte fill pattern is contained inthe <b>param</b> field.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK on success or one of the following error codes:<dl><dt><b>WDB_ERR_COMMUNICATION</b><dd>The connection to the target has died.<p><dt><b>WDB_ERR_MEM_ACCES</b><dd> Invalid memory region.<p></dl></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./bkendDoc.html#top">bkendDoc</a></b>, * .I "API Programmer's Guide: Object Module Loader"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -