MIDAS
Loading...
Searching...
No Matches
mfe.h File Reference
#include "midas.h"
Include dependency graph for mfe.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

INT frontend_init (void)
 Frontend initialization.
 
INT frontend_exit (void)
 Frontend exit.
 
INT frontend_loop (void)
 Frontend loop.
 
INT begin_of_run (INT run_number, char *error)
 Begin of Run.
 
INT end_of_run (INT run_number, char *error)
 End of Run.
 
INT pause_run (INT run_number, char *error)
 Pause Run.
 
INT resume_run (INT run_number, char *error)
 Resume Run.
 
INT poll_event (INT source, INT count, BOOL test)
 Polling routine for events.
 
INT interrupt_configure (INT cmd, INT source, POINTER_T adr)
 Interrupt configuration (not implemented)
 
void set_max_event_size (int size)
 
void install_frontend_loop (INT(*f)())
 
void install_frontend_exit (INT(*f)())
 
void install_begin_of_run (INT(*f)())
 
void install_end_of_run (INT(*f)())
 
void install_pause_run (INT(*f)())
 
void install_resume_run (INT(*f)())
 
void install_poll_event (INT(*f)(INT, INT, BOOL))
 
void mfe_error_check (void)
 
void readout_enable (bool flag)
 
bool readout_enabled (void)
 
void display (BOOL bInit)
 
void rotate_wheel (void)
 
BOOL logger_root (void)
 
void set_rate_period (int ms)
 
int get_rate_period (void)
 
INT manual_trigger (INT idx, void *prpc_param[])
 
INT get_frontend_index (void)
 
void mfe_get_args (int *argc, char ***argv)
 
void register_cnaf_callback (int debug)
 
void mfe_error (const char *error)
 
void mfe_set_error (void(*dispatcher)(const char *))
 
int set_equipment_status (const char *name, const char *eq_status, const char *status_class)
 
INT create_event_rb (int i)
 
INT get_event_rbh (int i)
 
void stop_readout_threads (void)
 
bool is_readout_thread_enabled (void)
 
int is_readout_thread_active (void)
 
void signal_readout_thread_active (int index, int flag)
 
INT set_odb_equipment_common (EQUIPMENT eq[], const char *name)
 

Variables

const charfrontend_name
 The frontend name (client name) as seen by other MIDAS clients.
 
const charfrontend_file_name
 The frontend file name, don't change it.
 
BOOL frontend_call_loop
 frontend_loop is called periodically if this variable is TRUE
 
INT max_event_size
 maximum event size produced by this frontend
 
INT max_event_size_frag
 maximum event size for fragmented events (EQ_FRAGMENTED)
 
INT event_buffer_size
 buffer size to hold events
 
INT display_period
 a frontend status page is displayed with this frequency in ms
 
BOOL equipment_common_overwrite
 
EQUIPMENT equipment []
 Main structure for midas equipment.
 
INT rpc_mode
 
INT run_state
 
INT run_number
 
DWORD actual_time
 
DWORD actual_millitime
 
DWORD rate_period
 
int gWriteCacheSize
 
char host_name [HOST_NAME_LENGTH]
 
char exp_name [NAME_LENGTH]
 
char full_frontend_name [256]
 
INT max_bytes_per_sec
 
INT optimize
 
INT fe_stop
 
BOOL debug
 
DWORD auto_restart
 
INT manual_trigger_event_id
 
INT verbosity_level
 
BOOL lockout_readout_thread
 
HNDLE hDB
 
HNDLE hClient
 
volatile int stop_all_threads
 
EQUIPMENTinterrupt_eq
 
EQUIPMENTmultithread_eq
 
BOOL slowcont_eq
 
voidevent_buffer
 
voidfrag_buffer
 
intn_events
 

Function Documentation

◆ begin_of_run()

INT begin_of_run ( INT  run_number,
char error 
)
extern

Begin of Run.

Called every run start transition. Set equipment status in ODB, start acquisition on the modules.

Parameters
[in]run_numberNumber of the run being started
[out]errorCan be used to write a message string to midas.log

Definition at line 361 of file feudp.cxx.

