/* $Date: 2000/03/08 19:31:30 $
 * $Revision: 1.8 $
 * $Author: ciolfi $
 *
 * File: das16ad.h
 *
 * Copyright 1994-2000 The MathWorks, Inc.
 */

#ifndef __ECPDSPDRIVER__
#define __ECPDSPDRIVER__

#include "tmwtypes.h"
//#include <dos.h>
//#include <conio.h>


//#define TURBO

//#include "drt_comp.h"

#define PMAC_HOST_BASE(addr)	(addr)
#define PMAC_HOST_RANGE(x)		(x)	/**total 16 ports & can change*/
#define PMAC_STATUS(addr)		(addr + 2)
#define PMAC_LO_INIT(addr)		(addr + 5)
#define PMAC_HI_INIT(addr)		(addr + 6)
#define PMAC_DATA(addr)			(addr + 7)

int inp( int n); // RDT 2/5/09
void outp (int n, char outchar ); // RDT 2/5/09

#if defined(MATLAB_MEX_FILE)
#define PMAC_RDY_TO_RCV(addr)		(2)
#define PMAC_RDY_TO_SEND(addr)		(1)
#endif
#if defined(RT)
#define PMAC_RDY_TO_RCV(addr)		((inp(PMAC_STATUS(addr)) & 2) == 2)
#define PMAC_RDY_TO_SEND(addr)		((inp(PMAC_STATUS(addr)) & 1) == 1)
#endif

#define IS_NUM_DACS_INRANGE			(i>0 && i<3)
#define IS_NUM_ENCS_INRANGE			(i>0 && i<6)
#define IS_TIMEOUT_INRANGE(i)		(i>=500 && i<=2000)
#define IS_SAMPLETIME_INRANGE(i)	(i>0)

////////////////////////////// Communication Return Codes///////////////////////////
#define COMM_OK           (0x00000001)
#define COMM_EOT          (0x80000000)
#define COMM_TIMEOUT      (0xC0000000)
#define COMM_ERROR        (0xE0000000)
#define COMM_UNSOLICITED  (0x10000000)

//////////////////////////////#defines for Ctrl characters//////////////////////////
#define NULL_CHR (0x0000)
#define CARRIAGE_RETURN (0x000D)
#define ACK_CHR (0x0006)

#define CTRL_A (0x01)
#define CTRL_B (0x02)
#define CTRL_C (0x03)
#define CTRL_D (0x04)
#define CTRL_E (0x05)
#define CTRL_F (0x06)
#define CTRL_G (0x07)
#define CTRL_H (0x08)
#define CTRL_I (0x09)
#define CTRL_J (0x0A)
#define CTRL_K (0x0B)
#define CTRL_L (0x0C)
#define CTRL_M (0x0D)
#define CTRL_N (0x0E)
#define CTRL_O (0x0F)
#define CTRL_P (0x10)
#define CTRL_Q (0x11)
#define CTRL_R (0x12)
#define CTRL_S (0x13)
#define CTRL_T (0x14)
#define CTRL_U (0x15)
#define CTRL_V (0x16)
#define CTRL_W (0x17)
#define CTRL_X (0x18)
#define CTRL_Y (0x19)
#define CTRL_Z (0x1A)

//#define pmac_timeout_cnt  (2000)  /* not implemented as desired...  */
//#define pmac_timeout_cnt  (500)  /* not implemented as desired...  */
#define delay_per_try  (5)         /* micro seconds delay per try */

#endif /* __DAS16AD__ */

/* EOF:     das16ad.h */
