/*
 * Q-STEER IR pulse width
 *
 * Q-STEER IR pulse timing is determined by information available
 * on below web page.
 *  http://homepage2.nifty.com/stear/doc/QSir.htm
 *  I really appreciate the author's efforts.
 */
#ifndef __QSTEER_H__
#define	__QSTEER_H__
/* Signal pulse width expressed in 100us */
#define	MIN_LEADER	17	/* Accepts leader between 1.7ms and 2.3ms */
#define	MAX_LEADER	23
#define	MIN_SIG0	3	/* Accepts zero between 3ms and 7ms */
#define	MAX_SIG0	7
#define	MIN_SIG1	8	/* Accepts one between 8ms and 12ms */
#define	MAX_SIG1	12

#define	T_MIN_LEADER	(FPCLK*MIN_LEADER/10000)
#define	T_MAX_LEADER	(FPCLK*MAX_LEADER/10000)
#define	T_MIN_SIG0	(FPCLK*MIN_SIG0/10000)
#define	T_MAX_SIG0	(FPCLK*MAX_SIG0/10000)
#define	T_MIN_SIG1	(FPCLK*MIN_SIG1/10000)
#define	T_MAX_SIG1	(FPCLK*MAX_SIG1/10000)

/*
 * Q-STEER IR command definition
 *    IR command consists from two channel bits and  four control bits.
 */
#define	IR_MAX_BITS	6	/* Two channel bits and 4 control bits */

/* Control bits */
#define	IR_CMD_FWD	0x01	/* Forward ^ */
#define	IR_CMD_BWD	0x02	/* Backward V */
#define	IR_CMD_LEFT	0x03	/* Left <- */
#define	IR_CMD_RIGHT	0x04	/* Right -> */
#define	IR_CMD_FFWD	0x05	/* Fast Forward ^^ */
#define	IR_CMD_FWLEFT	0x06	/* Forward left ^<- */
#define	IR_CMD_FWRIGHT	0x07	/* Forward right ^-> */
#define	IR_CMD_FFWDL	0x08	/* Fast Forward left ^^<- */
#define	IR_CMD_FFWDR	0x09	/* Fast Forward right ^^-> */
#define	IR_CMD_BWLEFT	0x0a	/* Backward left V<- */
#define	IR_CMD_BWRIGHT	0x0b	/* Backward right V-> */
#define	IR_CMD_FBWD	0x0c	/* Fast Backward VV */
#define	IR_CMD_FBWDL	0x0d	/* Fast Backward left VV<- */
#define	IR_CMD_FBWDR	0x0e	/* Fast Backward right VV-> */
#define	IR_CMD_STOP	0x0f	/* Stop */
#define	CMD_MASK	0x0f

/* Channel bits */
#define	BAND_MASK	0x30
#define	BAND_A		0x00
#define	BAND_B		0x10
#define	BAND_C		0x20
#define	BAND_D		0x30
#define	MY_BAND		BAND_D	/* We are listening D band */

/* We have four extended commands */
#define	IR_CMD_NEXT	0x10
#define	IR_CMD_PREV	0x11
#define	IR_CMD_NEXT_AL	0x12
#define	IR_CMD_PREV_AL	0x13

#endif	/* __QSTEER_H__ */
