/*
 ***************************************************************************
 *	   Polling the input signals and filling the current buffer
 *
 * Define FILLING_BUFFERS symbol before "including" this header file
 * for the file to generate actual data rather than references to them
 *
 ***************************************************************************
 */


#ifdef FILLING_BUFFERS			/* Generate actual private data	*/
#define _extern
#define _const
#else					/* Generate references only	*/
#define _extern extern
#define _const  const
#endif

					/* Common data			*/
#ifdef FILLING_BUFFERS
const int Polling_period =	1000;	/* Period for polling in microsec*/
#else
extern const int Polling_period;
#endif

_extern _const int No_channels_polled;

#ifdef FILLING_BUFFERS			/* Private data			*/

				/* Define channels to poll		*/
				/* The testing bits should be mapped	*/
				/* to the one of the external PC connectors*/
#define Poll_port1_no		0x3fe /* Serial Port COM1, modem status reg */
#define Poll_flag1              0x10  /* signal CTS, pin #5 of the 25 pin connector*/
#define Poll_port2_no		0x3fe /* Serial Port COM1, modem status reg  */
#define Poll_flag2              0x40  /* signal RI,  pin #22 of the 25 pin connector*/
#define Poll_flag3              0x10  /* signal DCD, pin #8 of the 25 pin connector*/

static const char * Poll_channels_descr [] =
	{ "",
	  "Serial Port COM1:, Signal CTS, pin #5  of the 25 pin connector",
	  "Serial Port COM1:, Signal RI,  pin #22 of the 25 pin connector",
	  "Serial Port COM1:, Signal DCD, pin #8  of the 25 pin connector",
	};
#endif

				/* Prepare the buffer for filling out	*/
void set_the_buffer_current(struct BUFFER far * bp);

void push_current_buffer();

			/* Set up a new value to the No_channels_polled	*/
			/* from the parameter given if it seems fit	*/
			/* return -1 if the no of channels given is	*/
			/* wrong					*/
			/* Otherwise, return 0				*/
int set_no_channels_to_poll(const int no_channels);

			/* Return the string describing the signal	*/
			/* to poll					*/
const char * poll_signal_description(const int channel_no);

void init_reset_timer_interrupt(
		const char flag	     /* 'I' for initializing,	    */
				     /* or 'R' for reset of the timer interr handling*/
		);

#undef _extern
#undef _const
