/* TT8RMLIB.H */

/******************* TPU Definitions ********************/


enum	{ LINK_CTRL, MAX_PER_CNT, LAST_ACCUM, ACCUM, ACCRT_UB, PPWA_LW };

/* PSC Pin State Control */
#define			ForceByPAC		0x00
#define			ForceHigh		0x01
#define			ForceLow		0x02
#define			NoForceState	0x03

/* PAC Pin Action Control (Inputs) */
#define			NoTranDet		0x00
#define			DetRising		0x04
#define			DetFalling		0x08
#define			DetEither		0x0c
#define			NoChangePAC		0x10

/* PAC Pin Action Control (Outputs) */
#define			NoChangematch	0x00
#define			HighOnMatch		0x04
#define			LowOnMatch		0x08
#define			ToggleOnMatch	0x0c

/* TBS Time Base/Directionality Control */
#define			InputChan		0x00
#define			OutputChan		0x80
#define			Cap1Match1		0x00
#define			Cap1Match2		0x20
#define			Cap2Match1		0x40
#define			Cap2Match2		0x60
#define			NoChangeTBS		0x100

/* DIO Parameters */
#define			CHANNEL_CONTROL		0
#define			PIN_LEVEL			1
#define			MATCH_RATE			2

/* DIO Sequences */
#define			UpdtOnTrans			0
#define			UpdtAtRate			1
#define			UpdtOnHSRInit		2

/* DIO Requests */
#define			SetHigh				1
#define			SetLow				2
#define			Initialize			3


/**** Function Prototypes ****/

void TPUSetupPWM(short chan, short pwmhi, short pwmper, short priority);
void TPUChangePWM(short chan, short pwmhi, short pwmper);
int TPUGetPinES(short chan, short edge);
void delay_lp(void);