362{
364 gSkipUnknownPackets = false;
365 return SUCCESS;
366}
static int gUnknownPacketCount
Definition feudp.cxx:87
static bool gSkipUnknownPackets
Definition feudp.cxx:88
#define SUCCESS
Definition mcstd.h:54

◆ create_event_rb()

INT create_event_rb ( int  i)

Definition at line 1150 of file mfe.cxx.

1150 {
1151 int status;
1152
1153 assert(i < MAX_N_THREADS);
1154 assert(rbh[i] == 0);
1156 assert(status == DB_SUCCESS);
1157 return rbh[i];
1158}
#define DB_SUCCESS
Definition midas.h:631
int rb_create(int size, int max_event_size, int *handle)
Definition midas.cxx:17336
INT i
Definition mdump.cxx:32
static int rbh[MAX_N_THREADS]
Definition mfe.cxx:71
#define MAX_N_THREADS
Definition mfe.cxx:33
INT max_event_size
Definition mfed.cxx:30
INT event_buffer_size
Definition mfed.cxx:36
DWORD status
Definition odbhist.cxx:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ display()

void display ( BOOL  bInit)
extern

Definition at line 1386 of file mfe.cxx.

1386 {
1387 INT i, status;
1389 char str[30];
1390
1391 if (bInit) {
1393
1394 if (host_name[0])
1395 strcpy(str, host_name);
1396 else
1397 strcpy(str, "<local>");
1398
1399 ss_printf(0, 0, "%s connected to %s. Press \"!\" to exit", full_frontend_name, str);
1400 ss_printf(0, 1,
1401 "================================================================================");
1402 ss_printf(0, 2, "Run status: %s",
1403 run_state == STATE_STOPPED ? "Stopped" : run_state == STATE_RUNNING ? "Running"
1404 : "Paused");
1405 ss_printf(25, 2, "Run number %d ", run_number);
1406 ss_printf(0, 3,
1407 "================================================================================");
1408 ss_printf(0, 4,
1409 "Equipment Status Events Events/sec Rate[B/s] ODB->FE FE->ODB");
1410 ss_printf(0, 5,
1411 "--------------------------------------------------------------------------------");
1412 for (i = 0; equipment[i].name[0]; i++)
1413 ss_printf(0, i + 6, "%s", equipment[i].name);
1414 }
1415
1416 /* display time */
1417 time(&full_time);
1418 char ctimebuf[32];
1420 mstrlcpy(str, ctimebuf + 11, sizeof(str));
1421 str[8] = 0;
1422 ss_printf(72, 0, "%s", str);
1423
1424 for (i = 0; equipment[i].name[0]; i++) {
1425 status = equipment[i].status;
1426
1427 if ((status == 0 || status == FE_SUCCESS) && equipment[i].info.enabled)
1428 ss_printf(14, i + 6, "OK ");
1429 else if (!equipment[i].info.enabled)
1430 ss_printf(14, i + 6, "Disabled ");
1431 else if (status == FE_ERR_ODB)
1432 ss_printf(14, i + 6, "ODB Error");
1433 else if (status == FE_ERR_HW)
1434 ss_printf(14, i + 6, "HW Error ");
1435 else if (status == FE_ERR_DISABLED)
1436 ss_printf(14, i + 6, "Disabled ");
1437 else if (status == FE_ERR_DRIVER)
1438 ss_printf(14, i + 6, "Driver err");
1439 else
1440 ss_printf(14, i + 6, "Unknown ");
1441
1442 if (equipment[i].stats.events_sent > 1E9)
1443 ss_printf(25, i + 6, "%1.3lfG ", equipment[i].stats.events_sent / 1E9);
1444 else if (equipment[i].stats.events_sent > 1E6)
1445 ss_printf(25, i + 6, "%1.3lfM ", equipment[i].stats.events_sent / 1E6);
1446 else
1447 ss_printf(25, i + 6, "%1.0lf ", equipment[i].stats.events_sent);
1448
1449 if (equipment[i].stats.events_per_sec > 1E6)
1450 ss_printf(36, i + 6, "%1.3lfM ", equipment[i].stats.events_per_sec / 1E6);
1451 else if (equipment[i].stats.events_per_sec > 1E3)
1452 ss_printf(36, i + 6, "%1.3lfk ", equipment[i].stats.events_per_sec / 1E3);
1453 else
1454 ss_printf(36, i + 6, "%1.1lf ", equipment[i].stats.events_per_sec);
1455
1456 if (equipment[i].stats.kbytes_per_sec > 1E3)
1457 ss_printf(47, i + 6, "%1.3lfM ", equipment[i].stats.kbytes_per_sec / 1E3);
1458 else if (equipment[i].stats.kbytes_per_sec < 1E3)
1459 ss_printf(47, i + 6, "%1.1lf ", equipment[i].stats.kbytes_per_sec * 1E3);
1460 else
1461 ss_printf(47, i + 6, "%1.3lfk ", equipment[i].stats.kbytes_per_sec);
1462
1463 ss_printf(58, i + 6, "%ld ", equipment[i].odb_in);
1464 ss_printf(69, i + 6, "%ld ", equipment[i].odb_out);
1465 }
1466
1467 /* go to next line */
1468 ss_printf(0, i + 6, "");
1469}
#define FE_SUCCESS
Definition midas.h:717
#define FE_ERR_ODB
Definition midas.h:718
#define FE_ERR_HW
Definition midas.h:719
#define FE_ERR_DRIVER
Definition midas.h:721
#define FE_ERR_DISABLED
Definition midas.h:720
#define STATE_STOPPED
Definition midas.h:305
#define STATE_RUNNING
Definition midas.h:307
void ss_clear_screen()
Definition system.cxx:7299
void ss_printf(INT x, INT y, const char *format,...)
Definition system.cxx:7382
void ** info
Definition fesimdaq.cxx:41
INT run_number
Definition mfe.cxx:36
INT run_state
Definition mfe.cxx:35
char full_frontend_name[256]
Definition mfe.cxx:45
char host_name[HOST_NAME_LENGTH]
Definition mfe.cxx:43
int INT
Definition midas.h:129
#define name(x)
Definition midas_macro.h:24
#define equipment(name, id, type, source, readon, period, readout, cd, driver)
Definition midas_macro.h:60
char str[256]
Definition odbhist.cxx:33
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ end_of_run()

