source: fact/tools/FAD/simple_daq/simple_daq.h@ 10077

Last change on this file since 10077 was 9905, checked in by neise, 14 years ago
new commands supported by 'simple_daq': variable phase shift commands: ps, psup, psdn, psreset SRCLK enable/disable: srclkon, srclkoff
File size: 1.9 KB
Line 
1#ifndef SOCKETCLIENT_H_
2#define SOCKETCLIENT_H_
3
4#include <stdlib.h>
5#include <string.h>
6#include <stdio.h>
7#include <unistd.h>
8#include <sys/socket.h>
9#include <arpa/inet.h>
10#include <netdb.h>
11#include <signal.h>
12
13#define MAX_COM_SIZE 32000
14#define IP_ADDR_LENGTH 16
15
16#define FIRST_DAQPORT 5000
17#define SOCKETS_PER_FAD 8
18
19// Commands for FAD
20#define CMD_Start 0xC000 // Start Run
21#define CMD_Stop 0x3000 // Stop Run
22#define CMD_Trigger 0xA000 // single trigger
23#define CMD_DENABLE 0x0600 // DENABLE line HIGH
24#define CMD_DDISABLE 0x0700 // DENABLE line LOW
25#define CMD_DWRITE_RUN 0x0800 // DWRITE possibly HIGH
26#define CMD_DWRITE_STOP 0x0900 // DWRITE always LOW
27
28#define CMD_SCLK_ON 0x1000
29#define CMD_SCLK_OFF 0x1100
30
31#define CMD_PS_DIRINC 0x1200
32#define CMD_PS_DIRDEC 0x1300
33#define CMD_PS_DO 0x1400
34#define CMD_PS_RESET 0x1700
35
36
37#define CMD_SRCLK_ON 0x1500
38#define CMD_SRCLK_OFF 0x1600
39
40#define CMD_Trigger_C 0xB000 // continous trigger
41#define CMD_Trigger_S 0x2000 // stop continous trigger
42#define CMD_Read 0x0A00 // read from Config-RAM
43#define CMD_Write 0x0500 // write to Config-RAM
44
45// Addresses in FAD Config-RAM
46#define MAX_ADDR 0xFF // highest address in Config-RAM
47#define BADDR_ROI 0x00 // Baseaddress ROI-Values
48#define BADDR_DAC 0x24 // Baseaddress DAC-Values
49
50// Max-Values
51#define MAX_VAL 65535
52#define MAX_ROINUM 35
53#define MAX_ROIVAL 1024
54#define MAX_DACNUM 7
55#define MAX_DACVAL 65535
56
57#define CONFIG_FILE_PATH "config.txt"
58
59class SimpleDaqConfiguration {
60public:
61 char FADIPAddress[IP_ADDR_LENGTH];
62 char outfilepath[200];
63 char outfilename[50];
64 char outfileext[10];
65};
66
67void cmd_send (const char* Buffer, int Socket); // Send commands to socket
68void int_handler (int sig); // Handle signal SIGINT (CTRL-C)
69void exit_program (int exit_status); // Cleanup and exit
70SimpleDaqConfiguration *getConfig (const char *path, int verbose = 0);
71
72#endif /*SOCKETCLIENT_H_*/
Note: See TracBrowser for help on using the repository browser.