
/* ##########################################################################
   ###                                                                    ###
   ### Edited for MOT/BBS; 07-FEB-92 (Ed2)                                ###
   ###                                                                    ###
   ### Revision History:                                                  ###
   ### Rev 0  - 25-Oct-91 Module Creation David C. Hughes Jr.             ###
   ### Rev 0  - 07-Nov-91 Added Multipled LED display definitions [DCHJR] ###
   ###                                                                    ###
   ########################################################################## */

#include "\mot\lib\config.h"
#include "\mot\lib\io.h"
#include "\mot\lib\pio.h"
#include "\mot\lib\sci.h"
#include "\mot\lib\spi.h"
#include "\mot\lib\timer.h"
#include "\mot\lib\directiv.h"
#include "\mot\lib\libdefs.h"

#define TRUE 1
#define FALSE 0
#define HIGH 1                /* logic one condition */
#define LOW  0                /* logic zero condition */
#define WRITE  1              /* parallel I/O port Data direction write */          
#define READ   0              /* parallel I/O port Data direction read */          
#define ATTN 0x2a             /* Intercpu attention request character */
#define EOC  0xd              /* Intercpu end of command character */
#define NULL 0                /* null terminator of string */
#define LED_ROW_LENGTH 16     /* bytes per row in multiplex LED display */

/* ###########################################
   ### PORT A parallel I/O bit definitions ###
   ########################################### */
#define SPARE_I0   0x1            /* not used as of yet.. */
#define SPARE_I1   0x2
#define IR_DATA    0x4            /* Filtered Infared remote sense data */
#define IRQ_SENSE  0x8            /* IRQ polarity sense */
#define PCNTRL     0x10           /* remote slave CPU power control output */
#define EEPOT_CS   0x20           /* Xicor EEPOT chip select */
#define EEPOT_UD   0x40           /* Xicor EEPOT up/down direction */
#define EEPOT_INC  0x80           /* Xicor EEPOT dump */
/* PACTL	equ	$26	DDRA7:PAEN:PAMOD:PEDGE:0:0:RTR1:RTR0
   PAINIT	equ	$e0	initial data pattern for port a */

/* ###########################################
   ### PORT B parallel I/O bit definitions ###
   ########################################### */
#define L_STROBE 0x1              /* Left Pre-Amp S/R Strobe  P2-1 */
#define L_CLK    0x2              /* Left Pre-Amp S/R Clock   P2-2 */
#define R_STROBE 0x4              /* Right Pre-Amp S/R Strobe P2-3 */
#define R_CLK    0x8              /* Right Pre-Amp S/R Clock  P2-4 */
#define T_STROBE 0x10             /* Top Indicator S/R Strobe P1-4 */
#define T_CLK    0x20             /* Top Indicator S/R Clock  P1-5 */
#define F_STROBE 0x40             /* Front LED S/R Strobe          */
#define F_CLK    0x80             /* Front LED S/R Clock           */

/* ##############################################
   ### PORT C parallel Output bit definitions ###
   ############################################## */
#define LED_DATA 0x1              /* shift register data   P1-6 P2-5 */
#define LED_ROW1 0x2              /* LED Row Data Bit 1    U4-1 */
#define LED_ROW2 0x4              /* LED Row Data Bit 2    U4-2 */
#define LED_ROW3 0x8              /* LED Row Data Bit 3    U4-3 */
#define LED_ROW4 0x10             /* LED Row Data Bit 4    U4-4 */
#define LED_ROW5 0x20             /* LED Row Data Bit 5    U4-5 */
#define LED_ROW6 0x40             /* LED Row Data Bit 6    U4-6 */
#define LED_ROW7 0x80             /* LED Row Data Bit 7    U4-7 */
/* DDRC	        EQU	$07	PORTC data direction register 1=output 0=input
   DDRCINT   	equ	$FF	Initial setting for data direction port c */

/* DDRD		equ	$09		address of port D data direction register
   DDRDINT   	equ	$15		Initial setting for data direction port d */

/* #############################################
   ### PORT E parallel INPUT bit definitions ###
   ############################################# */
#define BOOT_SEL    0x1            /* Monitor/EEPROM Boot select 1=EEprom */
#define SPARE_IE_2  0x2            /* spare input ports */
#define SPARE_IE_3  0x4            /* spare input ports */
#define SPARE_IE_4  0x8            /* spare input ports */
#define SPARE_IE_5  0x10           /* spare input ports */
#define TOP_PHASE_A 0x20           /* Top Pot Phase A P1-1 (pup) */
#define TOP_PHASE_B 0x40           /* Top Pot Phase B P1-2 (pup) */
#define TOP_BUTTON  0x80           /* Top Pot Button 0=pressed P1-3 (pup) */

/* #############################################################
   ### DRV_STATUS Boolean status array.  Driver status flags ###
   ############################################################# */
struct drv_template {
    unsigned short SEC_BOUNDRY : 1;    /* time_status @ second boundry flag */
    unsigned short MIN_BOUNDRY : 1;    /* time_status @ minute boundry flag */
  }; 

struct com_template {
    unsigned short PREAMBLE_RX : 1;      /* SPI pack preable received flag */
    unsigned short CMD_READY : 1;        /* new host complete command received flag */
    unsigned short SCI_AVAILABLE : 1;    /* SCI receiver character available */
  }; 
