Last change
on this file since 16971 was 9887, checked in by neise, 14 years ago |
added 'fadfake' a programm acting as a FAD board. still with very limited funcionality, but
nice for testing...
added a function OpenServerSocket() to SocketFunctions.cpp
|
File size:
1.5 KB
|
Line | |
---|
1 | #ifndef FADFAKE_H
|
---|
2 | #define FADFAKE_H
|
---|
3 |
|
---|
4 | #define MAX_COM_SIZE 10000
|
---|
5 |
|
---|
6 | // Commands for FAD
|
---|
7 | #define CMD_Start 0xC000
|
---|
8 | #define CMD_Stop 0x3000
|
---|
9 | #define CMD_Trigger 0xA000 // single trigger
|
---|
10 | #define CMD_Trigger_C 0xB000 // continous trigger
|
---|
11 | #define CMD_Trigger_S 0x2000 // stop continous trigger
|
---|
12 | #define CMD_Read 0x0A00 // read from Config-RAM
|
---|
13 | #define CMD_Write 0x0500 // write ro Config-RAM
|
---|
14 |
|
---|
15 | // Addresses in FAD Config-RAM
|
---|
16 | #define MAX_ADDR 0xFF // highest address in Config-RAM
|
---|
17 | #define BADDR_ROI 0x00 // Baseaddress ROI-Values
|
---|
18 | #define BADDR_DAC 0x24 // Baseaddress DAC-Values
|
---|
19 |
|
---|
20 | #define MAX_VAL 65535
|
---|
21 | #define MAX_ROINUM 35
|
---|
22 | #define MAX_ROIVAL 1024
|
---|
23 | #define MAX_DACNUM 7
|
---|
24 | #define MAX_DACVAL 65535
|
---|
25 |
|
---|
26 |
|
---|
27 | #include "../format_headers/formatfad.h"
|
---|
28 | #include "../format_headers/formatraw.h"
|
---|
29 |
|
---|
30 | int fadfake() ;
|
---|
31 | int sendEvent(int socketd, unsigned long triggerID, int ROI) ;
|
---|
32 |
|
---|
33 | template < typename T >
|
---|
34 | T hton(T value)
|
---|
35 | {
|
---|
36 | T d=0; //dummy variable
|
---|
37 | if ( sizeof(T)==4 )
|
---|
38 | {
|
---|
39 | d = htonl(value);
|
---|
40 | }
|
---|
41 | else if (sizeof(T)==2 )
|
---|
42 | {
|
---|
43 | d = htons(value);
|
---|
44 | }
|
---|
45 | else // if char or any other data type, I hope endianess is no problem :-|
|
---|
46 | {
|
---|
47 | // nothing
|
---|
48 | }
|
---|
49 | return d;
|
---|
50 | }
|
---|
51 |
|
---|
52 | template < typename T >
|
---|
53 | T ntoh(T value)
|
---|
54 | {
|
---|
55 | T d=0; //dummy variable
|
---|
56 | if ( sizeof(T)==4 )
|
---|
57 | {
|
---|
58 | d = ntohl(value);
|
---|
59 | }
|
---|
60 | else if (sizeof(T)==2 )
|
---|
61 | {
|
---|
62 | d = ntohs(value);
|
---|
63 | }
|
---|
64 | else // if char or any other data type, I hope endianess is no problem :-|
|
---|
65 | {
|
---|
66 | // nothing
|
---|
67 | }
|
---|
68 | return d;
|
---|
69 | }
|
---|
70 |
|
---|
71 |
|
---|
72 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.