The midas.h & midas.c


Modules

 Midas Define
 Midas Macros
 Midas Error definition
 Midas Structure Declaration
 Midas Message Functions (msg_xxx)
 Midas Common Functions (cm_xxx)
 Midas Buffer Manager Functions (bm_xxx)
 Midas RPC Functions (rpc_xxx)
 Midas Bank Functions (bk_xxx)
 Midas Ring Buffer Functions (rb_xxx)

Defines

#define DATABASE_VERSION   3
#define MIDAS_VERSION   "2.0.0"
#define MAX_EVENT_SIZE   0x400000
#define TAPE_BUFFER_SIZE   0x8000
#define NET_TCP_SIZE   0xFFFF
#define OPT_TCP_SIZE   8192
#define NET_UDP_SIZE   8192
#define EVENT_BUFFER_NAME   "SYSTEM"
#define DEFAULT_ODB_SIZE   0x100000
#define NAME_LENGTH   32
#define HOST_NAME_LENGTH   256
#define MAX_CLIENTS   64
#define MAX_EVENT_REQUESTS   10
#define MAX_OPEN_RECORDS   256
#define MAX_ODB_PATH   256
#define MAX_EXPERIMENT   32
#define BANKLIST_MAX   1024
#define STRING_BANKLIST_MAX   BANKLIST_MAX * 4
#define MIDAS_TCP_PORT   1175
#define DEFAULT_RPC_TIMEOUT   10000
#define WATCHDOG_INTERVAL   1000
#define DEFAULT_WATCHDOG_TIMEOUT   10000
#define CH_BS   8
#define CH_TAB   9
#define CH_CR   13
#define CH_EXT   0x100
#define CH_HOME   (CH_EXT+0)
#define CH_INSERT   (CH_EXT+1)
#define CH_DELETE   (CH_EXT+2)
#define CH_END   (CH_EXT+3)
#define CH_PUP   (CH_EXT+4)
#define CH_PDOWN   (CH_EXT+5)
#define CH_UP   (CH_EXT+6)
#define CH_DOWN   (CH_EXT+7)
#define CH_RIGHT   (CH_EXT+8)
#define CH_LEFT   (CH_EXT+9)
#define LAM_SOURCE(c, s)   (c<<24 | ((s) & 0xFFFFFF))
#define LAM_STATION(s)   (1<<(s-1))
#define LAM_SOURCE_CRATE(c)   (c>>24)
#define LAM_SOURCE_STATION(s)   ((s) & 0xFFFFFF)
#define CNAF   0x1
#define CNAF_nQ   0x2
#define CNAF_INHIBIT_SET   0x100
#define CNAF_INHIBIT_CLEAR   0x101
#define CNAF_CRATE_CLEAR   0x102
#define CNAF_CRATE_ZINIT   0x103
#define CNAF_TEST   0x110
#define ANA_CONTINUE   1
#define ANA_SKIP   0

Variables

static HNDLE _hKeyClient = 0
static HNDLE _hDB = 0
static char _client_name [NAME_LENGTH]
static char _path_name [MAX_STRING_LENGTH]
static INT _call_watchdog = TRUE
static INT _watchdog_timeout = DEFAULT_WATCHDOG_TIMEOUT
INT _semaphore_alarm
INT _semaphore_elog
INT _semaphore_history
INT _semaphore_msg


Define Documentation

#define ANA_CONTINUE   1

dox

Definition at line 765 of file midas.h.

#define ANA_SKIP   0

Definition at line 766 of file midas.h.

Referenced by process_event().

#define BANKLIST_MAX   1024

max # of banks in event

Definition at line 244 of file midas.h.

Referenced by bk_list().

#define CH_BS   8

special characters

Definition at line 386 of file midas.h.

Referenced by cmd_edit().

#define CH_CR   13

Definition at line 388 of file midas.h.

Referenced by cmd_edit().

#define CH_DELETE   (CH_EXT+2)

Definition at line 394 of file midas.h.

Referenced by cmd_edit().

#define CH_DOWN   (CH_EXT+7)

Definition at line 399 of file midas.h.

Referenced by cmd_edit().

#define CH_END   (CH_EXT+3)

Definition at line 395 of file midas.h.

Referenced by cmd_edit().

#define CH_EXT   0x100

Definition at line 390 of file midas.h.

Referenced by cmd_edit().

