Manuals >Reference >Controlling IC-CAP from Another Application Print version of this Book (PDF file) |
![]() ![]() |
|
|
Details of Function CallsThis section describes each function call available in the libiclinklibs.a library. The descriptions include available arguments, and the results returned, including error codes. For an example of each function call, see the IC-CAP IPC Link example program ($ICCAP_ROOT/src/ipcexample.c). This example program takes control of IC-CAP. It then sends PEL commands to access variables and datasets in an npn model, performs a time-consuming task, and sends a pin mapping to IC-CAP and then accesses it. launch_iccapint launch_iccap(const char *appName, const char *host, const char *iccapRoot, const char *altPath) launch_iccap invokes IC-CAP with the IPC link in place. appName declares the name of the invoking program. This name cannot contain any spaces. This name will appear in the interactive dialog selector in IC-CAP as well as within a menu. If appName is NULL or the null string, the default link name will be Unnamed_Link. host specifies the host's name on which to run. If this string is not NULL, and if gethostent matches this host with gethostbyname(), then no remsh or rsh is used. If host is not NULL (or null string), and it returns a hostent with gethostbyname, then remsh or rsh will be used to invoke IC-CAP. iccapRoot is the path to where IC-CAP has been installed on the machine on which it is to run. If iccapRoot is NULL, it is assumed that ICCAP_ROOT is or will be set in the environment and that $ICCAP_ROOT/bin is already in the path. altPath identifies a different path. Ordinarily, $ICCAP_ROOT/bin/iccap is used to invoke IC-CAP. Users often place a wrapper around this script to set up ICCAP_ROOT and LM_LICENSE_FILE. If this is the case, the alternate script can be named in this argument. launch_iccap returns 0 if successful, or the following error codes: initialize_session()int initialize_session() initialize_session attempts to gain control of the current IC-CAP session. Once initialized, PEL calls can be sent. IC-CAP is placed in a special mode on success of this call which will not raise any error dialogs. It also actively listens for calls from the link. initialize_session() returns 0 if successful, or one of the following error codes:
terminate_session()int terminate_session() terminate_session relinquishes control of IC-CAP. This enables you to interactively use IC-CAP. terminate_session() returns 0 if successful, or one of the following error codes:
send_PELint send_PEL(const char *PELText, int wait, char **errMsg, LinkReturnFuncT retfunc) send_PEL sends PELText across the link to be executed within IC-CAP. initialize_session() must have been called successfully prior to this working. The text can be multiline or a single line of code. Each call to send_PEL essentially begins a new macro, so temporary variables within text will not persist between send_PEL calls. However, temporary variables can be used within multiline PELText. PELText should be null terminated. wait specifies if send_PEL should wait for the PEL to finish before returning. If wait is nonzero, send_PEL will wait. If wait is 0, send_PEL will return immediately upon sending the PEL text to IC-CAP. The caller must then, at a later time, call get_PEL_response() to wait for the call to complete and collect the return status. See get_PEL_response. If errMsg is not NULL and a PEL error occurs (noted by return of -3), it will be set to point to an error message returned from IC-CAP. The message will be a null terminated string and must be freed with free(). No memory is allocated if NULL is passed to send_PEL, or if no error occurs. errMsg is only meaningful when -3 is returned. retfunc points to a function of type LinkReturnFuncT. This function will be invoked whenever IC-CAP calls one of the functions ICMSchar, ICMSint, ICMSreal, ICMSstr, or ICMSarray. The one argument to this function is a pointer to a LinkReturnS structure as shown in the following statement: typedef int (*LinkReturnFuncT)(struct LinkReturnS *); For details about the structure, see Details of the LinkReturnS Structure. send_PEL() returns 0 if successful, or one of the following error codes:
get_PEL_responseint get_PEL_response(char **errMsg, LinkReturnFuncT retfunc) get_PEL_response waits PEL from a prior send_PEL (with wait==0) to complete. If errMsg is not NULL and a PEL error occurred (error code -3), it will be set to point to an error message returned from IC-CAP. The message will be a null terminated string and must be freed with free(). No memory will be allocated if NULL is passed to send_PEL, or if no error occurs. errMsg is only meaningful when -3 is returned. retfunc points to a function of type LinkReturnFuncT. This function is invoked when IC-CAP calls one of the functions ICMSchar, ICMSint, ICMSreal, ICMSstr, or ICMSarray. The one argument to this function is a pointer to a LinkReturnS structure as shown in the following statement: typedef int (*LinkReturnFuncT)(struct LinkReturnS *); For details about the structure, see Details of the LinkReturnS Structure. get_PEL_response() returns 0 if successful, or one of the following error codes:
send_mapint send_map(int *pinMap, int numPins) send_map sends a new pin matrix mapping to IC-CAP for use with ICMSpin() or SPECSpin(). The indices of the pinMap array correspond to the actual pins in the hardware. The values of pinMap correspond to the logical pad numbers associated with the pins. For example, if pinMap[5]=12, a call to SPECSpin(5) would return 12. If hardware contains no 0 pin, load pinMap[0] with -1. send_map() returns 0 if successful, or one of the following error codes: |
|
|
|
![]() ![]() |