/*
 * MAC  Version 2.0           Author :  Vincent Hayward
 *                                      School of Electrical Engineering
 *                                      Purdue University
 *      Dir     : h
 *      File    : adc.h
 *      Remarks : RTI 1250 not completly understood.
 *      Usage   : provide adc conversion macro, set device addr.
 */


/*
 * This is the address setting for the RTI 1250
 */

#define UNUSED  (short *)0170400
#define GAIN    (short *)0170402
#define MADR    (short *)0170404
#define DATA    (short *)0170406
#define EOC              0100000

/*
 * ADCV is a macro to get a conversion done, because of problem
 * with the lsi11/23 of VALII it did not seem to work any more when
 * we installed VALII, probably a timing problem
 * that is why i kept the two versions
 *
 * ADCV(data, channel)
 */

#ifdef VALII
#define ADCV(d, ch)     *MADR = ch;             \
			*DATA = -1;             \
			while (*MADR < 0) {     \
				*MADR = EOC;    \
			}                       \
			d = *DATA;
#else
#define ADCV(d, ch)     *MADR = ch;             \
			*DATA = -1;             \
			do {                    \
				*MADR = EOC;    \
			} while (*MADR > 0);    \
			d = *DATA;
#endif
