Line data Source code
1 : /********************************************************************\
2 :
3 : Name: frontend.c
4 : Created by: Stefan Ritt
5 :
6 : Contents: Example Slow Control Frontend program. Defines two
7 : slow control equipments, one for a HV device and one
8 : for a multimeter (usually a general purpose PC plug-in
9 : card with A/D inputs/outputs. As a device driver,
10 : the "null" driver is used which simulates a device
11 : without accessing any hardware. The used class drivers
12 : cd_hv and cd_multi act as a link between the ODB and
13 : the equipment and contain some functionality like
14 : ramping etc. To form a fully functional frontend,
15 : the device driver "null" has to be replaces with
16 : real device drivers.
17 :
18 : $Id$
19 :
20 : \********************************************************************/
21 :
22 : #include <stdio.h>
23 : #include "midas.h"
24 : #include "mfe.h"
25 : #include "history.h"
26 : #include "class/hv.h"
27 : #include "class/multi.h"
28 : #include "device/nulldev.h"
29 : #include "bus/null.h"
30 :
31 : /*-- Globals -------------------------------------------------------*/
32 :
33 : /* The frontend name (client name) as seen by other MIDAS clients */
34 : const char *frontend_name = "SC Frontend";
35 : /* The frontend file name, don't change it */
36 : const char *frontend_file_name = __FILE__;
37 :
38 : /*-- Equipment list ------------------------------------------------*/
39 :
40 : /* device driver list */
41 : DEVICE_DRIVER hv_driver[] = {
42 : {"Dummy Device", nulldev, 16, null},
43 : {""}
44 : };
45 :
46 : DEVICE_DRIVER multi_driver[] = {
47 : {"Input", nulldev, 3, null, DF_INPUT},
48 : {"Output", nulldev, 2, null, DF_OUTPUT},
49 : {""}
50 : };
51 :
52 : BOOL equipment_common_overwrite = TRUE;
53 :
54 : EQUIPMENT equipment[] = {
55 :
56 : {"Environment", /* equipment name */
57 : {10, 0, /* event ID, trigger mask */
58 : "SYSTEM", /* event buffer */
59 : EQ_SLOW, /* equipment type */
60 : 0, /* event source */
61 : "FIXED", /* format */
62 : TRUE, /* enabled */
63 : RO_RUNNING | RO_TRANSITIONS, /* read when running and on transitions */
64 : 60000, /* produce event every 60 sec */
65 : 0, /* stop run after this event limit */
66 : 0, /* number of sub events */
67 : 1, /* log history every second */
68 : "", "", ""} ,
69 : cd_multi_read, /* readout routine */
70 : cd_multi, /* class driver main routine */
71 : multi_driver, /* device driver list */
72 : NULL, /* init string */
73 : },
74 :
75 : {""}
76 : };
77 :
78 :
79 : /*-- Frontend Init -------------------------------------------------*/
80 :
81 0 : INT frontend_init()
82 : {
83 0 : hs_define_panel("Environment", "Sines", {
84 : "Environment/Input:Input Channel 0",
85 : "Environment/Input:Input Channel 1"
86 : });
87 :
88 0 : return CM_SUCCESS;
89 : }
|