INT end_of_run ( INT  run_number,
char error 
)
extern

End of Run.

Called every stop run transition. Set equipment status in ODB, stop acquisition on the modules.

Parameters
[in]run_numberNumber of the run being ended
[out]errorCan be used to write a message string to midas.log

Definition at line 368 of file feudp.cxx.

369{
370 return SUCCESS;
371}

◆ frontend_exit()

INT frontend_exit ( void  )
extern

Frontend exit.

Runs at frontend shutdown. Disconnect hardware and set equipment status in ODB

Returns
Midas status code

Definition at line 80 of file mfed.cxx.

81{
83 return p_frontend_exit();
84 return CM_SUCCESS;
85}
#define CM_SUCCESS
Definition midas.h:582
INT(* p_frontend_exit)()
Definition mfed.cxx:73
Here is the call graph for this function:
Here is the caller graph for this function:

◆ frontend_init()

INT frontend_init ( void  )
extern

Frontend initialization.

Runs once at application startup. We initialize the hardware and optical interfaces and set the equipment status in ODB. We also lock the frontend to once physical cpu core.

Returns
Midas status code

Definition at line 143 of file midas_macro.h.

144{
145 HNDLE hkey;
146#ifdef EXP_PARAM_DEFINED
148#endif
149#ifdef TRIGGER_SETTINGS_DEFINED
151#endif
152#ifdef SCALER_SETTINGS_STR
154#endif
155
157
158#ifdef EXP_PARAM_DEFINED
159 db_create_record(hdb, 0, "/Experiment/Run Parameters", strcomb1(exp_param_str).c_str());
160 db_find_key(hdb, 0, "/Experiment/Run Parameters", &hkey);
162 sizeof(exp_param), MODE_READ, NULL, NULL) != DB_SUCCESS) {
163 cm_msg(MERROR, "frontend_init", "Cannot open Run Parameters in ODB");
164 return -1;
165 }
166#endif
167#ifdef TRIGGER_SETTINGS_DEFINED
168 db_create_record(hdb, 0, "/Equipment/Trigger/Settings", strcomb1(trigger_settings_str).c_str());
169 db_find_key(hdb, 0, "/Equipment/Trigger/Settings", &hkey);
173 cm_msg(MERROR, "frontend_init", "Cannot open Trigger Settings in ODB");
174 return -1;
175 }
176#endif
177#ifdef SCALER_SETTINGS_DEFINED
178 db_create_record(hdb, 0, "/Equipment/Scaler/Settings", strcomb1(scaler_settings_str).c_str());
179 db_find_key(hdb, 0, "/Equipment/Scaler/Settings", &hkey);
182 cm_msg(MERROR, "frontend_init", "Cannot open Scaler Settings in ODB");
183 return -1;
184 }
185#endif
186
187 user_init();
188 return SUCCESS;
189}
EXP_PARAM exp_param
Definition analyzer.cxx:51
TRIGGER_SETTINGS trigger_settings
Definition analyzer.cxx:52
#define EXP_PARAM_STR(_name)
Definition experim.h:30
#define TRIGGER_SETTINGS_STR(_name)
Definition experim.h:166
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
Definition midas.cxx:3011
#define MERROR
Definition midas.h:559
#define MODE_READ
Definition midas.h:370
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
INT db_open_record(HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info)
Definition odb.cxx:13291
std::string strcomb1(const char **list)
Definition odb.cxx:598
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4079
INT db_create_record(HNDLE hDB, HNDLE hKey, const char *orig_key_name, const char *init_str)
Definition odb.cxx:12800
INT HNDLE
Definition midas.h:132
HNDLE hdb
Definition midas_macro.h:21
void user_init(void)
Here is the caller graph for this function:

