#ifndef _SHM_H #define _SHM_H #define TYPE_MX 1 #define TYPE_ST 2 #define TYPE_SE 3 #define TYPE_SG 4 #define TYPE_SGCB 5 #define TYPE_CO 6 #define TYPE_SP 7 #define TYPE_SV 8 #define CMD_WR_MX 1 #define CMD_WR_ST 2 #define CMD_WR_SE 3 #define CMD_WR_SG 4 #define CMD_WR_SGCB 5 #define CMD_WR_CO 6 #define CMD_WR_SP 7 #define CMD_WR_SV 8 typedef union { float f; int i; char stVal; void *ptr; }GEN_VAL; typedef struct{ unsigned int secs; unsigned int ms; }TimeStamp; typedef struct utc_time_tag { unsigned int secs; // Number of seconds since January 1, 1970 unsigned int fraction; // Fraction of a second unsigned int qflags; // Quality flags, 8 least-significant bits only } UTC_TIME; typedef struct{ GEN_VAL v; int q; TimeStamp t; //#ifdef SUB_ENABLE int subEna; GEN_VAL subVal; int subQ; //#endif }SCL_MV; // typedef struct{ GEN_VAL v; int q; TimeStamp t; }USR_MV; // typedef struct{ GEN_VAL ctlVal; char ctlNum; TimeStamp t; char Test; char Check; int valType; }SCL_CO; typedef struct { unsigned char NumOfSG; //1-n unsigned char ActSG; //1-n unsigned char EditSG; //0-n,0 unsigned char CnfEdit; UTC_TIME LActTm;// TimeStamp }SGCB_CTRL; typedef union { USR_MV ana_mv; SCL_MV scl_mv; SCL_CO scl_co; SGCB_CTRL sgcb_ctrl; }SCL_VAL; typedef struct{ int type; int grp; int num; int ofs; GEN_VAL v; }SCL_DATA_SPEC; typedef struct{ int cmd; union { SCL_DATA_SPEC data_spec; }u; }SCL_MSG_TYPE; int start_scl_mem(); int stop_scl_mem(); void lock_scl_mem(); void unlock_scl_mem(); char *put_scl_data(int grp,int index,void *ptr,int num_bytes); char *get_scl_data(int grp,int index,void *ptr,int num_bytes); SCL_VAL* put_mv_data(int grp,int index,USR_MV *usr_mv,int num_do); SCL_VAL* get_mv_data(int grp,int index,USR_MV *usr_data,int num_do); SCL_VAL *put_do_data(int grp,int index,SCL_VAL *scl_do,int num_of_do); SCL_VAL *get_do_data(int grp,int index,SCL_VAL *scl_do,int num_of_do); SGCB_CTRL* get_sgcb_data(int index,SGCB_CTRL *sgcb); SGCB_CTRL* put_sgcb_data(int index,SGCB_CTRL *sgcb); char *get_sg_data(int grp,int index,char *ptr,int num_bytes); char *put_sg_data(int grp,int index,char *ptr,int num_bytes); char *get_se_data(int grp,int index,char *ptr,int num_bytes); char *put_se_data(int grp,int index,char *ptr,int num_bytes); int get_usr_data(int offs,void *ptr,int num_bytes); int put_usr_data(int offs,void *ptr,int num_bytes); int write_scl_msg(int cmd,SCL_DATA_SPEC *data_spec); #endif