ffd.h
1 /***************************************************************************
2  *
3  * Copyright (C) 2002 by Willem van Straten
4  * Licensed under the Academic Free License version 2.1
5  *
6  ***************************************************************************/
7 /*
8  * Default board ID's and serial port interfaces.
9  */
10 
11 #include <unistd.h>
12 
13 #if cbr
14 #define FFD_BOARD_ID 'a'
15 #define FFD_PORT "/dev/ttya"
16 #elif cbrl
17 #define FFD_BOARD_ID 'a'
18 #define FFD_PORT "/dev/ttya"
19 #elif cpsr
20 #define FFD_BOARD_ID 'a'
21 #define FFD_PORT "/dev/ttya"
22 #elif tmfe
23 #define FFD_BOARD_ID 'a'
24 #define FFD_PORT "/dev/ttya"
25 #else
26 #endif
27 
28 /*
29  * Physical board map from top to bottom:
30  *
31  * VME Poln Quad Conn Schematic User(SSB) User(DSB)
32  * --- ---- ---- ---- --------- --------- ---------
33  * I J12 ch D ch 0 ch 0
34  * LCP
35  * Q J11 ch C ch 1
36  * P1
37  * I J10 ch B ch 2 ch 2
38  * RCP
39  * Q J9 ch A ch 3
40  *
41  *
42  * I J8 ch H ch 4 ch 4
43  * LCP
44  * Q J7 ch G ch 5
45  * P2
46  * I J6 ch F ch 6 ch 6
47  * RCP
48  * Q J5 ch E ch 7
49  *
50  */
51 
52 
53 /*
54  * Maximum number of channels that can be in the data stream, i.e.,
55  * 4 channel 2 bit mode.
56  */
57 #define MAXCHAN 4 /* Maximum number of channels per */
58  /* bitpacker (i.e. host connection) */
59 #define BOARDCHAN 8 /* Number of channels on a full board */
60 #define DATA_MIN 2 /* minimum sample size (bits) */
61 #define DATA_MAX 8 /* maximum sample size (bits) */
62 #define MAXWORD 16 /* maximum data word size (bits), */
63  /* word size = nchan x nbits, e.g., */
64  /* 4chan x 4bits or 2chan x 8bits */
65 
66 
67 
68 /*
69  * Valid board address range.
70  */
71 #define FFD_BOARD_MIN 'a'
72 #define FFD_BOARD_MAX 'd'
73 
74 
75 
76 #ifndef SET_NONBLOCK
77 #define SET_NONBLOCK(f) fcntl(f, F_SETFL, fcntl(f, F_GETFL, 0)|O_NONBLOCK)
78 #define CLR_NONBLOCK(f) fcntl(f, F_SETFL, fcntl(f, F_GETFL, 0)&~O_NONBLOCK)
79 #endif
80 
81 
82 
83 #ifndef TRUE
84 #define TRUE 1
85 #endif
86 
87 #ifndef FALSE
88 #define FALSE 0
89 #endif
90 
91 #ifndef STRLEN
92 #define STRLEN 80
93 #endif
94 
95 
96 
97 typedef struct {
98  float re;
99  float im;
100 } COMPLEX;
101 
102 
103 #ifdef __cplusplus
104 extern "C" {
105 #endif
106 
107 int str2byte( char *arg );
108 long str2long( char *arg );
109 void voltage_unpack( u_char *raw, void *data, int channel, int nchan, int bits,
110  int npts, int SSB, int VOLTS, int FLOAT );
111 
112 int serial_read( u_char *value );
113 int serial_write( u_char *data, int npts );
114 int ffd_dac_update( u_char dac_chn, u_char nwr );
115 int ffd_header( int channel, char *header, int DEBUG );
116 int ffd_gain( int channel, double *db, int DEBUG );
117 int ffd_gain_dac_volts( int channel, double vneg, double vpos, int DEBUG );
118 int ffd_level( int chn, double *level_neg, double *level_pos, int DEBUG );
119 int ffd_mode( int bits, char *list, int DEBUG );
120 int ffd_register_read( char reg, u_char *value );
121 int ffd_register_write( char reg, u_char value );
122 void ffd_reset( char *device );
123 void ffd_serial_setup( char *device );
124 void ffd_serial_close();
125 void ffd_board( char board_id );
126 int ffd_start( int DEBUG );
127 int ffd_stop( int DEBUG );
128 int ffd_state();
129 int ffd_test();
130 void ffd_verbose( int VERBOSE );
131 void ffd_missing( int DEBUG );
132 void ffd_prompt();
133 int ffd_tmfe_multiplex();
134 int ffd_tmfe_level_set( int channel_lower, int channel_upper );
135 
136 #ifdef __cplusplus
137 }
138 #endif

Generated using doxygen 1.8.17