◆ frontend_loop()

INT frontend_loop ( void  )
extern

Frontend loop.

If frontend_call_loop is true, this routine gets called when the frontend is idle or once between every event.

Returns
Midas status code

Definition at line 162 of file mfed.cxx.

163{
164 if (p_frontend_loop)
165 return p_frontend_loop();
166 else
167 ss_sleep(10); // don't eat all CPU
168 return CM_SUCCESS;
169}
INT ss_sleep(INT millisec)
Definition system.cxx:3628
INT(* p_frontend_loop)()
Definition mfed.cxx:153
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_event_rbh()

INT get_event_rbh ( int  i)

Definition at line 1160 of file mfe.cxx.

1160 {
1161 return rbh[i];
1162}
Here is the caller graph for this function:

◆ get_frontend_index()

INT get_frontend_index ( void  )

Definition at line 2391 of file mfe.cxx.

2391 {
2392 return frontend_index;
2393}
static INT frontend_index
Definition mfe.cxx:53

◆ get_rate_period()

int get_rate_period ( void  )
extern

Definition at line 97 of file mfe.cxx.

97 {
98 return rate_period;
99}
DWORD rate_period
Definition mfe.cxx:39
Here is the caller graph for this function:

◆ install_begin_of_run()

void install_begin_of_run ( INT(*)()  f)
extern

Definition at line 91 of file mfed.cxx.

92{
94}
INT(* p_begin_of_run)()
Definition mfed.cxx:89

◆ install_end_of_run()

void install_end_of_run ( INT(*)()  f)
extern

Definition at line 107 of file mfed.cxx.

108{
109 p_end_of_run = f;
110}
INT(* p_end_of_run)()
Definition mfed.cxx:105

◆ install_frontend_exit()

void install_frontend_exit ( INT(*)()  f)
extern

Definition at line 75 of file mfed.cxx.

76{
78}

◆ install_frontend_loop()

void install_frontend_loop ( INT(*)()  f)
extern

Definition at line 155 of file mfed.cxx.

156{
157 p_frontend_loop = f;
158}

◆ install_pause_run()

void install_pause_run ( INT(*)()  f)
extern

Definition at line 123 of file mfed.cxx.

124{
125 p_pause_run = f;
126}
INT(* p_pause_run)()
Definition mfed.cxx:121

◆ install_poll_event()

