#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/time.h>
#include <assert.h>
#include "midas.h"
#include "mvmestd.h"
#include "vme/v792.h"
#include "v895.h"
#include "vme/v1190B.h"
Go to the source code of this file.
|
| INT | frontend_init () |
| | Frontend initialization.
|
| |
| INT | frontend_exit () |
| | Frontend exit.
|
| |
| 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 | frontend_loop () |
| | Frontend loop.
|
| |
| INT | read_event (char *pevent, INT off) |
| |
| int | mvme_read16 (int addr) |
| |
| int | mvme_read32 (int addr) |
| |
| void | encodeU32 (char *pdata, uint32_t value) |
| |
| uint32_t | odbReadUint32 (const char *name, int index, uint32_t defaultValue=0) |
| |
| int | enable_trigger () |
| |
| int | disable_trigger () |
| |
| INT | init_vme_modules () |
| |
| INT | poll_event (INT source, INT count, BOOL test) |
| | Polling routine for events.
|
| |
| INT | interrupt_configure (INT cmd, INT source, PTYPE adr) |
| |
| int | read_v792 (int base, const char *bname, char *pevent, int nchan) |
| |
| int | read_tdc (int base, char *pevent) |
| |
◆ HAVE_V1190B
◆ HAVE_V792
◆ HAVE_V895
◆ begin_of_run()
Begin of Run.
Called every run start transition. Set equipment status in ODB, start acquisition on the modules.
- Parameters
-
| [in] | run_number | Number of the run being started |
| [out] | error | Can be used to write a message string to midas.log |
Definition at line 284 of file fevme.cxx.
285{
288
290
293}
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
◆ disable_trigger()
Definition at line 194 of file fevme.cxx.
195{
196#ifdef HAVE_VMEIO
198#endif
199 return 0;
200}
◆ enable_trigger()
Definition at line 185 of file fevme.cxx.
186{
187#ifdef HAVE_VMEIO
189#endif
190 return 0;
191}
◆ encodeU32()
◆ end_of_run()
End of Run.
Called every stop run transition. Set equipment status in ODB, stop acquisition on the modules.
- Parameters
-
| [in] | run_number | Number of the run being ended |
| [out] | error | Can be used to write a message string to midas.log |
Definition at line 296 of file fevme.cxx.
297{
299
301 {
302 printf(
"breaking recursive end_of_run()\n");
304 }
305
307
311
313
315}
◆ frontend_exit()
Frontend exit.
Runs at frontend shutdown. Disconnect hardware and set equipment status in ODB
- Returns
- Midas status code
Definition at line 272 of file fevme.cxx.
273{
276
278
280}
int EXPRT mvme_close(MVME_INTERFACE *vme)
◆ frontend_init()
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 251 of file fevme.cxx.
252{
254
257
260
262
264
266}
int EXPRT mvme_open(MVME_INTERFACE **vme, int idx)
int EXPRT mvme_set_am(MVME_INTERFACE *vme, int am)
◆ frontend_loop()
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 334 of file fevme.cxx.
◆ init_vme_modules()
Definition at line 202 of file fevme.cxx.
203{
204#ifdef HAVE_VMEIO
208#endif
209
210#ifdef HAVE_V792
213#endif
214
215#ifdef HAVE_V895
217 {
219
224
225 for (
int j=0;
j<16;
j++)
226 {
229 }
230
231
232
233 }
234#endif
235
236#ifdef HAVE_V1190B
239#endif
240
241#ifdef HAVE_VF48
244#endif
245
247}
◆ interrupt_configure()
Definition at line 382 of file fevme.cxx.
383{
384 switch (cmd) {
386 break;
388 break;
390 break;
392 break;
393 }
395}
#define CMD_INTERRUPT_ATTACH
#define CMD_INTERRUPT_DISABLE
#define CMD_INTERRUPT_ENABLE
#define CMD_INTERRUPT_DETACH
◆ mvme_read16()
Definition at line 150 of file fevme.cxx.
151{
154}
unsigned int EXPRT mvme_read_value(MVME_INTERFACE *vme, mvme_addr_t vme_addr)
int EXPRT mvme_set_dmode(MVME_INTERFACE *vme, int dmode)
◆ mvme_read32()
◆ odbReadUint32()
Definition at line 170 of file fevme.cxx.
171{
174 int size = 4;
178 {
181 }
183}
char * frontend_name
The frontend name (client name) as seen by other MIDAS clients.
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
INT db_get_data_index(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT idx, DWORD type)
◆ pause_run()
Pause Run.
Called every pause run transition.
- Parameters
-
| [in] | run_number | Number of the run being ended |
| [out] | error | Can be used to write a message string to midas.log |
- Returns
- Midas status code
Definition at line 318 of file fevme.cxx.
◆ poll_event()
Polling routine for events.
- Parameters
-
| [in] | source | Event source (LAM/IRQ) |
| [in] | count | Loop count for event polling timeout |
| [in] | test | flag 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 348 of file fevme.cxx.
352{
353
354
356 {
358
359
363 }
364
366
367#if 0
369 {
371 if (true)
374 }
375 return 1;
376
378#endif
379}
◆ read_event()
Definition at line 550 of file fevme.cxx.
551{
552
553
554
556
557#ifdef HAVE_V792
559#endif
560#ifdef HAVE_V1190B
562#endif
563#ifdef HAVE_VF48
565#endif
566
568}
int read_v792(int base, const char *bname, char *pevent, int nchan)
int read_tdc(int base, char *pevent)
void bk_init32(void *event)
INT bk_size(const void *event)
◆ read_tdc()
Definition at line 437 of file fevme.cxx.
438{
446
447
449
450
452
454 {
455#if 0
458
460#endif
462 {
463 int code = 0x1F&(
data[
i]>>27);
464
466 continue;
467
468 switch (code)
469 {
470 case 0:
471 {
472 int edge = 0x1&(
data[
i]>>26);
474 int time = 0x3FFFF&
data[
i];
475#if 0
476 printf(
"tdc %3d: 0x%08x, code 0x%02x, edge %d, chan %2d, time %6d\n",
479 code,
480 edge,
482 time);
483#endif
490 }
491 break;
492
493
494 default:
495#if 0
496 printf(
"tdc %3d: 0x%08x, code 0x%02x\n",
i,
data[
i],code);
497#endif
498 break;
499 }
500 }
501
502#if 0
505#endif
506 }
507
511 else if (
xdata > 10000)
513
514#if 0
517#endif
518
520
522
524
525 return 0;
526}
INT bk_close(void *event, void *pdata)
void bk_create(void *event, const char *name, WORD type, void **pdata)
static te_expr * base(state *s)
◆ read_v792()
Definition at line 399 of file fevme.cxx.
400{
406
407
409
410
412
413
415
418
420 {
422 if (((w>>24)&0x7) != 0) continue;
423 int chan = (w>>16)&0x1F;
424 int val = (w&0x1FFF);
426 }
427
428
429
432
434}
◆ resume_run()
Resume Run.
Called every resume run transition.
- Parameters
-
| [in] | run_number | Number of the run being ended |
| [out] | error | Can be used to write a message string to midas.log |
- Returns
- Midas status code
Definition at line 326 of file fevme.cxx.
◆ display_period
a frontend status page is displayed with this frequency in ms
Definition at line 60 of file fevme.cxx.
◆ equipment
Initial value:= {
{"Trigger",
"SYSTEM",
"MIDAS",
500,
0,
0,
0,
"", "", "",}
,
}
,
{""}
}
INT read_event(char *pevent, INT off)
Main structure for midas equipment.
Definition at line 88 of file fevme.cxx.
88 {
89
90 {"Trigger",
92 "SYSTEM",
95 "MIDAS",
98
99 500,
100 0,
101 0,
102 0,
103 "", "", "",}
104 ,
108 }
109 ,
110
111 {""}
112 };
◆ event_buffer_size
| INT event_buffer_size = 200*1024 |
buffer size to hold events
Definition at line 69 of file fevme.cxx.
◆ frontend_call_loop
frontend_loop is called periodically if this variable is TRUE
Definition at line 57 of file fevme.cxx.
◆ frontend_file_name
The frontend file name, don't change it.
Definition at line 54 of file fevme.cxx.
◆ frontend_name
| char* frontend_name = "fevme" |
The frontend name (client name) as seen by other MIDAS clients.
Definition at line 52 of file fevme.cxx.
◆ gAdcBase
◆ gDisBase
| int gDisBase[] = { 0xE00000, 0 } |
◆ gHaveRun
◆ gTdcBase
◆ gVF48base
◆ gVme
◆ gVmeioBase
| int gVmeioBase = 0x780000 |
◆ hDB
main ODB handle
Definition at line 207 of file mana.cxx.
◆ max_event_size
| INT max_event_size = 100*1024 |
maximum event size produced by this frontend
Definition at line 63 of file fevme.cxx.
◆ max_event_size_frag
| INT max_event_size_frag = 1024*1024 |
maximum event size for fragmented events (EQ_FRAGMENTED)
Definition at line 66 of file fevme.cxx.
◆ run_state