15 #ifndef INC_db_access_H
16 #define INC_db_access_H
30 #define MAX_UNITS_SIZE 8
31 #define MAX_ENUM_STRING_SIZE 26
32 #define MAX_ENUM_STATES 16
40 typedef epicsUInt8 dbr_char_t;
41 typedef epicsInt16 dbr_short_t;
42 typedef epicsUInt16 dbr_ushort_t;
43 typedef epicsInt16 dbr_int_t;
44 typedef epicsUInt16 dbr_enum_t;
45 typedef epicsInt32 dbr_long_t;
46 typedef epicsUInt32 dbr_ulong_t;
47 typedef epicsFloat32 dbr_float_t;
48 typedef epicsFloat64 dbr_double_t;
49 typedef epicsUInt16 dbr_put_ackt_t;
50 typedef epicsUInt16 dbr_put_acks_t;
54 #ifndef db_accessHFORdb_accessC
64 #define DBF_NO_ACCESS 7
65 #define LAST_TYPE DBF_DOUBLE
66 #define VALID_DB_FIELD(x) ((x >= 0) && (x <= LAST_TYPE))
67 #define INVALID_DB_FIELD(x) ((x < 0) || (x > LAST_TYPE))
70 #define DBR_STRING DBF_STRING
71 #define DBR_INT DBF_INT
72 #define DBR_SHORT DBF_INT
73 #define DBR_FLOAT DBF_FLOAT
74 #define DBR_ENUM DBF_ENUM
75 #define DBR_CHAR DBF_CHAR
76 #define DBR_LONG DBF_LONG
77 #define DBR_DOUBLE DBF_DOUBLE
78 #define DBR_STS_STRING 7
79 #define DBR_STS_SHORT 8
80 #define DBR_STS_INT DBR_STS_SHORT
81 #define DBR_STS_FLOAT 9
82 #define DBR_STS_ENUM 10
83 #define DBR_STS_CHAR 11
84 #define DBR_STS_LONG 12
85 #define DBR_STS_DOUBLE 13
86 #define DBR_TIME_STRING 14
87 #define DBR_TIME_INT 15
88 #define DBR_TIME_SHORT 15
89 #define DBR_TIME_FLOAT 16
90 #define DBR_TIME_ENUM 17
91 #define DBR_TIME_CHAR 18
92 #define DBR_TIME_LONG 19
93 #define DBR_TIME_DOUBLE 20
94 #define DBR_GR_STRING 21
95 #define DBR_GR_SHORT 22
96 #define DBR_GR_INT DBR_GR_SHORT
97 #define DBR_GR_FLOAT 23
98 #define DBR_GR_ENUM 24
99 #define DBR_GR_CHAR 25
100 #define DBR_GR_LONG 26
101 #define DBR_GR_DOUBLE 27
102 #define DBR_CTRL_STRING 28
103 #define DBR_CTRL_SHORT 29
104 #define DBR_CTRL_INT DBR_CTRL_SHORT
105 #define DBR_CTRL_FLOAT 30
106 #define DBR_CTRL_ENUM 31
107 #define DBR_CTRL_CHAR 32
108 #define DBR_CTRL_LONG 33
109 #define DBR_CTRL_DOUBLE 34
110 #define DBR_PUT_ACKT DBR_CTRL_DOUBLE + 1
111 #define DBR_PUT_ACKS DBR_PUT_ACKT + 1
112 #define DBR_STSACK_STRING DBR_PUT_ACKS + 1
113 #define DBR_CLASS_NAME DBR_STSACK_STRING + 1
114 #define LAST_BUFFER_TYPE DBR_CLASS_NAME
115 #define VALID_DB_REQ(x) ((x >= 0) && (x <= LAST_BUFFER_TYPE))
116 #define INVALID_DB_REQ(x) ((x < 0) || (x > LAST_BUFFER_TYPE))
123 LIBCA_API
extern const int epicsTypeToDBR_XXXX [lastEpicsType+1];
128 LIBCA_API
extern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1];
179 dbr_short_t severity;
186 dbr_ushort_t severity;
194 dbr_short_t severity;
199 dbr_short_t severity;
206 dbr_short_t severity;
213 dbr_short_t severity;
220 dbr_short_t severity;
228 dbr_short_t severity;
235 dbr_short_t severity;
245 dbr_short_t severity;
253 dbr_short_t severity;
255 dbr_short_t RISC_pad;
262 dbr_short_t severity;
270 dbr_short_t severity;
272 dbr_short_t RISC_pad;
279 dbr_short_t severity;
281 dbr_short_t RISC_pad0;
282 dbr_char_t RISC_pad1;
289 dbr_short_t severity;
297 dbr_short_t severity;
311 dbr_short_t severity;
312 char units[MAX_UNITS_SIZE];
313 dbr_short_t upper_disp_limit;
314 dbr_short_t lower_disp_limit;
315 dbr_short_t upper_alarm_limit;
316 dbr_short_t upper_warning_limit;
317 dbr_short_t lower_warning_limit;
318 dbr_short_t lower_alarm_limit;
323 dbr_short_t severity;
324 char units[MAX_UNITS_SIZE];
325 dbr_short_t upper_disp_limit;
326 dbr_short_t lower_disp_limit;
327 dbr_short_t upper_alarm_limit;
328 dbr_short_t upper_warning_limit;
329 dbr_short_t lower_warning_limit;
330 dbr_short_t lower_alarm_limit;
337 dbr_short_t severity;
338 dbr_short_t precision;
339 dbr_short_t RISC_pad0;
340 char units[MAX_UNITS_SIZE];
341 dbr_float_t upper_disp_limit;
342 dbr_float_t lower_disp_limit;
343 dbr_float_t upper_alarm_limit;
344 dbr_float_t upper_warning_limit;
345 dbr_float_t lower_warning_limit;
346 dbr_float_t lower_alarm_limit;
353 dbr_short_t severity;
355 char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];
363 dbr_short_t severity;
364 char units[MAX_UNITS_SIZE];
365 dbr_char_t upper_disp_limit;
366 dbr_char_t lower_disp_limit;
367 dbr_char_t upper_alarm_limit;
368 dbr_char_t upper_warning_limit;
369 dbr_char_t lower_warning_limit;
370 dbr_char_t lower_alarm_limit;
378 dbr_short_t severity;
379 char units[MAX_UNITS_SIZE];
380 dbr_long_t upper_disp_limit;
381 dbr_long_t lower_disp_limit;
382 dbr_long_t upper_alarm_limit;
383 dbr_long_t upper_warning_limit;
384 dbr_long_t lower_warning_limit;
385 dbr_long_t lower_alarm_limit;
392 dbr_short_t severity;
393 dbr_short_t precision;
394 dbr_short_t RISC_pad0;
395 char units[MAX_UNITS_SIZE];
396 dbr_double_t upper_disp_limit;
397 dbr_double_t lower_disp_limit;
398 dbr_double_t upper_alarm_limit;
399 dbr_double_t upper_warning_limit;
400 dbr_double_t lower_warning_limit;
401 dbr_double_t lower_alarm_limit;
413 dbr_short_t severity;
414 char units[MAX_UNITS_SIZE];
415 dbr_short_t upper_disp_limit;
416 dbr_short_t lower_disp_limit;
417 dbr_short_t upper_alarm_limit;
418 dbr_short_t upper_warning_limit;
419 dbr_short_t lower_warning_limit;
420 dbr_short_t lower_alarm_limit;
421 dbr_short_t upper_ctrl_limit;
422 dbr_short_t lower_ctrl_limit;
427 dbr_short_t severity;
428 char units[MAX_UNITS_SIZE];
429 dbr_short_t upper_disp_limit;
430 dbr_short_t lower_disp_limit;
431 dbr_short_t upper_alarm_limit;
432 dbr_short_t upper_warning_limit;
433 dbr_short_t lower_warning_limit;
434 dbr_short_t lower_alarm_limit;
435 dbr_short_t upper_ctrl_limit;
436 dbr_short_t lower_ctrl_limit;
443 dbr_short_t severity;
444 dbr_short_t precision;
445 dbr_short_t RISC_pad;
446 char units[MAX_UNITS_SIZE];
447 dbr_float_t upper_disp_limit;
448 dbr_float_t lower_disp_limit;
449 dbr_float_t upper_alarm_limit;
450 dbr_float_t upper_warning_limit;
451 dbr_float_t lower_warning_limit;
452 dbr_float_t lower_alarm_limit;
453 dbr_float_t upper_ctrl_limit;
454 dbr_float_t lower_ctrl_limit;
461 dbr_short_t severity;
463 char strs[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];
471 dbr_short_t severity;
472 char units[MAX_UNITS_SIZE];
473 dbr_char_t upper_disp_limit;
474 dbr_char_t lower_disp_limit;
475 dbr_char_t upper_alarm_limit;
476 dbr_char_t upper_warning_limit;
477 dbr_char_t lower_warning_limit;
478 dbr_char_t lower_alarm_limit;
479 dbr_char_t upper_ctrl_limit;
480 dbr_char_t lower_ctrl_limit;
488 dbr_short_t severity;
489 char units[MAX_UNITS_SIZE];
490 dbr_long_t upper_disp_limit;
491 dbr_long_t lower_disp_limit;
492 dbr_long_t upper_alarm_limit;
493 dbr_long_t upper_warning_limit;
494 dbr_long_t lower_warning_limit;
495 dbr_long_t lower_alarm_limit;
496 dbr_long_t upper_ctrl_limit;
497 dbr_long_t lower_ctrl_limit;
504 dbr_short_t severity;
505 dbr_short_t precision;
506 dbr_short_t RISC_pad0;
507 char units[MAX_UNITS_SIZE];
508 dbr_double_t upper_disp_limit;
509 dbr_double_t lower_disp_limit;
510 dbr_double_t upper_alarm_limit;
511 dbr_double_t upper_warning_limit;
512 dbr_double_t lower_warning_limit;
513 dbr_double_t lower_alarm_limit;
514 dbr_double_t upper_ctrl_limit;
515 dbr_double_t lower_ctrl_limit;
519 #define dbr_size_n(TYPE,COUNT)\
520 ((unsigned)((COUNT)<0?dbr_size[TYPE]:dbr_size[TYPE]+((COUNT)-1)*dbr_value_size[TYPE]))
523 LIBCA_API
extern const unsigned short dbr_size[];
526 LIBCA_API
extern const unsigned short dbr_value_size[];
528 #ifndef db_accessHFORdb_accessC
530 enum dbr_value_class {
536 LIBCA_API
extern const enum dbr_value_class dbr_value_class[LAST_BUFFER_TYPE+1];
541 #define dbr_value_ptr(PDBR, DBR_TYPE) \
542 ((void *)(((char *)PDBR)+dbr_value_offset[DBR_TYPE]))
547 #define dbr_value_ptr_from_structure(PDBR, STRUCTURE)\
548 ((void *)(((char *)PDBR)+BYTE_OS(STRUCTURE, value)))
550 LIBCA_API
extern const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+1];
562 dbr_double_t doubleval;
591 dbr_put_ackt_t putackt;
592 dbr_put_acks_t putacks;
594 dbr_string_t classname;
637 #define db_strval_dim MAX_STRING_SIZE
638 #define db_units_dim MAX_UNITS_SIZE
639 #define db_desc_dim 24
640 #define db_name_dim 36
641 #define db_state_dim MAX_ENUM_STATES
642 #define db_state_text_dim MAX_ENUM_STRING_SIZE
644 #define dbf_type_is_valid(type) ((type) >= 0 && (type) <= LAST_TYPE)
645 #define dbr_type_is_valid(type) ((type) >= 0 && (type) <= LAST_BUFFER_TYPE)
646 #define dbr_type_is_plain(type) \
647 ((type) >= DBR_STRING && (type) <= DBR_DOUBLE)
648 #define dbr_type_is_STS(type) \
649 ((type) >= DBR_STS_STRING && (type) <= DBR_STS_DOUBLE)
650 #define dbr_type_is_TIME(type) \
651 ((type) >= DBR_TIME_STRING && (type) <= DBR_TIME_DOUBLE)
652 #define dbr_type_is_GR(type) \
653 ((type) >= DBR_GR_STRING && (type) <= DBR_GR_DOUBLE)
654 #define dbr_type_is_CTRL(type) \
655 ((type) >= DBR_CTRL_STRING && (type) <= DBR_CTRL_DOUBLE)
656 #define dbr_type_is_STRING(type) \
657 ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \
658 (type)%(LAST_TYPE+1) == DBR_STRING)
659 #define dbr_type_is_SHORT(type) \
660 ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \
661 (type)%(LAST_TYPE+1) == DBR_SHORT)
662 #define dbr_type_is_FLOAT(type) \
663 ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \
664 (type)%(LAST_TYPE+1) == DBR_FLOAT)
665 #define dbr_type_is_ENUM(type) \
666 ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \
667 (type)%(LAST_TYPE+1) == DBR_ENUM)
668 #define dbr_type_is_CHAR(type) \
669 ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \
670 (type)%(LAST_TYPE+1) == DBR_CHAR)
671 #define dbr_type_is_LONG(type) \
672 ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \
673 (type)%(LAST_TYPE+1) == DBR_LONG)
674 #define dbr_type_is_DOUBLE(type) \
675 ((type) >= 0 && (type) <= LAST_BUFFER_TYPE && \
676 (type)%(LAST_TYPE+1) == DBR_DOUBLE)
678 #define dbf_type_to_text(type) \
679 ( ((type) >= -1 && (type) < dbf_text_dim-2) ? \
680 dbf_text[type+1] : dbf_text_invalid )
682 #define dbf_text_to_type(text, type) \
683 for (type=dbf_text_dim-3; type>=0; type--) { \
684 if (strcmp(text, dbf_text[type+1]) == 0) \
688 #define dbr_type_to_text(type) \
689 ( ((type) >= 0 && (type) < dbr_text_dim) ? \
690 dbr_text[(type)] : dbr_text_invalid )
692 #define dbr_text_to_type(text, type) \
693 for (type=dbr_text_dim-2; type>=0; type--) { \
694 if (strcmp(text, dbr_text[type]) == 0) \
698 #define dbf_type_to_DBR(type) \
699 (((type) >= 0 && (type) <= dbf_text_dim-3) ? \
702 #define dbf_type_to_DBR_STS(type) \
703 (((type) >= 0 && (type) <= dbf_text_dim-3) ? \
704 (type) + (dbf_text_dim-2) : -1 )
706 #define dbf_type_to_DBR_TIME(type) \
707 (((type) >= 0 && (type) <= dbf_text_dim-3) ? \
708 (type) + 2*(dbf_text_dim-2) : -1 )
710 #define dbf_type_to_DBR_GR(type) \
711 (((type) >= 0 && (type) <= dbf_text_dim-3) ? \
712 (type) + 3*(dbf_text_dim-2) : -1 )
714 #define dbf_type_to_DBR_CTRL(type) \
715 (((type) >= 0 && (type) <= dbf_text_dim-3) ? \
716 (type) + 4*(dbf_text_dim-2) : -1 )
719 LIBCA_API
extern const char *dbf_text[LAST_TYPE+3];
720 LIBCA_API
extern const short dbf_text_dim;
721 LIBCA_API
extern const char *dbf_text_invalid;
723 LIBCA_API
extern const char *dbr_text[LAST_BUFFER_TYPE+1];
724 LIBCA_API
extern const short dbr_text_dim;
725 LIBCA_API
extern const char *dbr_text_invalid;
The core data types used by epics.
EPICS time stamp, for use from C code.
epicsType
Corresponding Type Codes (this enum must start at zero)
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
char epicsOldString[MAX_STRING_SIZE]
!! Don't use this - it may vanish in the future !!