/* pscomm.h Communication interface to packet sender programs: rtps.o - rt-linux, rtnet application linuxps - linux application */ // if compiled for RT_LINUX - uncomment the next line //#define PS_RT_LINUX #ifndef PS_RT_LINUX # define SHM1_KEY 990723 # define SHM2_KEY 990724 # define SHMC_KEY 990725 #endif // maximum number of packets in one table // Note: should be less than 34000 // because of 4M limit of shared memory buffers #define MAX_NUM_OF_PACKETS 11000 // communication protocol messages #define REQ_1 'r' #define REQ_2 'R' #define URG_REQ_1 'u' #define URG_REQ_2 'U' #define ACK 'A' // special time table entries #define NEW_TIME_SERIES -2 #define STOP_SENDING -1 // definition of the time table structure struct TimeTable { long long targetTime[MAX_NUM_OF_PACKETS]; int packetSize[MAX_NUM_OF_PACKETS]; }; // communication routines // ps_init() - returns 0 on success, -1 on error int ps_init(void); // ps_send() - returns 0 on success, 1 if late, -1 on error int ps_send(struct TimeTable*); // ps_cleanup() - returns 0 on success, -1 on error int ps_cleanup(void); // ps_getptrs() - returns 0 on success, 1 on error int ps_getptrs(volatile char **shm1p, volatile char **shm2p, volatile char **shmControlp);