Using the µVision Socket Interface  Application Note 198
Control and monitor µVision via the built-in TCP/IP interface
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
UVSC_C.h File Reference

Data Structures

struct  UVSC_CB_DATA
 

Macros

#define _UVSC_FUNC_   extern __declspec(dllexport)
 
#define UVSC_MAX_CLIENTS   10
 
#define UVSC_MAX_API_STR_SIZE   1024
 
#define UVSC_PORT_AUTO   0
 
#define UVSC_MIN_AUTO_PORT   1
 
#define UVSC_MAX_AUTO_PORT   65535
 

Typedefs

typedef void(* uvsc_cb )(void *cb_custom, UVSC_CB_TYPE type, UVSC_CB_DATA *data)
 
typedef void(* log_cb )(const char *msg, int msgLen)
 

Enumerations

enum  UVSC_STATUS {
  UVSC_STATUS_SUCCESS = 0,
  UVSC_STATUS_FAILED = 1,
  UVSC_STATUS_NOT_SUPPORTED = 2,
  UVSC_STATUS_NOT_INIT = 3,
  UVSC_STATUS_TIMEOUT = 4,
  UVSC_STATUS_INVALID_CONTEXT = 5,
  UVSC_STATUS_INVALID_PARAM = 6,
  UVSC_STATUS_BUFFER_TOO_SMALL = 7,
  UVSC_STATUS_CALLBACK_IN_USE = 8,
  UVSC_STATUS_COMMAND_ERROR = 9,
  UVSC_STATUS_END
}
 
enum  UVSC_RUNMODE {
  UVSC_RUNMODE_NORMAL = 0,
  UVSC_RUNMODE_LABVIEW = 1,
  UVSC_RUNMODE_END = 2
}
 
enum  UVSC_PBAR {
  UVSC_PBAR_INIT = 0,
  UVSC_PBAR_TEXT = 1,
  UVSC_PBAR_POS = 2,
  UVSC_PBAR_STOP = 3
}
 
enum  UVSC_CB_TYPE {
  UVSC_CB_ERROR = 0,
  UVSC_CB_ASYNC_MSG = 1,
  UVSC_CB_DISCONNECTED = 2,
  UVSC_CB_BUILD_OUTPUT_MSG = 3,
  UVSC_CB_PROGRESS_BAR_MSG = 4,
  UVSC_CB_CMD_OUTPUT_MSG = 5
}
 

Functions