#define CH_HOME   (CH_EXT+0)

Definition at line 392 of file midas.h.

Referenced by cmd_edit().

#define CH_INSERT   (CH_EXT+1)

Definition at line 393 of file midas.h.

#define CH_LEFT   (CH_EXT+9)

Definition at line 401 of file midas.h.

Referenced by cmd_edit().

#define CH_PDOWN   (CH_EXT+5)

Definition at line 397 of file midas.h.

#define CH_PUP   (CH_EXT+4)

Definition at line 396 of file midas.h.

#define CH_RIGHT   (CH_EXT+8)

Definition at line 400 of file midas.h.

Referenced by cmd_edit().

#define CH_TAB   9

Definition at line 387 of file midas.h.

#define CH_UP   (CH_EXT+6)

Definition at line 398 of file midas.h.

Referenced by cmd_edit().

#define CNAF   0x1

CNAF commands

Definition at line 431 of file midas.h.

Referenced by cnaf_callback(), and show_cnaf_page().

#define CNAF_CRATE_CLEAR   0x102

Definition at line 436 of file midas.h.

Referenced by cnaf_callback(), and show_cnaf_page().

#define CNAF_CRATE_ZINIT   0x103

Definition at line 437 of file midas.h.

Referenced by cnaf_callback(), and show_cnaf_page().

#define CNAF_INHIBIT_CLEAR   0x101

Definition at line 435 of file midas.h.

Referenced by cnaf_callback(), and show_cnaf_page().

#define CNAF_INHIBIT_SET   0x100

Definition at line 434 of file midas.h.

Referenced by cnaf_callback(), and show_cnaf_page().

#define CNAF_nQ   0x2

Definition at line 432 of file midas.h.

Referenced by cnaf_callback().

#define CNAF_TEST   0x110

Definition at line 438 of file midas.h.

Referenced by cnaf_callback().

#define DATABASE_VERSION   3

Definition at line 41 of file midas.h.

Referenced by command_loop(), and db_open_database().

#define DEFAULT_ODB_SIZE   0x100000

online database 1M

Definition at line 235 of file midas.h.

Referenced by cm_connect_experiment(), cm_connect_experiment1(), and main().

#define DEFAULT_RPC_TIMEOUT   10000

Timeouts [ms]

Definition at line 252 of file midas.h.

Referenced by main().

#define DEFAULT_WATCHDOG_TIMEOUT   10000

Watchdog

Definition at line 255 of file midas.h.

Referenced by cm_connect_experiment(), cm_connect_experiment1(), and main().

#define EVENT_BUFFER_NAME   "SYSTEM"

buffer name for commands

Definition at line 234 of file midas.h.

Referenced by command_loop().

#define HOST_NAME_LENGTH   256

length of TCP/IP names

Definition at line 238 of file midas.h.

Referenced by cm_connect_client(), cm_connect_experiment1(), cm_disconnect_experiment(), cm_set_client_info(), cm_shutdown(), cm_transition1(), ftp_open(), main(), and mftp_open().

#define LAM_SOURCE ( c,
 )     (c<<24 | ((s) & 0xFFFFFF))

Code the LAM crate and LAM station into a bitwise register.

Parameters:
c Crate number
s Slot number

Definition at line 409 of file midas.h.

#define LAM_SOURCE_CRATE (  )     (c>>24)

Convert the coded LAM crate to Crate number.

Parameters:
c coded crate

Definition at line 421 of file midas.h.

Referenced by poll_event().

#define LAM_SOURCE_STATION (  )     ((s) & 0xFFFFFF)

Convert the coded LAM station to Station number.

Parameters:
s Slot number

Definition at line 427 of file midas.h.

Referenced by poll_event().

#define LAM_STATION (  )     (1<<(s-1))

Code the Station number bitwise for the LAM source.

Parameters:
s Slot number

Definition at line 415 of file midas.h.

#define MAX_CLIENTS   64

client processes per buf/db

Definition at line 239 of file midas.h.

Referenced by bm_close_buffer(), bm_open_buffer(), bm_remove_client_locked(), db_close_database(), and db_open_database().

#define MAX_EVENT_REQUESTS   10

event requests per client

Definition at line 240 of file midas.h.

#define MAX_EVENT_SIZE   0x400000

dox maximum event size 4MB

Definition at line 222 of file midas.h.

