/************************************************************
 *  File Name:  AVICDriver.h
 *
 *  Version: V1.0
 *
 *  Requirements:
 *      AVIC
 *
 *  Description:
 *      This file contains the AVIC Driver definitions.
 *
 *  History:
 *
 *      Original          24-MAY-2001        R. Caldbeck
 *
 *
 ************************************************************/


#ifndef _AVICDRIVER_H
#define _AVICDRIVER_H

#include "system.h"
#include "m_QSMCM.h"



#define QSM_BASE (0x305000)    /* QSM Base Address */
#define QSM_SCC1R1   (* (REG16 *) (QSM_BASE+0x0a))
#define QSM_SC1SR    (* (REG16 *) (QSM_BASE+0x0c))
#define QSM_SC1DR    (* (REG16 *) (QSM_BASE+0x0e))
#define QSM_SCC2R1   (* (REG16 *) (QSM_BASE+0x22))
#define QSM_SC2SR    (* (REG16 *) (QSM_BASE+0x24))
#define QSM_SC2DR    (* (REG16 *) (QSM_BASE+0x26))


#define QSIZE 200         /* Queue size, in bytes */

typedef struct {
    UINT16 first;         /* Queue pointer for start of unprocessed bytes */
    UINT16 next;          /* Queue pointer for storage of next rcv'd byte */
    UINT32 rtc[QSIZE];    /* Array of RTC (Real-time Clock) values */
    UINT8  faults[QSIZE]; /* Array of fault values (NF,FE,PF) */
    UINT8  queue[QSIZE];  /* Array of received bytes */
} AVICDriverReceiveQueueStruct;

typedef struct {
    UINT16 next;          /* Queue pointer for next byte to transmit */
    UINT16 last;          /* Queue pointer for last byte to transmit */
    UINT8  queue[QSIZE];  /* Array of bytes to transmit */
} AVICDriverTransmitQueueStruct;



/* TX/RX queue structures */
extern AVICDriverReceiveQueueStruct AVICDriver_RXbuff1;
extern AVICDriverReceiveQueueStruct AVICDriver_RXbuff2;
extern AVICDriverTransmitQueueStruct AVICDriver_TXbuff1;
extern AVICDriverTransmitQueueStruct AVICDriver_TXbuff2;


void AVICDriver_Initialize (QSMCM * const AVIC);


#endif /* ifndef _AVICDRIVER_H  */
