#ifndef _DATAIO_H_
 
#define _DATAIO_H_
 
#include "stdint.h"
 
 
 
#define EVTREC_ID      1
 
#define RUNINFO_ID     2
 
#define POSREC_ID      3
 
#define RUNREC_ID      4
 
#define DATREC_ID      5
 
#define ITERATORREC_ID 6
 
#define ENDREC_ID      7
 
#define CAENV729REC_ID 8
 
#define MONREC_ID      9
 
 
 
typedef struct {
 
  uint32_t id;
 
  uint32_t len;
 
} HEADERREC;
 
 
 
#pragma pack(4)
 
typedef struct {
 
  uint32_t id,len;
 
  uint32_t fver,time;
 
  uint32_t nev,ped;
 
  int32_t nx,x0,dx,ny,y0,dy,direction;
 
  char serial[0xFF];
 
} RUNREC;
 
#pragma pack()
 
 
 
typedef struct {
 
  uint32_t id,len;
 
  uint32_t cmd,x0;
 
  uint32_t dx,nx;
 
  uint32_t chip,ch,neve,writemode;
 
} RUNINFO;
 
 
 
typedef struct {
 
  uint32_t id,len;
 
  uint32_t time;
 
} ENDREC;
 
 
 
typedef struct {
 
  uint32_t id,len;
 
  uint32_t time;
 
  int32_t ix,x,xset,iy,y,yset;
 
} POSREC;
 
 
 
typedef struct {
 
  uint32_t id,len;
 
  uint32_t time,nev;
 
} EVTREC;
 
 
 
typedef struct {
 
  uint32_t id,len;
 
  int chip,channel;
 
  uint32_t cmd,data,retval;
 
} DATREC;
 
 
 
typedef struct {
 
  uint32_t id,len;
 
  int level;
 
  int n;
 
  double value,step;
 
} ITERATORREC;
 
 
 
typedef struct {
 
  uint32_t id,len;
 
  uint32_t time;
 
  int32_t imon[24],iset[24],vmon[24],vset[24],status[24];
 
} MONREC;
 
 
 
#endif /* _DATAIO_H_ */