diff --git a/dsu3plugin/dsu3plugin.cpp b/dsu3plugin/dsu3plugin.cpp --- a/dsu3plugin/dsu3plugin.cpp +++ b/dsu3plugin/dsu3plugin.cpp @@ -244,6 +244,17 @@ bool dsu3plugin::dumpSymbol(const QStrin return false; } +QVariantList dsu3plugin::readSymbol(const QString &symbolName) +{ + if(this->elfFile->isopened()) + { + int symbolIndex=this->elfFile->getSymbolIndex(symbolName); + if(symbolIndex!=-1) + return socexplorerplugin::Read((unsigned int)this->elfFile->getSymbolAddress(symbolIndex),(unsigned int)this->elfFile->getSymbolSize(symbolIndex)/4); + } + return QVariantList(); +} + void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address) { unsigned int* buff; diff --git a/dsu3plugin/dsu3plugin.h b/dsu3plugin/dsu3plugin.h --- a/dsu3plugin/dsu3plugin.h +++ b/dsu3plugin/dsu3plugin.h @@ -57,7 +57,7 @@ public slots: //added for python backward compatibility void loadFile(){this->flashTarget();} bool dumpSymbol(const QString& symbolName,QString file,const QString& format); - + QVariantList readSymbol(const QString& symbolName); signals: void updateInfo(ElfFile* elfFile); private: diff --git a/spwplugin/StarDundee/fakestardundeespwusb_lib.cpp b/spwplugin/StarDundee/fakestardundeespwusb_lib.cpp new file mode 100644 --- /dev/null +++ b/spwplugin/StarDundee/fakestardundeespwusb_lib.cpp @@ -0,0 +1,653 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#include "fakestardundeespwusb_lib.h" +#include + + +char (*resolved_USBSpaceWire_Open)(star_device_handle *phDevice, int nDeviceNum)=NULL; +void (*resolved_USBSpaceWire_Close)(star_device_handle hDevice)=NULL; +U32 (*resolved_USBSpaceWire_ListDevices)()=NULL; +char (*resolved_USBSpaceWire_GetSerialNumber)(star_device_handle hDevice, U8 pSerialNumber[11])=NULL; +void (*resolved_USBSpaceWire_EnableNetworkMode)(star_device_handle hDevice, char enable)=NULL; +char (*resolved_USBSpaceWire_RegisterReceiveOnAllPorts)(star_device_handle hDevice)=NULL; +char (*resolved_USBSpaceWire_UnregisterReceiveOnAllPorts)(star_device_handle hDevice)=NULL; +char (*resolved_USBSpaceWire_ClearEndpoints)(star_device_handle hDevice)=NULL; +void (*resolved_USBSpaceWire_SetTimeout)(star_device_handle hDevice, double timeout)=NULL; +char (*resolved_USBSpaceWire_TC_Reset)(star_device_handle hDevice)=NULL; +char (*resolved_USBSpaceWire_TC_EnableExternalTimecodeSelection)(star_device_handle hDevice,char enable)=NULL; +U32 (*resolved_USBSpaceWire_TC_GetClockFrequency)(star_device_handle hDevice)=NULL; +char (*resolved_USBSpaceWire_TC_SetAutoTickInFrequency)(star_device_handle hDevice, U32 frequency)=NULL; +char (*resolved_USBSpaceWire_TC_EnableAutoTickIn)(star_device_handle hDevice, char enableAutoTickIns, char enableAllPorts)=NULL; +char (*resolved_USBSpaceWire_TC_PerformTickIn)(star_device_handle hDevice, U8 timein)=NULL; +U32 (*resolved_USBSpaceWire_GetDriverSendBufferSize)(star_device_handle hDevice)=NULL; +U32 (*resolved_USBSpaceWire_GetDriverReadBufferSize)(star_device_handle hDevice)=NULL; +char (*resolved_USBSpaceWire_IsReadThrottling)(star_device_handle hDevice)=NULL; + +char (*resolved_USBSpaceWire_WaitOnReadPacketAvailable)(star_device_handle hDevice, double timeout)=NULL; +USB_SPACEWIRE_STATUS (*resolved_USBSpaceWire_SendPacket)(star_device_handle hDevice, void *pBuffer, U32 nBufferSize, char bWait,USB_SPACEWIRE_ID *identifier)=NULL; +char (*resolved_USBSpaceWire_FreeSend)(star_device_handle hDevice, USB_SPACEWIRE_ID identifier)=NULL; +USB_SPACEWIRE_STATUS (*resolved_USBSpaceWire_ReadPackets)(star_device_handle hDevice, void *pBuffer, U32 nBufferSize,U32 nPacketNum, char bWait, PUSB_SPACEWIRE_PACKET_PROPERTIES properties,USB_SPACEWIRE_ID *identifier)=NULL; +char (*resolved_USBSpaceWire_FreeRead)(star_device_handle hDevice, USB_SPACEWIRE_ID identifier)=NULL; +SPACEWIRE_TRAFFIC_TYPE (*resolved_USBSpaceWire_GetReadTrafficType)(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum)=NULL; +USB_SPACEWIRE_EOP_TYPE (*resolved_USBSpaceWire_GetReadEOPStatus)(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties,U32 nPacketNum)=NULL; + +void (*resolved_CFGSpaceWire_EnableRMAP)(char useRMAP)=NULL; +void (*resolved_CFGSpaceWire_SetRMAPDestinationKey)(U8 destinationKey)=NULL; +void (*resolved_CFGSpaceWire_StackClear)(void)=NULL; +void (*resolved_CFGSpaceWire_AddrStackPush)(U8 dwAddress)=NULL; +void (*resolved_CFGSpaceWire_RetAddrStackPush)(U8 dwAddress)=NULL; +int (*resolved_CFGSpaceWire_SetBrickBaseTransmitRate)(star_device_handle hDevice, U32 dwBaseClk, U32 dwBaseDvdr, U32 dwEnableClk)=NULL; +int (*resolved_CFGSpaceWire_GetLinkStatusControl)(star_device_handle hDevice, U32 dwLinkNum, U32 *dwStatusControl)=NULL; +void (*resolved_CFGSpaceWire_LSEnableAutoStart)(U32 *dwStatusControl, char bEnabled)=NULL; +void (*resolved_CFGSpaceWire_LSEnableStart)(U32 *dwStatusControl, char bEnabled)=NULL; +void (*resolved_CFGSpaceWire_LSEnableDisabled)(U32 *dwStatusControl, char bEnabled)=NULL; +void (*resolved_CFGSpaceWire_LSEnableTristate)(U32 *dwStatusControl, char bEnabled)=NULL; +void (*resolved_CFGSpaceWire_LSPortType)(U32 dwStatusControl, U32 *dwPortType)=NULL; +void (*resolved_CFGSpaceWire_LSSetOperatingSpeed)(U32 *dwStatusControl, U32 dwOperatingSpeed)=NULL; +void (*resolved_CFGSpaceWire_LSConfigErrorStatus)(U32 dwStatusControl, U32 *dwErrorStatus)=NULL; +void (*resolved_CFGSpaceWire_LSExternalErrorStatus)(U32 dwStatusControl, U32 *dwErrorStatus)=NULL; +void (*resolved_CFGSpaceWire_LSErrorStatus)(U32 dwStatusControl, U32 *dwErrorStatus)=NULL; +void (*resolved_CFGSpaceWire_LSLinkState)(U32 dwStatusControl, U32 *dwLinkStatus)=NULL; +void (*resolved_CFGSpaceWire_LSIsLinkRunning)(U32 dwStatusControl, char *isLinkRunning)=NULL; +void (*resolved_CFGSpaceWire_LSIsAutoStart)(U32 dwStatusControl, char *isAutoStart)=NULL; +void (*resolved_CFGSpaceWire_LSIsStart)(U32 dwStatusControl, char *isStart)=NULL; +void (*resolved_CFGSpaceWire_LSIsDisabled)(U32 dwStatusControl, char *isDisabled)=NULL; +void (*resolved_CFGSpaceWire_LSIsTristate)(U32 dwStatusControl, char *isTristate)=NULL; +void (*resolved_CFGSpaceWire_LSOperatingSpeed)(U32 dwStatusControl, U32 *dwOperatingSpeed)=NULL; +void (*resolved_CFGSpaceWire_LSOutputPortConnection)(U32 dwStatusControl, U32 *dwOutputPortConnection)=NULL; +int (*resolved_CFGSpaceWire_SetLinkStatusControl)(star_device_handle hDevice, U32 dwLinkNum, U32 dwStatusControl)=NULL; +int (*resolved_CFGSpaceWire_SetAsInterface)(star_device_handle hDevice, char bEnabled, char bAddIdentifier)=NULL; +int (*resolved_CFGSpaceWire_ClearRoutingTableEntry)(star_device_handle hDevice, U32 nLogicalAddress)=NULL; +void (*resolved_CFGSpaceWire_RTBuildRoutingTableEntry)(U32 *dwRoutingTableEntry,U32 dwOutputPorts, char bDelHead, char bPriority)=NULL; +int (*resolved_CFGSpaceWire_SetRoutingTableEntry)(star_device_handle hDevice, U32 nLogicalAddress, U32 dwRoutingTableEntry)=NULL; +int (*resolved_CFGSpaceWire_GetRoutingTableEntry)(star_device_handle hDevice, U32 nLogicalAddress, U32 *dwRoutingTableEntry)=NULL; +void (*resolved_CFGSpaceWire_RTIsEnabled)(U32 dwRoutingTableEntry, char *bEnabled)=NULL; +void (*resolved_CFGSpaceWire_RTIsDelHead)(U32 dwRoutingTableEntry, char *bDelHead)=NULL; +void (*resolved_CFGSpaceWire_RTIsPriority)(U32 dwRoutingTableEntry, char *bPriority)=NULL; +void (*resolved_CFGSpaceWire_RTGetOutputPorts)(U32 dwRoutingTableEntry, U32 *dwOutputPorts)=NULL; +int (*resolved_CFGSpaceWire_GetTickEnableStatus)(star_device_handle hDevice, U32 *dwTickEnableStatus)=NULL; +int (*resolved_CFGSpaceWire_SetTickEnableStatus)(star_device_handle hDevice, U32 dwTickEnableStatus)=NULL; + + +typedef struct funcToresolve +{ + void (** function)(); + const char* symbolName; +}funcToresolve; + +QList funcTable=QList() +< +//#include +#include + + +/* Possible bit values */ +#define BIT0 (0x00000001) +#define BIT1 (0x00000002) +#define BIT2 (0x00000004) +#define BIT3 (0x00000008) +#define BIT4 (0x00000010) +#define BIT5 (0x00000020) +#define BIT6 (0x00000040) +#define BIT7 (0x00000080) +#define BIT8 (0x00000100) +#define BIT9 (0x00000200) +#define BIT10 (0x00000400) +#define BIT11 (0x00000800) +#define BIT12 (0x00001000) +#define BIT13 (0x00002000) +#define BIT14 (0x00004000) +#define BIT15 (0x00008000) +#define BIT16 (0x00010000) +#define BIT17 (0x00020000) +#define BIT18 (0x00040000) +#define BIT19 (0x00080000) +#define BIT20 (0x00100000) +#define BIT21 (0x00200000) +#define BIT22 (0x00400000) +#define BIT23 (0x00800000) +#define BIT24 (0x01000000) +#define BIT25 (0x02000000) +#define BIT26 (0x04000000) +#define BIT27 (0x08000000) +#define BIT28 (0x10000000) +#define BIT29 (0x20000000) +#define BIT30 (0x40000000) +#define BIT31 (0x80000000) + +/* SpaceWire Port errors */ +#define CFG_SPACEWIRE_NO_ERRORS (0) +#define CFG_SPACEWIRE_ERROR_ACTIVE (BIT0) +#define CFG_SPACEWIRE_PACKET_ADDRESS_ERROR (BIT1) +#define CFG_SPACEWIRE_PORT_TIMEOUT_ERROR (BIT2) +#define CFG_SPACEWIRE_DISCONNECT_ERROR (BIT3) +#define CFG_SPACEWIRE_PARITY_ERROR (BIT4) +#define CFG_SPACEWIRE_ESCAPE_ERROR (BIT5) +#define CFG_SPACEWIRE_CREDIT_ERROR (BIT6) +#define CFG_SPACEWIRE_CHARACTER_SEQUENCE_ERROR (BIT7) +#define CFG_SPACEWIRE_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \ + BIT4 | BIT5 | BIT6 | BIT7) + +/* Config Port errors */ +#define CFG_CONFIG_NO_ERRORS (0) +#define CFG_CONFIG_ERROR_ACTIVE (BIT0) + +/* Config Port errors (non-RMAP) */ +#define CFG_CONFIG_PACKET_ADDRESS_ERROR (BIT1) +#define CFG_CONFIG_PORT_TIMEOUT_ERROR (BIT2) +#define CFG_CONFIG_CHECKSUM_ERROR (BIT3) +#define CFG_CONFIG_TOO_SHORT_ERROR (BIT4) +#define CFG_CONFIG_TOO_LONG_ERROR (BIT5) +#define CFG_CONFIG_PACKET_EEP_ERROR (BIT6) +#define CFG_CONFIG_PROTOCOL_BYTE_ERROR (BIT7) +#define CFG_CONFIG_INVALID_REGISTER_ERROR (BIT8) +#define CFG_CONFIG_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \ + BIT4 | BIT5 | BIT6 | BIT7 | \ + BIT8) + +/* Config Port errors (RMAP) */ +#define CFG_CONFIG_RMAP_PORT_TIMEOUT_ERROR (BIT1) +#define CFG_CONFIG_RMAP_INVALID_HEADER_CRC (BIT2) +#define CFG_CONFIG_RMAP_INVALID_DATA_CRC (BIT3) +#define CFG_CONFIG_RMAP_INVALID_DESTINATION_KEY (BIT4) +#define CFG_CONFIG_RMAP_COMMAND_NOT_IMPLEMENTED (BIT5) +#define CFG_CONFIG_RMAP_INVALID_DATA_LENGTH (BIT6) +#define CFG_CONFIG_RMAP_INVALID_RMW_DATA_LENGTH (BIT7) +#define CFG_CONFIG_RMAP_INVALID_DESTINATION_ADDRESS (BIT8) +#define CFG_CONFIG_RMAP_EARLY_EOP (BIT9) +#define CFG_CONFIG_RMAP_LATE_EOP (BIT10) +#define CFG_CONFIG_RMAP_EARLY_EEP (BIT11) +#define CFG_CONFIG_RMAP_LATE_EEP (BIT12) +#define CFG_CONFIG_RMAP_VERIFY_BUFFER_OVERRUN_ERROR (BIT13) +#define CFG_CONFIG_RMAP_INVALID_REGISTER_ADDRESS (BIT14) +#define CFG_CONFIG_RMAP_UNSUPPORTED_PROTOCOL_ERROR (BIT15) +#define CFG_CONFIG_RMAP_SOURCE_LOGICAL_ADDRESS_ERROR (BIT16) +#define CFG_CONFIG_RMAP_SOURCE_PATH_ADDRESS_ERROR (BIT17) +#define CFG_CONFIG_RMAP_CARGO_TOO_LARGE (BIT18) +#define CFG_CONFIG_RMAP_UNUSED_COMMAND_OR_PACKET_TYPE (BIT19) +#define CFG_CONFIG_RMAP_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \ + BIT5 | BIT6 | BIT7 | BIT8 | BIT9 | \ + BIT10 | BIT11 | BIT12 | BIT13 | \ + BIT14 | BIT15 | BIT16 | BIT17 | \ + BIT18 | BIT19) + +/* External Port errors */ +#define CFG_EXTERNAL_NO_ERRORS (0) +#define CFG_EXTERNAL_ERROR_ACTIVE (BIT0) +#define CFG_EXTERNAL_PACKET_ADDRESS_ERROR (BIT1) +#define CFG_EXTERNAL_PORT_TIMEOUT_ERROR (BIT2) +#define CFG_EXTERNAL_INPUT_BUFFER_EMPTY_ERROR (BIT3) +#define CFG_EXTERNAL_INPUT_BUFFER_FULL_ERROR (BIT4) +#define CFG_EXTERNAL_OUTPUT_BUFFER_EMPTY_ERROR (BIT5) +#define CFG_EXTERNAL_OUTPUT_BUFFER_FULL_ERROR (BIT6) +#define CFG_EXTERNAL_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \ + BIT4 | BIT5 | BIT6) + +/* SpaceWire Port interface state */ +#define CFG_SPACEWIRE_ERROR_RESET (0) +#define CFG_SPACEWIRE_ERROR_WAIT (BIT0) +#define CFG_SPACEWIRE_READY (BIT1) +#define CFG_SPACEWIRE_STARTED (BIT1 | BIT0) +#define CFG_SPACEWIRE_CONNECTING (BIT2) +#define CFG_SPACEWIRE_RUN (BIT2 | BIT0) + +/* Port type */ +#define CFG_CONFIGURATION_PORT (0) +#define CFG_SPACEWIRE_SERIAL_PORT (BIT0) +#define CFG_SPACEWIRE_EXTERNAL_PORT (BIT1) + +/* SpaceWire Port control bits */ +#define CFG_SPACEWIRE_INTERFACE_STATE_START (8) +#define CFG_SPACEWIRE_INTERFACE_STATE (BIT8 | BIT9 | BIT10) +#define CFG_SPACEWIRE_RUNNING (BIT11) +#define CFG_SPACEWIRE_AUTOSTART (BIT12) +#define CFG_SPACEWIRE_START (BIT13) +#define CFG_SPACEWIRE_DISABLE (BIT14) +#define CFG_SPACEWIRE_TRISTATE (BIT15) +#define CFG_SPACEWIRE_RATE (BIT16 | BIT17 | BIT18 | \ + BIT19 | BIT20 | BIT21 | BIT22) +#define CFG_SPACEWIRE_RATE_START (16) + +/* Bits in the GAR Table */ +#define CFG_GAR_OUTPUT_PORTS_START (1) +#define CFG_GAR_OUTPUT_PORTS (BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | \ + BIT6 | BIT7 | BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | BIT13 | BIT14 | \ + BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | \ + BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28) +#define CFG_GAR_DEL_HEAD (BIT29) +#define CFG_GAR_PRIORITY (BIT30) +#define CFG_GAR_INVALID_ADDR (BIT31) + +/* Bits in the router control register */ +#define CFG_RC_TIMEOUT_ENABLE_START (0) +#define CFG_RC_TIMEOUT_ENABLE (BIT0) +#define CFG_RC_TIMEOUT_VALUE_START (1) +#define CFG_RC_TIMEOUT_VALUE (BIT1 | BIT2 | BIT3) +#define CFG_RC_DISABLE_ON_SILENCE (BIT4) +#define CFG_RC_DISABLE_ON_SILENCE_START (4) +#define CFG_RC_START_ON_REQUEST (BIT5) +#define CFG_RC_START_ON_REQUEST_START (5) +#define CFG_RC_SELF_ADDRESSING (BIT6) +#define CFG_RC_SELF_ADDRESSING_START (6) +#define CFG_RC_INTERFACE (BIT7) +#define CFG_RC_INTERFACE_START (7) +#define CFG_RC_INTERFACE_IDENT (BIT8) +#define CFG_RC_INTERFACE_IDENT_START (8) + +/* The bits shared by all ports */ +#define CFG_PORT_CONNECTION (BIT24 | BIT25 | BIT26 | BIT27 | BIT28) +#define CFG_PORT_CONNECTION_START (24) +#define CFG_PORT_TYPE (BIT29 | BIT30 | BIT31) +#define CFG_PORT_TYPE_START (29) + +/* Network discovery register values */ +#define CFG_NETD_TYPE (BIT0 | BIT1 | BIT2 | BIT3) +#define CFG_NETD_TYPE_START (0) +#define CFG_NETD_RETURN_PORT (BIT4 | BIT5 | BIT6 | BIT7) +#define CFG_NETD_RETURN_PORT_START (4) +#define CFG_NETD_RUNNING_PORTS (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \ + BIT13 | BIT14 | BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | \ + BIT21 | BIT22 | BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28 | \ + BIT29 | BIT30 | BIT31) +#define CFG_NETD_RUNNING_PORTS_START (8) + +/* Values in the ID register */ +#define CFG_ID_VERSION (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \ + BIT5 | BIT6 | BIT7) +#define CFG_ID_VERSION_START (0) +#define CFG_ID_CHIP (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \ + BIT13 | BIT14 | BIT15) +#define CFG_ID_CHIP_START (8) +#define CFG_ID_MANUFACTURER (BIT16 | BIT17 | BIT18 | BIT19 | \ + BIT20 | BIT21 | BIT22 | BIT23) +#define CFG_ID_MANUFACTURER_START (16) + +/* Values in the Time-Code register */ +#define CFG_TC_VALUE (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \ + BIT5) +#define CFG_TC_VALUE_START (0) +#define CFG_TC_FLAGS (BIT6 | BIT7) +#define CFG_TC_FLAGS_START (6) + +/* Values for the Router Base Clock Select */ +#define CFG_RTR_CLK_100_MBITS (0) +#define CFG_RTR_CLK_200_MBITS (BIT0) + +/* Values for the Brick Base Clock */ +#define CFG_BRK_CLK_100_MHZ (0) +#define CFG_BRK_CLK_120_MHZ (BIT0) +#define CFG_BRK_CLK_140_MHZ (BIT1) +#define CFG_BRK_CLK_160_MHZ (BIT0 | BIT1) +#define CFG_BRK_CLK_180_MHZ (BIT2) +#define CFG_BRK_CLK_200_MHZ (BIT2 | BIT0) + +/* Values for the Brick Base Divider */ +#define CFG_BRK_DVDR_1 (0) +#define CFG_BRK_DVDR_2 (BIT0) +#define CFG_BRK_DVDR_4 (BIT1) + +typedef enum +{ + TRANSFER_NOT_STARTED = 0, + TRANSFER_STARTED = 1, + TRANSFER_SUCCESS = 2, + TRANSFER_ERROR_DISCONNECT = 3, + TRANSFER_ERROR_PARITY = 4, + TRANSFER_ERROR_UNKNOWN = 5, + TRANSFER_ERROR_TIMEOUT = 6, + TRANSFER_ERROR_LINK_NOT_STARTED = 7, + TRANSFER_ERROR_USER_BUFFER_LOCK_FAILED = 8, + TRANSFER_ERROR_LINK_ALREADY_IN_USE = 9, + TRANSFER_ERROR_RECEIVE_BUFFER_FULL = 0xa, + TRANSFER_ERROR_OUT_OF_MEMORY = 0xb, + TRANSFER_ERROR_NOT_FOUND = 0xc, + TRANSFER_ERROR_USB_ERROR = 0xd, + TRANSFER_ERROR_NOT_REGISTERED_TO_RECEIVE = 0xe +} USB_SPACEWIRE_STATUS, *PUSB_SPACEWIRE_STATUS; + +#define SPACEWIRE_USB_EOP_CHAR ((U8)0x80) +#define SPACEWIRE_USB_EEP_CHAR ((U8)0x40) + +typedef enum +{ + SPACEWIRE_USB_NO_EOP = 0, + SPACEWIRE_USB_EOP = SPACEWIRE_USB_EOP_CHAR, + SPACEWIRE_USB_EEP = SPACEWIRE_USB_EEP_CHAR +} USB_SPACEWIRE_EOP_TYPE, *PUSB_SPACEWIRE_EOP_TYPE; + +typedef enum +{ + SPACEWIRE_TRAFFIC_UNKNOWN = -1, + SPACEWIRE_TRAFFIC_PACKET = 0, + SPACEWIRE_TRAFFIC_TIMECODE = 1, + SPACEWIRE_TRAFFIC_CONTROL = 2 +} SPACEWIRE_TRAFFIC_TYPE, *PSPACEWIRE_TRAFFIC_TYPE; + +typedef struct +{ + unsigned long len; + USB_SPACEWIRE_EOP_TYPE eop; + SPACEWIRE_TRAFFIC_TYPE type; +} USB_SPACEWIRE_PACKET_PROPERTIES, *PUSB_SPACEWIRE_PACKET_PROPERTIES; + + + +typedef enum +{ + CFG_TRANSFER_SUCCESS = 0x00, + CFG_TRANSMIT_PACKET_FAILURE = 0x01, + CFG_REPLY_PACKET_FAILURE = 0x02, + CFG_REPLY_PACKET_TOO_BIG = 0x03, + CFG_REPLY_PACKET_TOO_SMALL = 0x04, + CFG_REPLY_PACKET_NAK = 0x05, + CFG_REPLY_PACKET_CHECKSUM_ERROR = 0x06 +} CFG_SPACEWIRE_STATUS; + + + +char USBSpaceWire_Open(star_device_handle *phDevice, int nDeviceNum); +void USBSpaceWire_Close(star_device_handle hDevice); +U32 USBSpaceWire_ListDevices(); +char USBSpaceWire_GetSerialNumber(star_device_handle hDevice, U8 pSerialNumber[11]); +void USBSpaceWire_EnableNetworkMode(star_device_handle hDevice, char enable); +char USBSpaceWire_RegisterReceiveOnAllPorts(star_device_handle hDevice); +char USBSpaceWire_UnregisterReceiveOnAllPorts(star_device_handle hDevice); +char USBSpaceWire_ClearEndpoints(star_device_handle hDevice); +void USBSpaceWire_SetTimeout(star_device_handle hDevice, double timeout); +char USBSpaceWire_TC_Reset(star_device_handle hDevice); +char USBSpaceWire_TC_EnableExternalTimecodeSelection(star_device_handle hDevice,char enable); +U32 USBSpaceWire_TC_GetClockFrequency(star_device_handle hDevice); +char USBSpaceWire_TC_SetAutoTickInFrequency(star_device_handle hDevice, U32 frequency); +char USBSpaceWire_TC_EnableAutoTickIn(star_device_handle hDevice, char enableAutoTickIns, char enableAllPorts); +char USBSpaceWire_TC_PerformTickIn(star_device_handle hDevice, U8 timein); +U32 USBSpaceWire_GetDriverSendBufferSize(star_device_handle hDevice); +U32 USBSpaceWire_GetDriverReadBufferSize(star_device_handle hDevice); +char USBSpaceWire_IsReadThrottling(star_device_handle hDevice); + +char USBSpaceWire_WaitOnReadPacketAvailable(star_device_handle hDevice, double timeout); +USB_SPACEWIRE_STATUS USBSpaceWire_SendPacket(star_device_handle hDevice, void *pBuffer, U32 nBufferSize, char bWait,USB_SPACEWIRE_ID *identifier); +char USBSpaceWire_FreeSend(star_device_handle hDevice, USB_SPACEWIRE_ID identifier); +USB_SPACEWIRE_STATUS USBSpaceWire_ReadPackets(star_device_handle hDevice, void *pBuffer, U32 nBufferSize,U32 nPacketNum, char bWait, PUSB_SPACEWIRE_PACKET_PROPERTIES properties,USB_SPACEWIRE_ID *identifier); +char USBSpaceWire_FreeRead(star_device_handle hDevice, USB_SPACEWIRE_ID identifier); +SPACEWIRE_TRAFFIC_TYPE USBSpaceWire_GetReadTrafficType(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum); +USB_SPACEWIRE_EOP_TYPE USBSpaceWire_GetReadEOPStatus(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties,U32 nPacketNum); + +void CFGSpaceWire_EnableRMAP(char useRMAP); +void CFGSpaceWire_SetRMAPDestinationKey(U8 destinationKey); +void CFGSpaceWire_StackClear(void); +void CFGSpaceWire_AddrStackPush(U8 dwAddress); +void CFGSpaceWire_RetAddrStackPush(U8 dwAddress); +int CFGSpaceWire_SetBrickBaseTransmitRate(star_device_handle hDevice, U32 dwBaseClk, U32 dwBaseDvdr, U32 dwEnableClk); +int CFGSpaceWire_GetLinkStatusControl(star_device_handle hDevice, U32 dwLinkNum, U32 *dwStatusControl); +void CFGSpaceWire_LSEnableAutoStart(U32 *dwStatusControl, char bEnabled); +void CFGSpaceWire_LSEnableStart(U32 *dwStatusControl, char bEnabled); +void CFGSpaceWire_LSEnableDisabled(U32 *dwStatusControl, char bEnabled); +void CFGSpaceWire_LSEnableTristate(U32 *dwStatusControl, char bEnabled); +void CFGSpaceWire_LSPortType(U32 dwStatusControl, U32 *dwPortType); +void CFGSpaceWire_LSSetOperatingSpeed(U32 *dwStatusControl, U32 dwOperatingSpeed); +void CFGSpaceWire_LSConfigErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus); +void CFGSpaceWire_LSExternalErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus); +void CFGSpaceWire_LSErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus); +void CFGSpaceWire_LSLinkState(U32 dwStatusControl, U32 *dwLinkStatus); +void CFGSpaceWire_LSIsLinkRunning(U32 dwStatusControl, char *isLinkRunning); +void CFGSpaceWire_LSIsAutoStart(U32 dwStatusControl, char *isAutoStart); +void CFGSpaceWire_LSIsStart(U32 dwStatusControl, char *isStart); +void CFGSpaceWire_LSIsDisabled(U32 dwStatusControl, char *isDisabled); +void CFGSpaceWire_LSIsTristate(U32 dwStatusControl, char *isTristate); +void CFGSpaceWire_LSOperatingSpeed(U32 dwStatusControl, U32 *dwOperatingSpeed); +void CFGSpaceWire_LSOutputPortConnection(U32 dwStatusControl, U32 *dwOutputPortConnection); +int CFGSpaceWire_SetLinkStatusControl(star_device_handle hDevice, U32 dwLinkNum, U32 dwStatusControl); +int CFGSpaceWire_SetAsInterface(star_device_handle hDevice, char bEnabled, char bAddIdentifier); +int CFGSpaceWire_ClearRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress); +void CFGSpaceWire_RTBuildRoutingTableEntry(U32 *dwRoutingTableEntry,U32 dwOutputPorts, char bDelHead, char bPriority); +int CFGSpaceWire_SetRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress, U32 dwRoutingTableEntry); +int CFGSpaceWire_GetRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress, U32 *dwRoutingTableEntry); +void CFGSpaceWire_RTIsEnabled(U32 dwRoutingTableEntry, char *bEnabled); +void CFGSpaceWire_RTIsDelHead(U32 dwRoutingTableEntry, char *bDelHead); +void CFGSpaceWire_RTIsPriority(U32 dwRoutingTableEntry, char *bPriority); +void CFGSpaceWire_RTGetOutputPorts(U32 dwRoutingTableEntry, U32 *dwOutputPorts); +int CFGSpaceWire_GetTickEnableStatus(star_device_handle hDevice, U32 *dwTickEnableStatus); +int CFGSpaceWire_SetTickEnableStatus(star_device_handle hDevice, U32 dwTickEnableStatus); + + + + +class FakeStarDundeeSpwUSB_Lib +{ +public: + FakeStarDundeeSpwUSB_Lib(); + static void resolve(); +}; + +#endif // FAKESTARDUNDEESPWUSB_LIB_H diff --git a/spwplugin/StarDundee/stardundeegui.cpp b/spwplugin/StarDundee/stardundeegui.cpp --- a/spwplugin/StarDundee/stardundeegui.cpp +++ b/spwplugin/StarDundee/stardundeegui.cpp @@ -22,8 +22,9 @@ #include "stardundeegui.h" #include "ui_stardundeeGUI.h" -#include -#include +#include "fakestardundeespwusb_lib.h" +//#include +//#include StarDundeeGUI::StarDundeeGUI(QWidget *parent) : QWidget(parent),ui(new Ui::StarDundeeUI) diff --git a/spwplugin/StarDundee/stardundeespw_usb.cpp b/spwplugin/StarDundee/stardundeespw_usb.cpp --- a/spwplugin/StarDundee/stardundeespw_usb.cpp +++ b/spwplugin/StarDundee/stardundeespw_usb.cpp @@ -21,6 +21,7 @@ ----------------------------------------------------------------------------*/ #include "stardundeespw_usb.h" +#include "fakestardundeespwusb_lib.h" #include #include diff --git a/spwplugin/StarDundee/stardundeespw_usb.h b/spwplugin/StarDundee/stardundeespw_usb.h --- a/spwplugin/StarDundee/stardundeespw_usb.h +++ b/spwplugin/StarDundee/stardundeespw_usb.h @@ -23,8 +23,10 @@ #define STARDUNDEESPW_USB_H #include -#include -#include +//#include +//#include + +#include "fakestardundeespwusb_lib.h" #include #include #include diff --git a/spwplugin/spwplugin.cpp b/spwplugin/spwplugin.cpp --- a/spwplugin/spwplugin.cpp +++ b/spwplugin/spwplugin.cpp @@ -24,11 +24,13 @@ #include "stardundeespw_usb.h" #include "gr_esb_bridge.h" #include +#include "fakestardundeespwusb_lib.h" spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false) { Q_UNUSED(parent) + FakeStarDundeeSpwUSB_Lib::resolve(); this->bridge = NULL; this->scanDone = false; // this->pyObject = new spwPyWrapper(this); diff --git a/spwplugin/spwplugin.pro b/spwplugin/spwplugin.pro --- a/spwplugin/spwplugin.pro +++ b/spwplugin/spwplugin.pro @@ -7,6 +7,9 @@ CONFIG += socexplorerplugin QT += network webkit greaterThan(QT_MAJOR_VERSION, 4): QT += webkitwidgets +QMAKE_CXXFLAGS += -std=c++11 +QMAKE_CFLAGS += -std=c++11 + win32:CONFIG += dll win32:CONFIG -= static VERSION=0.6.0 @@ -42,7 +45,8 @@ HEADERS += \ SpwTcpPacketServer/spwtcppacketserver.h \ GR-ESB/gr_esb_bridge.h \ GR-ESB/gr_esb_ui.h \ - SpwTcpPacketServer/incomingpacketparser.h + SpwTcpPacketServer/incomingpacketparser.h \ + StarDundee/fakestardundeespwusb_lib.h SOURCES += \ @@ -53,7 +57,8 @@ SOURCES += \ SpwTcpPacketServer/spwtcppacketserver.cpp \ GR-ESB/gr_esb_bridge.cpp \ GR-ESB/gr_esb_ui.cpp \ - SpwTcpPacketServer/incomingpacketparser.cpp + SpwTcpPacketServer/incomingpacketparser.cpp \ + StarDundee/fakestardundeespwusb_lib.cpp FORMS += \ StarDundee/stardundeeGUI.ui \