mstitst.h
/* -------------------------------------------------------------------- FILE MSTITST.H Header file to be included for routines interfacing to the MSTI DR-11 board mstiintf interface program. Include as #include "/home/erickson/mstitst.h" LRE 2-15-95 ------------------------------------------------------------------ */ #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/sem.h> #include <sys/msg.h> /* FRAME_SIZE is half the MSTI payload frame size. Necessitated by the optimum buffer size for the DR-11. */ #define FRAME_SIZE 32768 #define NUM_BUFS 6 /* ikonbuf type is the shared memory setup for the frames read in from the DR-11. */ typedef struct { char buf[FRAME_SIZE] ; } ikonbuf_t ; #define BUFF_SIZE sizeof(ikonbuf_t) /* Use these key files to get the keys using ftok. */ /* Use shm.key.n with n 0 thru 5 for shared memory buffers 0 thru 5 */ #define SHM_KEY_FILE "/ikkey/shm.key.\0" #define MSG_KEY_FILE "/ikkey/msg.key\0" #ifndef _IDR_REG_H /* IDR_FCN1 and IDR_FCN2 must be the same as defined in idr_reg.h included by idr_io.h as used in the interface program. */ #define IDR_FCN1 0x02 #define IDR_FCN2 0x04 #else #define _MSTI_INTF #endif /* Able to collect "Real Time" or "Stored Data" as defined by the MSTI ICD. */ #define ST_DAT IDR_FCN1 #define RT_DAT IDR_FCN2 /* Message types in the message queue. */ #define MSG_TO_IKON 100 #define MSG_FROM_IKON 200 /* Commands to send to the interface program. */ #define QUIT_CMD 100 #define RD_DATA_TO_FILE_CMD 200 #define RD_TO_BUF_CMD 300 #define QUIT_RD_TO_BUF_CMD 400 #define SET_UP_SNAPSHOTS_CMD 500 #define TAKE_SNAPSHOT_CMD 600 #define QUIT_SNAP_SHOTS_CMD 700 #define FILL_BUFS_CMD 800 /* Max size of string to be sent to the interface program. */ #define MAX_MSG_SIZE 1024 /* Structure used to send a message to the interface program. */ typedef struct { long msg_type ; int msg_len ; int cmd ; int num_frames ; /* MSTI frames. Intf prog fugures buffers */ int data_type ; /* Stored or real time */ char msg[MAX_MSG_SIZE] ; } to_ikonmsg_t ; /* Size used to send a message to the interface program */ #define TO_IKON_MSG_LEN (sizeof(to_ikonmsg_t) - sizeof(long)) /* Max size of string returned by the interface program */ #define STATUS_MSG_SIZE 256 /* Structure used to receive a message from the interface program. */ typedef struct { long msg_type ; int msg_len ; int cmd ; int status ; char msg[STATUS_MSG_SIZE] ; } from_ikonmsg_t ; /* Size used to receive a message from the interface program */ #define FROM_IKON_MSG_LEN (sizeof(from_ikonmsg_t) - sizeof(long)) /* Status returned by the interface program. */ #define MSTI_OK 0 #define MSTI_FOPEN_ERR 1 #define MSTI_RD_ERR 2 #define MSTI_WR_ERR 3 #define MSTI_FWR_ERR 4 #define MSTI_FORK_ERR 5 #define MSTI_CONT_RD_ERR 6 #define MSTI_UNK_CMD_ERR 7 #define MSTI_BUSY_ERR 8 /* ------------------------------------------------------------------- Additional stuff for the mstiintf program. -------------------------------------------------------------------- */ #ifdef _MSTI_INTF #define IKON_DEV_NAME "/dev/idr0\0" #define SEM_KEY_FILE "/ikkey/sem.key\0" #define PERMS 0666 #define NUM_SEMS 2 #define TLM_DAT IDR_FCN3 #endif