void install_poll_event ( INT(*)(INT, INT, BOOL f)
extern

Definition at line 54 of file mfed.cxx.

55{
56 p_poll_event = f;
57}
INT(* p_poll_event)(INT, INT, BOOL)
Definition mfed.cxx:52
Here is the caller graph for this function:

◆ install_resume_run()

void install_resume_run ( INT(*)()  f)
extern

Definition at line 139 of file mfed.cxx.

140{
141 p_resume_run = f;
142}
INT(* p_resume_run)()
Definition mfed.cxx:137

◆ interrupt_configure()

INT interrupt_configure ( INT  cmd,
INT  source,
POINTER_T  adr 
)
extern

Interrupt configuration (not implemented)

Routine for interrupt configuration if equipment is set in EQ_INTERRUPT mode. Not implemented right now, returns SUCCESS.

Parameters
[in]cmdCommand for interrupt events (see midas.h)
[in]sourceEquipment index number
[in]adrInterrupt routine (see mfe.c)
Returns
Midas status code

Definition at line 513 of file feccusb.cxx.

514{
515 switch (cmd) {
517 break;
519 break;
521 break;
523 break;
524 }
525 return SUCCESS;
526}
#define CMD_INTERRUPT_ATTACH
Definition midas.h:822
#define CMD_INTERRUPT_DISABLE
Definition midas.h:821
#define CMD_INTERRUPT_ENABLE
Definition midas.h:820
#define CMD_INTERRUPT_DETACH
Definition midas.h:823
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_readout_thread_active()

int is_readout_thread_active ( void  )

Definition at line 1172 of file mfe.cxx.

1172 {
1173 int i;
1174 for (i = 0; i < MAX_N_THREADS; i++)
1176 return TRUE;
1177 return FALSE;
1178}
#define FALSE
Definition cfortran.h:309
static volatile int readout_thread_active[MAX_N_THREADS]
Definition mfe.cxx:74
#define TRUE
Definition midas.h:182
Here is the caller graph for this function:

◆ is_readout_thread_enabled()

bool is_readout_thread_enabled ( void  )

Definition at line 1168 of file mfe.cxx.

1168 {
1169 return !_stop_all_threads;
1170}
std::atomic< bool > _stop_all_threads(false)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logger_root()

BOOL logger_root ( void  )
extern

Definition at line 1518 of file mfe.cxx.

1520{
1521 int size, i, status;
1522 char str[80];
1524
1525 if (db_find_key(hDB, 0, "/Logger/Channels", &hKeyRoot) == DB_SUCCESS) {
1526 for (i = 0;; i++) {
1529 break;
1530
1531 strcpy(str, "MIDAS");
1532 size = sizeof(str);
1533 db_get_value(hDB, hKey, "Settings/Format", str, &size, TID_STRING, TRUE);
1534
1535 if (equal_ustring(str, "ROOT"))
1536 return TRUE;
1537 }
1538 }
1539
1540 return FALSE;
1541}
#define DB_NO_MORE_SUBKEYS
Definition midas.h:646
#define TID_STRING
Definition midas.h:346
BOOL equal_ustring(const char *str1, const char *str2)
Definition odb.cxx:3201
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
Definition odb.cxx:5415
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5586
HNDLE hKey
HNDLE hDB
main ODB handle
Definition mfe.cxx:58
Here is the call graph for this function:
Here is the caller graph for this function:

◆ manual_trigger()

INT manual_trigger ( INT  idx,
void prpc_param[] 
)
extern

Definition at line 267 of file mfe.cxx.

267 {
269 return SUCCESS;
270}
INT manual_trigger_event_id
Definition mfe.cxx:52
#define CWORD(_i)
Definition midas.h:1625
Here is the caller graph for this function:

◆ mfe_error()

void mfe_error ( const char error)

Definition at line 2418 of file mfe.cxx.

2421{
2422 if (mfe_mutex == NULL) {
2424 if (status != SS_SUCCESS && status != SS_CREATED) {
2425 cm_msg(MERROR, "mfe_error", "Cannot create mutex\n");
2426 return;
2427 }
2428 }
2429
2430 /* put error into FIFO */
2432 mstrlcpy(mfe_error_str[mfe_error_w], error, 256);
2435}
#define SS_SUCCESS
Definition midas.h:663
#define SS_CREATED
Definition midas.h:664
INT ss_mutex_release(MUTEX_T *mutex)
Definition system.cxx:3157
INT ss_mutex_create(MUTEX_T **mutex, BOOL recursive)
Definition system.cxx:2941
INT ss_mutex_wait_for(MUTEX_T *mutex, INT timeout)
Definition system.cxx:3037
int mfe_error_w
Definition mfe.cxx:2401
MUTEX_T * mfe_mutex
Definition mfe.cxx:2402
char mfe_error_str[MFE_ERROR_SIZE][256]
Definition mfe.cxx:2400
#define MFE_ERROR_SIZE
Definition mfe.cxx:2399
Here is the call graph for this function:

◆ mfe_error_check()

void mfe_error_check ( void  )
extern

Definition at line 2437 of file mfe.cxx.

2437 {
2438 if (mfe_mutex != NULL) {
2440 if (mfe_error_w != mfe_error_r) {
2444 }
2446 }
2447}
void(* mfe_error_dispatcher)(const char *)
Definition mfe.cxx:2397
int mfe_error_r
Definition mfe.cxx:2401
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mfe_get_args()

void mfe_get_args ( int argc,
char ***  argv 
)

Definition at line 2454 of file mfe.cxx.

2454 {
2455 *argc = _argc;
2456 *argv = _argv;
2457}
static int _argc
Definition mfe.cxx:2451
static char ** _argv
Definition mfe.cxx:2452
Here is the call graph for this function:

◆ mfe_set_error()

void mfe_set_error ( void(*)(const char *)  dispatcher)

Definition at line 2404 of file mfe.cxx.

2404 {
2405 int status;
2406
2407 mfe_error_dispatcher = dispatcher;
2409 memset(mfe_error_str, 0, sizeof(mfe_error_str));
2410
2411 if (mfe_mutex == NULL) {
2413 if (status != SS_SUCCESS && status != SS_CREATED)
2414 cm_msg(MERROR, "mfe_set_error", "Cannot create mutex\n");
2415 }
2416}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pause_run()

INT pause_run ( INT  run_number,
char error 
)
extern

Pause Run.

Called every pause run transition.

Parameters
[in]run_numberNumber of the run being ended
[out]errorCan be used to write a message string to midas.log
Returns
Midas status code

Definition at line 373 of file feudp.cxx.

374{
375 return SUCCESS;
376}

◆ poll_event()

INT poll_event ( INT  source,
INT  count,
BOOL  test 
)
extern

Polling routine for events.

Parameters
[in]sourceEvent source (LAM/IRQ)
[in]countLoop count for event polling timeout
[in]testflag used to time the polling
Returns
1 if event is available, 0 if done polling (no event). If test equals TRUE, don't return.

Definition at line 388 of file feudp.cxx.

389{
390 //printf("poll_event: source %d, count %d, test %d\n", source, count, test);
391
392 if (test) {
393 for (int i=0; i<count; i++)
394 ss_sleep(10);
395 return 1;
396 }
397
398 return 1;
399}
double count
Definition mdump.cxx:33
program test
Definition miniana.f:6
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readout_enable()

void readout_enable ( bool  flag)
extern

Definition at line 1100 of file mfe.cxx.

1100 {
1102
1103 if (interrupt_eq) {
1104 if (flag)
1106 else
1108 }
1109}
static std::atomic< bool > _readout_enabled_flag(false)
EQUIPMENT * interrupt_eq
Definition mfe.cxx:61
INT interrupt_configure(__attribute__((unused)) INT cmd, __attribute__((unused)) INT source, __attribute__((unused)) PTYPE adr)
Definition mfed.cxx:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readout_enabled()

bool readout_enabled ( void  )
extern

Definition at line 1096 of file mfe.cxx.

1096 {
1097 return _readout_enabled_flag;
1098}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_cnaf_callback()

void register_cnaf_callback ( int  debug)

Definition at line 122 of file cnaf_callback.cxx.

122 {
124 /* register CNAF callback */
127}
INT cnaf_callback(INT index, void *prpc_param[])
static int cnaf_debug
INT cm_register_function(INT id, INT(*func)(INT, void **))
Definition midas.cxx:5790
#define RPC_CNAF16
Definition mrpc.h:125
#define RPC_CNAF24
Definition mrpc.h:126
BOOL debug
debug printouts
Definition mana.cxx:254

◆ resume_run()

INT resume_run ( INT  run_number,
char error 
)
extern

Resume Run.

Called every resume run transition.

Parameters
[in]run_numberNumber of the run being ended
[out]errorCan be used to write a message string to midas.log
Returns
Midas status code

Definition at line 378 of file feudp.cxx.

379{
380 return SUCCESS;
381}

◆ rotate_wheel()

void rotate_wheel ( void  )
extern

Definition at line 1503 of file mfe.cxx.

1503 {
1504 static DWORD last_wheel = 0, wheel_index = 0;
1505 static char wheel_char[] = {'-', '\\', '|', '/'};
1506
1507 if (display_period && !mfe_debug) {
1508 if (ss_millitime() - last_wheel > 300) {
1510 ss_printf(79, 2, "%c", wheel_char[wheel_index]);
1511 wheel_index = (wheel_index + 1) % 4;
1512 }
1513 }
1514}
unsigned int DWORD
Definition mcstd.h:51
DWORD ss_millitime()
Definition system.cxx:3393
BOOL mfe_debug
Definition mfe.cxx:56
INT display_period
Definition mfed.cxx:27
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_equipment_status()

int set_equipment_status ( const char name,
const char eq_status,
const char status_class 
)

Definition at line 884 of file mfe.cxx.

884 {
885 int status, idx;
886 char str[256];
887 HNDLE hKey;
888
889 for (idx = 0; equipment[idx].name[0]; idx++)
891 break;
892
894 sprintf(str, "/Equipment/%s/Common", name);
895 db_find_key(hDB, 0, str, &hKey);
896 assert(hKey);
897
898 mstrlcpy(str, equipment_status, sizeof(str));
899 status = db_set_value(hDB, hKey, "Status", str, 256, 1, TID_STRING);
900 assert(status == DB_SUCCESS);
901 mstrlcpy(str, status_class, sizeof(str));
902 status = db_set_value(hDB, hKey, "Status color", str, 32, 1, TID_STRING);
903 assert(status == DB_SUCCESS);
904 }
905
906 return SUCCESS;
907}
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
Definition odb.cxx:5261
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_max_event_size()

