Index: APIInterface.h =================================================================== --- APIInterface.h (revision 5824) +++ APIInterface.h (working copy) @@ -148,6 +148,7 @@ virtual int32_t EnumDevice(uint32_t ulBoard, uint32_t ulSize, void* pvBoardInfo) = 0; virtual int32_t EnumChannel(uint32_t ulBoard, uint32_t ulChannel, uint32_t ulSize, void* pvChannelInfo) = 0; + virtual int32_t RestartDevice(char* szBoard) = 0; CTransportLayer* GetTransportLayer(void) { return m_pcTransportLayer; } bool ConnectionValid(void) { return m_fConnectionValid; } Index: cifXFunctions.cpp =================================================================== --- cifXFunctions.cpp (revision 5824) +++ cifXFunctions.cpp (working copy) @@ -544,32 +544,31 @@ int32_t APIENTRY xDriverRestartDevice(CIFXHANDLE hDriver, char* szBoardName, void* pvData) { UNREFERENCED_PARAMETER(pvData); // Keep compiler happy - CHECK_POINTER(szBoardName); - - int32_t lRet = CIFX_NO_ERROR; - bool fCloseDriver = false; + CDevice* pcDevice = NULL; + int32_t lRet = CIFX_NO_ERROR; - if(NULL == hDriver) + if (g_pcDeviceHandler == NULL) { lRet = xDriverOpen(&hDriver); - fCloseDriver = true; + } else + { + hDriver = NULL; } - if(CIFX_NO_ERROR == lRet) + if (CIFX_NO_ERROR == lRet) { - HANDLE hSysdevice = NULL; - - // Open Sysdevice -> connect device, verify device is available - if(CIFX_NO_ERROR == (lRet = xSysdeviceOpen( hDriver, szBoardName, &hSysdevice))) + pcDevice = g_pcDeviceHandler->GetDevice(szBoardName); + if (NULL == pcDevice) { - /* Reset device. Use interface specific reset timeout */ - lRet = xSysdeviceReset( hSysdevice, 0); - xSysdeviceClose( hSysdevice); + lRet = CIFX_INVALID_BOARD; + } else + { + lRet = pcDevice->m_pcEndpoint->m_pcDefaultDataLayer->RestartDevice(szBoardName); } + + if(hDriver) + xDriverClose( hDriver); } - - if(fCloseDriver) - xDriverClose( hDriver); return lRet; } Index: Marshaller.cpp =================================================================== --- Marshaller.cpp (revision 5824) +++ Marshaller.cpp (working copy) @@ -664,6 +664,45 @@ } ///////////////////////////////////////////////////////////////////////////// +/// Restart device +/// \param szBoard Name of Board +/// \return CIFX_NO_ERROR on succes +///////////////////////////////////////////////////////////////////////////// +int32_t CMarshaller::RestartDevice(char* szBoard) +{ + int32_t lRet = CIFX_INVALID_HANDLE; + uint8_t* pbRecvData = NULL; + uint32_t ulRecvDataLen = 0; + DRV_RESTARTDEVICE_REQ_T tRestartREQ = {0}; + + strcpy(tRestartREQ.tData.abBoardName, szBoard); + + GenerateHeader((PMARSHALLER_DATA_FRAME_HEADER_T) &tRestartREQ, + m_dwDriverHandle, + MARSHALLER_DRV_METHODID_RESTARTDEVICE, + true, + sizeof(DRV_RESTARTDEVICE_REQ_DATA_T)); + + lRet = m_pcTransportLayer->TransferPacket(HIL_TRANSPORT_TYPE_MARSHALLER, + (BYTE*)&tRestartREQ, + sizeof(tRestartREQ), + pbRecvData, + ulRecvDataLen, + m_pcEndpoint, + 0, + CIFX_TO_CONT_PACKET); + + if(CIFX_NO_ERROR == lRet) + { + PMARSHALLER_DATA_FRAME_HEADER_T ptCnf = reinterpret_cast(pbRecvData); + lRet = VerifyTransferResult(&tRestartREQ.tHeader, ptCnf); + delete [] pbRecvData; + } + + return lRet; +} + +///////////////////////////////////////////////////////////////////////////// /// xSysdevice functions ///////////////////////////////////////////////////////////////////////////// Index: Marshaller.h =================================================================== --- Marshaller.h (revision 5824) +++ Marshaller.h (working copy) @@ -69,6 +69,7 @@ virtual uint32_t GetDeviceCount( void); virtual int32_t EnumDevice(uint32_t ulBoard, uint32_t ulSize, void* pvBoardInfo); virtual int32_t EnumChannel(uint32_t ulBoard, uint32_t ulChannel, uint32_t ulSize, void* pvChannelInfo); + virtual int32_t RestartDevice(char* szBoard); /* System device depending functions */ virtual int32_t xSysdeviceOpen ( CIFXHANDLE hDriver, char* szBoard, CIFXHANDLE* phSysdevice); Index: MarshallerFrame.h =================================================================== --- MarshallerFrame.h (revision 5824) +++ MarshallerFrame.h (working copy) @@ -48,6 +48,7 @@ #define MARSHALLER_DRV_METHODID_ENUMCHANNELS 0x00000006 /*!< Driver Object: xDriverEnumChannels */ #define MARSHALLER_DRV_METHODID_OPENCHANNEL 0x00000008 /*!< Driver Object: xDriverOpenChannel */ #define MARSHALLER_DRV_METHODID_OPENSYSDEV 0x00000009 /*!< Driver Object: xDriverSysDeviceOpen */ +#define MARSHALLER_DRV_METHODID_RESTARTDEVICE 0x00000010 /*!< Driver Object: xDriverRestartDevice */ #define MARSHALLER_SYSDEV_METHODID_CLOSE 0x00000001 /*!< Sysdevice Object: xSysdeviceClose */ #define MARSHALLER_SYSDEV_METHODID_INFO 0x00000002 /*!< Sysdevice Object: xSysdeviceInfo */ @@ -244,6 +245,23 @@ } DRV_ENUMCHANNELS_REQ_T, *PDRV_ENUMCHANNELS_REQ_T; +/*****************************************************************************/ +/*! Driver - xDriverRestartDevice request */ +/*****************************************************************************/ +typedef struct DRV_RESTARTDEVICE_REQ_DATA_Ttag +{ + char abBoardName[CIFx_MAX_INFO_NAME_LENTH]; + +} DRV_RESTARTDEVICE_REQ_DATA_T, *PDRV_RESTARTDEVICE_REQ_DATA_T; + +typedef struct DRV_RESTARTDEVICE_REQ_Ttag +{ + MARSHALLER_DATA_FRAME_HEADER_T tHeader; + DRV_RESTARTDEVICE_REQ_DATA_T tData; + +} DRV_RESTARTDEVICE_REQ_T, *PDRV_RESTARTDEVICE_REQ_T; + + /***************************************************************************** ____ _ _ / ___| _ _ ___ __| | ___ __ __ (_) ___ ___ Index: rcXPacket.cpp =================================================================== --- rcXPacket.cpp (revision 5824) +++ rcXPacket.cpp (working copy) @@ -359,6 +359,17 @@ } ///////////////////////////////////////////////////////////////////////////// +/// Restart device +/// \param szBoard Name of Board +/// \return CIFX_NO_ERROR on succes +///////////////////////////////////////////////////////////////////////////// +int32_t CrcXPacket::RestartDevice(char* szBoard) +{ + UNREFERENCED_PARAMETER(szBoard); + return CIFX_FUNCTION_NOT_AVAILABLE; +} + +///////////////////////////////////////////////////////////////////////////// /// Read device information /// \return CIFX_NO_ERROR on success ///////////////////////////////////////////////////////////////////////////// Index: rcXPacket.h =================================================================== --- rcXPacket.h (revision 5824) +++ rcXPacket.h (working copy) @@ -81,6 +81,8 @@ uint32_t ulSize, void* pvChannelInfo); + virtual int32_t RestartDevice(char* szBoard); + /////////////////////////////////////////// // Not implemented netX API functions /////////////////////////////////////////// Index: Version History.txt =================================================================== --- Version History.txt (revision 5824) +++ Version History.txt (working copy) @@ -19,11 +19,30 @@ # # ############################################################################# +V0.10.2.0 (under development) +---------------------- +Changed: + - Add support for xDriverRestartDevice() call + +Add-ons: + - None. + +Bug fixes: + - None. + + V0.10.1.0 (2013-06-26) ---------------------- Changed: - Added calling convention (stdcall) to netXAPI Callbacks +Add-ons: + - None. + +Bug fixes: + - None. + + V0.10.0.0 (2013-03-01) ---------------------- Changes: