##// END OF EJS Templates
Added wrapper to use StarDundee driver as a plugin, since they don't respect...
jeandet -
r63:7db793755e5c default
parent child
Show More
This diff has been collapsed as it changes many lines, (653 lines changed) Show them Hide them
@@ -0,0 +1,653
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
22 #include "fakestardundeespwusb_lib.h"
23 #include <QDebug>
24
25
26 char (*resolved_USBSpaceWire_Open)(star_device_handle *phDevice, int nDeviceNum)=NULL;
27 void (*resolved_USBSpaceWire_Close)(star_device_handle hDevice)=NULL;
28 U32 (*resolved_USBSpaceWire_ListDevices)()=NULL;
29 char (*resolved_USBSpaceWire_GetSerialNumber)(star_device_handle hDevice, U8 pSerialNumber[11])=NULL;
30 void (*resolved_USBSpaceWire_EnableNetworkMode)(star_device_handle hDevice, char enable)=NULL;
31 char (*resolved_USBSpaceWire_RegisterReceiveOnAllPorts)(star_device_handle hDevice)=NULL;
32 char (*resolved_USBSpaceWire_UnregisterReceiveOnAllPorts)(star_device_handle hDevice)=NULL;
33 char (*resolved_USBSpaceWire_ClearEndpoints)(star_device_handle hDevice)=NULL;
34 void (*resolved_USBSpaceWire_SetTimeout)(star_device_handle hDevice, double timeout)=NULL;
35 char (*resolved_USBSpaceWire_TC_Reset)(star_device_handle hDevice)=NULL;
36 char (*resolved_USBSpaceWire_TC_EnableExternalTimecodeSelection)(star_device_handle hDevice,char enable)=NULL;
37 U32 (*resolved_USBSpaceWire_TC_GetClockFrequency)(star_device_handle hDevice)=NULL;
38 char (*resolved_USBSpaceWire_TC_SetAutoTickInFrequency)(star_device_handle hDevice, U32 frequency)=NULL;
39 char (*resolved_USBSpaceWire_TC_EnableAutoTickIn)(star_device_handle hDevice, char enableAutoTickIns, char enableAllPorts)=NULL;
40 char (*resolved_USBSpaceWire_TC_PerformTickIn)(star_device_handle hDevice, U8 timein)=NULL;
41 U32 (*resolved_USBSpaceWire_GetDriverSendBufferSize)(star_device_handle hDevice)=NULL;
42 U32 (*resolved_USBSpaceWire_GetDriverReadBufferSize)(star_device_handle hDevice)=NULL;
43 char (*resolved_USBSpaceWire_IsReadThrottling)(star_device_handle hDevice)=NULL;
44
45 char (*resolved_USBSpaceWire_WaitOnReadPacketAvailable)(star_device_handle hDevice, double timeout)=NULL;
46 USB_SPACEWIRE_STATUS (*resolved_USBSpaceWire_SendPacket)(star_device_handle hDevice, void *pBuffer, U32 nBufferSize, char bWait,USB_SPACEWIRE_ID *identifier)=NULL;
47 char (*resolved_USBSpaceWire_FreeSend)(star_device_handle hDevice, USB_SPACEWIRE_ID identifier)=NULL;
48 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;
49 char (*resolved_USBSpaceWire_FreeRead)(star_device_handle hDevice, USB_SPACEWIRE_ID identifier)=NULL;
50 SPACEWIRE_TRAFFIC_TYPE (*resolved_USBSpaceWire_GetReadTrafficType)(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum)=NULL;
51 USB_SPACEWIRE_EOP_TYPE (*resolved_USBSpaceWire_GetReadEOPStatus)(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties,U32 nPacketNum)=NULL;
52
53 void (*resolved_CFGSpaceWire_EnableRMAP)(char useRMAP)=NULL;
54 void (*resolved_CFGSpaceWire_SetRMAPDestinationKey)(U8 destinationKey)=NULL;
55 void (*resolved_CFGSpaceWire_StackClear)(void)=NULL;
56 void (*resolved_CFGSpaceWire_AddrStackPush)(U8 dwAddress)=NULL;
57 void (*resolved_CFGSpaceWire_RetAddrStackPush)(U8 dwAddress)=NULL;
58 int (*resolved_CFGSpaceWire_SetBrickBaseTransmitRate)(star_device_handle hDevice, U32 dwBaseClk, U32 dwBaseDvdr, U32 dwEnableClk)=NULL;
59 int (*resolved_CFGSpaceWire_GetLinkStatusControl)(star_device_handle hDevice, U32 dwLinkNum, U32 *dwStatusControl)=NULL;
60 void (*resolved_CFGSpaceWire_LSEnableAutoStart)(U32 *dwStatusControl, char bEnabled)=NULL;
61 void (*resolved_CFGSpaceWire_LSEnableStart)(U32 *dwStatusControl, char bEnabled)=NULL;
62 void (*resolved_CFGSpaceWire_LSEnableDisabled)(U32 *dwStatusControl, char bEnabled)=NULL;
63 void (*resolved_CFGSpaceWire_LSEnableTristate)(U32 *dwStatusControl, char bEnabled)=NULL;
64 void (*resolved_CFGSpaceWire_LSPortType)(U32 dwStatusControl, U32 *dwPortType)=NULL;
65 void (*resolved_CFGSpaceWire_LSSetOperatingSpeed)(U32 *dwStatusControl, U32 dwOperatingSpeed)=NULL;
66 void (*resolved_CFGSpaceWire_LSConfigErrorStatus)(U32 dwStatusControl, U32 *dwErrorStatus)=NULL;
67 void (*resolved_CFGSpaceWire_LSExternalErrorStatus)(U32 dwStatusControl, U32 *dwErrorStatus)=NULL;
68 void (*resolved_CFGSpaceWire_LSErrorStatus)(U32 dwStatusControl, U32 *dwErrorStatus)=NULL;
69 void (*resolved_CFGSpaceWire_LSLinkState)(U32 dwStatusControl, U32 *dwLinkStatus)=NULL;
70 void (*resolved_CFGSpaceWire_LSIsLinkRunning)(U32 dwStatusControl, char *isLinkRunning)=NULL;
71 void (*resolved_CFGSpaceWire_LSIsAutoStart)(U32 dwStatusControl, char *isAutoStart)=NULL;
72 void (*resolved_CFGSpaceWire_LSIsStart)(U32 dwStatusControl, char *isStart)=NULL;
73 void (*resolved_CFGSpaceWire_LSIsDisabled)(U32 dwStatusControl, char *isDisabled)=NULL;
74 void (*resolved_CFGSpaceWire_LSIsTristate)(U32 dwStatusControl, char *isTristate)=NULL;
75 void (*resolved_CFGSpaceWire_LSOperatingSpeed)(U32 dwStatusControl, U32 *dwOperatingSpeed)=NULL;
76 void (*resolved_CFGSpaceWire_LSOutputPortConnection)(U32 dwStatusControl, U32 *dwOutputPortConnection)=NULL;
77 int (*resolved_CFGSpaceWire_SetLinkStatusControl)(star_device_handle hDevice, U32 dwLinkNum, U32 dwStatusControl)=NULL;
78 int (*resolved_CFGSpaceWire_SetAsInterface)(star_device_handle hDevice, char bEnabled, char bAddIdentifier)=NULL;
79 int (*resolved_CFGSpaceWire_ClearRoutingTableEntry)(star_device_handle hDevice, U32 nLogicalAddress)=NULL;
80 void (*resolved_CFGSpaceWire_RTBuildRoutingTableEntry)(U32 *dwRoutingTableEntry,U32 dwOutputPorts, char bDelHead, char bPriority)=NULL;
81 int (*resolved_CFGSpaceWire_SetRoutingTableEntry)(star_device_handle hDevice, U32 nLogicalAddress, U32 dwRoutingTableEntry)=NULL;
82 int (*resolved_CFGSpaceWire_GetRoutingTableEntry)(star_device_handle hDevice, U32 nLogicalAddress, U32 *dwRoutingTableEntry)=NULL;
83 void (*resolved_CFGSpaceWire_RTIsEnabled)(U32 dwRoutingTableEntry, char *bEnabled)=NULL;
84 void (*resolved_CFGSpaceWire_RTIsDelHead)(U32 dwRoutingTableEntry, char *bDelHead)=NULL;
85 void (*resolved_CFGSpaceWire_RTIsPriority)(U32 dwRoutingTableEntry, char *bPriority)=NULL;
86 void (*resolved_CFGSpaceWire_RTGetOutputPorts)(U32 dwRoutingTableEntry, U32 *dwOutputPorts)=NULL;
87 int (*resolved_CFGSpaceWire_GetTickEnableStatus)(star_device_handle hDevice, U32 *dwTickEnableStatus)=NULL;
88 int (*resolved_CFGSpaceWire_SetTickEnableStatus)(star_device_handle hDevice, U32 dwTickEnableStatus)=NULL;
89
90
91 typedef struct funcToresolve
92 {
93 void (** function)();
94 const char* symbolName;
95 }funcToresolve;
96
97 QList<funcToresolve> funcTable=QList<funcToresolve>()
98 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_Open,"USBSpaceWire_Open"}
99 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_Close,"USBSpaceWire_Close"}
100 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_ListDevices,"USBSpaceWire_ListDevices"}
101 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_GetSerialNumber,"USBSpaceWire_GetSerialNumber"}
102 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_EnableNetworkMode,"USBSpaceWire_EnableNetworkMode"}
103 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_RegisterReceiveOnAllPorts,"USBSpaceWire_RegisterReceiveOnAllPorts"}
104 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_UnregisterReceiveOnAllPorts,"USBSpaceWire_UnregisterReceiveOnAllPorts"}
105 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_ClearEndpoints,"USBSpaceWire_ClearEndpoints"}
106 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_SetTimeout,"USBSpaceWire_SetTimeout"}
107 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_TC_Reset,"USBSpaceWire_TC_Reset"}
108 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_TC_EnableExternalTimecodeSelection,"USBSpaceWire_TC_EnableExternalTimecodeSelection"}
109 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_TC_GetClockFrequency,"USBSpaceWire_TC_GetClockFrequency"}
110 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_TC_SetAutoTickInFrequency,"USBSpaceWire_TC_SetAutoTickInFrequency"}
111 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_TC_EnableAutoTickIn,"USBSpaceWire_TC_EnableAutoTickIn"}
112 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_TC_PerformTickIn,"USBSpaceWire_TC_PerformTickIn"}
113 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_GetDriverSendBufferSize,"USBSpaceWire_GetDriverSendBufferSize"}
114 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_GetDriverReadBufferSize,"USBSpaceWire_GetDriverReadBufferSize"}
115 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_IsReadThrottling,"USBSpaceWire_IsReadThrottling"}
116 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_WaitOnReadPacketAvailable,"USBSpaceWire_WaitOnReadPacketAvailable"}
117 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_SendPacket,"USBSpaceWire_SendPacket"}
118 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_FreeSend,"USBSpaceWire_FreeSend"}
119 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_ReadPackets,"USBSpaceWire_ReadPackets"}
120 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_FreeRead,"USBSpaceWire_FreeRead"}
121 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_GetReadTrafficType,"USBSpaceWire_GetReadTrafficType"}
122 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_GetReadEOPStatus,"USBSpaceWire_GetReadEOPStatus"}
123 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_EnableRMAP,"CFGSpaceWire_EnableRMAP"}
124 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_SetRMAPDestinationKey,"CFGSpaceWire_SetRMAPDestinationKey"}
125 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_StackClear,"CFGSpaceWire_StackClear"}
126 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_AddrStackPush,"CFGSpaceWire_AddrStackPush"}
127 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_RetAddrStackPush,"CFGSpaceWire_RetAddrStackPush"}
128 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_SetBrickBaseTransmitRate,"CFGSpaceWire_SetBrickBaseTransmitRate"}
129 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_GetLinkStatusControl,"CFGSpaceWire_GetLinkStatusControl"}
130 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSEnableAutoStart,"CFGSpaceWire_LSEnableAutoStart"}
131 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSEnableStart,"CFGSpaceWire_LSEnableStart"}
132 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSEnableDisabled,"CFGSpaceWire_LSEnableDisabled"}
133 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSEnableTristate,"CFGSpaceWire_LSEnableTristate"}
134 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSPortType,"CFGSpaceWire_LSPortType"}
135 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSSetOperatingSpeed,"CFGSpaceWire_LSSetOperatingSpeed"}
136 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSConfigErrorStatus,"CFGSpaceWire_LSConfigErrorStatus"}
137 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSExternalErrorStatus,"CFGSpaceWire_LSExternalErrorStatus"}
138 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSErrorStatus,"CFGSpaceWire_LSErrorStatus"}
139 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSLinkState,"CFGSpaceWire_LSLinkState"}
140 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSIsLinkRunning,"CFGSpaceWire_LSIsLinkRunning"}
141 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSIsAutoStart,"CFGSpaceWire_LSIsAutoStart"}
142 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSIsStart,"CFGSpaceWire_LSIsStart"}
143 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSIsDisabled,"CFGSpaceWire_LSIsDisabled"}
144 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSIsTristate,"CFGSpaceWire_LSIsTristate"}
145 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSOperatingSpeed,"CFGSpaceWire_LSOperatingSpeed"}
146 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_LSOutputPortConnection,"CFGSpaceWire_LSOutputPortConnection"}
147 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_SetLinkStatusControl,"CFGSpaceWire_SetLinkStatusControl"}
148 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_SetAsInterface,"CFGSpaceWire_SetAsInterface"}
149 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_ClearRoutingTableEntry,"CFGSpaceWire_ClearRoutingTableEntry"}
150 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_RTBuildRoutingTableEntry,"CFGSpaceWire_RTBuildRoutingTableEntry"}
151 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_SetRoutingTableEntry,"CFGSpaceWire_SetRoutingTableEntry"}
152 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_GetRoutingTableEntry,"CFGSpaceWire_GetRoutingTableEntry"}
153 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_RTIsEnabled,"CFGSpaceWire_RTIsEnabled"}
154 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_RTIsDelHead,"CFGSpaceWire_RTIsDelHead"}
155 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_RTIsPriority,"CFGSpaceWire_RTIsPriority"}
156 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_RTGetOutputPorts,"CFGSpaceWire_RTGetOutputPorts"}
157 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_GetTickEnableStatus,"CFGSpaceWire_GetTickEnableStatus"}
158 <<funcToresolve{(void (**)())&resolved_CFGSpaceWire_SetTickEnableStatus,"CFGSpaceWire_SetTickEnableStatus"};
159
160
161
162 FakeStarDundeeSpwUSB_Lib::FakeStarDundeeSpwUSB_Lib()
163 {
164
165 }
166
167 void FakeStarDundeeSpwUSB_Lib::resolve()
168 {
169 QLibrary cfgLib;
170 QLibrary usbLib;
171 usbLib.setFileName("/home/spacewire/usb/spw_usb_driver_v2.68/lib/x86_64/libSpaceWireUSBAPI.so");
172 cfgLib.setFileName("/home/spacewire/usb/spw_usb_driver_v2.68/lib/x86_64/libConfigLibraryUSB.so");
173 usbLib.load();
174 cfgLib.load();
175 if(usbLib.isLoaded()&&cfgLib.isLoaded())
176 {
177 for(int i=0;i<funcTable.count();i++)
178 {
179 QString symbolName = funcTable[i].symbolName;
180 if(!symbolName.contains("USBSpaceWire_"))
181 {
182 *(funcTable[i].function) = usbLib.resolve(funcTable[i].symbolName);
183 if(*(funcTable[i].function)==NULL)
184 *(funcTable[i].function) = cfgLib.resolve(funcTable[i].symbolName);
185 }
186 else
187 {
188 *(funcTable[i].function) = cfgLib.resolve(funcTable[i].symbolName);
189 if(*(funcTable[i].function)==NULL)
190 *(funcTable[i].function) = usbLib.resolve(funcTable[i].symbolName);
191 }
192 }
193 }
194 }
195
196
197
198 char USBSpaceWire_Open(star_device_handle *phDevice, int nDeviceNum)
199 {
200 if(resolved_USBSpaceWire_Open!=NULL)
201 return resolved_USBSpaceWire_Open(phDevice, nDeviceNum);
202 return 0;
203 }
204
205
206 void USBSpaceWire_Close(star_device_handle hDevice)
207 {
208 if(resolved_USBSpaceWire_Close!=NULL)
209 resolved_USBSpaceWire_Close(hDevice);
210 }
211
212
213 U32 USBSpaceWire_ListDevices()
214 {
215 if(resolved_USBSpaceWire_ListDevices!=NULL)
216 return resolved_USBSpaceWire_ListDevices();
217 return 0;
218 }
219
220
221 char USBSpaceWire_GetSerialNumber(star_device_handle hDevice, U8 pSerialNumber[])
222 {
223 if(resolved_USBSpaceWire_GetSerialNumber!=NULL)
224 return resolved_USBSpaceWire_GetSerialNumber(hDevice,pSerialNumber);
225 return 0;
226 }
227
228
229 void USBSpaceWire_EnableNetworkMode(star_device_handle hDevice, char enable)
230 {
231 if(resolved_USBSpaceWire_EnableNetworkMode!=NULL)
232 resolved_USBSpaceWire_EnableNetworkMode(hDevice,enable);
233 }
234
235
236 char USBSpaceWire_RegisterReceiveOnAllPorts(star_device_handle hDevice)
237 {
238 if(resolved_USBSpaceWire_RegisterReceiveOnAllPorts!=NULL)
239 return resolved_USBSpaceWire_RegisterReceiveOnAllPorts(hDevice);
240 return 0;
241 }
242
243
244 char USBSpaceWire_UnregisterReceiveOnAllPorts(star_device_handle hDevice)
245 {
246 if(resolved_USBSpaceWire_UnregisterReceiveOnAllPorts!=NULL)
247 return resolved_USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice);
248 return 0;
249 }
250
251
252 char USBSpaceWire_ClearEndpoints(star_device_handle hDevice)
253 {
254 if(resolved_USBSpaceWire_ClearEndpoints!=NULL)
255 return resolved_USBSpaceWire_ClearEndpoints(hDevice);
256 return 0;
257 }
258
259
260 void USBSpaceWire_SetTimeout(star_device_handle hDevice, double timeout)
261 {
262 if(resolved_USBSpaceWire_SetTimeout!=NULL)
263 resolved_USBSpaceWire_SetTimeout(hDevice,timeout);
264 }
265
266
267 char USBSpaceWire_TC_Reset(star_device_handle hDevice)
268 {
269 if(resolved_USBSpaceWire_TC_Reset!=NULL)
270 return resolved_USBSpaceWire_TC_Reset(hDevice);
271 return 0;
272 }
273
274
275 char USBSpaceWire_TC_EnableExternalTimecodeSelection(star_device_handle hDevice, char enable)
276 {
277 if(resolved_USBSpaceWire_TC_EnableExternalTimecodeSelection!=NULL)
278 return resolved_USBSpaceWire_TC_EnableExternalTimecodeSelection(hDevice,enable);
279 return 0;
280 }
281
282
283 U32 USBSpaceWire_TC_GetClockFrequency(star_device_handle hDevice)
284 {
285 if(resolved_USBSpaceWire_TC_GetClockFrequency!=NULL)
286 return resolved_USBSpaceWire_TC_GetClockFrequency(hDevice);
287 return 0;
288 }
289
290
291 char USBSpaceWire_TC_SetAutoTickInFrequency(star_device_handle hDevice, U32 frequency)
292 {
293 if(resolved_USBSpaceWire_TC_SetAutoTickInFrequency!=NULL)
294 return resolved_USBSpaceWire_TC_SetAutoTickInFrequency(hDevice,frequency);
295 return 0;
296 }
297
298
299 char USBSpaceWire_TC_EnableAutoTickIn(star_device_handle hDevice, char enableAutoTickIns, char enableAllPorts)
300 {
301 if(resolved_USBSpaceWire_TC_EnableAutoTickIn!=NULL)
302 return resolved_USBSpaceWire_TC_EnableAutoTickIn(hDevice,enableAutoTickIns,enableAllPorts);
303 return 0;
304 }
305
306
307 char USBSpaceWire_TC_PerformTickIn(star_device_handle hDevice, U8 timein)
308 {
309 if(resolved_USBSpaceWire_TC_PerformTickIn!=NULL)
310 return resolved_USBSpaceWire_TC_PerformTickIn(hDevice,timein);
311 return 0;
312 }
313
314
315 U32 USBSpaceWire_GetDriverSendBufferSize(star_device_handle hDevice)
316 {
317 if(resolved_USBSpaceWire_GetDriverSendBufferSize!=NULL)
318 return resolved_USBSpaceWire_GetDriverSendBufferSize(hDevice);
319 return 0;
320 }
321
322
323 U32 USBSpaceWire_GetDriverReadBufferSize(star_device_handle hDevice)
324 {
325 if(resolved_USBSpaceWire_GetDriverReadBufferSize!=NULL)
326 return resolved_USBSpaceWire_GetDriverReadBufferSize(hDevice);
327 return 0;
328 }
329
330
331 char USBSpaceWire_IsReadThrottling(star_device_handle hDevice)
332 {
333 if(resolved_USBSpaceWire_IsReadThrottling!=NULL)
334 return resolved_USBSpaceWire_IsReadThrottling(hDevice);
335 return 0;
336 }
337
338
339 char USBSpaceWire_WaitOnReadPacketAvailable(star_device_handle hDevice, double timeout)
340 {
341 if(resolved_USBSpaceWire_WaitOnReadPacketAvailable!=NULL)
342 return resolved_USBSpaceWire_WaitOnReadPacketAvailable(hDevice,timeout);
343 return 0;
344 }
345
346
347 USB_SPACEWIRE_STATUS USBSpaceWire_SendPacket(star_device_handle hDevice, void *pBuffer, U32 nBufferSize, char bWait, USB_SPACEWIRE_ID *identifier)
348 {
349 if(resolved_USBSpaceWire_SendPacket!=NULL)
350 return resolved_USBSpaceWire_SendPacket(hDevice,pBuffer,nBufferSize,bWait,identifier);
351 return TRANSFER_ERROR_USB_ERROR;
352 }
353
354
355 char USBSpaceWire_FreeSend(star_device_handle hDevice, USB_SPACEWIRE_ID identifier)
356 {
357 if(resolved_USBSpaceWire_FreeSend!=NULL)
358 return resolved_USBSpaceWire_FreeSend(hDevice,identifier);
359 return 0;
360 }
361
362
363 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)
364 {
365 if(resolved_USBSpaceWire_ReadPackets!=NULL)
366 return resolved_USBSpaceWire_ReadPackets(hDevice,pBuffer,nBufferSize, nPacketNum,bWait, properties,identifier);
367 return TRANSFER_ERROR_USB_ERROR;
368 }
369
370
371 char USBSpaceWire_FreeRead(star_device_handle hDevice, USB_SPACEWIRE_ID identifier)
372 {
373 if(resolved_USBSpaceWire_FreeRead!=NULL)
374 return resolved_USBSpaceWire_FreeRead(hDevice,identifier);
375 return 0;
376 }
377
378
379 SPACEWIRE_TRAFFIC_TYPE USBSpaceWire_GetReadTrafficType(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum)
380 {
381 if(resolved_USBSpaceWire_GetReadTrafficType!=NULL)
382 return resolved_USBSpaceWire_GetReadTrafficType(pProperties,nPacketNum);
383 return SPACEWIRE_TRAFFIC_UNKNOWN;
384 }
385
386
387 USB_SPACEWIRE_EOP_TYPE USBSpaceWire_GetReadEOPStatus(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum)
388 {
389 if(resolved_USBSpaceWire_GetReadEOPStatus!=NULL)
390 return resolved_USBSpaceWire_GetReadEOPStatus(pProperties,nPacketNum);
391 return SPACEWIRE_USB_NO_EOP;
392 }
393
394
395 void CFGSpaceWire_EnableRMAP(char useRMAP)
396 {
397 if(resolved_CFGSpaceWire_EnableRMAP!=NULL)
398 resolved_CFGSpaceWire_EnableRMAP(useRMAP);
399 }
400
401
402 void CFGSpaceWire_SetRMAPDestinationKey(U8 destinationKey)
403 {
404 if(resolved_CFGSpaceWire_SetRMAPDestinationKey!=NULL)
405 resolved_CFGSpaceWire_SetRMAPDestinationKey(destinationKey);
406 }
407
408
409 void CFGSpaceWire_StackClear()
410 {
411 if(resolved_CFGSpaceWire_StackClear!=NULL)
412 resolved_CFGSpaceWire_StackClear();
413 }
414
415
416 void CFGSpaceWire_AddrStackPush(U8 dwAddress)
417 {
418 if(resolved_CFGSpaceWire_AddrStackPush!=NULL)
419 resolved_CFGSpaceWire_AddrStackPush(dwAddress);
420 }
421
422
423 void CFGSpaceWire_RetAddrStackPush(U8 dwAddress)
424 {
425 if(resolved_CFGSpaceWire_RetAddrStackPush!=NULL)
426 resolved_CFGSpaceWire_RetAddrStackPush(dwAddress);
427 }
428
429
430 int CFGSpaceWire_SetBrickBaseTransmitRate(star_device_handle hDevice, U32 dwBaseClk, U32 dwBaseDvdr, U32 dwEnableClk)
431 {
432 if(resolved_CFGSpaceWire_SetBrickBaseTransmitRate!=NULL)
433 return resolved_CFGSpaceWire_SetBrickBaseTransmitRate(hDevice, dwBaseClk, dwBaseDvdr, dwEnableClk);
434 return 0;
435 }
436
437
438 int CFGSpaceWire_GetLinkStatusControl(star_device_handle hDevice, U32 dwLinkNum, U32 *dwStatusControl)
439 {
440 if(resolved_CFGSpaceWire_GetLinkStatusControl!=NULL)
441 return resolved_CFGSpaceWire_GetLinkStatusControl(hDevice, dwLinkNum, dwStatusControl);
442 return 0;
443 }
444
445
446 void CFGSpaceWire_LSEnableAutoStart(U32 *dwStatusControl, char bEnabled)
447 {
448 if(resolved_CFGSpaceWire_LSEnableAutoStart!=NULL)
449 resolved_CFGSpaceWire_LSEnableAutoStart(dwStatusControl, bEnabled);
450 }
451
452
453 void CFGSpaceWire_LSEnableStart(U32 *dwStatusControl, char bEnabled)
454 {
455 if(resolved_CFGSpaceWire_LSEnableStart!=NULL)
456 resolved_CFGSpaceWire_LSEnableStart(dwStatusControl, bEnabled);
457 }
458
459
460 void CFGSpaceWire_LSEnableDisabled(U32 *dwStatusControl, char bEnabled)
461 {
462 if(resolved_CFGSpaceWire_LSEnableDisabled!=NULL)
463 resolved_CFGSpaceWire_LSEnableDisabled(dwStatusControl, bEnabled);
464 }
465
466
467 void CFGSpaceWire_LSEnableTristate(U32 *dwStatusControl, char bEnabled)
468 {
469 if(resolved_CFGSpaceWire_LSEnableTristate!=NULL)
470 resolved_CFGSpaceWire_LSEnableTristate(dwStatusControl, bEnabled);
471 }
472
473
474 void CFGSpaceWire_LSPortType(U32 dwStatusControl, U32 *dwPortType)
475 {
476 if(resolved_CFGSpaceWire_LSPortType!=NULL)
477 resolved_CFGSpaceWire_LSPortType(dwStatusControl, dwPortType);
478 }
479
480
481 void CFGSpaceWire_LSSetOperatingSpeed(U32 *dwStatusControl, U32 dwOperatingSpeed)
482 {
483 if(resolved_CFGSpaceWire_LSSetOperatingSpeed!=NULL)
484 resolved_CFGSpaceWire_LSSetOperatingSpeed(dwStatusControl, dwOperatingSpeed);
485 }
486
487
488 void CFGSpaceWire_LSConfigErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus)
489 {
490 if(resolved_CFGSpaceWire_LSConfigErrorStatus!=NULL)
491 resolved_CFGSpaceWire_LSConfigErrorStatus(dwStatusControl, dwErrorStatus);
492 }
493
494
495 void CFGSpaceWire_LSExternalErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus)
496 {
497 if(resolved_CFGSpaceWire_LSExternalErrorStatus!=NULL)
498 resolved_CFGSpaceWire_LSExternalErrorStatus(dwStatusControl, dwErrorStatus);
499 }
500
501
502 void CFGSpaceWire_LSErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus)
503 {
504 if(resolved_CFGSpaceWire_LSErrorStatus!=NULL)
505 resolved_CFGSpaceWire_LSErrorStatus(dwStatusControl, dwErrorStatus);
506 }
507
508
509 void CFGSpaceWire_LSLinkState(U32 dwStatusControl, U32 *dwLinkStatus)
510 {
511 if(resolved_CFGSpaceWire_LSLinkState!=NULL)
512 resolved_CFGSpaceWire_LSLinkState(dwStatusControl, dwLinkStatus);
513 }
514
515
516 void CFGSpaceWire_LSIsLinkRunning(U32 dwStatusControl, char *isLinkRunning)
517 {
518 if(resolved_CFGSpaceWire_LSIsLinkRunning!=NULL)
519 resolved_CFGSpaceWire_LSIsLinkRunning(dwStatusControl, isLinkRunning);
520 }
521
522
523 void CFGSpaceWire_LSIsAutoStart(U32 dwStatusControl, char *isAutoStart)
524 {
525 if(resolved_CFGSpaceWire_LSIsAutoStart!=NULL)
526 resolved_CFGSpaceWire_LSIsAutoStart(dwStatusControl, isAutoStart);
527 }
528
529
530 void CFGSpaceWire_LSIsStart(U32 dwStatusControl, char *isStart)
531 {
532 if(resolved_CFGSpaceWire_LSIsStart!=NULL)
533 resolved_CFGSpaceWire_LSIsStart(dwStatusControl, isStart);
534 }
535
536
537 void CFGSpaceWire_LSIsDisabled(U32 dwStatusControl, char *isDisabled)
538 {
539 if(resolved_CFGSpaceWire_LSIsDisabled!=NULL)
540 resolved_CFGSpaceWire_LSIsDisabled(dwStatusControl, isDisabled);
541 }
542
543
544 void CFGSpaceWire_LSIsTristate(U32 dwStatusControl, char *isTristate)
545 {
546 if(resolved_CFGSpaceWire_LSIsTristate!=NULL)
547 resolved_CFGSpaceWire_LSIsTristate(dwStatusControl, isTristate);
548 }
549
550
551 void CFGSpaceWire_LSOperatingSpeed(U32 dwStatusControl, U32 *dwOperatingSpeed)
552 {
553 if(resolved_CFGSpaceWire_LSOperatingSpeed!=NULL)
554 resolved_CFGSpaceWire_LSOperatingSpeed(dwStatusControl, dwOperatingSpeed);
555 }
556
557
558 void CFGSpaceWire_LSOutputPortConnection(U32 dwStatusControl, U32 *dwOutputPortConnection)
559 {
560 if(resolved_CFGSpaceWire_LSOutputPortConnection!=NULL)
561 resolved_CFGSpaceWire_LSOutputPortConnection(dwStatusControl, dwOutputPortConnection);
562 }
563
564
565 int CFGSpaceWire_SetLinkStatusControl(star_device_handle hDevice, U32 dwLinkNum, U32 dwStatusControl)
566 {
567 if(resolved_CFGSpaceWire_SetLinkStatusControl!=NULL)
568 return resolved_CFGSpaceWire_SetLinkStatusControl(hDevice, dwLinkNum, dwStatusControl);
569 return 0;
570 }
571
572
573 int CFGSpaceWire_SetAsInterface(star_device_handle hDevice, char bEnabled, char bAddIdentifier)
574 {
575 if(resolved_CFGSpaceWire_SetAsInterface!=NULL)
576 return resolved_CFGSpaceWire_SetAsInterface(hDevice, bEnabled, bAddIdentifier);
577 return 0;
578 }
579
580
581 int CFGSpaceWire_ClearRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress)
582 {
583 if(resolved_CFGSpaceWire_ClearRoutingTableEntry!=NULL)
584 return resolved_CFGSpaceWire_ClearRoutingTableEntry(hDevice,nLogicalAddress);
585 return 0;
586 }
587
588
589 void CFGSpaceWire_RTBuildRoutingTableEntry(U32 *dwRoutingTableEntry, U32 dwOutputPorts, char bDelHead, char bPriority)
590 {
591 if(resolved_CFGSpaceWire_RTBuildRoutingTableEntry!=NULL)
592 resolved_CFGSpaceWire_RTBuildRoutingTableEntry(dwRoutingTableEntry, dwOutputPorts, bDelHead, bPriority);
593 }
594
595
596 int CFGSpaceWire_SetRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress, U32 dwRoutingTableEntry)
597 {
598 if(resolved_CFGSpaceWire_SetRoutingTableEntry!=NULL)
599 return resolved_CFGSpaceWire_SetRoutingTableEntry(hDevice,nLogicalAddress, dwRoutingTableEntry);
600 return 0;
601 }
602
603
604 int CFGSpaceWire_GetRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress, U32 *dwRoutingTableEntry)
605 {
606 if(resolved_CFGSpaceWire_GetRoutingTableEntry!=NULL)
607 return resolved_CFGSpaceWire_GetRoutingTableEntry(hDevice,nLogicalAddress, dwRoutingTableEntry);
608 return 0;
609 }
610
611
612 void CFGSpaceWire_RTIsEnabled(U32 dwRoutingTableEntry, char *bEnabled)
613 {
614 if(resolved_CFGSpaceWire_RTIsEnabled!=NULL)
615 resolved_CFGSpaceWire_RTIsEnabled( dwRoutingTableEntry, bEnabled);
616 }
617
618
619 void CFGSpaceWire_RTIsDelHead(U32 dwRoutingTableEntry, char *bDelHead)
620 {
621 if(resolved_CFGSpaceWire_RTIsDelHead!=NULL)
622 resolved_CFGSpaceWire_RTIsDelHead( dwRoutingTableEntry, bDelHead);
623 }
624
625
626 void CFGSpaceWire_RTIsPriority(U32 dwRoutingTableEntry, char *bPriority)
627 {
628 if(resolved_CFGSpaceWire_RTIsPriority!=NULL)
629 resolved_CFGSpaceWire_RTIsPriority( dwRoutingTableEntry, bPriority);
630 }
631
632
633 void CFGSpaceWire_RTGetOutputPorts(U32 dwRoutingTableEntry, U32 *dwOutputPorts)
634 {
635 if(resolved_CFGSpaceWire_RTGetOutputPorts!=NULL)
636 resolved_CFGSpaceWire_RTGetOutputPorts( dwRoutingTableEntry, dwOutputPorts);
637 }
638
639
640 int CFGSpaceWire_GetTickEnableStatus(star_device_handle hDevice, U32 *dwTickEnableStatus)
641 {
642 if(resolved_CFGSpaceWire_GetTickEnableStatus!=NULL)
643 return resolved_CFGSpaceWire_GetTickEnableStatus( hDevice, dwTickEnableStatus);
644 return 0;
645 }
646
647
648 int CFGSpaceWire_SetTickEnableStatus(star_device_handle hDevice, U32 dwTickEnableStatus)
649 {
650 if(resolved_CFGSpaceWire_SetTickEnableStatus!=NULL)
651 return resolved_CFGSpaceWire_SetTickEnableStatus( hDevice, dwTickEnableStatus);
652 return 0;
653 }
@@ -0,0 +1,372
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
22 #ifndef FAKESTARDUNDEESPWUSB_LIB_H
23 #define FAKESTARDUNDEESPWUSB_LIB_H
24
25 typedef void *star_device_handle;
26 typedef void * USB_SPACEWIRE_ID;
27 typedef unsigned char U8;
28 typedef unsigned int U32;
29 //#include <spw_usb_api.h>
30 //#include <spw_config_library.h>
31 #include <QLibrary>
32
33
34 /* Possible bit values */
35 #define BIT0 (0x00000001)
36 #define BIT1 (0x00000002)
37 #define BIT2 (0x00000004)
38 #define BIT3 (0x00000008)
39 #define BIT4 (0x00000010)
40 #define BIT5 (0x00000020)
41 #define BIT6 (0x00000040)
42 #define BIT7 (0x00000080)
43 #define BIT8 (0x00000100)
44 #define BIT9 (0x00000200)
45 #define BIT10 (0x00000400)
46 #define BIT11 (0x00000800)
47 #define BIT12 (0x00001000)
48 #define BIT13 (0x00002000)
49 #define BIT14 (0x00004000)
50 #define BIT15 (0x00008000)
51 #define BIT16 (0x00010000)
52 #define BIT17 (0x00020000)
53 #define BIT18 (0x00040000)
54 #define BIT19 (0x00080000)
55 #define BIT20 (0x00100000)
56 #define BIT21 (0x00200000)
57 #define BIT22 (0x00400000)
58 #define BIT23 (0x00800000)
59 #define BIT24 (0x01000000)
60 #define BIT25 (0x02000000)
61 #define BIT26 (0x04000000)
62 #define BIT27 (0x08000000)
63 #define BIT28 (0x10000000)
64 #define BIT29 (0x20000000)
65 #define BIT30 (0x40000000)
66 #define BIT31 (0x80000000)
67
68 /* SpaceWire Port errors */
69 #define CFG_SPACEWIRE_NO_ERRORS (0)
70 #define CFG_SPACEWIRE_ERROR_ACTIVE (BIT0)
71 #define CFG_SPACEWIRE_PACKET_ADDRESS_ERROR (BIT1)
72 #define CFG_SPACEWIRE_PORT_TIMEOUT_ERROR (BIT2)
73 #define CFG_SPACEWIRE_DISCONNECT_ERROR (BIT3)
74 #define CFG_SPACEWIRE_PARITY_ERROR (BIT4)
75 #define CFG_SPACEWIRE_ESCAPE_ERROR (BIT5)
76 #define CFG_SPACEWIRE_CREDIT_ERROR (BIT6)
77 #define CFG_SPACEWIRE_CHARACTER_SEQUENCE_ERROR (BIT7)
78 #define CFG_SPACEWIRE_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \
79 BIT4 | BIT5 | BIT6 | BIT7)
80
81 /* Config Port errors */
82 #define CFG_CONFIG_NO_ERRORS (0)
83 #define CFG_CONFIG_ERROR_ACTIVE (BIT0)
84
85 /* Config Port errors (non-RMAP) */
86 #define CFG_CONFIG_PACKET_ADDRESS_ERROR (BIT1)
87 #define CFG_CONFIG_PORT_TIMEOUT_ERROR (BIT2)
88 #define CFG_CONFIG_CHECKSUM_ERROR (BIT3)
89 #define CFG_CONFIG_TOO_SHORT_ERROR (BIT4)
90 #define CFG_CONFIG_TOO_LONG_ERROR (BIT5)
91 #define CFG_CONFIG_PACKET_EEP_ERROR (BIT6)
92 #define CFG_CONFIG_PROTOCOL_BYTE_ERROR (BIT7)
93 #define CFG_CONFIG_INVALID_REGISTER_ERROR (BIT8)
94 #define CFG_CONFIG_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \
95 BIT4 | BIT5 | BIT6 | BIT7 | \
96 BIT8)
97
98 /* Config Port errors (RMAP) */
99 #define CFG_CONFIG_RMAP_PORT_TIMEOUT_ERROR (BIT1)
100 #define CFG_CONFIG_RMAP_INVALID_HEADER_CRC (BIT2)
101 #define CFG_CONFIG_RMAP_INVALID_DATA_CRC (BIT3)
102 #define CFG_CONFIG_RMAP_INVALID_DESTINATION_KEY (BIT4)
103 #define CFG_CONFIG_RMAP_COMMAND_NOT_IMPLEMENTED (BIT5)
104 #define CFG_CONFIG_RMAP_INVALID_DATA_LENGTH (BIT6)
105 #define CFG_CONFIG_RMAP_INVALID_RMW_DATA_LENGTH (BIT7)
106 #define CFG_CONFIG_RMAP_INVALID_DESTINATION_ADDRESS (BIT8)
107 #define CFG_CONFIG_RMAP_EARLY_EOP (BIT9)
108 #define CFG_CONFIG_RMAP_LATE_EOP (BIT10)
109 #define CFG_CONFIG_RMAP_EARLY_EEP (BIT11)
110 #define CFG_CONFIG_RMAP_LATE_EEP (BIT12)
111 #define CFG_CONFIG_RMAP_VERIFY_BUFFER_OVERRUN_ERROR (BIT13)
112 #define CFG_CONFIG_RMAP_INVALID_REGISTER_ADDRESS (BIT14)
113 #define CFG_CONFIG_RMAP_UNSUPPORTED_PROTOCOL_ERROR (BIT15)
114 #define CFG_CONFIG_RMAP_SOURCE_LOGICAL_ADDRESS_ERROR (BIT16)
115 #define CFG_CONFIG_RMAP_SOURCE_PATH_ADDRESS_ERROR (BIT17)
116 #define CFG_CONFIG_RMAP_CARGO_TOO_LARGE (BIT18)
117 #define CFG_CONFIG_RMAP_UNUSED_COMMAND_OR_PACKET_TYPE (BIT19)
118 #define CFG_CONFIG_RMAP_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \
119 BIT5 | BIT6 | BIT7 | BIT8 | BIT9 | \
120 BIT10 | BIT11 | BIT12 | BIT13 | \
121 BIT14 | BIT15 | BIT16 | BIT17 | \
122 BIT18 | BIT19)
123
124 /* External Port errors */
125 #define CFG_EXTERNAL_NO_ERRORS (0)
126 #define CFG_EXTERNAL_ERROR_ACTIVE (BIT0)
127 #define CFG_EXTERNAL_PACKET_ADDRESS_ERROR (BIT1)
128 #define CFG_EXTERNAL_PORT_TIMEOUT_ERROR (BIT2)
129 #define CFG_EXTERNAL_INPUT_BUFFER_EMPTY_ERROR (BIT3)
130 #define CFG_EXTERNAL_INPUT_BUFFER_FULL_ERROR (BIT4)
131 #define CFG_EXTERNAL_OUTPUT_BUFFER_EMPTY_ERROR (BIT5)
132 #define CFG_EXTERNAL_OUTPUT_BUFFER_FULL_ERROR (BIT6)
133 #define CFG_EXTERNAL_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \
134 BIT4 | BIT5 | BIT6)
135
136 /* SpaceWire Port interface state */
137 #define CFG_SPACEWIRE_ERROR_RESET (0)
138 #define CFG_SPACEWIRE_ERROR_WAIT (BIT0)
139 #define CFG_SPACEWIRE_READY (BIT1)
140 #define CFG_SPACEWIRE_STARTED (BIT1 | BIT0)
141 #define CFG_SPACEWIRE_CONNECTING (BIT2)
142 #define CFG_SPACEWIRE_RUN (BIT2 | BIT0)
143
144 /* Port type */
145 #define CFG_CONFIGURATION_PORT (0)
146 #define CFG_SPACEWIRE_SERIAL_PORT (BIT0)
147 #define CFG_SPACEWIRE_EXTERNAL_PORT (BIT1)
148
149 /* SpaceWire Port control bits */
150 #define CFG_SPACEWIRE_INTERFACE_STATE_START (8)
151 #define CFG_SPACEWIRE_INTERFACE_STATE (BIT8 | BIT9 | BIT10)
152 #define CFG_SPACEWIRE_RUNNING (BIT11)
153 #define CFG_SPACEWIRE_AUTOSTART (BIT12)
154 #define CFG_SPACEWIRE_START (BIT13)
155 #define CFG_SPACEWIRE_DISABLE (BIT14)
156 #define CFG_SPACEWIRE_TRISTATE (BIT15)
157 #define CFG_SPACEWIRE_RATE (BIT16 | BIT17 | BIT18 | \
158 BIT19 | BIT20 | BIT21 | BIT22)
159 #define CFG_SPACEWIRE_RATE_START (16)
160
161 /* Bits in the GAR Table */
162 #define CFG_GAR_OUTPUT_PORTS_START (1)
163 #define CFG_GAR_OUTPUT_PORTS (BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | \
164 BIT6 | BIT7 | BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | BIT13 | BIT14 | \
165 BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | \
166 BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28)
167 #define CFG_GAR_DEL_HEAD (BIT29)
168 #define CFG_GAR_PRIORITY (BIT30)
169 #define CFG_GAR_INVALID_ADDR (BIT31)
170
171 /* Bits in the router control register */
172 #define CFG_RC_TIMEOUT_ENABLE_START (0)
173 #define CFG_RC_TIMEOUT_ENABLE (BIT0)
174 #define CFG_RC_TIMEOUT_VALUE_START (1)
175 #define CFG_RC_TIMEOUT_VALUE (BIT1 | BIT2 | BIT3)
176 #define CFG_RC_DISABLE_ON_SILENCE (BIT4)
177 #define CFG_RC_DISABLE_ON_SILENCE_START (4)
178 #define CFG_RC_START_ON_REQUEST (BIT5)
179 #define CFG_RC_START_ON_REQUEST_START (5)
180 #define CFG_RC_SELF_ADDRESSING (BIT6)
181 #define CFG_RC_SELF_ADDRESSING_START (6)
182 #define CFG_RC_INTERFACE (BIT7)
183 #define CFG_RC_INTERFACE_START (7)
184 #define CFG_RC_INTERFACE_IDENT (BIT8)
185 #define CFG_RC_INTERFACE_IDENT_START (8)
186
187 /* The bits shared by all ports */
188 #define CFG_PORT_CONNECTION (BIT24 | BIT25 | BIT26 | BIT27 | BIT28)
189 #define CFG_PORT_CONNECTION_START (24)
190 #define CFG_PORT_TYPE (BIT29 | BIT30 | BIT31)
191 #define CFG_PORT_TYPE_START (29)
192
193 /* Network discovery register values */
194 #define CFG_NETD_TYPE (BIT0 | BIT1 | BIT2 | BIT3)
195 #define CFG_NETD_TYPE_START (0)
196 #define CFG_NETD_RETURN_PORT (BIT4 | BIT5 | BIT6 | BIT7)
197 #define CFG_NETD_RETURN_PORT_START (4)
198 #define CFG_NETD_RUNNING_PORTS (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \
199 BIT13 | BIT14 | BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | \
200 BIT21 | BIT22 | BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28 | \
201 BIT29 | BIT30 | BIT31)
202 #define CFG_NETD_RUNNING_PORTS_START (8)
203
204 /* Values in the ID register */
205 #define CFG_ID_VERSION (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \
206 BIT5 | BIT6 | BIT7)
207 #define CFG_ID_VERSION_START (0)
208 #define CFG_ID_CHIP (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \
209 BIT13 | BIT14 | BIT15)
210 #define CFG_ID_CHIP_START (8)
211 #define CFG_ID_MANUFACTURER (BIT16 | BIT17 | BIT18 | BIT19 | \
212 BIT20 | BIT21 | BIT22 | BIT23)
213 #define CFG_ID_MANUFACTURER_START (16)
214
215 /* Values in the Time-Code register */
216 #define CFG_TC_VALUE (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \
217 BIT5)
218 #define CFG_TC_VALUE_START (0)
219 #define CFG_TC_FLAGS (BIT6 | BIT7)
220 #define CFG_TC_FLAGS_START (6)
221
222 /* Values for the Router Base Clock Select */
223 #define CFG_RTR_CLK_100_MBITS (0)
224 #define CFG_RTR_CLK_200_MBITS (BIT0)
225
226 /* Values for the Brick Base Clock */
227 #define CFG_BRK_CLK_100_MHZ (0)
228 #define CFG_BRK_CLK_120_MHZ (BIT0)
229 #define CFG_BRK_CLK_140_MHZ (BIT1)
230 #define CFG_BRK_CLK_160_MHZ (BIT0 | BIT1)
231 #define CFG_BRK_CLK_180_MHZ (BIT2)
232 #define CFG_BRK_CLK_200_MHZ (BIT2 | BIT0)
233
234 /* Values for the Brick Base Divider */
235 #define CFG_BRK_DVDR_1 (0)
236 #define CFG_BRK_DVDR_2 (BIT0)
237 #define CFG_BRK_DVDR_4 (BIT1)
238
239 typedef enum
240 {
241 TRANSFER_NOT_STARTED = 0,
242 TRANSFER_STARTED = 1,
243 TRANSFER_SUCCESS = 2,
244 TRANSFER_ERROR_DISCONNECT = 3,
245 TRANSFER_ERROR_PARITY = 4,
246 TRANSFER_ERROR_UNKNOWN = 5,
247 TRANSFER_ERROR_TIMEOUT = 6,
248 TRANSFER_ERROR_LINK_NOT_STARTED = 7,
249 TRANSFER_ERROR_USER_BUFFER_LOCK_FAILED = 8,
250 TRANSFER_ERROR_LINK_ALREADY_IN_USE = 9,
251 TRANSFER_ERROR_RECEIVE_BUFFER_FULL = 0xa,
252 TRANSFER_ERROR_OUT_OF_MEMORY = 0xb,
253 TRANSFER_ERROR_NOT_FOUND = 0xc,
254 TRANSFER_ERROR_USB_ERROR = 0xd,
255 TRANSFER_ERROR_NOT_REGISTERED_TO_RECEIVE = 0xe
256 } USB_SPACEWIRE_STATUS, *PUSB_SPACEWIRE_STATUS;
257
258 #define SPACEWIRE_USB_EOP_CHAR ((U8)0x80)
259 #define SPACEWIRE_USB_EEP_CHAR ((U8)0x40)
260
261 typedef enum
262 {
263 SPACEWIRE_USB_NO_EOP = 0,
264 SPACEWIRE_USB_EOP = SPACEWIRE_USB_EOP_CHAR,
265 SPACEWIRE_USB_EEP = SPACEWIRE_USB_EEP_CHAR
266 } USB_SPACEWIRE_EOP_TYPE, *PUSB_SPACEWIRE_EOP_TYPE;
267
268 typedef enum
269 {
270 SPACEWIRE_TRAFFIC_UNKNOWN = -1,
271 SPACEWIRE_TRAFFIC_PACKET = 0,
272 SPACEWIRE_TRAFFIC_TIMECODE = 1,
273 SPACEWIRE_TRAFFIC_CONTROL = 2
274 } SPACEWIRE_TRAFFIC_TYPE, *PSPACEWIRE_TRAFFIC_TYPE;
275
276 typedef struct
277 {
278 unsigned long len;
279 USB_SPACEWIRE_EOP_TYPE eop;
280 SPACEWIRE_TRAFFIC_TYPE type;
281 } USB_SPACEWIRE_PACKET_PROPERTIES, *PUSB_SPACEWIRE_PACKET_PROPERTIES;
282
283
284
285 typedef enum
286 {
287 CFG_TRANSFER_SUCCESS = 0x00,
288 CFG_TRANSMIT_PACKET_FAILURE = 0x01,
289 CFG_REPLY_PACKET_FAILURE = 0x02,
290 CFG_REPLY_PACKET_TOO_BIG = 0x03,
291 CFG_REPLY_PACKET_TOO_SMALL = 0x04,
292 CFG_REPLY_PACKET_NAK = 0x05,
293 CFG_REPLY_PACKET_CHECKSUM_ERROR = 0x06
294 } CFG_SPACEWIRE_STATUS;
295
296
297
298 char USBSpaceWire_Open(star_device_handle *phDevice, int nDeviceNum);
299 void USBSpaceWire_Close(star_device_handle hDevice);
300 U32 USBSpaceWire_ListDevices();
301 char USBSpaceWire_GetSerialNumber(star_device_handle hDevice, U8 pSerialNumber[11]);
302 void USBSpaceWire_EnableNetworkMode(star_device_handle hDevice, char enable);
303 char USBSpaceWire_RegisterReceiveOnAllPorts(star_device_handle hDevice);
304 char USBSpaceWire_UnregisterReceiveOnAllPorts(star_device_handle hDevice);
305 char USBSpaceWire_ClearEndpoints(star_device_handle hDevice);
306 void USBSpaceWire_SetTimeout(star_device_handle hDevice, double timeout);
307 char USBSpaceWire_TC_Reset(star_device_handle hDevice);
308 char USBSpaceWire_TC_EnableExternalTimecodeSelection(star_device_handle hDevice,char enable);
309 U32 USBSpaceWire_TC_GetClockFrequency(star_device_handle hDevice);
310 char USBSpaceWire_TC_SetAutoTickInFrequency(star_device_handle hDevice, U32 frequency);
311 char USBSpaceWire_TC_EnableAutoTickIn(star_device_handle hDevice, char enableAutoTickIns, char enableAllPorts);
312 char USBSpaceWire_TC_PerformTickIn(star_device_handle hDevice, U8 timein);
313 U32 USBSpaceWire_GetDriverSendBufferSize(star_device_handle hDevice);
314 U32 USBSpaceWire_GetDriverReadBufferSize(star_device_handle hDevice);
315 char USBSpaceWire_IsReadThrottling(star_device_handle hDevice);
316
317 char USBSpaceWire_WaitOnReadPacketAvailable(star_device_handle hDevice, double timeout);
318 USB_SPACEWIRE_STATUS USBSpaceWire_SendPacket(star_device_handle hDevice, void *pBuffer, U32 nBufferSize, char bWait,USB_SPACEWIRE_ID *identifier);
319 char USBSpaceWire_FreeSend(star_device_handle hDevice, USB_SPACEWIRE_ID identifier);
320 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);
321 char USBSpaceWire_FreeRead(star_device_handle hDevice, USB_SPACEWIRE_ID identifier);
322 SPACEWIRE_TRAFFIC_TYPE USBSpaceWire_GetReadTrafficType(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum);
323 USB_SPACEWIRE_EOP_TYPE USBSpaceWire_GetReadEOPStatus(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties,U32 nPacketNum);
324
325 void CFGSpaceWire_EnableRMAP(char useRMAP);
326 void CFGSpaceWire_SetRMAPDestinationKey(U8 destinationKey);
327 void CFGSpaceWire_StackClear(void);
328 void CFGSpaceWire_AddrStackPush(U8 dwAddress);
329 void CFGSpaceWire_RetAddrStackPush(U8 dwAddress);
330 int CFGSpaceWire_SetBrickBaseTransmitRate(star_device_handle hDevice, U32 dwBaseClk, U32 dwBaseDvdr, U32 dwEnableClk);
331 int CFGSpaceWire_GetLinkStatusControl(star_device_handle hDevice, U32 dwLinkNum, U32 *dwStatusControl);
332 void CFGSpaceWire_LSEnableAutoStart(U32 *dwStatusControl, char bEnabled);
333 void CFGSpaceWire_LSEnableStart(U32 *dwStatusControl, char bEnabled);
334 void CFGSpaceWire_LSEnableDisabled(U32 *dwStatusControl, char bEnabled);
335 void CFGSpaceWire_LSEnableTristate(U32 *dwStatusControl, char bEnabled);
336 void CFGSpaceWire_LSPortType(U32 dwStatusControl, U32 *dwPortType);
337 void CFGSpaceWire_LSSetOperatingSpeed(U32 *dwStatusControl, U32 dwOperatingSpeed);
338 void CFGSpaceWire_LSConfigErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus);
339 void CFGSpaceWire_LSExternalErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus);
340 void CFGSpaceWire_LSErrorStatus(U32 dwStatusControl, U32 *dwErrorStatus);
341 void CFGSpaceWire_LSLinkState(U32 dwStatusControl, U32 *dwLinkStatus);
342 void CFGSpaceWire_LSIsLinkRunning(U32 dwStatusControl, char *isLinkRunning);
343 void CFGSpaceWire_LSIsAutoStart(U32 dwStatusControl, char *isAutoStart);
344 void CFGSpaceWire_LSIsStart(U32 dwStatusControl, char *isStart);
345 void CFGSpaceWire_LSIsDisabled(U32 dwStatusControl, char *isDisabled);
346 void CFGSpaceWire_LSIsTristate(U32 dwStatusControl, char *isTristate);
347 void CFGSpaceWire_LSOperatingSpeed(U32 dwStatusControl, U32 *dwOperatingSpeed);
348 void CFGSpaceWire_LSOutputPortConnection(U32 dwStatusControl, U32 *dwOutputPortConnection);
349 int CFGSpaceWire_SetLinkStatusControl(star_device_handle hDevice, U32 dwLinkNum, U32 dwStatusControl);
350 int CFGSpaceWire_SetAsInterface(star_device_handle hDevice, char bEnabled, char bAddIdentifier);
351 int CFGSpaceWire_ClearRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress);
352 void CFGSpaceWire_RTBuildRoutingTableEntry(U32 *dwRoutingTableEntry,U32 dwOutputPorts, char bDelHead, char bPriority);
353 int CFGSpaceWire_SetRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress, U32 dwRoutingTableEntry);
354 int CFGSpaceWire_GetRoutingTableEntry(star_device_handle hDevice, U32 nLogicalAddress, U32 *dwRoutingTableEntry);
355 void CFGSpaceWire_RTIsEnabled(U32 dwRoutingTableEntry, char *bEnabled);
356 void CFGSpaceWire_RTIsDelHead(U32 dwRoutingTableEntry, char *bDelHead);
357 void CFGSpaceWire_RTIsPriority(U32 dwRoutingTableEntry, char *bPriority);
358 void CFGSpaceWire_RTGetOutputPorts(U32 dwRoutingTableEntry, U32 *dwOutputPorts);
359 int CFGSpaceWire_GetTickEnableStatus(star_device_handle hDevice, U32 *dwTickEnableStatus);
360 int CFGSpaceWire_SetTickEnableStatus(star_device_handle hDevice, U32 dwTickEnableStatus);
361
362
363
364
365 class FakeStarDundeeSpwUSB_Lib
366 {
367 public:
368 FakeStarDundeeSpwUSB_Lib();
369 static void resolve();
370 };
371
372 #endif // FAKESTARDUNDEESPWUSB_LIB_H
@@ -244,6 +244,17 bool dsu3plugin::dumpSymbol(const QStrin
244 return false;
244 return false;
245 }
245 }
246
246
247 QVariantList dsu3plugin::readSymbol(const QString &symbolName)
248 {
249 if(this->elfFile->isopened())
250 {
251 int symbolIndex=this->elfFile->getSymbolIndex(symbolName);
252 if(symbolIndex!=-1)
253 return socexplorerplugin::Read((unsigned int)this->elfFile->getSymbolAddress(symbolIndex),(unsigned int)this->elfFile->getSymbolSize(symbolIndex)/4);
254 }
255 return QVariantList();
256 }
257
247 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
258 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
248 {
259 {
249 unsigned int* buff;
260 unsigned int* buff;
@@ -57,7 +57,7 public slots:
57 //added for python backward compatibility
57 //added for python backward compatibility
58 void loadFile(){this->flashTarget();}
58 void loadFile(){this->flashTarget();}
59 bool dumpSymbol(const QString& symbolName,QString file,const QString& format);
59 bool dumpSymbol(const QString& symbolName,QString file,const QString& format);
60
60 QVariantList readSymbol(const QString& symbolName);
61 signals:
61 signals:
62 void updateInfo(ElfFile* elfFile);
62 void updateInfo(ElfFile* elfFile);
63 private:
63 private:
@@ -22,8 +22,9
22 #include "stardundeegui.h"
22 #include "stardundeegui.h"
23
23
24 #include "ui_stardundeeGUI.h"
24 #include "ui_stardundeeGUI.h"
25 #include <spw_usb_api.h>
25 #include "fakestardundeespwusb_lib.h"
26 #include <spw_config_library.h>
26 //#include <spw_usb_api.h>
27 //#include <spw_config_library.h>
27
28
28 StarDundeeGUI::StarDundeeGUI(QWidget *parent) :
29 StarDundeeGUI::StarDundeeGUI(QWidget *parent) :
29 QWidget(parent),ui(new Ui::StarDundeeUI)
30 QWidget(parent),ui(new Ui::StarDundeeUI)
@@ -21,6 +21,7
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22
22
23 #include "stardundeespw_usb.h"
23 #include "stardundeespw_usb.h"
24 #include "fakestardundeespwusb_lib.h"
24 #include <socexplorerengine.h>
25 #include <socexplorerengine.h>
25 #include <qhexedit.h>
26 #include <qhexedit.h>
26
27
@@ -23,8 +23,10
23 #define STARDUNDEESPW_USB_H
23 #define STARDUNDEESPW_USB_H
24
24
25 #include <QObject>
25 #include <QObject>
26 #include <spw_usb_api.h>
26 //#include <spw_usb_api.h>
27 #include <spw_config_library.h>
27 //#include <spw_config_library.h>
28
29 #include "fakestardundeespwusb_lib.h"
28 #include <socexplorerplugin.h>
30 #include <socexplorerplugin.h>
29 #include <abstractspwbridge.h>
31 #include <abstractspwbridge.h>
30 #include <QThread>
32 #include <QThread>
@@ -24,11 +24,13
24 #include "stardundeespw_usb.h"
24 #include "stardundeespw_usb.h"
25 #include "gr_esb_bridge.h"
25 #include "gr_esb_bridge.h"
26 #include <socexplorerproxy.h>
26 #include <socexplorerproxy.h>
27 #include "fakestardundeespwusb_lib.h"
27
28
28
29
29 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false)
30 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false)
30 {
31 {
31 Q_UNUSED(parent)
32 Q_UNUSED(parent)
33 FakeStarDundeeSpwUSB_Lib::resolve();
32 this->bridge = NULL;
34 this->bridge = NULL;
33 this->scanDone = false;
35 this->scanDone = false;
34 // this->pyObject = new spwPyWrapper(this);
36 // this->pyObject = new spwPyWrapper(this);
@@ -7,6 +7,9 CONFIG += socexplorerplugin
7 QT += network webkit
7 QT += network webkit
8 greaterThan(QT_MAJOR_VERSION, 4): QT += webkitwidgets
8 greaterThan(QT_MAJOR_VERSION, 4): QT += webkitwidgets
9
9
10 QMAKE_CXXFLAGS += -std=c++11
11 QMAKE_CFLAGS += -std=c++11
12
10 win32:CONFIG += dll
13 win32:CONFIG += dll
11 win32:CONFIG -= static
14 win32:CONFIG -= static
12 VERSION=0.6.0
15 VERSION=0.6.0
@@ -42,7 +45,8 HEADERS += \
42 SpwTcpPacketServer/spwtcppacketserver.h \
45 SpwTcpPacketServer/spwtcppacketserver.h \
43 GR-ESB/gr_esb_bridge.h \
46 GR-ESB/gr_esb_bridge.h \
44 GR-ESB/gr_esb_ui.h \
47 GR-ESB/gr_esb_ui.h \
45 SpwTcpPacketServer/incomingpacketparser.h
48 SpwTcpPacketServer/incomingpacketparser.h \
49 StarDundee/fakestardundeespwusb_lib.h
46
50
47
51
48 SOURCES += \
52 SOURCES += \
@@ -53,7 +57,8 SOURCES += \
53 SpwTcpPacketServer/spwtcppacketserver.cpp \
57 SpwTcpPacketServer/spwtcppacketserver.cpp \
54 GR-ESB/gr_esb_bridge.cpp \
58 GR-ESB/gr_esb_bridge.cpp \
55 GR-ESB/gr_esb_ui.cpp \
59 GR-ESB/gr_esb_ui.cpp \
56 SpwTcpPacketServer/incomingpacketparser.cpp
60 SpwTcpPacketServer/incomingpacketparser.cpp \
61 StarDundee/fakestardundeespwusb_lib.cpp
57
62
58 FORMS += \
63 FORMS += \
59 StarDundee/stardundeeGUI.ui \
64 StarDundee/stardundeeGUI.ui \
General Comments 0
You need to be logged in to leave comments. Login now