This diff has been collapsed as it changes many lines, (690 lines changed) Show them Hide them | |||
@@ -0,0 +1,690 | |||
|
1 | /** | |
|
2 | * \file rmap_packet_library.h | |
|
3 | * \brief Declarations of the functions provided by the STAR-Dundee RMAP Packet | |
|
4 | * Library. | |
|
5 | * STAR-Dundee\n | |
|
6 | * Unit 12, Dundee University Incubator\n | |
|
7 | * James Lindsay Place\n | |
|
8 | * Dundee Technopole\n | |
|
9 | * Dundee, DD1 5JJ\n | |
|
10 | * Scotland, UK\n | |
|
11 | * e-mail: support@star-dundee.com | |
|
12 | * | |
|
13 | * This file contains the declarations of the functions provided by the | |
|
14 | * STAR-Dundee RMAP Packet Library, along with constants and types used by the | |
|
15 | * library. The RMAP Packet Library provides functions for building and | |
|
16 | * interpreting RMAP packets. | |
|
17 | * | |
|
18 | * <b>IMPORTANT NOTE:</b> | |
|
19 | * \note If you are experiencing compilation errors indicating that | |
|
20 | * U8 is already defined, for example, please add the following | |
|
21 | * line to your code prior to including this file:\n | |
|
22 | * <code>\#define NO_STAR_TYPES</code>\n | |
|
23 | * Alternatively you can compile your code with a flag of | |
|
24 | * <code>-DNO_STAR_TYPES</code>.\n | |
|
25 | * (Copied from star_dundee_types.h) | |
|
26 | * | |
|
27 | * \version 3.2 - June 19th 2012\n | |
|
28 | * Fixed bug when checking a write command packet or read reply packet | |
|
29 | * has a data length of 0. | |
|
30 | * Updates to documentation. | |
|
31 | * | |
|
32 | * \version 3.1 - February 10th 2012\n | |
|
33 | * Minor updates to packet types to avoid errors in static | |
|
34 | * analysers.\n\n | |
|
35 | * | |
|
36 | * \version 3.0 - October 14th 2011\n | |
|
37 | * Updated linking process on Windows.\n | |
|
38 | * Updated library file name.\n\n | |
|
39 | * | |
|
40 | * \version 2.1 - August 22nd 2011\n | |
|
41 | * Made minor improvements to the internal structure.\n\n | |
|
42 | * | |
|
43 | * \version 2.0 - October 28th 2009\n | |
|
44 | * Changed internal architecture to minimise memory allocations.\n | |
|
45 | * Restored __stdcall calling convention on Windows.\n | |
|
46 | * Updated names to be consistent with terminology in latest RMAP | |
|
47 | * standard.\n | |
|
48 | * Added functions to calculate the length of different packet types | |
|
49 | * and to fill a buffer with specific packets.\n\n | |
|
50 | * | |
|
51 | * \version 1.9 - July 29th 2009\n | |
|
52 | * Fixed problem with byte ordering in return value of | |
|
53 | * RMAP_GetAddress.\n | |
|
54 | * Fixed bug when creating read and write reply packets, with a packet | |
|
55 | * structure provided.\n\n | |
|
56 | * | |
|
57 | * \version 1.8 - February 26th 2009\n | |
|
58 | * Updated the calling convention used in the function declaration to | |
|
59 | * __stdcall on Windows.\n\n | |
|
60 | * | |
|
61 | * \version 1.7 - November 20th 2008\n | |
|
62 | * Fixed problem with naming of RMAP_IsCRCValid in header file.\n | |
|
63 | * Added function to calculate a CRC starting from a CRC seed | |
|
64 | * value.\n\n | |
|
65 | * | |
|
66 | * \version 1.6 - October 29th 2007\n | |
|
67 | * Added support for SpaceCube.\n\n | |
|
68 | * | |
|
69 | * \version 1.5 - March 23rd 2007\n | |
|
70 | * Used star_dundee_types.h to represent integer values of 1, 2 and 4 | |
|
71 | * bytes in a cross-platform manner.\n | |
|
72 | * Fixed problems encountered on big endian machines.\n\n | |
|
73 | * | |
|
74 | * \version 1.4 - March 19th 2007\n | |
|
75 | * Improved freeing of memory following errors.\n\n | |
|
76 | * | |
|
77 | * \version 1.3 - November 7th 2006\n | |
|
78 | * Updated to be multi-platform.\n | |
|
79 | * Using new CRC table.\n | |
|
80 | * Fixed error when checking the format of read-modify-write command | |
|
81 | * packets, data length incorrect.\n | |
|
82 | * Fixed error when identifying the start of the extended and normal | |
|
83 | * read/write address.\n | |
|
84 | * Fixed error when reading the data length in a read command.\n\n | |
|
85 | * | |
|
86 | * \version 1.2 - April 3rd 2006\n | |
|
87 | * Fixed potential problems with RMAP_PACKET_STATUS enum being an | |
|
88 | * undefined size (no change to this file required).\n\n | |
|
89 | * | |
|
90 | * \version 1.1 - March 9th 2006\n | |
|
91 | * Added support for different byte alignment requirements.\n\n | |
|
92 | * | |
|
93 | * \version 1.0 - December 20th 2005\n | |
|
94 | * Initial version.\n\n | |
|
95 | * | |
|
96 | * Copyright © 2009 STAR-Dundee Ltd | |
|
97 | */ | |
|
98 | ||
|
99 | ||
|
100 | ||
|
101 | #ifndef RMAP_PACKET_LIBRARY_H | |
|
102 | #define RMAP_PACKET_LIBRARY_H | |
|
103 | ||
|
104 | ||
|
105 | ||
|
106 | #include "star-dundee_types.h" | |
|
107 | ||
|
108 | ||
|
109 | ||
|
110 | #ifdef __cplusplus | |
|
111 | extern "C" { | |
|
112 | #endif | |
|
113 | ||
|
114 | ||
|
115 | ||
|
116 | #if defined(_WIN32) || defined(_WIN64) | |
|
117 | #ifdef _WIN64 | |
|
118 | #define RMAPPACKETLIBRARY_CC | |
|
119 | #else | |
|
120 | #define RMAPPACKETLIBRARY_CC __stdcall | |
|
121 | #endif | |
|
122 | #else | |
|
123 | #define RMAPPACKETLIBRARY_CC | |
|
124 | #endif | |
|
125 | ||
|
126 | ||
|
127 | ||
|
128 | typedef enum | |
|
129 | { | |
|
130 | RMAP_SUCCESS = 0x00, | |
|
131 | RMAP_GENERAL_ERROR = 0x01, | |
|
132 | RMAP_UNUSED_PACKET_TYPE_OR_COMMAND_CODE = 0x02, | |
|
133 | RMAP_INVALID_KEY = 0x03, | |
|
134 | RMAP_INVALID_DATA_CRC = 0x04, | |
|
135 | RMAP_EARLY_EOP = 0x05, | |
|
136 | RMAP_TOO_MUCH_DATA = 0x06, | |
|
137 | RMAP_EEP = 0x07, | |
|
138 | RMAP_VERIFY_BUFFER_OVERRUN = 0x09, | |
|
139 | RMAP_COMMAND_NOT_IMPLEMENTED_OR_AUTHORISED = 0x0a, | |
|
140 | RMAP_RMW_DATA_LENGTH_ERROR = 0x0b, | |
|
141 | RMAP_INVALID_TARGET_LOGICAL_ADDRESS = 0x0c, | |
|
142 | RMAP_INVALID_STATUS = 0xff | |
|
143 | } RMAP_STATUS; | |
|
144 | ||
|
145 | ||
|
146 | ||
|
147 | #define RMAP_PROTOCOL_IDENTIFIER 1 | |
|
148 | ||
|
149 | #define RMAP_RESERVED_BIT 0x80 | |
|
150 | #define RMAP_COMMAND_BIT 0x40 | |
|
151 | #define RMAP_WRITE_OPERATION_BIT 0x20 | |
|
152 | #define RMAP_VERIFY_BEFORE_WRITE_BIT 0x10 | |
|
153 | #define RMAP_REPLY_BIT 0x08 | |
|
154 | #define RMAP_INCREMENT_ADDRESS_BIT 0x04 | |
|
155 | #define RMAP_REPLY_ADDRESS_LENGTH_BITS 0x03 | |
|
156 | ||
|
157 | ||
|
158 | ||
|
159 | typedef enum | |
|
160 | { | |
|
161 | RMAP_WRITE_COMMAND = (RMAP_COMMAND_BIT | | |
|
162 | RMAP_WRITE_OPERATION_BIT), | |
|
163 | RMAP_WRITE_REPLY = (RMAP_WRITE_OPERATION_BIT), | |
|
164 | RMAP_READ_COMMAND = (RMAP_COMMAND_BIT), | |
|
165 | RMAP_READ_REPLY = (0), | |
|
166 | RMAP_READ_MODIFY_WRITE_COMMAND = (RMAP_COMMAND_BIT | | |
|
167 | RMAP_VERIFY_BEFORE_WRITE_BIT), | |
|
168 | RMAP_READ_MODIFY_WRITE_REPLY = (RMAP_VERIFY_BEFORE_WRITE_BIT), | |
|
169 | RMAP_INVALID_PACKET_TYPE = (0xff) | |
|
170 | } RMAP_PACKET_TYPE; | |
|
171 | ||
|
172 | ||
|
173 | ||
|
174 | typedef struct | |
|
175 | { | |
|
176 | RMAP_PACKET_TYPE packetType; | |
|
177 | U8 *pTargetAddress; | |
|
178 | unsigned long targetAddressLength; | |
|
179 | U8 *pReplyAddress; | |
|
180 | unsigned long replyAddressLength; | |
|
181 | U8 *pProtocolIdentifier; | |
|
182 | U8 *pInstruction; | |
|
183 | char verifyBeforeWrite; | |
|
184 | char acknowledge; | |
|
185 | char incrementAddress; | |
|
186 | U8 *pKey; | |
|
187 | U16 *pTransactionIdentifier; | |
|
188 | U32 *pReadWriteAddress; | |
|
189 | U8 *pExtendedReadWriteAddress; | |
|
190 | U8 *pStatus; | |
|
191 | U8 *pHeader; | |
|
192 | unsigned long headerLength; | |
|
193 | U8 *pHeaderCRC; | |
|
194 | U8 *pData; | |
|
195 | void *pDataLength; | |
|
196 | U32 dataLength; | |
|
197 | U8 *pDataCRC; | |
|
198 | U8 *pMask; | |
|
199 | U8 maskLength; | |
|
200 | U8 *pRawPacket; | |
|
201 | unsigned long rawPacketLength; | |
|
202 | } RMAP_PACKET; | |
|
203 | ||
|
204 | ||
|
205 | ||
|
206 | /* Declarations of the functions provided by the RMAP Packet Library */ | |
|
207 | ||
|
208 | U32 | |
|
209 | RMAPPACKETLIBRARY_CC | |
|
210 | RMAP_GetVersion( | |
|
211 | void | |
|
212 | ); | |
|
213 | ||
|
214 | U8 | |
|
215 | RMAPPACKETLIBRARY_CC | |
|
216 | RMAP_CalculateCRC( | |
|
217 | void *pBuffer, | |
|
218 | unsigned long len | |
|
219 | ); | |
|
220 | ||
|
221 | U8 | |
|
222 | RMAPPACKETLIBRARY_CC | |
|
223 | RMAP_CalculateCRCWithSeed( | |
|
224 | void *pBuffer, | |
|
225 | unsigned long len, | |
|
226 | U8 crc | |
|
227 | ); | |
|
228 | ||
|
229 | char | |
|
230 | RMAPPACKETLIBRARY_CC | |
|
231 | RMAP_IsCRCValid( | |
|
232 | void *pBuffer, | |
|
233 | unsigned long len, | |
|
234 | U8 crc | |
|
235 | ); | |
|
236 | ||
|
237 | RMAP_STATUS | |
|
238 | RMAPPACKETLIBRARY_CC | |
|
239 | RMAP_CheckPacketValid( | |
|
240 | void *pRawPacket, | |
|
241 | unsigned long packetLength, | |
|
242 | RMAP_PACKET *pPacketStruct, | |
|
243 | char checkPacketTooLong | |
|
244 | ); | |
|
245 | ||
|
246 | RMAP_PACKET_TYPE | |
|
247 | RMAPPACKETLIBRARY_CC | |
|
248 | RMAP_GetPacketType( | |
|
249 | RMAP_PACKET *pPacketStruct | |
|
250 | ); | |
|
251 | ||
|
252 | U8 * | |
|
253 | RMAPPACKETLIBRARY_CC | |
|
254 | RMAP_GetTargetAddress( | |
|
255 | RMAP_PACKET *pPacketStruct, | |
|
256 | unsigned long *pTargetAddressLength | |
|
257 | ); | |
|
258 | ||
|
259 | char | |
|
260 | RMAPPACKETLIBRARY_CC | |
|
261 | RMAP_GetVerifyBeforeWrite( | |
|
262 | RMAP_PACKET *pPacketStruct | |
|
263 | ); | |
|
264 | ||
|
265 | char | |
|
266 | RMAPPACKETLIBRARY_CC | |
|
267 | RMAP_GetPerformAcknowledgement( | |
|
268 | RMAP_PACKET *pPacketStruct | |
|
269 | ); | |
|
270 | ||
|
271 | char | |
|
272 | RMAPPACKETLIBRARY_CC | |
|
273 | RMAP_GetIncrementAddress( | |
|
274 | RMAP_PACKET *pPacketStruct | |
|
275 | ); | |
|
276 | ||
|
277 | U8 | |
|
278 | RMAPPACKETLIBRARY_CC | |
|
279 | RMAP_GetKey( | |
|
280 | RMAP_PACKET *pPacketStruct | |
|
281 | ); | |
|
282 | ||
|
283 | U8 * | |
|
284 | RMAPPACKETLIBRARY_CC | |
|
285 | RMAP_GetReplyAddress( | |
|
286 | RMAP_PACKET *pPacketStruct, | |
|
287 | unsigned long *pReplyAddressLength | |
|
288 | ); | |
|
289 | ||
|
290 | U16 | |
|
291 | RMAPPACKETLIBRARY_CC | |
|
292 | RMAP_GetTransactionID( | |
|
293 | RMAP_PACKET *pPacketStruct | |
|
294 | ); | |
|
295 | ||
|
296 | U32 | |
|
297 | RMAPPACKETLIBRARY_CC | |
|
298 | RMAP_GetAddress( | |
|
299 | RMAP_PACKET *pPacketStruct, | |
|
300 | U8 *pExtendedAddress | |
|
301 | ); | |
|
302 | ||
|
303 | U8 * | |
|
304 | RMAPPACKETLIBRARY_CC | |
|
305 | RMAP_GetData( | |
|
306 | RMAP_PACKET *pPacketStruct, | |
|
307 | U32 *pDataLength | |
|
308 | ); | |
|
309 | ||
|
310 | U32 | |
|
311 | RMAPPACKETLIBRARY_CC | |
|
312 | RMAP_GetReadLength( | |
|
313 | RMAP_PACKET* pPacketStruct | |
|
314 | ); | |
|
315 | ||
|
316 | RMAP_STATUS | |
|
317 | RMAPPACKETLIBRARY_CC | |
|
318 | RMAP_GetStatus( | |
|
319 | RMAP_PACKET *pPacketStruct | |
|
320 | ); | |
|
321 | ||
|
322 | U8 | |
|
323 | RMAPPACKETLIBRARY_CC | |
|
324 | RMAP_GetHeaderCRC( | |
|
325 | RMAP_PACKET *pPacketStruct | |
|
326 | ); | |
|
327 | ||
|
328 | U8 | |
|
329 | RMAPPACKETLIBRARY_CC | |
|
330 | RMAP_GetDataCRC( | |
|
331 | RMAP_PACKET *pPacketStruct | |
|
332 | ); | |
|
333 | ||
|
334 | U8 * | |
|
335 | RMAPPACKETLIBRARY_CC | |
|
336 | RMAP_GetMask( | |
|
337 | RMAP_PACKET *pPacketStruct, | |
|
338 | U8 *pMaskLength | |
|
339 | ); | |
|
340 | ||
|
341 | unsigned long | |
|
342 | RMAPPACKETLIBRARY_CC | |
|
343 | RMAP_CalculateWriteCommandPacketLength( | |
|
344 | unsigned long targetAddressLength, | |
|
345 | unsigned long replyAddressLength, | |
|
346 | U32 dataLength, | |
|
347 | char alignment | |
|
348 | ); | |
|
349 | ||
|
350 | char | |
|
351 | RMAPPACKETLIBRARY_CC | |
|
352 | RMAP_FillWriteCommandPacket( | |
|
353 | U8 *pTargetAddress, | |
|
354 | unsigned long targetAddressLength, | |
|
355 | U8 *pReplyAddress, | |
|
356 | unsigned long replyAddressLength, | |
|
357 | char verifyBeforeWrite, | |
|
358 | char acknowledge, | |
|
359 | char incrementAddress, | |
|
360 | U8 key, | |
|
361 | U16 transactionIdentifier, | |
|
362 | U32 writeAddress, | |
|
363 | U8 extendedWriteAddress, | |
|
364 | U8 *pData, | |
|
365 | U32 dataLength, | |
|
366 | unsigned long *pRawPacketLength, | |
|
367 | RMAP_PACKET *pPacketStruct, | |
|
368 | char alignment, | |
|
369 | U8 *pRawPacket, | |
|
370 | unsigned long rawPacketLength | |
|
371 | ); | |
|
372 | ||
|
373 | void * | |
|
374 | RMAPPACKETLIBRARY_CC | |
|
375 | RMAP_BuildWriteCommandPacket( | |
|
376 | U8 *pTargetAddress, | |
|
377 | unsigned long targetAddressLength, | |
|
378 | U8 *pReplyAddress, | |
|
379 | unsigned long replyAddressLength, | |
|
380 | char verifyBeforeWrite, | |
|
381 | char acknowledge, | |
|
382 | char incrementAddress, | |
|
383 | U8 key, | |
|
384 | U16 transactionIdentifier, | |
|
385 | U32 writeAddress, | |
|
386 | U8 extendedWriteAddress, | |
|
387 | U8 *pData, | |
|
388 | U32 dataLength, | |
|
389 | unsigned long *pRawPacketLength, | |
|
390 | RMAP_PACKET *pPacketStruct, | |
|
391 | char alignment | |
|
392 | ); | |
|
393 | ||
|
394 | void * | |
|
395 | RMAPPACKETLIBRARY_CC | |
|
396 | RMAP_BuildWriteRegisterPacket( | |
|
397 | U8 *pTargetAddress, | |
|
398 | unsigned long targetAddressLength, | |
|
399 | U8 *pReplyAddress, | |
|
400 | unsigned long replyAddressLength, | |
|
401 | char verifyBeforeWrite, | |
|
402 | char acknowledge, | |
|
403 | char incrementAddress, | |
|
404 | U8 key, | |
|
405 | U16 transactionIdentifier, | |
|
406 | U32 writeAddress, | |
|
407 | U8 extendedWriteAddress, | |
|
408 | U32 registerValue, | |
|
409 | unsigned long *pRawPacketLength, | |
|
410 | RMAP_PACKET *pPacketStruct, | |
|
411 | char alignment | |
|
412 | ); | |
|
413 | ||
|
414 | unsigned long | |
|
415 | RMAPPACKETLIBRARY_CC | |
|
416 | RMAP_CalculateWriteReplyPacketLength( | |
|
417 | unsigned long initiatorAddressLength, | |
|
418 | char alignment | |
|
419 | ); | |
|
420 | ||
|
421 | char | |
|
422 | RMAPPACKETLIBRARY_CC | |
|
423 | RMAP_FillWriteReplyPacket( | |
|
424 | U8 *pInitiatorAddress, | |
|
425 | unsigned long initiatorAddressLength, | |
|
426 | U8 targetAddress, | |
|
427 | char verifyBeforeWrite, | |
|
428 | char incrementAddress, | |
|
429 | RMAP_STATUS status, | |
|
430 | U16 transactionIdentifier, | |
|
431 | unsigned long *pRawPacketLength, | |
|
432 | RMAP_PACKET *pPacketStruct, | |
|
433 | char alignment, | |
|
434 | U8 *pRawPacket, | |
|
435 | unsigned long rawPacketLength | |
|
436 | ); | |
|
437 | ||
|
438 | void * | |
|
439 | RMAPPACKETLIBRARY_CC | |
|
440 | RMAP_BuildWriteReplyPacket( | |
|
441 | U8 *pInitiatorAddress, | |
|
442 | unsigned long initiatorAddressLength, | |
|
443 | U8 targetAddress, | |
|
444 | char verifyBeforeWrite, | |
|
445 | char incrementAddress, | |
|
446 | RMAP_STATUS status, | |
|
447 | U16 transactionIdentifier, | |
|
448 | unsigned long *pRawPacketLength, | |
|
449 | RMAP_PACKET *pPacketStruct, | |
|
450 | char alignment | |
|
451 | ); | |
|
452 | ||
|
453 | unsigned long | |
|
454 | RMAPPACKETLIBRARY_CC | |
|
455 | RMAP_CalculateReadCommandPacketLength( | |
|
456 | unsigned long targetAddressLength, | |
|
457 | unsigned long replyAddressLength, | |
|
458 | char alignment | |
|
459 | ); | |
|
460 | ||
|
461 | char | |
|
462 | RMAPPACKETLIBRARY_CC | |
|
463 | RMAP_FillReadCommandPacket( | |
|
464 | U8 *pTargetAddress, | |
|
465 | unsigned long targetAddressLength, | |
|
466 | U8 *pReplyAddress, | |
|
467 | unsigned long replyAddressLength, | |
|
468 | char incrementAddress, | |
|
469 | U8 key, | |
|
470 | U16 transactionIdentifier, | |
|
471 | U32 readAddress, | |
|
472 | U8 extendedReadAddress, | |
|
473 | U32 dataLength, | |
|
474 | unsigned long *pRawPacketLength, | |
|
475 | RMAP_PACKET *pPacketStruct, | |
|
476 | char alignment, | |
|
477 | U8 *pRawPacket, | |
|
478 | unsigned long rawPacketLength | |
|
479 | ); | |
|
480 | ||
|
481 | void * | |
|
482 | RMAPPACKETLIBRARY_CC | |
|
483 | RMAP_BuildReadCommandPacket( | |
|
484 | U8 *pTargetAddress, | |
|
485 | unsigned long targetAddressLength, | |
|
486 | U8 *pReplyAddress, | |
|
487 | unsigned long replyAddressLength, | |
|
488 | char incrementAddress, | |
|
489 | U8 key, | |
|
490 | U16 transactionIdentifier, | |
|
491 | U32 readAddress, | |
|
492 | U8 extendedReadAddress, | |
|
493 | U32 dataLength, | |
|
494 | unsigned long *pRawPacketLength, | |
|
495 | RMAP_PACKET *pPacketStruct, | |
|
496 | char alignment | |
|
497 | ); | |
|
498 | ||
|
499 | void * | |
|
500 | RMAPPACKETLIBRARY_CC | |
|
501 | RMAP_BuildReadRegisterPacket( | |
|
502 | U8 *pTargetAddress, | |
|
503 | unsigned long targetAddressLength, | |
|
504 | U8 *pReplyAddress, | |
|
505 | unsigned long replyAddressLength, | |
|
506 | char incrementAddress, | |
|
507 | U8 key, | |
|
508 | U16 transactionIdentifier, | |
|
509 | U32 readAddress, | |
|
510 | U8 extendedReadAddress, | |
|
511 | unsigned long *pRawPacketLength, | |
|
512 | RMAP_PACKET *pPacketStruct, | |
|
513 | char alignment | |
|
514 | ); | |
|
515 | ||
|
516 | unsigned long | |
|
517 | RMAPPACKETLIBRARY_CC | |
|
518 | RMAP_CalculateReadReplyPacketLength( | |
|
519 | unsigned long initiatorAddressLength, | |
|
520 | U32 dataLength, | |
|
521 | char alignment | |
|
522 | ); | |
|
523 | ||
|
524 | char | |
|
525 | RMAPPACKETLIBRARY_CC | |
|
526 | RMAP_FillReadReplyPacket( | |
|
527 | U8 *pInitiatorAddress, | |
|
528 | unsigned long initiatorAddressLength, | |
|
529 | U8 targetAddress, | |
|
530 | char incrementAddress, | |
|
531 | RMAP_STATUS status, | |
|
532 | U16 transactionIdentifier, | |
|
533 | U8 *pData, | |
|
534 | U32 dataLength, | |
|
535 | unsigned long *pRawPacketLength, | |
|
536 | RMAP_PACKET *pPacketStruct, | |
|
537 | char alignment, | |
|
538 | U8 *pRawPacket, | |
|
539 | unsigned long rawPacketLength | |
|
540 | ); | |
|
541 | ||
|
542 | void * | |
|
543 | RMAPPACKETLIBRARY_CC | |
|
544 | RMAP_BuildReadReplyPacket( | |
|
545 | U8 *pInitiatorAddress, | |
|
546 | unsigned long initiatorAddressLength, | |
|
547 | U8 targetAddress, | |
|
548 | char incrementAddress, | |
|
549 | RMAP_STATUS status, | |
|
550 | U16 transactionIdentifier, | |
|
551 | U8 *pData, | |
|
552 | U32 dataLength, | |
|
553 | unsigned long *pRawPacketLength, | |
|
554 | RMAP_PACKET *pPacketStruct, | |
|
555 | char alignment | |
|
556 | ); | |
|
557 | ||
|
558 | unsigned long | |
|
559 | RMAPPACKETLIBRARY_CC | |
|
560 | RMAP_CalculateReadModifyWriteCommandPacketLength( | |
|
561 | unsigned long targetAddressLength, | |
|
562 | unsigned long replyAddressLength, | |
|
563 | U32 dataAndMaskLength, | |
|
564 | char alignment | |
|
565 | ); | |
|
566 | ||
|
567 | char | |
|
568 | RMAPPACKETLIBRARY_CC | |
|
569 | RMAP_FillReadModifyWriteCommandPacket( | |
|
570 | U8 *pTargetAddress, | |
|
571 | unsigned long targetAddressLength, | |
|
572 | U8 *pReplyAddress, | |
|
573 | unsigned long replyAddressLength, | |
|
574 | U8 key, | |
|
575 | U16 transactionIdentifier, | |
|
576 | U32 readModifyWriteAddress, | |
|
577 | U8 extendedReadModifyWriteAddress, | |
|
578 | U8 dataAndMaskLength, | |
|
579 | U8 *pData, | |
|
580 | U8 *pMask, | |
|
581 | unsigned long *pRawPacketLength, | |
|
582 | RMAP_PACKET *pPacketStruct, | |
|
583 | char alignment, | |
|
584 | U8 *pRawPacket, | |
|
585 | unsigned long rawPacketLength | |
|
586 | ); | |
|
587 | ||
|
588 | void * | |
|
589 | RMAPPACKETLIBRARY_CC | |
|
590 | RMAP_BuildReadModifyWriteCommandPacket( | |
|
591 | U8 *pTargetAddress, | |
|
592 | unsigned long targetAddressLength, | |
|
593 | U8 *pReplyAddress, | |
|
594 | unsigned long replyAddressLength, | |
|
595 | U8 key, | |
|
596 | U16 transactionIdentifier, | |
|
597 | U32 readModifyWriteAddress, | |
|
598 | U8 extendedReadModifyWriteAddress, | |
|
599 | U8 dataAndMaskLength, | |
|
600 | U8 *pData, | |
|
601 | U8 *mask, | |
|
602 | unsigned long *pRawPacketLength, | |
|
603 | RMAP_PACKET *pPacketStruct, | |
|
604 | char alignment | |
|
605 | ); | |
|
606 | ||
|
607 | void * | |
|
608 | RMAPPACKETLIBRARY_CC | |
|
609 | RMAP_BuildReadModifyWriteRegisterPacket( | |
|
610 | U8 *pTargetAddress, | |
|
611 | unsigned long targetAddressLength, | |
|
612 | U8 *pReplyAddress, | |
|
613 | unsigned long replyAddressLength, | |
|
614 | U8 key, | |
|
615 | U16 transactionIdentifier, | |
|
616 | U32 readModifyWriteAddress, | |
|
617 | U8 extendedReadModifyWriteAddress, | |
|
618 | U32 registerValue, | |
|
619 | U32 mask, | |
|
620 | unsigned long *pRawPacketLength, | |
|
621 | RMAP_PACKET *pPacketStruct, | |
|
622 | char alignment | |
|
623 | ); | |
|
624 | ||
|
625 | unsigned long | |
|
626 | RMAPPACKETLIBRARY_CC | |
|
627 | RMAP_CalculateReadModifyWriteReplyPacketLength( | |
|
628 | unsigned long initiatorAddressLength, | |
|
629 | U32 dataLength, | |
|
630 | char alignment | |
|
631 | ); | |
|
632 | ||
|
633 | char | |
|
634 | RMAPPACKETLIBRARY_CC | |
|
635 | RMAP_FillReadModifyWriteReplyPacket( | |
|
636 | U8 *pInitiatorAddress, | |
|
637 | unsigned long initiatorAddressLength, | |
|
638 | U8 targetAddress, | |
|
639 | RMAP_STATUS status, | |
|
640 | U16 transactionIdentifier, | |
|
641 | unsigned long dataLength, | |
|
642 | U8 *pData, | |
|
643 | unsigned long *pRawPacketLength, | |
|
644 | RMAP_PACKET *pPacketStruct, | |
|
645 | char alignment, | |
|
646 | U8 *pRawPacket, | |
|
647 | unsigned long rawPacketLength | |
|
648 | ); | |
|
649 | ||
|
650 | void * | |
|
651 | RMAPPACKETLIBRARY_CC | |
|
652 | RMAP_BuildReadModifyWriteReplyPacket( | |
|
653 | U8 *pInitiatorAddress, | |
|
654 | unsigned long initiatorAddressLength, | |
|
655 | U8 targetAddress, | |
|
656 | RMAP_STATUS status, | |
|
657 | U16 transactionIdentifier, | |
|
658 | unsigned long dataLength, | |
|
659 | U8 *pData, | |
|
660 | unsigned long *pRawPacketLength, | |
|
661 | RMAP_PACKET *pPacketStruct, | |
|
662 | char alignment | |
|
663 | ); | |
|
664 | ||
|
665 | void | |
|
666 | RMAPPACKETLIBRARY_CC | |
|
667 | RMAP_FreeBuffer( | |
|
668 | void *pBuffer | |
|
669 | ); | |
|
670 | ||
|
671 | ||
|
672 | /* Macros for accessing the version */ | |
|
673 | ||
|
674 | #define RMAP_GET_VERSION_MAJOR(versionInfo) (((version) & 0xff000000) >> 24) | |
|
675 | #define RMAP_GET_VERSION_MINOR(versionInfo) (((version) & 0x00ff0000) >> 16) | |
|
676 | #define RMAP_GET_VERSION_EDIT(versionInfo) (((version) & 0x0000ffc0) >> 6) | |
|
677 | #define RMAP_GET_VERSION_PATCH(versionInfo) ((version) & 0x0000003f) | |
|
678 | ||
|
679 | ||
|
680 | ||
|
681 | #ifdef __cplusplus | |
|
682 | } | |
|
683 | #endif | |
|
684 | ||
|
685 | ||
|
686 | ||
|
687 | #endif /* RMAP_PACKET_LIBRARY_H */ | |
|
688 | ||
|
689 | ||
|
690 |
@@ -0,0 +1,205 | |||
|
1 | /******************************************************************************/ | |
|
2 | /* */ | |
|
3 | /* spacewire_usb.h */ | |
|
4 | /* */ | |
|
5 | /* Header file for all constants which may be used with the STAR-Dundee */ | |
|
6 | /* SpaceWire USB driver. */ | |
|
7 | /* */ | |
|
8 | /* Version 2.61, September 17th 2012 */ | |
|
9 | /* */ | |
|
10 | /* Version 2.61, 17/09/12 */ | |
|
11 | /* ====================== */ | |
|
12 | /* Added support for STAR Fire and WBS II. */ | |
|
13 | /* */ | |
|
14 | /* Version 2.60, 04/01/12 */ | |
|
15 | /* ====================== */ | |
|
16 | /* Added support for EGSE and SPLT. */ | |
|
17 | /* */ | |
|
18 | /* Version 2.59, 15/08/11 */ | |
|
19 | /* ====================== */ | |
|
20 | /* Added support for RTC. */ | |
|
21 | /* */ | |
|
22 | /* Version 2.58, 12/10/10 */ | |
|
23 | /* ===================== */ | |
|
24 | /* Added support for Link Analyser Mk2. */ | |
|
25 | /* */ | |
|
26 | /* Version 2.51 */ | |
|
27 | /* ============ */ | |
|
28 | /* Added use of star_dundee_types.h. */ | |
|
29 | /* */ | |
|
30 | /* Version 2.5 */ | |
|
31 | /* =========== */ | |
|
32 | /* Initial version, following change to new architecture. */ | |
|
33 | /* */ | |
|
34 | /* Copyright (2012), STAR-Dundee Ltd., */ | |
|
35 | /* STAR House, */ | |
|
36 | /* 166 Nethergate, */ | |
|
37 | /* Dundee, DD1 4EE, */ | |
|
38 | /* Scotland, UK. */ | |
|
39 | /* e-mail: support@star-dundee.com */ | |
|
40 | /* */ | |
|
41 | /******************************************************************************/ | |
|
42 | ||
|
43 | ||
|
44 | ||
|
45 | #ifndef SPACEWIRE_USB_H | |
|
46 | #define SPACEWIRE_USB_H | |
|
47 | ||
|
48 | ||
|
49 | ||
|
50 | #ifdef __cplusplus | |
|
51 | extern "C" { | |
|
52 | #endif | |
|
53 | ||
|
54 | ||
|
55 | /* The types used by the API */ | |
|
56 | #include "star_dundee_types.h" | |
|
57 | ||
|
58 | ||
|
59 | /* End of packet marker types */ | |
|
60 | #define SPACEWIRE_USB_EOP_CHAR ((U8)0x80) | |
|
61 | #define SPACEWIRE_USB_EEP_CHAR ((U8)0x40) | |
|
62 | ||
|
63 | /* The protocol byte used to identify LODI packets */ | |
|
64 | #define SPACEWIRE_USB_LODI_PROTOCOL (0xd1) | |
|
65 | ||
|
66 | ||
|
67 | ||
|
68 | /* Possible results of read and send operations */ | |
|
69 | typedef enum | |
|
70 | { | |
|
71 | TRANSFER_NOT_STARTED = 0, | |
|
72 | TRANSFER_STARTED = 1, | |
|
73 | TRANSFER_SUCCESS = 2, | |
|
74 | TRANSFER_ERROR_DISCONNECT = 3, | |
|
75 | TRANSFER_ERROR_PARITY = 4, | |
|
76 | TRANSFER_ERROR_UNKNOWN = 5, | |
|
77 | TRANSFER_ERROR_TIMEOUT = 6, | |
|
78 | TRANSFER_ERROR_LINK_NOT_STARTED = 7, | |
|
79 | TRANSFER_ERROR_USER_BUFFER_LOCK_FAILED = 8, | |
|
80 | TRANSFER_ERROR_LINK_ALREADY_IN_USE = 9, | |
|
81 | TRANSFER_ERROR_RECEIVE_BUFFER_FULL = 0xa, | |
|
82 | TRANSFER_ERROR_OUT_OF_MEMORY = 0xb, | |
|
83 | TRANSFER_ERROR_NOT_FOUND = 0xc, | |
|
84 | TRANSFER_ERROR_USB_ERROR = 0xd, | |
|
85 | TRANSFER_ERROR_NOT_REGISTERED_TO_RECEIVE = 0xe | |
|
86 | } USB_SPACEWIRE_STATUS, *PUSB_SPACEWIRE_STATUS; | |
|
87 | ||
|
88 | ||
|
89 | ||
|
90 | /* Possible traffic types */ | |
|
91 | typedef enum | |
|
92 | { | |
|
93 | SPACEWIRE_TRAFFIC_UNKNOWN = -1, | |
|
94 | SPACEWIRE_TRAFFIC_PACKET = 0, | |
|
95 | SPACEWIRE_TRAFFIC_TIMECODE = 1, | |
|
96 | SPACEWIRE_TRAFFIC_CONTROL = 2 | |
|
97 | } SPACEWIRE_TRAFFIC_TYPE, *PSPACEWIRE_TRAFFIC_TYPE; | |
|
98 | ||
|
99 | ||
|
100 | ||
|
101 | /* The different end of packet marker types */ | |
|
102 | typedef enum | |
|
103 | { | |
|
104 | SPACEWIRE_USB_NO_EOP = 0, | |
|
105 | SPACEWIRE_USB_EOP = SPACEWIRE_USB_EOP_CHAR, | |
|
106 | SPACEWIRE_USB_EEP = SPACEWIRE_USB_EEP_CHAR | |
|
107 | } USB_SPACEWIRE_EOP_TYPE, *PUSB_SPACEWIRE_EOP_TYPE; | |
|
108 | ||
|
109 | ||
|
110 | ||
|
111 | /* Possible device types */ | |
|
112 | typedef enum | |
|
113 | { | |
|
114 | SPACEWIRE_DEVICE_UNKNOWN = -1, | |
|
115 | SPACEWIRE_ROUTER_USB = 0, | |
|
116 | SPACEWIRE_BRICK = 1, | |
|
117 | SPACEWIRE_LINK_ANALYSER = 2, | |
|
118 | SPACEWIRE_CONFORMANCE_TESTER = 3, | |
|
119 | SPACEWIRE_TUNNEL_BRICK = 4, | |
|
120 | SPACEWIRE_LINK_ANALYSER_MK2 = 5, | |
|
121 | SPACEWIRE_RTC = 6, | |
|
122 | SPACEWIRE_EGSE = 7, | |
|
123 | SPACEWIRE_PHYSICAL_LAYER_TESTER = 8, | |
|
124 | STAR_FIRE = 9, | |
|
125 | WBS_II = 10 | |
|
126 | } SPACEWIRE_DEVICE_TYPE, *PSPACEWIRE_DEVICE_TYPE; | |
|
127 | ||
|
128 | ||
|
129 | ||
|
130 | ||
|
131 | /* Structure used to store packet lengths and EOPs for a read request */ | |
|
132 | typedef struct | |
|
133 | { | |
|
134 | unsigned long len; | |
|
135 | USB_SPACEWIRE_EOP_TYPE eop; | |
|
136 | SPACEWIRE_TRAFFIC_TYPE type; | |
|
137 | } USB_SPACEWIRE_PACKET_PROPERTIES, *PUSB_SPACEWIRE_PACKET_PROPERTIES; | |
|
138 | ||
|
139 | ||
|
140 | ||
|
141 | /* The type of all send and receive identifiers */ | |
|
142 | typedef void * USB_SPACEWIRE_ID; | |
|
143 | ||
|
144 | ||
|
145 | ||
|
146 | /* Structure used to represent the firmware version of a device */ | |
|
147 | typedef struct | |
|
148 | { | |
|
149 | U8 major; | |
|
150 | U8 minor; | |
|
151 | U16 edit; | |
|
152 | U8 patch; | |
|
153 | } SPACEWIRE_FIRMWARE_VERSION; | |
|
154 | ||
|
155 | ||
|
156 | /* The product ID used by each STAR-Dundee SpaceWire device */ | |
|
157 | ||
|
158 | /** The product ID used by a device with no EEPROM */ | |
|
159 | #define SPACEWIRE_PRODUCT_ID_NO_EEPROM (0x8613) | |
|
160 | /** The product ID used by an old device in the power check state */ | |
|
161 | #define SPACEWIRE_PRODUCT_ID_POWER_CHECK (0x461f) | |
|
162 | /** The product ID used by an old device with no ID set */ | |
|
163 | #define SPACEWIRE_PRODUCT_ID_NO_ID (0x1002) | |
|
164 | /** The product ID used by the SpaceWire Router-USB */ | |
|
165 | #define SPACEWIRE_PRODUCT_ID_ROUTER_USB (0x1011) | |
|
166 | /** The product ID used by the SpaceWire-USB Brick */ | |
|
167 | #define SPACEWIRE_PRODUCT_ID_BRICK (0x1012) | |
|
168 | /** The product ID used by the SpaceWire Link Analyser */ | |
|
169 | #define SPACEWIRE_PRODUCT_ID_LINK_ANALYSER (0x1013) | |
|
170 | /** The product ID used by the SpaceWire Conformance Tester */ | |
|
171 | #define SPACEWIRE_PRODUCT_ID_CONFORMANCE_TESTER (0x1014) | |
|
172 | /** The product ID used by the SpaceWire-IP Tunnel */ | |
|
173 | #define SPACEWIRE_PRODUCT_ID_TUNNEL_BRICK (0x1015) | |
|
174 | /** The product ID used by the SpaceWire Router-USB with multiple channels */ | |
|
175 | #define SPACEWIRE_PRODUCT_ID_ROUTER_MULTIPLE_CHANNELS (0x1016) | |
|
176 | /** The product ID used by the SpaceWire Router-USB II Rev 4 */ | |
|
177 | #define SPACEWIRE_PRODUCT_ID_ROUTER_USB_II_REV4 (0x1017) | |
|
178 | /** The product ID used by the SpaceWire Link Analyser Mk2 */ | |
|
179 | #define SPACEWIRE_PRODUCT_ID_LINK_ANALYSER_MK2 (0x1018) | |
|
180 | /** The product ID used by the SpaceWire RTC */ | |
|
181 | #define SPACEWIRE_PRODUCT_ID_RTC (0x1019) | |
|
182 | /** The product ID used by the SpaceWire EGSE */ | |
|
183 | #define SPACEWIRE_PRODUCT_ID_EGSE (0x101a) | |
|
184 | /** The product ID used by the SpaceWire SPLT */ | |
|
185 | #define SPACEWIRE_PRODUCT_ID_SPLT (0x101b) | |
|
186 | /** The product ID used by the STAR Fire device */ | |
|
187 | #define SPACEWIRE_PRODUCT_ID_STAR_FIRE (0x101c) | |
|
188 | /** The product ID used by the WBS II device */ | |
|
189 | #define SPACEWIRE_PRODUCT_ID_WBS_II (0x101d) | |
|
190 | /** A product ID to be used by a future device */ | |
|
191 | #define SPACEWIRE_PRODUCT_ID_FUTURE_101E (0x101e) | |
|
192 | /** A product ID to be used by a future device */ | |
|
193 | #define SPACEWIRE_PRODUCT_ID_FUTURE_101F (0x101f) | |
|
194 | ||
|
195 | ||
|
196 | #ifdef __cplusplus | |
|
197 | } | |
|
198 | #endif | |
|
199 | ||
|
200 | ||
|
201 | ||
|
202 | #endif /* SPACEWIRE_USB_H */ | |
|
203 | ||
|
204 | ||
|
205 |
This diff has been collapsed as it changes many lines, (659 lines changed) Show them Hide them | |||
@@ -0,0 +1,659 | |||
|
1 | /******************************************************************************/ | |
|
2 | /* */ | |
|
3 | /* spw_config_library.h */ | |
|
4 | /* */ | |
|
5 | /* Declaration of the functions, and definition of macros provided by the */ | |
|
6 | /* SpaceWire Router Configuration Library for the SpaceWire USB and */ | |
|
7 | /* SpaceWire PCI drivers. */ | |
|
8 | /* */ | |
|
9 | /* Version 2.62 - November 7th 2012 */ | |
|
10 | /* */ | |
|
11 | /* Version 2.62 - 07/11/12 */ | |
|
12 | /* ======================= */ | |
|
13 | /* Removed commas at end of enumerators. */ | |
|
14 | /* */ | |
|
15 | /* Version 2.60 - 05/04/12 */ | |
|
16 | /* ======================= */ | |
|
17 | /* Updated declarations to replace CFGSpaceWire_EnableReadOnAllPorts */ | |
|
18 | /* with CFGSpaceWire_EnableReceiveOnAllPorts and */ | |
|
19 | /* CFGSpaceWire_IsReadingOnAllPortsEnabled with */ | |
|
20 | /* CFGSpaceWire_IsReceiveOnAllPortsEnabled. */ | |
|
21 | /* */ | |
|
22 | /* Version 2.54 - 10/12/10 */ | |
|
23 | /* ======================= */ | |
|
24 | /* Replaced CFGSpaceWire_RTOutputPorts with */ | |
|
25 | /* CFGSpaceWire_RTGetOutputPorts, which doesn't unnecessarily shift the */ | |
|
26 | /* output port bits and is consistent with */ | |
|
27 | /* CFGSpaceWire_RTBuildRoutingTableEntry. */ | |
|
28 | /* */ | |
|
29 | /* Version 2.53 - 26/02/09 */ | |
|
30 | /* ======================= */ | |
|
31 | /* Updated the calling convention used in the function declarations to */ | |
|
32 | /* __stdcall on Windows. */ | |
|
33 | /* */ | |
|
34 | /* Version 2.52, 04/11/08 */ | |
|
35 | /* ====================== */ | |
|
36 | /* Added support for precision transmit rate on new Router-USB. */ | |
|
37 | /* Added chip ID values. */ | |
|
38 | /* */ | |
|
39 | /* Version 2.51, 21/10/08 */ | |
|
40 | /* ====================== */ | |
|
41 | /* Updated to support Windows. */ | |
|
42 | /* */ | |
|
43 | /* Version 2.50, 08/11/06 */ | |
|
44 | /* ====================== */ | |
|
45 | /* Initial version, following change to new structure. */ | |
|
46 | /* */ | |
|
47 | /* Copyright (c) 2012, STAR-Dundee Ltd., */ | |
|
48 | /* STAR House, */ | |
|
49 | /* 166 Nethergate, */ | |
|
50 | /* Dundee, DD1 4EE, */ | |
|
51 | /* Scotland, UK. */ | |
|
52 | /* http://www.star-dundee.com */ | |
|
53 | /* e-mail: support@star-dundee.com */ | |
|
54 | /* */ | |
|
55 | /******************************************************************************/ | |
|
56 | ||
|
57 | ||
|
58 | ||
|
59 | #ifndef SPACEWIRE_ROUTER_LIBRARY | |
|
60 | #define SPACEWIRE_ROUTER_LIBRARY | |
|
61 | ||
|
62 | ||
|
63 | #include "star_dundee_types.h" | |
|
64 | ||
|
65 | ||
|
66 | #ifdef __cplusplus | |
|
67 | extern "C" { | |
|
68 | #endif | |
|
69 | ||
|
70 | ||
|
71 | ||
|
72 | #if defined(_WIN32) || defined(_WIN64) | |
|
73 | ||
|
74 | ||
|
75 | /* Windows specifc functions and macros */ | |
|
76 | ||
|
77 | #ifdef ROUTERCONFIGURATIONLIBRARY_EXPORTS | |
|
78 | #define ROUTER_CONFIG_LIBRARY __declspec(dllexport) | |
|
79 | #else | |
|
80 | #define ROUTER_CONFIG_LIBRARY __declspec(dllimport) | |
|
81 | #endif | |
|
82 | ||
|
83 | /* The calling convention to be used */ | |
|
84 | #ifdef _WIN64 | |
|
85 | #define ROUTER_CONFIG_CC | |
|
86 | #else | |
|
87 | #define ROUTER_CONFIG_CC __stdcall | |
|
88 | #endif /* WIN64 */ | |
|
89 | ||
|
90 | ||
|
91 | #include "windows.h" | |
|
92 | ||
|
93 | ||
|
94 | #else /* _WIN32 */ | |
|
95 | ||
|
96 | ||
|
97 | /* Linux specific functions and macros */ | |
|
98 | ||
|
99 | #define ROUTER_CONFIG_LIBRARY | |
|
100 | #define ROUTER_CONFIG_CC | |
|
101 | ||
|
102 | ||
|
103 | #endif /* _WIN32 */ | |
|
104 | ||
|
105 | ||
|
106 | ||
|
107 | /* Possible bit values */ | |
|
108 | #define BIT0 (0x00000001) | |
|
109 | #define BIT1 (0x00000002) | |
|
110 | #define BIT2 (0x00000004) | |
|
111 | #define BIT3 (0x00000008) | |
|
112 | #define BIT4 (0x00000010) | |
|
113 | #define BIT5 (0x00000020) | |
|
114 | #define BIT6 (0x00000040) | |
|
115 | #define BIT7 (0x00000080) | |
|
116 | #define BIT8 (0x00000100) | |
|
117 | #define BIT9 (0x00000200) | |
|
118 | #define BIT10 (0x00000400) | |
|
119 | #define BIT11 (0x00000800) | |
|
120 | #define BIT12 (0x00001000) | |
|
121 | #define BIT13 (0x00002000) | |
|
122 | #define BIT14 (0x00004000) | |
|
123 | #define BIT15 (0x00008000) | |
|
124 | #define BIT16 (0x00010000) | |
|
125 | #define BIT17 (0x00020000) | |
|
126 | #define BIT18 (0x00040000) | |
|
127 | #define BIT19 (0x00080000) | |
|
128 | #define BIT20 (0x00100000) | |
|
129 | #define BIT21 (0x00200000) | |
|
130 | #define BIT22 (0x00400000) | |
|
131 | #define BIT23 (0x00800000) | |
|
132 | #define BIT24 (0x01000000) | |
|
133 | #define BIT25 (0x02000000) | |
|
134 | #define BIT26 (0x04000000) | |
|
135 | #define BIT27 (0x08000000) | |
|
136 | #define BIT28 (0x10000000) | |
|
137 | #define BIT29 (0x20000000) | |
|
138 | #define BIT30 (0x40000000) | |
|
139 | #define BIT31 (0x80000000) | |
|
140 | ||
|
141 | ||
|
142 | ||
|
143 | /* Exported enums and structs */ | |
|
144 | ||
|
145 | ||
|
146 | ||
|
147 | /* Read write address errors */ | |
|
148 | typedef enum | |
|
149 | { | |
|
150 | CFG_TRANSFER_SUCCESS = 0x00, | |
|
151 | CFG_TRANSMIT_PACKET_FAILURE = 0x01, | |
|
152 | CFG_REPLY_PACKET_FAILURE = 0x02, | |
|
153 | CFG_REPLY_PACKET_TOO_BIG = 0x03, | |
|
154 | CFG_REPLY_PACKET_TOO_SMALL = 0x04, | |
|
155 | CFG_REPLY_PACKET_NAK = 0x05, | |
|
156 | CFG_REPLY_PACKET_CHECKSUM_ERROR = 0x06 | |
|
157 | } CFG_SPACEWIRE_STATUS; | |
|
158 | ||
|
159 | ||
|
160 | ||
|
161 | /* Length of port timeout */ | |
|
162 | typedef enum | |
|
163 | { | |
|
164 | CFG_PORT_TIMEOUT_100US = 0x0, | |
|
165 | CFG_PORT_TIMEOUT_1MS = 0x1, | |
|
166 | CFG_PORT_TIMEOUT_10MS = 0x2, | |
|
167 | CFG_PORT_TIMEOUT_100MS = 0x3, | |
|
168 | CFG_PORT_TIMEOUT_1S = 0x4 | |
|
169 | } CFG_SPACEWIRE_PORT_TIMEOUT; | |
|
170 | ||
|
171 | ||
|
172 | ||
|
173 | /* SpaceWire Port errors */ | |
|
174 | #define CFG_SPACEWIRE_NO_ERRORS (0) | |
|
175 | #define CFG_SPACEWIRE_ERROR_ACTIVE (BIT0) | |
|
176 | #define CFG_SPACEWIRE_PACKET_ADDRESS_ERROR (BIT1) | |
|
177 | #define CFG_SPACEWIRE_PORT_TIMEOUT_ERROR (BIT2) | |
|
178 | #define CFG_SPACEWIRE_DISCONNECT_ERROR (BIT3) | |
|
179 | #define CFG_SPACEWIRE_PARITY_ERROR (BIT4) | |
|
180 | #define CFG_SPACEWIRE_ESCAPE_ERROR (BIT5) | |
|
181 | #define CFG_SPACEWIRE_CREDIT_ERROR (BIT6) | |
|
182 | #define CFG_SPACEWIRE_CHARACTER_SEQUENCE_ERROR (BIT7) | |
|
183 | #define CFG_SPACEWIRE_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \ | |
|
184 | BIT4 | BIT5 | BIT6 | BIT7) | |
|
185 | ||
|
186 | /* Config Port errors */ | |
|
187 | #define CFG_CONFIG_NO_ERRORS (0) | |
|
188 | #define CFG_CONFIG_ERROR_ACTIVE (BIT0) | |
|
189 | ||
|
190 | /* Config Port errors (non-RMAP) */ | |
|
191 | #define CFG_CONFIG_PACKET_ADDRESS_ERROR (BIT1) | |
|
192 | #define CFG_CONFIG_PORT_TIMEOUT_ERROR (BIT2) | |
|
193 | #define CFG_CONFIG_CHECKSUM_ERROR (BIT3) | |
|
194 | #define CFG_CONFIG_TOO_SHORT_ERROR (BIT4) | |
|
195 | #define CFG_CONFIG_TOO_LONG_ERROR (BIT5) | |
|
196 | #define CFG_CONFIG_PACKET_EEP_ERROR (BIT6) | |
|
197 | #define CFG_CONFIG_PROTOCOL_BYTE_ERROR (BIT7) | |
|
198 | #define CFG_CONFIG_INVALID_REGISTER_ERROR (BIT8) | |
|
199 | #define CFG_CONFIG_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \ | |
|
200 | BIT4 | BIT5 | BIT6 | BIT7 | \ | |
|
201 | BIT8) | |
|
202 | ||
|
203 | /* Config Port errors (RMAP) */ | |
|
204 | #define CFG_CONFIG_RMAP_PORT_TIMEOUT_ERROR (BIT1) | |
|
205 | #define CFG_CONFIG_RMAP_INVALID_HEADER_CRC (BIT2) | |
|
206 | #define CFG_CONFIG_RMAP_INVALID_DATA_CRC (BIT3) | |
|
207 | #define CFG_CONFIG_RMAP_INVALID_DESTINATION_KEY (BIT4) | |
|
208 | #define CFG_CONFIG_RMAP_COMMAND_NOT_IMPLEMENTED (BIT5) | |
|
209 | #define CFG_CONFIG_RMAP_INVALID_DATA_LENGTH (BIT6) | |
|
210 | #define CFG_CONFIG_RMAP_INVALID_RMW_DATA_LENGTH (BIT7) | |
|
211 | #define CFG_CONFIG_RMAP_INVALID_DESTINATION_ADDRESS (BIT8) | |
|
212 | #define CFG_CONFIG_RMAP_EARLY_EOP (BIT9) | |
|
213 | #define CFG_CONFIG_RMAP_LATE_EOP (BIT10) | |
|
214 | #define CFG_CONFIG_RMAP_EARLY_EEP (BIT11) | |
|
215 | #define CFG_CONFIG_RMAP_LATE_EEP (BIT12) | |
|
216 | #define CFG_CONFIG_RMAP_VERIFY_BUFFER_OVERRUN_ERROR (BIT13) | |
|
217 | #define CFG_CONFIG_RMAP_INVALID_REGISTER_ADDRESS (BIT14) | |
|
218 | #define CFG_CONFIG_RMAP_UNSUPPORTED_PROTOCOL_ERROR (BIT15) | |
|
219 | #define CFG_CONFIG_RMAP_SOURCE_LOGICAL_ADDRESS_ERROR (BIT16) | |
|
220 | #define CFG_CONFIG_RMAP_SOURCE_PATH_ADDRESS_ERROR (BIT17) | |
|
221 | #define CFG_CONFIG_RMAP_CARGO_TOO_LARGE (BIT18) | |
|
222 | #define CFG_CONFIG_RMAP_UNUSED_COMMAND_OR_PACKET_TYPE (BIT19) | |
|
223 | #define CFG_CONFIG_RMAP_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \ | |
|
224 | BIT5 | BIT6 | BIT7 | BIT8 | BIT9 | \ | |
|
225 | BIT10 | BIT11 | BIT12 | BIT13 | \ | |
|
226 | BIT14 | BIT15 | BIT16 | BIT17 | \ | |
|
227 | BIT18 | BIT19) | |
|
228 | ||
|
229 | /* External Port errors */ | |
|
230 | #define CFG_EXTERNAL_NO_ERRORS (0) | |
|
231 | #define CFG_EXTERNAL_ERROR_ACTIVE (BIT0) | |
|
232 | #define CFG_EXTERNAL_PACKET_ADDRESS_ERROR (BIT1) | |
|
233 | #define CFG_EXTERNAL_PORT_TIMEOUT_ERROR (BIT2) | |
|
234 | #define CFG_EXTERNAL_INPUT_BUFFER_EMPTY_ERROR (BIT3) | |
|
235 | #define CFG_EXTERNAL_INPUT_BUFFER_FULL_ERROR (BIT4) | |
|
236 | #define CFG_EXTERNAL_OUTPUT_BUFFER_EMPTY_ERROR (BIT5) | |
|
237 | #define CFG_EXTERNAL_OUTPUT_BUFFER_FULL_ERROR (BIT6) | |
|
238 | #define CFG_EXTERNAL_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \ | |
|
239 | BIT4 | BIT5 | BIT6) | |
|
240 | ||
|
241 | /* SpaceWire Port interface state */ | |
|
242 | #define CFG_SPACEWIRE_ERROR_RESET (0) | |
|
243 | #define CFG_SPACEWIRE_ERROR_WAIT (BIT0) | |
|
244 | #define CFG_SPACEWIRE_READY (BIT1) | |
|
245 | #define CFG_SPACEWIRE_STARTED (BIT1 | BIT0) | |
|
246 | #define CFG_SPACEWIRE_CONNECTING (BIT2) | |
|
247 | #define CFG_SPACEWIRE_RUN (BIT2 | BIT0) | |
|
248 | ||
|
249 | /* Port type */ | |
|
250 | #define CFG_CONFIGURATION_PORT (0) | |
|
251 | #define CFG_SPACEWIRE_SERIAL_PORT (BIT0) | |
|
252 | #define CFG_SPACEWIRE_EXTERNAL_PORT (BIT1) | |
|
253 | ||
|
254 | /* SpaceWire Port control bits */ | |
|
255 | #define CFG_SPACEWIRE_INTERFACE_STATE_START (8) | |
|
256 | #define CFG_SPACEWIRE_INTERFACE_STATE (BIT8 | BIT9 | BIT10) | |
|
257 | #define CFG_SPACEWIRE_RUNNING (BIT11) | |
|
258 | #define CFG_SPACEWIRE_AUTOSTART (BIT12) | |
|
259 | #define CFG_SPACEWIRE_START (BIT13) | |
|
260 | #define CFG_SPACEWIRE_DISABLE (BIT14) | |
|
261 | #define CFG_SPACEWIRE_TRISTATE (BIT15) | |
|
262 | #define CFG_SPACEWIRE_RATE (BIT16 | BIT17 | BIT18 | \ | |
|
263 | BIT19 | BIT20 | BIT21 | BIT22) | |
|
264 | #define CFG_SPACEWIRE_RATE_START (16) | |
|
265 | ||
|
266 | /* Bits in the GAR Table */ | |
|
267 | #define CFG_GAR_OUTPUT_PORTS_START (1) | |
|
268 | #define CFG_GAR_OUTPUT_PORTS (BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | \ | |
|
269 | BIT6 | BIT7 | BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | BIT13 | BIT14 | \ | |
|
270 | BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | \ | |
|
271 | BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28) | |
|
272 | #define CFG_GAR_DEL_HEAD (BIT29) | |
|
273 | #define CFG_GAR_PRIORITY (BIT30) | |
|
274 | #define CFG_GAR_INVALID_ADDR (BIT31) | |
|
275 | ||
|
276 | /* Bits in the router control register */ | |
|
277 | #define CFG_RC_TIMEOUT_ENABLE_START (0) | |
|
278 | #define CFG_RC_TIMEOUT_ENABLE (BIT0) | |
|
279 | #define CFG_RC_TIMEOUT_VALUE_START (1) | |
|
280 | #define CFG_RC_TIMEOUT_VALUE (BIT1 | BIT2 | BIT3) | |
|
281 | #define CFG_RC_DISABLE_ON_SILENCE (BIT4) | |
|
282 | #define CFG_RC_DISABLE_ON_SILENCE_START (4) | |
|
283 | #define CFG_RC_START_ON_REQUEST (BIT5) | |
|
284 | #define CFG_RC_START_ON_REQUEST_START (5) | |
|
285 | #define CFG_RC_SELF_ADDRESSING (BIT6) | |
|
286 | #define CFG_RC_SELF_ADDRESSING_START (6) | |
|
287 | #define CFG_RC_INTERFACE (BIT7) | |
|
288 | #define CFG_RC_INTERFACE_START (7) | |
|
289 | #define CFG_RC_INTERFACE_IDENT (BIT8) | |
|
290 | #define CFG_RC_INTERFACE_IDENT_START (8) | |
|
291 | ||
|
292 | /* The bits shared by all ports */ | |
|
293 | #define CFG_PORT_CONNECTION (BIT24 | BIT25 | BIT26 | BIT27 | BIT28) | |
|
294 | #define CFG_PORT_CONNECTION_START (24) | |
|
295 | #define CFG_PORT_TYPE (BIT29 | BIT30 | BIT31) | |
|
296 | #define CFG_PORT_TYPE_START (29) | |
|
297 | ||
|
298 | /* Network discovery register values */ | |
|
299 | #define CFG_NETD_TYPE (BIT0 | BIT1 | BIT2 | BIT3) | |
|
300 | #define CFG_NETD_TYPE_START (0) | |
|
301 | #define CFG_NETD_RETURN_PORT (BIT4 | BIT5 | BIT6 | BIT7) | |
|
302 | #define CFG_NETD_RETURN_PORT_START (4) | |
|
303 | #define CFG_NETD_RUNNING_PORTS (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \ | |
|
304 | BIT13 | BIT14 | BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | \ | |
|
305 | BIT21 | BIT22 | BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28 | \ | |
|
306 | BIT29 | BIT30 | BIT31) | |
|
307 | #define CFG_NETD_RUNNING_PORTS_START (8) | |
|
308 | ||
|
309 | /* Values in the ID register */ | |
|
310 | #define CFG_ID_VERSION (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \ | |
|
311 | BIT5 | BIT6 | BIT7) | |
|
312 | #define CFG_ID_VERSION_START (0) | |
|
313 | #define CFG_ID_CHIP (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \ | |
|
314 | BIT13 | BIT14 | BIT15) | |
|
315 | #define CFG_ID_CHIP_START (8) | |
|
316 | #define CFG_ID_MANUFACTURER (BIT16 | BIT17 | BIT18 | BIT19 | \ | |
|
317 | BIT20 | BIT21 | BIT22 | BIT23) | |
|
318 | #define CFG_ID_MANUFACTURER_START (16) | |
|
319 | ||
|
320 | /* Values in the Time-Code register */ | |
|
321 | #define CFG_TC_VALUE (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \ | |
|
322 | BIT5) | |
|
323 | #define CFG_TC_VALUE_START (0) | |
|
324 | #define CFG_TC_FLAGS (BIT6 | BIT7) | |
|
325 | #define CFG_TC_FLAGS_START (6) | |
|
326 | ||
|
327 | /* Values for the Router Base Clock Select */ | |
|
328 | #define CFG_RTR_CLK_100_MBITS (0) | |
|
329 | #define CFG_RTR_CLK_200_MBITS (BIT0) | |
|
330 | ||
|
331 | /* Values for the Brick Base Clock */ | |
|
332 | #define CFG_BRK_CLK_100_MHZ (0) | |
|
333 | #define CFG_BRK_CLK_120_MHZ (BIT0) | |
|
334 | #define CFG_BRK_CLK_140_MHZ (BIT1) | |
|
335 | #define CFG_BRK_CLK_160_MHZ (BIT0 | BIT1) | |
|
336 | #define CFG_BRK_CLK_180_MHZ (BIT2) | |
|
337 | #define CFG_BRK_CLK_200_MHZ (BIT2 | BIT0) | |
|
338 | ||
|
339 | /* Values for the Brick Base Divider */ | |
|
340 | #define CFG_BRK_DVDR_1 (0) | |
|
341 | #define CFG_BRK_DVDR_2 (BIT0) | |
|
342 | #define CFG_BRK_DVDR_4 (BIT1) | |
|
343 | ||
|
344 | /* Values in the Tx register */ | |
|
345 | #define CFG_TX_BRICK_2MBITS (BIT27) | |
|
346 | #define CFG_TX_BRICK_2MBITS_START (27) | |
|
347 | ||
|
348 | /* Values in the Precision Transmit Rate register */ | |
|
349 | #define CFG_PT_ENABLE (BIT16) | |
|
350 | #define CFG_PT_ENABLE_START (16) | |
|
351 | #define CFG_PT_READY (BIT17) | |
|
352 | #define CFG_PT_READY_START (17) | |
|
353 | #define CFG_PT_IN_USE (BIT20) | |
|
354 | #define CFG_PT_IN_USE_START (20) | |
|
355 | #define CFG_PT_RATE_BITS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | \ | |
|
356 | BIT7 | BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \ | |
|
357 | BIT13 | BIT14 | BIT15 ) | |
|
358 | #define CFG_PT_DIVIDER_CONSTANT ((double)(pow((double)2, (double)48) / (double)600)) | |
|
359 | ||
|
360 | /* Chip ID values */ | |
|
361 | #define CFG_CID_ROUTER_ASIC (0) /* SpaceWire Router ASIC and IP */ | |
|
362 | #define CFG_CID_ROUTER_USB (1) /* Original SpaceWire Router-USB */ | |
|
363 | #define CFG_CID_USB_BRICK (2) /* SpaceWire-USB Brick */ | |
|
364 | #define CFG_CID_FEIC (4) /* The FEIC chip */ | |
|
365 | #define CFG_CID_ROUTER_USB_2 (5) /* New SpaceWire Router-USB */ | |
|
366 | #define CFG_CID_PCI_MK2 (7) /* SpaceWire PCI Mk2 */ | |
|
367 | #define CFG_CID_PCI_EXPRESS (8) /* SpaceWire PCI Express */ | |
|
368 | #define CFG_CID_RTC (9) /* RTC Development Unit */ | |
|
369 | #define CFG_CID_CONFORMANCE_TESTER (10) /* SpaceWire Conformance Tester */ | |
|
370 | #define CFG_CID_EGSE (11) /* SpaceWire EGSE */ | |
|
371 | #define CFG_CID_STAR_FIRE (12) /* STAR Fire */ | |
|
372 | #define CFG_CID_WBS_MK2 (14) /* WBS Mk2 */ | |
|
373 | ||
|
374 | ||
|
375 | /* Addresses which can be read from and written to */ | |
|
376 | #define CFG_EXTENDED_ADDRESS (0x100) | |
|
377 | #define CFG_ADDR_NET_DISC (CFG_EXTENDED_ADDRESS + 0) | |
|
378 | #define CFG_ADDR_NET_DISC_IDENT (CFG_EXTENDED_ADDRESS + 1) | |
|
379 | #define CFG_ADDR_ROUTER_CONTROL (CFG_EXTENDED_ADDRESS + 2) | |
|
380 | #define CFG_ADDR_ERRORS (CFG_EXTENDED_ADDRESS + 3) | |
|
381 | #define CFG_ADDR_TIMECODE (CFG_EXTENDED_ADDRESS + 4) | |
|
382 | #define CFG_ADDR_IDS (CFG_EXTENDED_ADDRESS + 5) | |
|
383 | #define CFG_ADDR_GP (CFG_EXTENDED_ADDRESS + 6) | |
|
384 | #define CFG_ADDR_TICK (CFG_EXTENDED_ADDRESS + 7) | |
|
385 | #define CFG_ADDR_TX_RATE (CFG_EXTENDED_ADDRESS + 8) | |
|
386 | #define CFG_ADDR_PRECISION_1 (CFG_EXTENDED_ADDRESS + 0xC) | |
|
387 | #define CFG_ADDR_PRECISION_2 (CFG_EXTENDED_ADDRESS + 0xD) | |
|
388 | ||
|
389 | ||
|
390 | /* Exported functions */ | |
|
391 | ||
|
392 | /* Version information */ | |
|
393 | ROUTER_CONFIG_LIBRARY double ROUTER_CONFIG_CC CFGSpaceWire_GetAPIVersion(void); | |
|
394 | ||
|
395 | /* Configuration address stack manipulation functions */ | |
|
396 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_StackClear(void); | |
|
397 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_AddrStackPush( | |
|
398 | U8 dwAddress); | |
|
399 | ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_AddrStackPop(void); | |
|
400 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RetAddrStackPush( | |
|
401 | U8 dwAddress); | |
|
402 | ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_RetAddrStackPop(void); | |
|
403 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_SetProtocolByte( | |
|
404 | U8 ProtocolByte); | |
|
405 | ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_GetProtocolByte(void); | |
|
406 | ||
|
407 | /* RMAP functions */ | |
|
408 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_EnableRMAP( | |
|
409 | char useRMAP); | |
|
410 | ROUTER_CONFIG_LIBRARY char ROUTER_CONFIG_CC CFGSpaceWire_IsRMAPEnabled(); | |
|
411 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_SetRMAPDestinationKey( | |
|
412 | U8 destinationKey); | |
|
413 | ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_GetRMAPDestinationKey(); | |
|
414 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_SetRMAPAlignment( | |
|
415 | U8 alignment); | |
|
416 | ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_GetRMAPAlignment(); | |
|
417 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
418 | CFGSpaceWire_EnableReceiveOnAllPorts(char enable); | |
|
419 | ROUTER_CONFIG_LIBRARY char ROUTER_CONFIG_CC | |
|
420 | CFGSpaceWire_IsReceiveOnAllPortsEnabled(); | |
|
421 | ||
|
422 | /* Ignoring replies to write commands functions */ | |
|
423 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IgnoreWriteReplies( | |
|
424 | char ignore); | |
|
425 | ROUTER_CONFIG_LIBRARY char ROUTER_CONFIG_CC | |
|
426 | CFGSpaceWire_AreWriteRepliesIgnored(); | |
|
427 | ||
|
428 | /* Configuration address read and write functions */ | |
|
429 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_ReadAddress( | |
|
430 | star_device_handle hDevice, U32 dwAddress, U32 *dwData); | |
|
431 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_WriteAddress( | |
|
432 | star_device_handle hDevice, U32 dwAddress, U32 dwData); | |
|
433 | ||
|
434 | /* Router link functions */ | |
|
435 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_StartLink( | |
|
436 | star_device_handle hDevice, U32 dwLinkNum); | |
|
437 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_StopLink( | |
|
438 | star_device_handle hDevice, U32 dwLinkNum); | |
|
439 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_TriStateLink( | |
|
440 | star_device_handle hDevice, U32 dwLinkNum, char bEnabled); | |
|
441 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetLinkSpeed( | |
|
442 | star_device_handle hDevice, U32 dwLinkNum, U32 dwSpeed); | |
|
443 | ||
|
444 | /* Routing table functions */ | |
|
445 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetRoutingTableEntry( | |
|
446 | star_device_handle hDevice, U32 nLogicalAddress, U32 *dwRoutingTableEntry); | |
|
447 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetRoutingTableEntry( | |
|
448 | star_device_handle hDevice, U32 nLogicalAddress, U32 dwRoutingTableEntry); | |
|
449 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_ClearRoutingTableEntry( | |
|
450 | star_device_handle hDevice, U32 nLogicalAddress); | |
|
451 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTIsEnabled( | |
|
452 | U32 dwRoutingTableEntry, char *bEnabled); | |
|
453 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTIsDelHead( | |
|
454 | U32 dwRoutingTableEntry, char *bDelHead); | |
|
455 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTIsPriority( | |
|
456 | U32 dwRoutingTableEntry, char *bPriority); | |
|
457 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTOutputPorts( | |
|
458 | U32 dwRoutingTableEntry, U32 *dwOutputPorts); | |
|
459 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTGetOutputPorts( | |
|
460 | U32 dwRoutingTableEntry, U32 *dwOutputPorts); | |
|
461 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
462 | CFGSpaceWire_RTBuildRoutingTableEntry(U32 *dwRoutingTableEntry, | |
|
463 | U32 dwOutputPorts, char bDelHead, char bPriority); | |
|
464 | ||
|
465 | /* Link status control functions */ | |
|
466 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetLinkStatusControl( | |
|
467 | star_device_handle hDevice, U32 dwLinkNum, U32 *dwStatusControl); | |
|
468 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetLinkStatusControl( | |
|
469 | star_device_handle hDevice, U32 dwLinkNum, U32 dwStatusControl); | |
|
470 | ||
|
471 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSErrorStatus( | |
|
472 | U32 dwStatusControl, U32 *dwErrorStatus); | |
|
473 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSConfigErrorStatus( | |
|
474 | U32 dwStatusControl, U32 *dwErrorStatus); | |
|
475 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSExternalErrorStatus( | |
|
476 | U32 dwStatusControl, U32 *dwErrorStatus); | |
|
477 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSLinkState( | |
|
478 | U32 dwStatusControl, U32 *dwLinkStatus); | |
|
479 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsLinkRunning( | |
|
480 | U32 dwStatusControl, char *isLinkRunning); | |
|
481 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsAutoStart( | |
|
482 | U32 dwStatusControl, char *isAutoStart); | |
|
483 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableAutoStart( | |
|
484 | U32 *dwStatusControl, char bEnabled); | |
|
485 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsStart( | |
|
486 | U32 dwStatusControl, char *isStart); | |
|
487 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableStart( | |
|
488 | U32 *dwStatusControl, char bEnabled); | |
|
489 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsDisabled( | |
|
490 | U32 dwStatusControl, char *isDisabled); | |
|
491 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableDisabled( | |
|
492 | U32 *dwStatusControl, char bEnabled); | |
|
493 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsTristate( | |
|
494 | U32 dwStatusControl, char *isTristate); | |
|
495 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableTristate( | |
|
496 | U32 *dwStatusControl, char bEnabled); | |
|
497 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSOperatingSpeed( | |
|
498 | U32 dwStatusControl, U32 *dwOperatingSpeed); | |
|
499 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSSetOperatingSpeed( | |
|
500 | U32 *dwStatusControl, U32 dwOperatingSpeed); | |
|
501 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSOutputPortConnection( | |
|
502 | U32 dwStatusControl, U32 *dwOutputPortConnection); | |
|
503 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSPortType( | |
|
504 | U32 dwStatusControl, U32 *dwPortType); | |
|
505 | ||
|
506 | /* Network discovery information retreival */ | |
|
507 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
508 | CFGSpaceWire_GetNetworkDiscoveryValue(star_device_handle hDevice, | |
|
509 | U32 *dwNetworkDiscovery); | |
|
510 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDDeviceType( | |
|
511 | U32 dwNetDisc, U32 *dwDeviceType); | |
|
512 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDReturnPort( | |
|
513 | U32 dwNetDisc, U32 *dwReturnPort); | |
|
514 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDRunningLinks( | |
|
515 | U32 dwNetDisc, U32 *dwRunningLinks); | |
|
516 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDNumberLinks( | |
|
517 | U32 dwNetDisc, U32 *dwNumberLinks); | |
|
518 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetNumberLinks( | |
|
519 | star_device_handle hDevice, U32 *dwNumLinks); | |
|
520 | ||
|
521 | /* Router identity register functions */ | |
|
522 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetNetworkID( | |
|
523 | star_device_handle hDevice, U32 dwNetworkID); | |
|
524 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetNetworkID( | |
|
525 | star_device_handle hDevice, U32 *dwNetworkID); | |
|
526 | ||
|
527 | /* Router control register functions */ | |
|
528 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetPortTimeout( | |
|
529 | star_device_handle hDevice, char bEnabled, | |
|
530 | CFG_SPACEWIRE_PORT_TIMEOUT timeout); | |
|
531 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetPortTimeout( | |
|
532 | star_device_handle hDevice, char *bEnabled, | |
|
533 | CFG_SPACEWIRE_PORT_TIMEOUT *timeout); | |
|
534 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_IsPortTimeoutEnabled( | |
|
535 | star_device_handle hDevice, char *bEnabled); | |
|
536 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetAsInterface( | |
|
537 | star_device_handle hDevice, char bEnabled, char bAddIdentifier); | |
|
538 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
539 | CFGSpaceWire_GetRouterControlRegister(star_device_handle hDevice, | |
|
540 | U32 *dwRouterCtrlReg); | |
|
541 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
542 | CFGSpaceWire_SetRouterControlRegister(star_device_handle hDevice, | |
|
543 | U32 dwRouterCtrlReg); | |
|
544 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetTimeoutEnabled( | |
|
545 | U32 dwRouterCtrlReg, char *bEnabled); | |
|
546 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetTimeoutEnabled( | |
|
547 | U32 *dwRouterCtrlReg, char bEnabled); | |
|
548 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetTimeoutSelection( | |
|
549 | U32 dwRouterCtrlReg, U32 *dwSelection); | |
|
550 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetTimeoutSelection( | |
|
551 | U32 *dwRouterCtrlReg, U32 dwSelection); | |
|
552 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetDisableOnSilence( | |
|
553 | U32 dwRouterCtrlReg, char *bEnabled); | |
|
554 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetDisableOnSilence( | |
|
555 | U32 *dwRouterCtrlReg, char bEnabled); | |
|
556 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetStartOnRequest( | |
|
557 | U32 dwRouterCtrlReg, char *bEnabled); | |
|
558 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetStartOnRequest( | |
|
559 | U32 *dwRouterCtrlReg, char bEnabled); | |
|
560 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetSelfAddressing( | |
|
561 | U32 dwRouterCtrlReg, char *bEnabled); | |
|
562 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetSelfAddressing( | |
|
563 | U32 *dwRouterCtrlReg, char bEnabled); | |
|
564 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetInterface( | |
|
565 | U32 dwRouterCtrlReg, char *bEnabled); | |
|
566 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetInterface( | |
|
567 | U32 *dwRouterCtrlReg, char bEnabled); | |
|
568 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
569 | CFGSpaceWire_RCGetInterfaceIdentifier(U32 dwRouterCtrlReg, char *bEnabled); | |
|
570 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
571 | CFGSpaceWire_RCSetInterfaceIdentifier(U32 *dwRouterCtrlReg, char bEnabled); | |
|
572 | ||
|
573 | /* Error active register functions */ | |
|
574 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetErrorStatus( | |
|
575 | star_device_handle hDevice, U32 *dwErrorStatus); | |
|
576 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_ClearErrorStatus( | |
|
577 | star_device_handle hDevice, U32 dwPorts); | |
|
578 | ||
|
579 | /* Time-Code register functions */ | |
|
580 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetTimecodeRegister( | |
|
581 | star_device_handle hDevice, U32 *dwTimecodeReg); | |
|
582 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_TCGetValue( | |
|
583 | U32 dwTimecodeReg, U32 *dwValue); | |
|
584 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_TCGetFlags( | |
|
585 | U32 dwTimecodeReg, U32 *dwValue); | |
|
586 | ||
|
587 | /* Manufacturer and Chip ID register functions */ | |
|
588 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetIDRegister( | |
|
589 | star_device_handle hDevice, U32 *dwIDs); | |
|
590 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IDGetManufacturer( | |
|
591 | U32 dwIDs, U32 *dwManufacturerID); | |
|
592 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IDGetChipID(U32 dwIDs, | |
|
593 | U32 *dwChipID); | |
|
594 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IDGetVersion(U32 dwIDs, | |
|
595 | U32 *dwVersion); | |
|
596 | ||
|
597 | /* General purpose register functions */ | |
|
598 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetGeneralPurposeStatus( | |
|
599 | star_device_handle hDevice, U32 *dwGeneralPurposeStatus); | |
|
600 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetGeneralPurposeStatus( | |
|
601 | star_device_handle hDevice, U32 dwGeneralPurposeStatus); | |
|
602 | ||
|
603 | /* Tick enable register functions */ | |
|
604 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetTickEnableStatus( | |
|
605 | star_device_handle hDevice, U32 *dwTickEnableStatus); | |
|
606 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetTickEnableStatus( | |
|
607 | star_device_handle hDevice, U32 dwTickEnableStatus); | |
|
608 | ||
|
609 | ||
|
610 | /* Base Transmit Rate functions */ | |
|
611 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
612 | CFGSpaceWire_SetRouterBaseTransmitRate(star_device_handle hDevice, | |
|
613 | U32 dwBaseClkSel); | |
|
614 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
615 | CFGSpaceWire_GetRouterBaseTransmitRate(star_device_handle hDevice, | |
|
616 | U32 *dwBaseClkSel); | |
|
617 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
618 | CFGSpaceWire_SetBrickBaseTransmitRate(star_device_handle hDevice, | |
|
619 | U32 dwBaseClk, U32 dwBaseDvdr, U32 dwEnableClk); | |
|
620 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
621 | CFGSpaceWire_GetBrickBaseTransmitRate(star_device_handle hDevice, | |
|
622 | U32 *dwBaseClk, U32 *dwBaseDvdr, U32 *dwEnableClk); | |
|
623 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
624 | CFGSpaceWire_GetPrecisionTransmitRegister(star_device_handle hDevice, | |
|
625 | U32 *dwPrecisionTransmit); | |
|
626 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
627 | CFGSpaceWire_SetPrecisionTransmitRegister(star_device_handle hDevice, | |
|
628 | U32 dwPrecisionTransmit); | |
|
629 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
630 | CFGSpaceWire_PTGetPrecisionTransmitEnabled(U32 dwPrecisionTransmit, | |
|
631 | char *bEnabled); | |
|
632 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
633 | CFGSpaceWire_PTSetPrecisionTransmitEnabled(U32 *dwPrecisionTransmit, | |
|
634 | char bEnabled); | |
|
635 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
636 | CFGSpaceWire_PTGetPrecisionTransmitReady(U32 dwPrecisionTransmit, | |
|
637 | char *bEnabled); | |
|
638 | ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC | |
|
639 | CFGSpaceWire_PTGetPrecisionTransmitInUse(U32 dwPrecisionTransmit, | |
|
640 | char *bEnabled); | |
|
641 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
642 | CFGSpaceWire_GetPrecisionTransmitRate(star_device_handle hDevice, | |
|
643 | double *PrecisionTransmitRate); | |
|
644 | ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC | |
|
645 | CFGSpaceWire_SetPrecisionTransmitRate(star_device_handle hDevice, | |
|
646 | double PrecisionTransmitRate); | |
|
647 | ||
|
648 | ||
|
649 | ||
|
650 | #ifdef __cplusplus | |
|
651 | } | |
|
652 | #endif | |
|
653 | ||
|
654 | ||
|
655 | ||
|
656 | #endif /* SPACEWIRE_ROUTER_LIBRARY */ | |
|
657 | ||
|
658 | ||
|
659 |
@@ -0,0 +1,330 | |||
|
1 | /******************************************************************************/ | |
|
2 | /* */ | |
|
3 | /* spw_usb_api.h */ | |
|
4 | /* */ | |
|
5 | /* Declaration of the functions provided by the SpaceWire USB API Library */ | |
|
6 | /* for the SpaceWire USB devices. */ | |
|
7 | /* */ | |
|
8 | /* Version 2.62, March 11th 2013 */ | |
|
9 | /* */ | |
|
10 | /* Version 2.62, 11/03/13 */ | |
|
11 | /* ====================== */ | |
|
12 | /* Fixed bug dealing with received traffic which is not a packet. */ | |
|
13 | /* */ | |
|
14 | /* Version 2.61, 21/09/12 */ | |
|
15 | /* ====================== */ | |
|
16 | /* Added support for STAR Fire and WBS II. */ | |
|
17 | /* */ | |
|
18 | /* Version 2.60, 04/01/12 */ | |
|
19 | /* ====================== */ | |
|
20 | /* Added support for EGSE and SPLT. */ | |
|
21 | /* */ | |
|
22 | /* Version 2.59, 15/08/11 */ | |
|
23 | /* ====================== */ | |
|
24 | /* Added support for RTC. */ | |
|
25 | /* */ | |
|
26 | /* Version 2.5, 12/10/10 */ | |
|
27 | /* ===================== */ | |
|
28 | /* Added support for Link Analyser Mk2. */ | |
|
29 | /* */ | |
|
30 | /* Version 1.5, 12/03/10 */ | |
|
31 | /* ===================== */ | |
|
32 | /* Added GetFirmwareVersionExtended and restored GetFirmwareVersion to */ | |
|
33 | /* its original form. */ | |
|
34 | /* */ | |
|
35 | /* Version 1.4, 03/03/10 */ | |
|
36 | /* ===================== */ | |
|
37 | /* Fixed bug waiting on a receive to complete. */ | |
|
38 | /* Added support for multiple send channels. */ | |
|
39 | /* Added functions to get serial number and product ID. */ | |
|
40 | /* */ | |
|
41 | /* Version 1.3, 26/2/09 */ | |
|
42 | /* ==================== */ | |
|
43 | /* Updated the calling convention used in the function declaration to */ | |
|
44 | /* __stdcall on Windows. */ | |
|
45 | /* */ | |
|
46 | /* Version 1.2, 21/1/09 */ | |
|
47 | /* ==================== */ | |
|
48 | /* Updated to compile on both Windows and Linux. */ | |
|
49 | /* */ | |
|
50 | /* Version 1.1, 8/10/06 */ | |
|
51 | /* ==================== */ | |
|
52 | /* Linux release. */ | |
|
53 | /* */ | |
|
54 | /* Version 1.0, 24/4/06 */ | |
|
55 | /* ==================== */ | |
|
56 | /* Initial version. */ | |
|
57 | /* */ | |
|
58 | /* Copyright (2013), STAR-Dundee Ltd., */ | |
|
59 | /* STAR House, */ | |
|
60 | /* 166 Nethergate, */ | |
|
61 | /* Dundee, DD1 4EE, */ | |
|
62 | /* Scotland, UK. */ | |
|
63 | /* e-mail: support@star-dundee.com */ | |
|
64 | /* */ | |
|
65 | /******************************************************************************/ | |
|
66 | ||
|
67 | ||
|
68 | ||
|
69 | #ifndef SPACEWIRE_USB_API_H | |
|
70 | #define SPACEWIRE_USB_API_H | |
|
71 | ||
|
72 | ||
|
73 | ||
|
74 | ||
|
75 | #ifdef __cplusplus | |
|
76 | extern "C" { | |
|
77 | #endif | |
|
78 | ||
|
79 | ||
|
80 | ||
|
81 | #include "spacewire_usb.h" | |
|
82 | ||
|
83 | ||
|
84 | ||
|
85 | #if defined(_WIN32) || defined(_WIN64) | |
|
86 | ||
|
87 | ||
|
88 | /* Windows specifc functions and macros */ | |
|
89 | ||
|
90 | #ifdef SPACEWIREUSBAPI_EXPORTS | |
|
91 | #define SPACEWIREUSB_API __declspec(dllexport) | |
|
92 | #else | |
|
93 | #define SPACEWIREUSB_API __declspec(dllimport) | |
|
94 | #endif | |
|
95 | ||
|
96 | #ifdef _WIN64 | |
|
97 | #define SPW_USB_API_CC | |
|
98 | #else | |
|
99 | #define SPW_USB_API_CC __stdcall | |
|
100 | #endif /* WIN64 */ | |
|
101 | ||
|
102 | ||
|
103 | #include "windows.h" | |
|
104 | ||
|
105 | ||
|
106 | #else /* _WIN32 */ | |
|
107 | ||
|
108 | ||
|
109 | /* Linux specific functions and macros */ | |
|
110 | ||
|
111 | #define SPACEWIREUSB_API | |
|
112 | #define SPW_USB_API_CC | |
|
113 | ||
|
114 | ||
|
115 | #endif /* _WIN32 */ | |
|
116 | ||
|
117 | ||
|
118 | ||
|
119 | /* Functions provided by the API */ | |
|
120 | ||
|
121 | /* General functions */ | |
|
122 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_Open( | |
|
123 | star_device_handle *phDevice, int nDeviceNum); | |
|
124 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_Close( | |
|
125 | star_device_handle hDevice); | |
|
126 | SPACEWIREUSB_API U8 SPW_USB_API_CC USBSpaceWire_CountDevices(); | |
|
127 | SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_ListDevices(); | |
|
128 | SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetDriverVersion(); | |
|
129 | SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetIFVersion(); | |
|
130 | SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetAPIVersion(); | |
|
131 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetTimeout( | |
|
132 | star_device_handle hDevice, double timeout); | |
|
133 | SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetTimeout( | |
|
134 | star_device_handle hDevice); | |
|
135 | SPACEWIREUSB_API U8 SPW_USB_API_CC USBSpaceWire_GetSpaceWireAddress( | |
|
136 | star_device_handle hDevice); | |
|
137 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetSpaceWireAddress( | |
|
138 | star_device_handle hDevice, U8 address); | |
|
139 | SPACEWIREUSB_API U16 SPW_USB_API_CC USBSpaceWire_GetFirmwareVersion( | |
|
140 | star_device_handle hDevice); | |
|
141 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_GetFirmwareVersionExtended( | |
|
142 | star_device_handle hDevice, SPACEWIRE_FIRMWARE_VERSION *pVersion); | |
|
143 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_ClearEndpoints( | |
|
144 | star_device_handle hDevice); | |
|
145 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_ResetDevice( | |
|
146 | star_device_handle hDevice); | |
|
147 | SPACEWIREUSB_API SPACEWIRE_DEVICE_TYPE SPW_USB_API_CC | |
|
148 | USBSpaceWire_GetDeviceType(star_device_handle hDevice); | |
|
149 | SPACEWIREUSB_API SPACEWIRE_DEVICE_TYPE SPW_USB_API_CC | |
|
150 | USBSpaceWire_GetUnopenedDeviceType(int deviceNum); | |
|
151 | SPACEWIREUSB_API U16 SPW_USB_API_CC USBSpaceWire_GetDeviceProductID( | |
|
152 | star_device_handle hDevice); | |
|
153 | SPACEWIREUSB_API U16 SPW_USB_API_CC USBSpaceWire_GetUnopenedDeviceProductID( | |
|
154 | int deviceNum); | |
|
155 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableHeaderMode( | |
|
156 | star_device_handle hDevice, char enable); | |
|
157 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsHeaderModeEnabled( | |
|
158 | star_device_handle hDevice); | |
|
159 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableNetworkMode( | |
|
160 | star_device_handle hDevice, char enable); | |
|
161 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsNetworkModeEnabled( | |
|
162 | star_device_handle hDevice); | |
|
163 | SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetUSBVersion( | |
|
164 | star_device_handle hDevice); | |
|
165 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_GetAPIString(char *str); | |
|
166 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_GetSerialNumber( | |
|
167 | star_device_handle hDevice, U8 pSerialNumber[11]); | |
|
168 | ||
|
169 | /* Receive functions */ | |
|
170 | SPACEWIREUSB_API unsigned long SPW_USB_API_CC | |
|
171 | USBSpaceWire_GetDriverDroppedPackets(star_device_handle hDevice); | |
|
172 | SPACEWIREUSB_API unsigned long SPW_USB_API_CC | |
|
173 | USBSpaceWire_GetDriverDroppedBytes(star_device_handle hDevice); | |
|
174 | SPACEWIREUSB_API unsigned long SPW_USB_API_CC USBSpaceWire_GetDroppedPackets( | |
|
175 | star_device_handle hDevice); | |
|
176 | SPACEWIREUSB_API unsigned long SPW_USB_API_CC USBSpaceWire_GetDroppedBytes( | |
|
177 | star_device_handle hDevice); | |
|
178 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_RegisterReceiveOnPort( | |
|
179 | star_device_handle hDevice, U8 port); | |
|
180 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_UnregisterReceiveOnPort( | |
|
181 | star_device_handle hDevice, U8 port); | |
|
182 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_RegisterReceiveOnAllPorts( | |
|
183 | star_device_handle hDevice); | |
|
184 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_UnregisterReceiveOnAllPorts( | |
|
185 | star_device_handle hDevice); | |
|
186 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_ReadPackets( | |
|
187 | star_device_handle hDevice, void *pBuffer, U32 nBufferSize, | |
|
188 | U32 nPacketNum, char bWait, PUSB_SPACEWIRE_PACKET_PROPERTIES properties, | |
|
189 | USB_SPACEWIRE_ID *identifier); | |
|
190 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeRead( | |
|
191 | star_device_handle hDevice, USB_SPACEWIRE_ID identifier); | |
|
192 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeAllReads( | |
|
193 | star_device_handle hDevice); | |
|
194 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_GetReadStatus( | |
|
195 | star_device_handle hDevice, USB_SPACEWIRE_ID identifier); | |
|
196 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
197 | USBSpaceWire_WaitOnReadCompleting(star_device_handle hDevice, | |
|
198 | USB_SPACEWIRE_ID identifier, char bWaitIndefinitely); | |
|
199 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableReadThrottling( | |
|
200 | star_device_handle hDevice, char enable); | |
|
201 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsReadThrottling( | |
|
202 | star_device_handle hDevice); | |
|
203 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetDriverReadBufferSize( | |
|
204 | star_device_handle hDevice, unsigned long nBufferSize); | |
|
205 | SPACEWIREUSB_API unsigned long SPW_USB_API_CC | |
|
206 | USBSpaceWire_GetDriverReadBufferSize(star_device_handle hDevice); | |
|
207 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetDriverReadStructsNum( | |
|
208 | star_device_handle hDevice, unsigned long nStructsNum); | |
|
209 | SPACEWIREUSB_API unsigned long SPW_USB_API_CC | |
|
210 | USBSpaceWire_GetDriverReadStructsNum(star_device_handle hDevice); | |
|
211 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_WaitOnReadPacketAvailable( | |
|
212 | star_device_handle hDevice, double timeout); | |
|
213 | SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_GetReadLength( | |
|
214 | PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum); | |
|
215 | SPACEWIREUSB_API USB_SPACEWIRE_EOP_TYPE SPW_USB_API_CC | |
|
216 | USBSpaceWire_GetReadEOPStatus(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, | |
|
217 | U32 nPacketNum); | |
|
218 | SPACEWIREUSB_API SPACEWIRE_TRAFFIC_TYPE SPW_USB_API_CC | |
|
219 | USBSpaceWire_GetReadTrafficType( | |
|
220 | PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum); | |
|
221 | ||
|
222 | /* Send functions */ | |
|
223 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_GetNumberOfSendChannels( | |
|
224 | star_device_handle hDevice); | |
|
225 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_SendPacketTo( | |
|
226 | star_device_handle hDevice, void *pBuffer, U32 nBufferSize, | |
|
227 | U8 *pAddress, U32 nAddressLen, char bWait, | |
|
228 | USB_SPACEWIRE_ID *identifier); | |
|
229 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
230 | USBSpaceWire_SendPacketToOverChannel(star_device_handle hDevice, U8 channel, | |
|
231 | void *pBuffer, U32 nBufferSize, U8 *pAddress, U32 nAddressLen, | |
|
232 | char bWait, USB_SPACEWIRE_ID *identifier); | |
|
233 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
234 | USBSpaceWire_SendMultiplePacketsTo(star_device_handle hDevice, | |
|
235 | void *pBuffer, U32 nPacketSize, U32 nBufferSize, U8 *pAddress, | |
|
236 | U32 nAddressLen, char bWait, USB_SPACEWIRE_ID *identifier); | |
|
237 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
238 | USBSpaceWire_SendMultiplePacketsToOverChannel(star_device_handle hDevice, | |
|
239 | U8 channel, void *pBuffer, U32 nPacketSize, U32 nBufferSize, | |
|
240 | U8 *pAddress, U32 nAddressLen, char bWait, | |
|
241 | USB_SPACEWIRE_ID *identifier); | |
|
242 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
243 | USBSpaceWire_SendMultiplePacketLengthsTo(star_device_handle hDevice, | |
|
244 | void **pBuffers, U32 *pPacketSizes, U32 nNumberOfPackets, U8 *pAddress, | |
|
245 | U32 nAddressLen, char bWait, USB_SPACEWIRE_ID *identifier); | |
|
246 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
247 | USBSpaceWire_SendMultiplePacketLengthsToOverChannel( | |
|
248 | star_device_handle hDevice, U8 channel, void **pBuffers, | |
|
249 | U32 *pPacketSizes, U32 nNumberOfPackets, U8 *pAddress, U32 nAddressLen, | |
|
250 | char bWait, USB_SPACEWIRE_ID *identifier); | |
|
251 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_SendPacket( | |
|
252 | star_device_handle hDevice, void *pBuffer, U32 nBufferSize, char bWait, | |
|
253 | USB_SPACEWIRE_ID *identifier); | |
|
254 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
255 | USBSpaceWire_SendPacketOverChannel(star_device_handle hDevice, U8 channel, | |
|
256 | void *pBuffer, U32 nBufferSize, char bWait, | |
|
257 | USB_SPACEWIRE_ID *identifier); | |
|
258 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
259 | USBSpaceWire_SendMultiplePackets(star_device_handle hDevice, void *pBuffer, | |
|
260 | U32 nPacketSize, U32 nBufferSize, char bWait, | |
|
261 | USB_SPACEWIRE_ID *identifier); | |
|
262 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
263 | USBSpaceWire_SendMultiplePacketsOverChannel(star_device_handle hDevice, | |
|
264 | U8 channel, void *pBuffer, U32 nPacketSize, U32 nBufferSize, char bWait, | |
|
265 | USB_SPACEWIRE_ID *identifier); | |
|
266 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
267 | USBSpaceWire_SendMultiplePacketLengths(star_device_handle hDevice, | |
|
268 | void **pBuffers, U32 *pPacketSizes, U32 nNumberOfPackets, char bWait, | |
|
269 | USB_SPACEWIRE_ID *identifier); | |
|
270 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
271 | USBSpaceWire_SendMultiplePacketLengthsOverChannel( | |
|
272 | star_device_handle hDevice, U8 channel, void **pBuffers, | |
|
273 | U32 *pPacketSizes, U32 nNumberOfPackets, char bWait, | |
|
274 | USB_SPACEWIRE_ID *identifier); | |
|
275 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeSend( | |
|
276 | star_device_handle hDevice, USB_SPACEWIRE_ID identifier); | |
|
277 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeAllSends( | |
|
278 | star_device_handle hDevice); | |
|
279 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_GetSendStatus( | |
|
280 | star_device_handle hDevice, USB_SPACEWIRE_ID identifier); | |
|
281 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
282 | USBSpaceWire_WaitOnSendCompleting(star_device_handle hDevice, | |
|
283 | USB_SPACEWIRE_ID identifier, char bWaitIndefinitely); | |
|
284 | SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_GetSendSize( | |
|
285 | star_device_handle hDevice, USB_SPACEWIRE_ID identifier); | |
|
286 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetDriverSendBufferSize( | |
|
287 | star_device_handle hDevice, U32 nBufferSize); | |
|
288 | SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_GetDriverSendBufferSize( | |
|
289 | star_device_handle hDevice); | |
|
290 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableSendEEPs( | |
|
291 | star_device_handle hDevice, char enable); | |
|
292 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsSendEEPsEnabled( | |
|
293 | star_device_handle hDevice); | |
|
294 | SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC | |
|
295 | USBSpaceWire_TunnelSendTraffic(star_device_handle hDevice, | |
|
296 | SPACEWIRE_TRAFFIC_TYPE type, void *pBuffer, U32 nBufferSize, | |
|
297 | USB_SPACEWIRE_EOP_TYPE eop, U8 port, char bWait, | |
|
298 | USB_SPACEWIRE_ID *identifier); | |
|
299 | ||
|
300 | /* Time-code functions */ | |
|
301 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_PerformTickIn( | |
|
302 | star_device_handle hDevice, U8 timein); | |
|
303 | SPACEWIREUSB_API char SPW_USB_API_CC | |
|
304 | USBSpaceWire_TC_EnableExternalTimecodeSelection(star_device_handle hDevice, | |
|
305 | char enable); | |
|
306 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_Reset( | |
|
307 | star_device_handle hDevice); | |
|
308 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_EnableAutoTickIn( | |
|
309 | star_device_handle hDevice, char enableAutoTickIns, char enableAllPorts); | |
|
310 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_SetAutoTickInFrequency( | |
|
311 | star_device_handle hDevice, U32 frequency); | |
|
312 | SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_StartReadingTimecodes( | |
|
313 | star_device_handle hDevice, void *arg, void (*callbackfunc)( | |
|
314 | star_device_handle hDevice, U8 timecode, void *arg)); | |
|
315 | SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_TC_StopReadingTimecodes( | |
|
316 | star_device_handle hDevice); | |
|
317 | SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_TC_GetClockFrequency( | |
|
318 | star_device_handle hDevice); | |
|
319 | ||
|
320 | ||
|
321 | ||
|
322 | #ifdef __cplusplus | |
|
323 | } | |
|
324 | #endif | |
|
325 | ||
|
326 | ||
|
327 | ||
|
328 | #endif /* SPACEWIRE_USB_API_H */ | |
|
329 | ||
|
330 |
@@ -0,0 +1,161 | |||
|
1 | /** | |
|
2 | * \file star-dundee_types.h | |
|
3 | * \brief Definitions of STAR-Dundee commonly used types. | |
|
4 | * \author Stuart Mills\n | |
|
5 | * STAR-Dundee\n | |
|
6 | * c/o School of Computing\n | |
|
7 | * University of Dundee\n | |
|
8 | * Dundee, DD1 4HN\n | |
|
9 | * Scotland, UK\n | |
|
10 | * e-mail: support@star-dundee.com | |
|
11 | * | |
|
12 | * This file contains the definitions of common types used by STAR-Dundee | |
|
13 | * software drivers and APIs. | |
|
14 | * | |
|
15 | * <b>IMPORTANT NOTE:</b> | |
|
16 | * \note If you are experiencing compilation errors indicating that | |
|
17 | * U8 is already defined, for example, please add the following | |
|
18 | * line to your code prior to including this file:\n | |
|
19 | * <code>\#define NO_STAR_TYPES</code>\n | |
|
20 | * Alternatively you can compile your code with a flag of | |
|
21 | * <code>-DNO_STAR_TYPES</code>.\n | |
|
22 | * | |
|
23 | * \version 1.1 - August 22nd 2011\n | |
|
24 | * Removed star_device_handle, not required by STAR-System.\n\n | |
|
25 | * | |
|
26 | * \version 1.0 - March 22nd 2007\n | |
|
27 | * Initial version.\n\n | |
|
28 | * | |
|
29 | * Copyright © 2009 STAR-Dundee Ltd | |
|
30 | */ | |
|
31 | ||
|
32 | ||
|
33 | /** | |
|
34 | * \defgroup STARDundeeTypes STAR-Dundee Types | |
|
35 | * This section contains the definitions of types used in STAR-Dundee software | |
|
36 | * drivers and APIs. | |
|
37 | */ | |
|
38 | ||
|
39 | /** | |
|
40 | * \def TRUE | |
|
41 | * \ingroup STARDundeeTypes | |
|
42 | * A value that can be used to represent the boolean value of true. | |
|
43 | */ | |
|
44 | ||
|
45 | /** | |
|
46 | * \def FALSE | |
|
47 | * \ingroup STARDundeeTypes | |
|
48 | * A value that can be used to represent the boolean value of false. | |
|
49 | */ | |
|
50 | ||
|
51 | /** | |
|
52 | * \typedef U8 | |
|
53 | * \ingroup STARDundeeTypes | |
|
54 | * A type that can be used to represent an unsigned 8-bit number. | |
|
55 | */ | |
|
56 | ||
|
57 | /** | |
|
58 | * \typedef U16 | |
|
59 | * \ingroup STARDundeeTypes | |
|
60 | * A type that can be used to represent an unsigned 16-bit number. | |
|
61 | */ | |
|
62 | ||
|
63 | /** | |
|
64 | * \typedef U32 | |
|
65 | * \ingroup STARDundeeTypes | |
|
66 | * A type that can be used to represent an unsigned 32-bit number. | |
|
67 | */ | |
|
68 | ||
|
69 | /** | |
|
70 | * \typedef REGISTER | |
|
71 | * \ingroup STARDundeeTypes | |
|
72 | * A type that can be used to represent a 4-byte register. | |
|
73 | */ | |
|
74 | ||
|
75 | ||
|
76 | #ifndef STAR_DUNDEE_TYPES | |
|
77 | #define STAR_DUNDEE_TYPES | |
|
78 | ||
|
79 | /* Define TRUE and FALSE */ | |
|
80 | #ifndef TRUE | |
|
81 | #define TRUE 1 | |
|
82 | #endif | |
|
83 | #ifndef FALSE | |
|
84 | #define FALSE 0 | |
|
85 | #endif | |
|
86 | ||
|
87 | #ifndef NO_STAR_TYPES | |
|
88 | ||
|
89 | #if (defined(__linux__) || defined(LINUX) || defined(__LINUX__) || \ | |
|
90 | defined(__CYGWIN__)) && defined(__KERNEL__) | |
|
91 | ||
|
92 | #include <linux/types.h> | |
|
93 | ||
|
94 | /* Define U8, U16 and U32 in the Linux kernel */ | |
|
95 | #ifndef U8 | |
|
96 | typedef u8 U8; | |
|
97 | #endif | |
|
98 | #ifndef U16 | |
|
99 | typedef u16 U16; | |
|
100 | #endif | |
|
101 | #ifndef U32 | |
|
102 | typedef u32 U32; | |
|
103 | #endif | |
|
104 | ||
|
105 | #else | |
|
106 | ||
|
107 | #include <limits.h> | |
|
108 | ||
|
109 | /* Define U8 */ | |
|
110 | #ifndef U8 | |
|
111 | #if (UCHAR_MAX == 0xff) | |
|
112 | typedef unsigned char U8; | |
|
113 | #elif (UINT_MAX == 0xff) | |
|
114 | typedef unsigned int U8; | |
|
115 | #else | |
|
116 | #error "No valid definition of U8 available" | |
|
117 | #endif | |
|
118 | #endif | |
|
119 | ||
|
120 | /* Define U16 */ | |
|
121 | #ifndef U16 | |
|
122 | #if (USHRT_MAX == 0xffff) | |
|
123 | typedef unsigned short U16; | |
|
124 | #elif (UINT_MAX == 0xffff) | |
|
125 | typedef unsigned int U16; | |
|
126 | #elif (UCHAR_MAX == 0xffff) | |
|
127 | typedef unsigned char U16; | |
|
128 | #else | |
|
129 | #error "No valid definition of U16 available" | |
|
130 | #endif | |
|
131 | #endif | |
|
132 | ||
|
133 | /* Define U32 */ | |
|
134 | #ifndef U32 | |
|
135 | #if (UINT_MAX == 0xffffffff) | |
|
136 | typedef unsigned int U32; | |
|
137 | #elif (ULONG_MAX == 0xffffffff) | |
|
138 | typedef unsigned long U32; | |
|
139 | #elif (USHRT_MAX == 0xffffffff) | |
|
140 | typedef unsigned short U32; | |
|
141 | #elif (UCHAR_MAX == 0xffffffff) | |
|
142 | typedef unsigned char U32; | |
|
143 | #else | |
|
144 | #error "No valid definition of U32 available" | |
|
145 | #endif | |
|
146 | #endif | |
|
147 | ||
|
148 | #endif /* Linux kernel test */ | |
|
149 | ||
|
150 | ||
|
151 | #endif /* NO_STAR_TYPES */ | |
|
152 | ||
|
153 | /* Define REGISTER */ | |
|
154 | #ifndef REGISTER | |
|
155 | typedef U32 REGISTER; | |
|
156 | #endif | |
|
157 | ||
|
158 | ||
|
159 | #endif /* STAR_DUNDEE_TYPES */ | |
|
160 | ||
|
161 |
@@ -0,0 +1,97 | |||
|
1 | /******************************************************************************/ | |
|
2 | /* */ | |
|
3 | /* star_dundee_types.h */ | |
|
4 | /* */ | |
|
5 | /* This file contains the definitions of common types used by STAR-Dundee */ | |
|
6 | /* drivers and APIs. */ | |
|
7 | /* */ | |
|
8 | /* IMPORTANT NOTE: If you are experiencing compilation errors indicating */ | |
|
9 | /* that U8 is already defined, for example, please add the */ | |
|
10 | /* following line to your code prior to including this */ | |
|
11 | /* file: */ | |
|
12 | /* #define NO_STAR_TYPES */ | |
|
13 | /* Alternatively you can compile your code with a flag of */ | |
|
14 | /* -DNO_STAR_TYPES. */ | |
|
15 | /* */ | |
|
16 | /* Version 1.0, March 22nd 2007 */ | |
|
17 | /* */ | |
|
18 | /* Version 1.0 - March 22nd 2007 */ | |
|
19 | /* =========== */ | |
|
20 | /* Initial version. */ | |
|
21 | /* */ | |
|
22 | /* Copyright (2012), STAR-Dundee Ltd., */ | |
|
23 | /* STAR House, */ | |
|
24 | /* 166 Nethergate, */ | |
|
25 | /* Dundee, DD1 4EE, */ | |
|
26 | /* Scotland, UK. */ | |
|
27 | /* e-mail: support@star-dundee.com */ | |
|
28 | /* */ | |
|
29 | /******************************************************************************/ | |
|
30 | ||
|
31 | ||
|
32 | ||
|
33 | #ifndef STAR_DUNDEE_TYPES | |
|
34 | #define STAR_DUNDEE_TYPES | |
|
35 | ||
|
36 | ||
|
37 | typedef void *star_device_handle; | |
|
38 | ||
|
39 | ||
|
40 | #ifndef NO_STAR_TYPES | |
|
41 | ||
|
42 | #if (defined(__linux__) || defined(LINUX) || defined(__LINUX__)) && \ | |
|
43 | defined(__KERNEL__) | |
|
44 | ||
|
45 | #include <linux/types.h> | |
|
46 | ||
|
47 | /* Define U8, U16 and U32 in the Linux kernel */ | |
|
48 | typedef u8 U8; | |
|
49 | typedef u16 U16; | |
|
50 | typedef u32 U32; | |
|
51 | ||
|
52 | #else | |
|
53 | ||
|
54 | #include <limits.h> | |
|
55 | ||
|
56 | /* Define U8 */ | |
|
57 | #if (UCHAR_MAX == 0xff) | |
|
58 | typedef unsigned char U8; | |
|
59 | #elif (UINT_MAX == 0xff) | |
|
60 | typedef unsigned int U8; | |
|
61 | #else | |
|
62 | #error "No valid definition of U8 available" | |
|
63 | #endif | |
|
64 | ||
|
65 | /* Define U16 */ | |
|
66 | #if (USHRT_MAX == 0xffff) | |
|
67 | typedef unsigned short U16; | |
|
68 | #elif (UINT_MAX == 0xffff) | |
|
69 | typedef unsigned int U16; | |
|
70 | #elif (UCHAR_MAX == 0xffff) | |
|
71 | typedef unsigned char U16; | |
|
72 | #else | |
|
73 | #error "No valid definition of U16 available" | |
|
74 | #endif | |
|
75 | ||
|
76 | /* Define U32 */ | |
|
77 | #if (UINT_MAX == 0xffffffff) | |
|
78 | typedef unsigned int U32; | |
|
79 | #elif (ULONG_MAX == 0xffffffff) | |
|
80 | typedef unsigned long U32; | |
|
81 | #elif (USHRT_MAX == 0xffffffff) | |
|
82 | typedef unsigned short U32; | |
|
83 | #elif (UCHAR_MAX == 0xffffffff) | |
|
84 | typedef unsigned char U32; | |
|
85 | #else | |
|
86 | #error "No valid definition of U32 available" | |
|
87 | #endif | |
|
88 | ||
|
89 | #endif /* Linux kernel test */ | |
|
90 | ||
|
91 | ||
|
92 | #endif /* NO_STAR_TYPES */ | |
|
93 | ||
|
94 | ||
|
95 | #endif /* STAR_DUNDEE_TYPES */ | |
|
96 | ||
|
97 |
|
1 | NO CONTENT: new file 100755, binary diff hidden |
|
1 | NO CONTENT: new file 100755, binary diff hidden |
@@ -1,6 +1,6 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: PAULs_LPPMON_PLUGINS |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.4) on: |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.4) on: Thu Apr 11 13:20:26 2013 | |
|
4 | 4 | # Project: PAULs_LPPMON_PLUGINS.pro |
|
5 | 5 | # Template: subdirs |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro |
@@ -1,6 +1,6 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by Qt Creator 2.4.1, 2013-04- |
|
|
3 | <!-- Written by Qt Creator 2.4.1, 2013-04-11T13:22:01. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -1,6 +1,6 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: librmapplugin.so.1.0.0 |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.4) on: |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.4) on: Thu Apr 11 13:20:26 2013 | |
|
4 | 4 | # Project: rmapplugin.pro |
|
5 | 5 | # Template: lib |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro |
@@ -13,10 +13,10 CXX = g++ | |||
|
13 | 13 | DEFINES = -DPLUGIN=rmapplugin -DPLUGINHEADER="\"rmapplugin.h\"" -Ddriver_Name="\"RMAPPlugin\"" -Ddriver_Author="\"Paul Leroy paul.leroy@lpp.polytechnique.fr\"" -Ddriver_Version="\"1.1.2\"" -Ddriver_Description="\"AHB bus controler, works with Gaisler's AHB plugn' play bus.\"" -Ddriver_can_be_root=1 -Ddriver_can_be_child=0 -Ddriver_VID=0 -Ddriver_PID=0 -DLPPMON_VERSION="\"0.0.1\"" -DUNIXTRANSLATIONPATH -DLPPMON_PLUGINS_INSTALL_PATH="QDir::homePath()+\"/.lppmon/plugins\"" -DLPPMON_CONFIG_PATH="QDir::homePath()+\"/.lppmon/config\"" -DLPPMON_TRANSLATION_PATH="\"/etc/lppmon/translations\"" -DLPPMONPLUGIN_LIBRARY -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED |
|
14 | 14 | CFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES) |
|
15 | 15 | CXXFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -W -D_REENTRANT -fPIC $(DEFINES) |
|
16 |
INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include -I. -I../common_PLE -I../spw_usb_driver_v2.6 |
|
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include -I. -I../common_PLE -I../spw_usb_driver_v2.63/inc -I/usr/include/lppmon/common -I/usr/include/lppmon -I/usr/include/lppmon/pluginsInterface -I/usr/include/PythonQt -Imoc | |
|
17 | 17 | LINK = g++ |
|
18 | 18 | LFLAGS = -Wl,-O1 -Wl,-z,relro -shared -Wl,-soname,librmapplugin.so.1 |
|
19 |
LIBS = $(SUBLIBS) -L/usr/lib64 ../spw_usb_driver_v2.6 |
|
|
19 | LIBS = $(SUBLIBS) -L/usr/lib64 ../spw_usb_driver_v2.63/lib/x86_64/libSpaceWireUSBAPI.so ../spw_usb_driver_v2.63/lib/x86_64/libConfigLibraryUSB.so -ldl -lutil -lm -lpython2.7 -lPythonQt_QtAll -lPythonQt -lQtXml -lQtGui -lQtNetwork -lQtCore -lpthread | |
|
20 | 20 | AR = ar cqs |
|
21 | 21 | RANLIB = |
|
22 | 22 | QMAKE = /usr/bin/qmake-qt4 |
@@ -20,14 +20,14 DEFINES += driver_PID=0 | |||
|
20 | 20 | |
|
21 | 21 | QT += network |
|
22 | 22 | |
|
23 |
LIBS += ../spw_usb_driver_v2.6 |
|
|
24 |
../spw_usb_driver_v2.6 |
|
|
23 | LIBS += ../spw_usb_driver_v2.63/lib/x86_64/libSpaceWireUSBAPI.so \ | |
|
24 | ../spw_usb_driver_v2.63/lib/x86_64/libConfigLibraryUSB.so | |
|
25 | 25 | |
|
26 | 26 | |
|
27 | 27 | INCLUDEPATH += \ |
|
28 | 28 | $${PWD} \ |
|
29 | 29 | ../common_PLE \ |
|
30 |
../spw_usb_driver_v2.6 |
|
|
30 | ../spw_usb_driver_v2.63/inc | |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | HEADERS += \ |
General Comments 0
You need to be logged in to leave comments.
Login now