void set_max_event_size ( int  size)
extern

Definition at line 40 of file mfed.cxx.

41{
42 max_event_size = size;
43}

◆ set_odb_equipment_common()

INT set_odb_equipment_common ( EQUIPMENT  eq[],
const char name 
)

◆ set_rate_period()

void set_rate_period ( int  ms)
extern

Definition at line 93 of file mfe.cxx.

93 {
95}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ signal_readout_thread_active()

void signal_readout_thread_active ( int  index,
int  flag 
)

Definition at line 1180 of file mfe.cxx.

1180 {
1182}
INT index
Definition mana.cxx:271
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_readout_threads()

void stop_readout_threads ( void  )

Definition at line 1164 of file mfe.cxx.

1164 {
1165 _stop_all_threads = true;
1166}
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ actual_millitime

DWORD actual_millitime
extern

Definition at line 38 of file mfe.cxx.

◆ actual_time

DWORD actual_time
extern

Definition at line 37 of file mfe.cxx.

◆ auto_restart

DWORD auto_restart
extern

Definition at line 51 of file mfe.cxx.

◆ debug

BOOL debug
extern

Definition at line 254 of file mana.cxx.

◆ display_period

INT display_period
extern

a frontend status page is displayed with this frequency in ms

Definition at line 27 of file mfed.cxx.

