Listing 2 (lidar.h)
/* ---
Header for lidar tasks. This header includes
the IDs for the message queues and shared memory,
shared structures, and shared definitions.
--- */
#include <file.h>
#include <time.h>
#include <types.h>
#include <stat.h>
#include <resource.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/oscalls.h>
#include <tclock.h>
/* --- queue keys --- */
#define AVAILABLE_Q 1
#define GRAPHICS_Q 2
#define READ_Q 3
#define WRITE_Q 4
/* --- shared memory key --- */
#define FB_KEY 10
/* --- semaphore keys --- */
#define ALIVE_KEY "alive"
/* --- message structure containing frame buffer
index (key) for shared memory access --- */
typedef struct message_rec {
long type; /* required */
int key; /* index into shared memory */
} message;
/* -- defines for messages -- */
#define MSG_SIZE 4
/* --- frame buffer number and size --- */
#define N_FRAMES 10
#define FRAME_SIZE 2560
#define WRITE_SIZE 2560
#define READ_SIZE 2070
/* --- number of runs to make for sample program --- */
#define N_RUNS 100
/* --- priorities for each process --- */
#define LIDAR_ACQ 19
#define LIDAR_READ 18
#define LIDAR_WRITE 17
#define LIDAR_GRAPH 16
/* --- useful defines --- */
#define TRUE 1
#define FALSE 0
#define QUIT -1
#define NOFLAGS 0
#define ANYTYPE 0