MIDAS
Loading...
Searching...
No Matches
scfe.c File Reference
#include <stdio.h>
#include "midas.h"
#include "class/multi.h"
#include "rpi_temp.h"
#include "rpi_led.h"
Include dependency graph for scfe.c:

Go to the source code of this file.

Functions

INT poll_event (INT source[], INT count, BOOL test)
 
INT interrupt_configure (INT cmd, INT source[], POINTER_T adr)
 
INT frontend_init ()
 Frontend initialization.
 
INT frontend_exit ()
 Frontend exit.
 
INT frontend_loop ()
 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.
 

Variables

const charfrontend_name = "SC Frontend"
 The frontend name (client name) as seen by other MIDAS clients.
 
const charfrontend_file_name = __FILE__
 The frontend file name, don't change it.
 
BOOL frontend_call_loop = FALSE
 frontend_loop is called periodically if this variable is TRUE
 
INT display_period = 1000
 a frontend status page is displayed with this frequency in ms
 
INT max_event_size = 10000
 maximum event size produced by this frontend
 
INT max_event_size_frag = 5 * 1024 * 1024
 maximum event size for fragmented events (EQ_FRAGMENTED)
 
INT event_buffer_size = 10 * 10000
 buffer size to hold events
 
DEVICE_DRIVER multi_driver []
 
EQUIPMENT equipment []
 Main structure for midas equipment.
 

Function Documentation

◆ begin_of_run()

INT begin_of_run ( INT  run_number,
char error 
)

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 138 of file scfe.c.

139{
140 return CM_SUCCESS;
141}
#define CM_SUCCESS
Definition midas.h:582

◆ end_of_run()

INT end_of_run ( INT  run_number,
char error 
)

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 145 of file scfe.c.

146{
147 return CM_SUCCESS;
148}

◆ 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 124 of file scfe.c.

125{
126 return CM_SUCCESS;
127}

◆ frontend_init()

INT frontend_init ( void  )

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 117 of file scfe.c.

118{
119 return CM_SUCCESS;
120}

◆ 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 131 of file scfe.c.

132{
133 return CM_SUCCESS;
134}

◆ interrupt_configure()

INT interrupt_configure ( INT  cmd,
INT  source[],
POINTER_T  adr 
)

Definition at line 110 of file scfe.c.

111{
112 return 1;
113};

◆ pause_run()

INT pause_run ( INT  run_number,
char error 
)

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 152 of file scfe.c.

153{
154 return CM_SUCCESS;
155}

◆ poll_event()

INT poll_event ( INT  source[],
INT  count,
BOOL  test 
)

Definition at line 106 of file scfe.c.

107{
108 return 1;
109};

◆ resume_run()

INT resume_run ( INT  run_number,
char error 
)

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 159 of file scfe.c.

160{
161 return CM_SUCCESS;
162}

Variable Documentation

◆ display_period

INT display_period = 1000

a frontend status page is displayed with this frequency in ms

Definition at line 60 of file scfe.c.

◆ equipment

EQUIPMENT equipment[]
Initial value:
= {
{"RaspberryPi",
{4, 0,
"SYSTEM",
0,
"MIDAS",
TRUE,
60000,
0,
0,
1,
"", "", ""} ,
NULL,
},
{""}
}
#define RO_TRANSITIONS
Definition midas.h:434
#define RO_RUNNING
Definition midas.h:426
#define EQ_SLOW
Definition midas.h:418
#define TRUE
Definition midas.h:182
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
DEVICE_DRIVER multi_driver[]
Definition scfe.c:74

Main structure for midas equipment.

Definition at line 80 of file scfe.c.

80 {
81 {"RaspberryPi", /* equipment name */
82 {4, 0, /* event ID, trigger mask */
83 "SYSTEM", /* event buffer */
84 EQ_SLOW, /* equipment type */
85 0, /* event source */
86 "MIDAS", /* format */
87 TRUE, /* enabled */
88 RO_RUNNING | RO_TRANSITIONS, /* read when running and on transitions */
89 60000, /* read every 60 sec */
90 0, /* stop run after this event limit */
91 0, /* number of sub events */
92 1, /* log history every event */
93 "", "", ""} ,
94 cd_multi_read, /* readout routine */
95 cd_multi, /* class driver main routine */
96 multi_driver, /* device driver list */
97 NULL, /* init string */
98 },
99
100 {""}
101};

◆ event_buffer_size

INT event_buffer_size = 10 * 10000

buffer size to hold events

Definition at line 69 of file scfe.c.

◆ frontend_call_loop

BOOL frontend_call_loop = FALSE

frontend_loop is called periodically if this variable is TRUE

Definition at line 57 of file scfe.c.

◆ frontend_file_name

const char* frontend_file_name = __FILE__

The frontend file name, don't change it.

Definition at line 54 of file scfe.c.

◆ frontend_name

const char* frontend_name = "SC Frontend"

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

Definition at line 52 of file scfe.c.

◆ max_event_size

INT max_event_size = 10000

maximum event size produced by this frontend

Definition at line 63 of file scfe.c.

◆ max_event_size_frag

INT max_event_size_frag = 5 * 1024 * 1024

maximum event size for fragmented events (EQ_FRAGMENTED)

Definition at line 66 of file scfe.c.

◆ multi_driver

DEVICE_DRIVER multi_driver[]
Initial value:
= {
{"Temperature", rpi_temp, 1, NULL, DF_INPUT },
{"LED", rpi_led, 64, NULL, DF_OUTPUT },
{""}
}
#define DF_OUTPUT
Definition midas.h:1051
#define DF_INPUT
Definition midas.h:1050
INT rpi_led(INT cmd,...)
Definition rpi_led.c:143
INT rpi_temp(INT cmd,...)
Definition rpi_temp.c:134

Definition at line 74 of file scfe.c.

74 {
75 {"Temperature", rpi_temp, 1, NULL, DF_INPUT }, // one input channel
76 {"LED", rpi_led, 64, NULL, DF_OUTPUT }, // 64 output channels
77 {""}
78};