◆ equipment

EQUIPMENT equipment[]
extern

Main structure for midas equipment.

Definition at line 52 of file feudp.cxx.

52 {
53 { EQ_NAME, /* equipment name */
54 {EQ_EVID, 0, "SYSTEM", /* event ID, trigger mask, Evbuf */
55 EQ_MULTITHREAD, 0, "MIDAS", /* equipment type, EventSource, format */
56 TRUE, RO_ALWAYS, /* enabled?, WhenRead? */
57 50, 0, 0, 0, /* poll[ms], Evt Lim, SubEvtLim, LogHist */
58 "", "", "",}, read_event, /* readout routine */
59 },
60 {""}
61};
#define EQ_NAME
Definition feudp.cxx:43
int read_event(char *pevent, INT off)
Definition feudp.cxx:403
#define EQ_EVID
Definition feudp.cxx:47
#define EQ_MULTITHREAD
Definition midas.h:417
#define RO_ALWAYS
Definition midas.h:436

◆ equipment_common_overwrite

BOOL equipment_common_overwrite
extern

Definition at line 50 of file feudp.cxx.

◆ event_buffer

void* event_buffer
extern

Definition at line 65 of file mfe.cxx.

◆ event_buffer_size

INT event_buffer_size
extern

buffer size to hold events

Definition at line 36 of file mfed.cxx.

◆ exp_name

char exp_name[NAME_LENGTH]
extern

Definition at line 243 of file mana.cxx.

◆ fe_stop

INT fe_stop
extern

Definition at line 49 of file mfe.cxx.

◆ frag_buffer

void* frag_buffer
extern

Definition at line 66 of file mfe.cxx.

◆ frontend_call_loop

BOOL frontend_call_loop
extern

frontend_loop is called periodically if this variable is TRUE

Definition at line 24 of file mfed.cxx.

◆ frontend_file_name

const char* frontend_file_name
extern

The frontend file name, don't change it.

Definition at line 23 of file feudp.cxx.

◆ frontend_name

const char* frontend_name
extern

The frontend name (client name) as seen by other MIDAS clients.

Definition at line 22 of file feudp.cxx.

◆ full_frontend_name

char full_frontend_name[256]
extern

Definition at line 45 of file mfe.cxx.

◆ gWriteCacheSize

int gWriteCacheSize
extern

Definition at line 41 of file mfe.cxx.

◆ hClient

HNDLE hClient
extern

Definition at line 59 of file mfe.cxx.

◆ hDB

HNDLE hDB
extern

Definition at line 207 of file mana.cxx.

◆ host_name

char host_name[HOST_NAME_LENGTH]
extern

Definition at line 242 of file mana.cxx.

◆ interrupt_eq

EQUIPMENT* interrupt_eq
extern

Definition at line 61 of file mfe.cxx.

◆ lockout_readout_thread

BOOL lockout_readout_thread
extern

Definition at line 55 of file mfe.cxx.

◆ manual_trigger_event_id

INT manual_trigger_event_id
extern

Definition at line 52 of file mfe.cxx.

◆ max_bytes_per_sec

INT max_bytes_per_sec
extern

Definition at line 47 of file mfe.cxx.

◆ max_event_size

INT max_event_size
extern

maximum event size produced by this frontend

Definition at line 30 of file mfed.cxx.

◆ max_event_size_frag

INT max_event_size_frag
extern

maximum event size for fragmented events (EQ_FRAGMENTED)

Definition at line 33 of file mfed.cxx.

◆ multithread_eq

EQUIPMENT* multithread_eq
extern

Definition at line 62 of file mfe.cxx.

◆ n_events

int* n_events
extern

Definition at line 68 of file mfe.cxx.

◆ optimize

INT optimize
extern

Definition at line 48 of file mfe.cxx.

◆ rate_period

DWORD rate_period
extern

Definition at line 39 of file mfe.cxx.

◆ rpc_mode

INT rpc_mode
extern

Definition at line 27 of file mfe.cxx.

◆ run_number

INT run_number
extern

Definition at line 246 of file mana.cxx.

◆ run_state

INT run_state
extern

Definition at line 35 of file mfe.cxx.

◆ slowcont_eq

BOOL slowcont_eq
extern

Definition at line 64 of file mfe.cxx.

◆ stop_all_threads

volatile int stop_all_threads
extern

◆ verbosity_level

INT verbosity_level
extern

Definition at line 54 of file mfe.cxx.