#ifndef _MPC555_QSMCM_H
#define _MPC555_QSMCM_H

#include "system.h"
#include "555.h"

#ifdef  __cplusplus
extern "C" {
#endif

/***********************************************************************=
*****/
/*                              MODULE :QSMCM                           =
    */
/***********************************************************************=
*****/
typedef struct QSMCM_tag {
    union {
        VUINT16 R;
        struct {
            VUINT16 STOP:1;
            VUINT16 FRZ1:1;
              VUINT16:6;
            VUINT16 SUPV:1;
              VUINT16:3;
            VUINT16 IARB:4;
        } B;
    } QSMCR;

    union {
        VUINT16 R;
        VUINT16 B;
    } QTEST;

    union {
        VUINT16 R;
        struct {
              VUINT16:3;
            VUINT16 ILDSCI:5;
              VUINT16:8;
        } B;
    } QDSCI_IL;

    union {
        VUINT16 R;
        struct {
              VUINT16:11;
            VUINT16 ILQSPI:5;
        } B;
    } QSPI_IL;

    union {
        VUINT16 R;
        struct {
            VUINT16 OTHR:1;
            VUINT16 LNKBD:1;
              VUINT16:1;
            VUINT16 SC1BR:13;
        } B;
    } SCC1R0;

    union {
        VUINT16 R;
        struct {
              VUINT16:1;
            VUINT16 LOOPS:1;
            VUINT16 WOMS:1;
            VUINT16 ILT:1;
            VUINT16 PT:1;
            VUINT16 PE:1;
            VUINT16 M:1;
            VUINT16 WAKE:1;
            VUINT16 TIE:1;
            VUINT16 TCIE:1;
            VUINT16 RIE:1;
            VUINT16 ILIE:1;
            VUINT16 TE:1;
            VUINT16 RE:1;
            VUINT16 RWU:1;
            VUINT16 SBK:1;
        } B;
    } SCC1R1;

    union {
        VUINT16 R;
        struct {
              VUINT16:7;
            VUINT16 TDRE:1;
            VUINT16 TC:1;
            VUINT16 RDRF:1;
            VUINT16 RAF:1;
            VUINT16 IDLE:1;
            VUINT16 OR:1;
            VUINT16 NF:1;
            VUINT16 FE:1;
            VUINT16 PF:1;
        } B;
    } SC1SR;

    union {
        VUINT16 R;
        struct {
              VUINT16:7;
            VUINT16 R8_T8:1;
            VUINT16 R7_T7:1;
            VUINT16 R6_T6:1;
            VUINT16 R5_T5:1;
            VUINT16 R4_T4:1;
            VUINT16 R3_T3:1;
            VUINT16 R2_T2:1;
            VUINT16 R1_T1:1;
            VUINT16 R0_T0:1;
        } B;
    } SC1DR;

    VUINT16 res22;
    VUINT16 res23;

    union {
        VUINT16 R;
        struct {
              VUINT16:4;
            VUINT16 QDRXD2:1;
            VUINT16 QDTXD2:1;
            VUINT16 QDRXD1:1;
            VUINT16 QDTXD1:1;
              VUINT16:1;
            VUINT16 QDPCS3:1;
            VUINT16 QDPCS2:1;
            VUINT16 QDPCS1:1;
            VUINT16 QDPCS0:1;
            VUINT16 QDSCK:1;
            VUINT16 QDMOSI:1;
            VUINT16 QDMISO:1;
        } B;
    } PORTQS;

    union {
        VUINT8 R;
        struct {
              VUINT8:1;
            VUINT8 QPAPCS3:1;
            VUINT8 QPAPCS2:1;
            VUINT8 QPAPCS1:1;
            VUINT8 QPAPCS0:1;
              VUINT8:1;
            VUINT8 QPAMOSI:1;
            VUINT8 QPAMISO:1;
        } B;
    } PQSPAR;

    union {
        VUINT8 R;
        struct {
              VUINT8:1;
            VUINT8 QDDPCS3:1;
            VUINT8 QDDPCS2:1;
            VUINT8 QDDPCS1:1;
            VUINT8 QDDPCS0:1;
            VUINT8 QDDSCK:1;
            VUINT8 QDDMOSI:1;
            VUINT8 QDDMISO:1;
        } B;
    } DDRQS;

    union {
        VUINT16 R;
        struct {
            VUINT16 MSTR:1;
            VUINT16 WOMQ:1;
            VUINT16 BITS:4;
            VUINT16 CPOL:1;
            VUINT16 CPHA:1;
            VUINT16 SPBR:8;
        } B;
    } SPCR0;

    union {
        VUINT16 R;
        struct {
            VUINT16 SPE:1;
            VUINT16 DSCKL:7;
            VUINT16 DTL:8;
        } B;
    } SPCR1;

    union {
        VUINT16 R;
        struct {
            VUINT16 SPIFIE:1;
            VUINT16 WREN:1;
            VUINT16 WRTO:1;
            VUINT16 ENDQP:5;
              VUINT16:3;
            VUINT16 NEWQP:5;
        } B;
    } SPCR2;

    union {
        VUINT8 R;
        struct {
              VUINT8:5;
            VUINT8 LOOPQ:1;
            VUINT8 HMIE:1;
            VUINT8 HALT:1;
        } B;
    } SPCR3;

    union {
        VUINT8 R;
        struct {
            VUINT8 SPIF:1;
            VUINT8 MODF:1;
            VUINT8 HALTA:1;
            VUINT8 CPTQP:5;
        } B;
    } SPSR;

    union {
        VUINT16 R;
        struct {
            VUINT16 OTHR:1;
            VUINT16 LNKBD:1;
              VUINT16:1;
            VUINT16 SC2BR:13;
        } B;
    } SCC2R0;

    union {
        VUINT16 R;
        struct {
              VUINT16:1;
            VUINT16 LOOPS:1;
            VUINT16 WOMS:1;
            VUINT16 ILT:1;
            VUINT16 PT:1;
            VUINT16 PE:1;
            VUINT16 M:1;
            VUINT16 WAKE:1;
            VUINT16 TIE:1;
            VUINT16 TCIE:1;
            VUINT16 RIE:1;
            VUINT16 ILIE:1;
            VUINT16 TE:1;
            VUINT16 RE:1;
            VUINT16 RWU:1;
            VUINT16 SBK:1;
        } B;
    } SCC2R1;

    union {
        VUINT16 R;
        struct {
              VUINT16:7;
            VUINT16 TDRE:1;
            VUINT16 TC:1;
            VUINT16 RDRF:1;
            VUINT16 RAF:1;
            VUINT16 IDLE:1;
            VUINT16 OR:1;
            VUINT16 NF:1;
            VUINT16 FE:1;
            VUINT16 PF:1;
        } B;
    } SC2SR;

    union {
        VUINT16 R;
        struct {
              VUINT16:7;
            VUINT16 R8_T8:1;
            VUINT16 R7_T7:1;
            VUINT16 R6_T6:1;
            VUINT16 R5_T5:1;
            VUINT16 R4_T4:1;
            VUINT16 R3_T3:1;
            VUINT16 R2_T2:1;
            VUINT16 R1_T1:1;
            VUINT16 R0_T0:1;
        } B;
    } SC2DR;

    union {
        VUINT16 R;
        struct {
            VUINT16 QTPNT:4;
            VUINT16 QTHFI:1;
            VUINT16 QBHFI:1;
            VUINT16 QTHEI:1;
            VUINT16 QBHEI:1;
              VUINT16:1;
            VUINT16 QTE:1;
            VUINT16 QRE:1;
            VUINT16 QTWE:1;
            VUINT16 QTSZ:4;
        } B;
    } QSCI1CR;

    union {
        VUINT16 R;
        struct {
              VUINT16:3;
            VUINT16 QOR:1;
            VUINT16 QTHF:1;
            VUINT16 QBHF:1;
            VUINT16 QTHE:1;
            VUINT16 QBHE:1;
            VUINT16 QRPNT:4;
            VUINT16 QPEND:4;
        } B;
    } QSCI1SR;

    union {
        VUINT16 R;
        VUINT16 B;
    } SCTQ[16];

    union {
        VUINT16 R;
        VUINT16 B;
    } SCRQ[16];

    VUINT16 RES25[106];

    union {
        VUINT16 R;
        VUINT16 B;
    } RECRAM[32];

    union {
        VUINT16 R;
        VUINT16 B;
    } TRANRAM[32];

    union {
        VUINT8 R;
        struct {
            VUINT8 CONT:1;
            VUINT8 BITSE:1;
            VUINT8 DT:1;
            VUINT8 DSCK:1;
            VUINT8 PCS3:1;
            VUINT8 PCS2:1;
            VUINT8 PCS1:1;
            VUINT8 PCS0:1;
        } B;
    } COMDRAM[32];
} QSMCM;


#define SCI  (*( struct QSMCM_tag *)  (__IMB + 0x305000))
//#define SCI_1  (*(__IMB + 0x305008))
//#define SCI_2  (*(__IMB + 0x305020))


#ifdef  __cplusplus
}
#endif


#endif /* ifndef _MPC555_QSMCM_H  */