_UVSC_FUNC_ void UVSC_Version (UINT *pUVSCVersion, UINT *pUVSOCKVersion)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_Init (int uvMinPort, int uvMaxPort)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_UnInit (void)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_OpenConnection (char *name, int *iConnHandle, int *pPort, char *uvCmd, UVSC_RUNMODE uvRunmode, uvsc_cb callback, void *cb_custom, char *logFileName, xBOOL logFileAppend, log_cb logCallback)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_CloseConnection (int iConnHandle, xBOOL terminate)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_ConnHandleFromConnName (char *name, int *iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GetLastError (int iConnHandle, UV_OPERATION *msgType, UV_STATUS *status, char *str, int maxStrLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_LogControl (int iConnHandle, xBOOL enableRaw, xBOOL enableTrace)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_SET_OPTIONS (int iConnHandle, UVSOCK_OPTIONS *pOptions)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_UVSOCK_VERSION (int iConnHandle, UINT *pMajor, UINT *pMinor)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_EXT_VERSION (int iConnHandle, EXTVERS *pVersions, UINT *pVersionsLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_HIDE (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_SHOW (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_MAXIMIZE (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_MINIMIZE (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_RESTORE (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_UI_LOCK (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_UI_UNLOCK (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GEN_CHECK_LICENSE (int iConnHandle, UVLICINFO *pLicInfo)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_LOAD (int iConnHandle, PRJDATA *pProjectFile, int projectFileLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_CLOSE (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_ADD_FILE (int iConnHandle, PRJDATA *pGroupFiles, int groupFilesLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_DEL_FILE (int iConnHandle, PRJDATA *pGroupFiles, int groupFilesLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_ENUM_FILES (int iConnHandle, SSTR *pGroup, int groupLen, SSTR *pFiles, int *pFileIndexes, int *pFileCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_ADD_GROUP (int iConnHandle, PRJDATA *pGroups, int groupsLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_DEL_GROUP (int iConnHandle, PRJDATA *pGroups, int groupsLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_SET_TARGET (int iConnHandle, PRJDATA *pTargets, int targetsLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_SET_OUTPUTNAME (int iConnHandle, PRJDATA *pTargets, int targetsLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_ENUM_GROUPS (int iConnHandle, SSTR *pGroups, int *pGroupIndexes, int *pGroupCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_ENUM_TARGETS (int iConnHandle, SSTR *pTargets, int *pTargetIndexes, int *pTargetCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_ACTIVE_FILES (int iConnHandle, UINT *pActiveFileCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_BUILD (int iConnHandle, xBOOL rebuild)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_BUILD_CANCEL (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_CLEAN (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_FLASH_DOWNLOAD (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_GET_OPTITEM (int iConnHandle, TRNOPT *pTrnOpt, int trnOptLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_SET_OPTITEM (int iConnHandle, TRNOPT *pTrnOpt, int trnOptLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_GET_DEBUG_TARGET (int iConnHandle, DBGTGTOPT *pDbgTgtOpt)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_SET_DEBUG_TARGET (int iConnHandle, DBGTGTOPT *pDbgTgtOpt)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_CMD_PROGRESS (int iConnHandle, PGRESS *pPgress, int pgressLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_GET_OUTPUTNAME (int iConnHandle, iPATHREQ *piPathRq, SSTR *pName, int nameLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_PRJ_GET_CUR_TARGET (int iConnHandle, iPATHREQ *piPathRq, SSTR *pName, int nameLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENTER (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EXIT (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_START_EXECUTION (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_RUN_TO_ADDRESS (int iConnHandle, xU64 address)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STOP_EXECUTION (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STATUS (int iConnHandle, int *pStatus)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STEP_HLL (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STEP_HLL_N (int iConnHandle, UINT count)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STEP_INSTRUCTION (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STEP_INSTRUCTION_N (int iConnHandle, UINT count)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STEP_INTO (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STEP_INTO_N (int iConnHandle, UINT count)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_STEP_OUT (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_RESET (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_MEM_READ (int iConnHandle, AMEM *pMem, int memLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_MEM_WRITE (int iConnHandle, AMEM *pMem, int memLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_CREATE_BP (int iConnHandle, BKPARM *pBkptSet, int bkptSetLen, BKRSP *pBkptRsp, int *pBkptRspLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_CHANGE_BP (int iConnHandle, BKCHG *pBkptChg, int bkptChgLen, BKRSP *pBkptRsp, int *pBkptRspLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUMERATE_BP (int iConnHandle, BKRSP *pBkptRsp, int *pBkptIndexes, int *pBkptCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_SERIAL_GET (int iConnHandle, SERIO *pSerIO, int serIOLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_SERIAL_PUT (int iConnHandle, SERIO *pSerIO, int serIOLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_CALC_EXPRESSION (int iConnHandle, VSET *pVSet, int vSetLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVAL_WATCH_EXPRESSION (int iConnHandle, VSET *pVSet, int vSetLen, VARINFO *pVarInfo)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_REMOVE_WATCH_EXPRESSION (int iConnHandle, VSET *pVSet, int vSetLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUM_VARIABLES (int iConnHandle, IVARENUM *iVarEnum, VARINFO *pVarInfo, int *nVarInfoCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_VARIABLE_SET (int iConnHandle, VARVAL *pVar, int vVarLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUM_VTR (int iConnHandle, iVTRENUM *piVtrEnum, AVTR *paVTR, int *pVtrIndexes, int *pVtrCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_VTR_GET (int iConnHandle, VSET *pVSet, int vSetLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_VTR_SET (int iConnHandle, VSET *pVSet, int vSetLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ITM_REGISTER (int iConnHandle, ITMOUT *pItmOut, int itmIoLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ITM_UNREGISTER (int iConnHandle, ITMOUT *pItmOut, int itmIoLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUM_STACK (int iConnHandle, iSTKENUM *piStkEnum, STACKENUM *pStackEnum, int *pStackCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUM_TASKS (int iConnHandle, TASKENUM *pTaskEnum, int *pTaskCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUM_MENUS (int iConnHandle, MENUID *pMenuID, MENUENUM *pViewEnum, int *pMenuCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_MENU_EXEC (int iConnHandle, MENUID *pMenuID)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ADR_TOFILELINE (int iConnHandle, ADRMTFL *pAdrMtfl, AFLMAP *pAflMap, int *pAflMapLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ADR_SHOWCODE (int iConnHandle, iSHOWSYNC *piShowSync)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_POWERSCALE_SHOWCODE (int iConnHandle, UVSC_PSTAMP *pPowerScaleData)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_WAKE (int iConnHandle, iINTERVAL *piInterval)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_SLEEP (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EXEC_CMD (int iConnHandle, EXECCMD *pCmd, int cmdLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GetBuildOutputSize (int iConnHandle, int *pBuildOutputSize)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GetBuildOutput (int iConnHandle, char *pBuildOutput, int buildOutputLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GetCmdOutputSize (int iConnHandle, int *pCmdOutputSize)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_GetCmdOutput (int iConnHandle, char *pCmdOutput, int cmdOutputLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_ReadBuildQ (int iConnHandle, char *pOutputLine, int timeout)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_ReadPBarQ (int iConnHandle, UVSC_PBAR *pBar, char *pStr, int timeout)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_ReadAsyncQ (int iConnHandle, int iQueueNo, UVSOCK_CMD *buf, int timeout)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_FlushAsyncQ (int iConnHandle, int iQueueNo)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_TxRxRaw (int iConnHandle, UVSOCK_CMD *buf)
 
_UVSC_FUNC_ UVSOCK_CMDUVSC_CreateMsg (UVSOCK_CMD *buf, UV_OPERATION eCmd, int nLen, const void *pData)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVAL_EXPRESSION_TO_STR (int iConnHandle, VSET *pVSet, int vSetLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_FILELINE_TO_ADR (int iConnHandle, AFLMAP *pAflMap, int nAflMapLen, VSET *pVSet, int vSetLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUM_REGISTER_GROUPS (int iConnHandle, SSTR *pGroups, int *pGroupCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_ENUM_REGISTERS (int iConnHandle, REGENUM *pRegisters, int *pRegisterCount)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_READ_REGISTERS (int iConnHandle, char *pBuf, int *pBufLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_REGISTER_SET (int iConnHandle, VSET *pVSet, int vSetLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_DSM_READ (int iConnHandle, AMEM *pMem, int memLen)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVTR_REGISTER (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVTR_UNREGISTER (int iConnHandle)
 
_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVTR_ENUMSCVDFILES (int iConnHandle, SSTR *pFiles, int *pFileCount)
 

Description

UVSOCK Client DLL Interface.

Version
V2.28

API for the UVSC DLL, to facilitate 3rd party application communication with uVision.

General API Rules

  • All 'reserved' data fields must be written as 0 and ignored when reading.
  • Non-relevant data fields in requests must be written as 0.
  • The UVSC DLL must be loaded from the installed UV3 folder to guarantee compatibility with UV3.exe. The UVSC DLL must not be included in your distributed application, unless your application is guaranteed to be used only with the specific version of KEIL tools from which the UVSC DLL was taken.

Version History

Author, Date, Version

  • RAS, 08.02.2008, V2.02
  • RAS, 20.02.2008, V2.03
  • RAS, 18.03.2008, V2.04
  • RAS, 22.04.2008, V2.05
  • RAS, 25.04.2008, V2.06
  • RAS, 09.05.2008, V2.07
  • RAS, 25.09.2008, V2.08
  • PH, 22.07.2009, V2.09
  • TdB, 25.11.2010, V2.10
  • ED, 20.02.2011, V2.11
  • ED, 20.03.2011, V2.12 / V2.13
  • PH, 28.04.2011, V2.14
  • JR, 18.04.2012, V2.24
  • JR, 16.04.2013, V2.25
  • TdB, 09.06.2016, V2.26
  • TdB, 09.06.2016, V2.27
  • TdB, 09.06.2016, V2.28

Change Log

Version 2.02:

  • initial release
  • version in line with UVSOCK interface

Version 2.03:

  • Additional error codes (UVSC_STATUS_INVALID_CONTEXT, UVSC_STATUS_INVALID_PARAM, UVSC_STATUS_BUFFER_TOO_SMALL, UVSC_STATUS_CALLBACK_IN_USE, UVSC_STATUS_COMMAND_ERROR)
  • Build and progress bar callbacks added (UVSC_CB_BUILD_OUTPUT_MSG, UVSC_CB_PROGRESS_BAR_MSG)

Version 2.04:

  • Bug fix: Increased size of internal message queue to 200
  • Bug fix: Removed buffer overrun from UVSC logging
  • Enhancement: Logging completely disabled when NULL passed to both logFileName and logCallback in UVSC_OpenConnection

Version 2.05:

  • Bug fix: Replaced bool type with xBOOL, as bool is C++ only type. API is still binary compatible.

Version 2.06:

  • Enhancement: Modified Message Box blocking mechanism, reducing the amount of messages required to complete several commands
  • Baseline: Backwards compatibility for UVSC_C.h API from this version

Version 2.07:

  • Bug Fix: Timeouts changed (Message Response = 10 seconds, Async Response = 3 minutes)
  • Bug Fix: Removed occasional deadlock in UVSC_DBG_EXIT()
  • Bug Fix: Calling UVSC_LogControl() no longer returns an error if logging is not enabled

Version 2.08:

  • Enhancement: Added UV_DBG_EXEC_CMD command. It allows any command line to be executed via UVSOCK
  • Enhancement: Added UV_PRG_GET_OUTPUTNAME command. It allows the current executable name to be retrieved

Version 2.09:

  • Enhancement: Changed display of Breakpoint-command responses to show BP_DELETED, BP_ENABLED etc. This requires to look at 'cmdRsp.status' for exact Bp-action.

Version 2.10:

Version 2.11:

Version 2.14:

  • Correction: Mantis #4789: removed 'UVSC_PSTAMP' from response created by OkToClientGeneric()

Version 2.15:

  • Bugfix: Writing beyond buffer size is fixed in UV_DBG_ENUM_STACK

Version 2.17:

Version 2.18:

Version 2.19:

Version 2.20:

Version 2.21:

  • Enhancement: Struct VARINO is extended with number of flags to support Eclipse client

Version 2.22:

  • Correction: Comments are changed to match implementation

Version 2.23:

  • Enhancement: Added UV_GEN_SET_OPTIONS to set general UVSC options

Version 2.24:

  • Enhancement: Added 'showSyncErr' flag to UVSC_PSTAMP to show sync error message in uVision

Version 2.25:

Version 2.26:

Version 2.27:

  • Enhancement: fixed Copyright

Version 2.28:

  • Enhancement: fixed Version numbers for all UVSock related files

Function Documentation

_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVTR_ENUMSCVDFILES ( int  iConnHandle,
SSTR pFiles,
int *  pFileCount 
)

Fetch list of Event Recorder related SCVD files

Parameters
iConnHandleHandle for the connection, as returned by UVSC_OpenConnection
pFilesPointer to the SCVD files
pFileCountNUmber of SCVD files to be parsed
Returns
UVSC_STATUS_SUCCESS on success, or an error code
Precondition
UVSC_OpenConnection must have been called successfully
A valid project is loaded, and uVision is debugging

Use this function to receive Event Recorder related SCVD files

_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVTR_REGISTER ( int  iConnHandle)

Register for Event Recorder

Parameters
iConnHandleHandle for the connection, as returned by UVSC_OpenConnection
Returns
UVSC_STATUS_SUCCESS on success, or an error code
Precondition
UVSC_OpenConnection must have been called successfully
A valid project is loaded, and uVision is debugging

Use this function to receive Event Recorder Events

_UVSC_FUNC_ UVSC_STATUS UVSC_DBG_EVTR_UNREGISTER ( int  iConnHandle)

Unregister for Event Recorder

Parameters
iConnHandleHandle for the connection, as returned by UVSC_OpenConnection
Returns
UVSC_STATUS_SUCCESS on success, or an error code
Precondition
UVSC_OpenConnection must have been called successfully
A valid project is loaded, and uVision is debugging

Use this function to stop receiving Event Recorder Events