Referenced by command_loop(), dm_buffer_create(), main(), md_file_ropen(), midas_event_skip(), process_event(), receive_event(), register_equipment(), register_requests(), source_booking(), tr_start(), and write_event_midas().

#define MAX_EXPERIMENT   32

number of different exp.

Definition at line 243 of file midas.h.

Referenced by cm_connect_experiment1(), cm_list_experiments(), cm_scan_experiments(), and cm_select_experiment().

#define MAX_ODB_PATH   256

length of path in ODB

Definition at line 242 of file midas.h.

Referenced by db_copy(), search_callback(), and search_key().

#define MAX_OPEN_RECORDS   256

number of open DB records

Definition at line 241 of file midas.h.

#define MIDAS_TCP_PORT   1175

Definition at line 248 of file midas.h.

Referenced by cm_list_experiments(), and main().

#define MIDAS_VERSION   "2.0.0"

Definition at line 44 of file midas.h.

Referenced by cm_get_version().

#define NAME_LENGTH   32

length of names, mult.of 8!

Definition at line 237 of file midas.h.

Referenced by add_event(), bm_open_buffer(), book_ntuples(), cm_check_client(), cm_connect_client(), cm_connect_experiment1(), cm_exist(), cm_get_client_info(), cm_select_experiment(), cm_set_client_info(), cm_shutdown(), cm_transition1(), command_loop(), db_open_database(), debug_print(), do_jrpc_rev0(), export_hist(), generate_hist_graph(), get_event_id(), get_variable_id(), MidasHistory::GetEventsFromOdbEvents(), MidasHistory::GetEventsFromOdbTags(), MidasHistory::GetTagsFromEquipment(), MidasHistory::GetTagsFromOdb(), interprete(), load_fragment(), main(), open_history(), readHstFile(), resize_vars_odb(), save_vars_odb(), show_cnaf_page(), show_create_page(), show_custom_page(), show_elog_new(), show_elog_page(), show_elog_query(), show_hist_config_page(), show_hist_page(), show_set_page(), and show_status_page().

#define NET_TCP_SIZE   0xFFFF

maximum TCP transfer size

Definition at line 230 of file midas.h.

Referenced by rpc_send_event(), and scheduler().

#define NET_UDP_SIZE   8192

maximum UDP transfer

Definition at line 232 of file midas.h.

#define OPT_TCP_SIZE   8192

optimal TCP buffer size

Definition at line 231 of file midas.h.

#define STRING_BANKLIST_MAX   BANKLIST_MAX * 4

for bk_list()

Definition at line 245 of file midas.h.

Referenced by md_bank_event_display().

#define TAPE_BUFFER_SIZE   0x8000

buffer size for taping data

Definition at line 228 of file midas.h.

Referenced by md_file_ropen(), midas_log_open(), and midas_write().

#define WATCHDOG_INTERVAL   1000

Definition at line 253 of file midas.h.

Referenced by cm_set_client_info(), and cm_set_watchdog_params().


Variable Documentation

INT _call_watchdog = TRUE [static]

Definition at line 1180 of file midas.c.

Referenced by cm_get_watchdog_params(), and cm_set_watchdog_params().

char _client_name[NAME_LENGTH] [static]

Definition at line 1178 of file midas.c.

HNDLE _hDB = 0 [static]

Definition at line 1177 of file midas.c.

Referenced by cm_get_experiment_database(), and cm_set_experiment_database().

HNDLE _hKeyClient = 0 [static]

dox

Definition at line 1176 of file midas.c.

Referenced by cm_connect_experiment1(), cm_get_experiment_database(), and cm_set_experiment_database().

char _path_name[MAX_STRING_LENGTH] [static]

Definition at line 1179 of file midas.c.

INT _semaphore_alarm

Definition at line 1182 of file midas.c.

Referenced by db_close_database().

INT _semaphore_elog

Definition at line 1182 of file midas.c.

Referenced by db_close_database().

INT _semaphore_history

Definition at line 1182 of file midas.c.

Referenced by db_close_database().

INT _semaphore_msg

Definition at line 1182 of file midas.c.

Referenced by db_close_database().

INT _watchdog_timeout = DEFAULT_WATCHDOG_TIMEOUT [static]

Definition at line 1181 of file midas.c.

Referenced by cm_get_watchdog_params(), and cm_set_watchdog_params().


Midas DOC Version 3.0.0 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Exaos Lee - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk