MIDAS
Loading...
Searching...
No Matches
mfed.cxx File Reference
#include <cstdio>
#include <cstring>
#include <history.h>
#include "midas.h"
#include "mfe.h"
#include "odbxx.h"
Include dependency graph for mfed.cxx:

Go to the source code of this file.

Functions

void set_max_event_size (int size)
 
void set_event_buffer_size (int size)
 
void install_poll_event (INT(*f)(INT, INT, BOOL))
 
INT poll_event (__attribute__((unused)) INT source, __attribute__((unused)) INT count, __attribute__((unused)) BOOL test)
 
INT interrupt_configure (__attribute__((unused)) INT cmd, __attribute__((unused)) INT source, __attribute__((unused)) PTYPE adr)
 
INT set_cache_size (std::string buffer, int size)
 
void install_frontend_exit (INT(*f)())
 
INT frontend_exit ()
 Frontend exit.
 
void install_begin_of_run (INT(*f)())
 
INT begin_of_run (__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
 
void install_end_of_run (INT(*f)())
 
INT end_of_run (__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
 
void install_pause_run (INT(*f)())
 
INT pause_run (__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
 
void install_resume_run (INT(*f)())
 
INT resume_run (__attribute__((unused)) INT rn, __attribute__((unused)) char *error)
 
void install_frontend_loop (INT(*f)())
 
INT frontend_loop ()
 Frontend loop.
 

Variables

BOOL frontend_call_loop = TRUE
 
INT display_period = 0
 
INT max_event_size = 1024 * 1024
 
INT max_event_size_frag = 5 * 1024 * 1024
 
INT event_buffer_size = 2 * 1024 * 1024
 
INT(* p_poll_event )(INT, INT, BOOL) = NULL
 
INT(* p_frontend_exit )() = NULL
 
INT(* p_begin_of_run )() = NULL
 
INT(* p_end_of_run )() = NULL
 
INT(* p_pause_run )() = NULL
 
INT(* p_resume_run )() = NULL
 
INT(* p_frontend_loop )() = NULL
 

Function Documentation

◆ begin_of_run()

INT begin_of_run ( __attribute__((unused)) INT  rn,
__attribute__((unused)) char error 
)

Definition at line 116 of file mfed.cxx.

117{
118 if (p_begin_of_run)
119 return p_begin_of_run();
120 return CM_SUCCESS;
121}
#define CM_SUCCESS
Definition midas.h:582
INT(* p_begin_of_run)()
Definition mfed.cxx:109
Here is the caller graph for this function:

◆ end_of_run()

INT end_of_run ( __attribute__((unused)) INT  rn,
__attribute__((unused)) char error 
)

Definition at line 132 of file mfed.cxx.

133{
134 if (p_end_of_run)
135 return p_end_of_run();
136 return CM_SUCCESS;
137}
INT(* p_end_of_run)()
Definition mfed.cxx:125
Here is the caller graph for this function:

◆ frontend_exit()

INT frontend_exit ( void  )

Frontend exit.

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

Returns
Midas status code

Definition at line 100 of file mfed.cxx.

101{
102 if (p_frontend_exit)
103 return p_frontend_exit();
104 return CM_SUCCESS;
105}
INT(* p_frontend_exit)()
Definition mfed.cxx:93
Here is the caller graph for this function:

◆ frontend_loop()

INT frontend_loop ( void  )

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 182 of file mfed.cxx.

183{
184 if (p_frontend_loop)
185 return p_frontend_loop();
186 else
187 ss_sleep(10); // don't eat all CPU
188 return CM_SUCCESS;
189}
INT ss_sleep(INT millisec)
Definition system.cxx:3628
INT(* p_frontend_loop)()
Definition mfed.cxx:173
Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_begin_of_run()

void install_begin_of_run ( INT(*)()  f)

Definition at line 111 of file mfed.cxx.

112{
113 p_begin_of_run = f;
114}

◆ install_end_of_run()

void install_end_of_run ( INT(*)()  f)

Definition at line 127 of file mfed.cxx.

128{
129 p_end_of_run = f;
130}

◆ install_frontend_exit()

void install_frontend_exit ( INT(*)()  f)

Definition at line 95 of file mfed.cxx.

96{
98}

◆ install_frontend_loop()

void install_frontend_loop ( INT(*)()  f)

Definition at line 175 of file mfed.cxx.

176{
177 p_frontend_loop = f;
178}

◆ install_pause_run()

void install_pause_run ( INT(*)()  f)

Definition at line 143 of file mfed.cxx.

144{
145 p_pause_run = f;
146}
INT(* p_pause_run)()
Definition mfed.cxx:141

◆ install_poll_event()

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

Definition at line 55 of file mfed.cxx.

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

◆ install_resume_run()

void install_resume_run ( INT(*)()  f)

Definition at line 159 of file mfed.cxx.

160{
161 p_resume_run = f;
162}
INT(* p_resume_run)()
Definition mfed.cxx:157

◆ interrupt_configure()

INT interrupt_configure ( __attribute__((unused)) INT  cmd,
__attribute__((unused)) INT  source,
__attribute__((unused)) PTYPE  adr 
)

Definition at line 67 of file mfed.cxx.

68{
69 return 1;
70}
Here is the caller graph for this function:

◆ pause_run()

INT pause_run ( __attribute__((unused)) INT  rn,
__attribute__((unused)) char error 
)

Definition at line 148 of file mfed.cxx.

149{
150 if (p_pause_run)
151 return p_pause_run();
152 return CM_SUCCESS;
153}

◆ poll_event()

INT poll_event ( __attribute__((unused)) INT  source,
__attribute__((unused)) INT  count,
__attribute__((unused)) BOOL  test 
)

Definition at line 60 of file mfed.cxx.

61{
62 if (p_poll_event)
63 return p_poll_event(source, count, test);
64 return 1;
65}
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:

◆ resume_run()

INT resume_run ( __attribute__((unused)) INT  rn,
__attribute__((unused)) char error 
)

Definition at line 164 of file mfed.cxx.

165{
166 if (p_resume_run)
167 return p_resume_run();
168 return CM_SUCCESS;
169}

◆ set_cache_size()

INT set_cache_size ( std::string  buffer,
int  size 
)

Definition at line 74 of file mfed.cxx.

75{
76 if (size < MIN_WRITE_CACHE_SIZE && size != 0) {
77 cm_msg(MERROR, "set_cache_size", "Requested write cache size %d too small, minimum is %d", size, MIN_WRITE_CACHE_SIZE);
78 return 0;
79 }
80
81 gWriteCacheSize = size;
82 for (int i=0 ; i<equipment[i].name[0] ; i++)
83 if (std::string(equipment[i].info.buffer) == buffer) {
84 bm_set_cache_size(equipment[i].buffer_handle, 0, size);
85 return 1;
86 }
87
88 return 0;
89}
INT bm_set_cache_size(INT buffer_handle, size_t read_size, size_t write_size)
Definition midas.cxx:8148
#define MERROR
Definition midas.h:559
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
void ** info
Definition fesimdaq.cxx:41
INT i
Definition mdump.cxx:32
int gWriteCacheSize
Definition mfe.cxx:41
#define MIN_WRITE_CACHE_SIZE
Definition midas.h:257
#define equipment(name, id, type, source, readon, period, readout, cd, driver)
Definition midas_macro.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_event_buffer_size()

void set_event_buffer_size ( int  size)

Definition at line 46 of file mfed.cxx.

47{
48 event_buffer_size = size;
49}
INT event_buffer_size
Definition mfed.cxx:36

◆ set_max_event_size()

void set_max_event_size ( int  size)

Definition at line 40 of file mfed.cxx.

41{
42 max_event_size = size;
43 event_buffer_size = 2 * size;
44}
INT max_event_size
Definition mfed.cxx:30

Variable Documentation

◆ display_period

INT display_period = 0

Definition at line 27 of file mfed.cxx.

◆ event_buffer_size

INT event_buffer_size = 2 * 1024 * 1024

Definition at line 36 of file mfed.cxx.

◆ frontend_call_loop

BOOL frontend_call_loop = TRUE

Definition at line 24 of file mfed.cxx.

◆ max_event_size

INT max_event_size = 1024 * 1024

Definition at line 30 of file mfed.cxx.

◆ max_event_size_frag

INT max_event_size_frag = 5 * 1024 * 1024

Definition at line 33 of file mfed.cxx.

◆ p_begin_of_run

INT(* p_begin_of_run) () ( ) = NULL

Definition at line 109 of file mfed.cxx.

◆ p_end_of_run

INT(* p_end_of_run) () ( ) = NULL

Definition at line 125 of file mfed.cxx.

◆ p_frontend_exit

INT(* p_frontend_exit) () ( ) = NULL

Definition at line 93 of file mfed.cxx.

◆ p_frontend_loop

INT(* p_frontend_loop) () ( ) = NULL

Definition at line 173 of file mfed.cxx.

◆ p_pause_run

INT(* p_pause_run) () ( ) = NULL

Definition at line 141 of file mfed.cxx.

◆ p_poll_event

INT(* p_poll_event) (INT, INT, BOOL) ( INT  ,
INT  ,
BOOL   
) = NULL

Definition at line 53 of file mfed.cxx.

◆ p_resume_run

INT(* p_resume_run) () ( ) = NULL

Definition at line 157 of file mfed.cxx.