/**HEADER********************************************************************
* 
* Copyright (c) 2008 Freescale Semiconductor;
* All Rights Reserved                       
*
* Copyright (c) 1989-2008 ARC International;
* All Rights Reserved
*
*************************************************************************** 
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR 
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
* IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
* THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************
*
* $FileName: mcf52xx_qspi.h$
* $Version : 3.0.2.0$
* $Date    : Mar-12-2009$
*
* Comments:
*
*   This file contains the type definitions for the mcf52xx QSPI module.
*
*END************************************************************************/

#ifndef __mcf52xx_qspi_h__
#define __mcf52xx_qspi_h__

#define __mcf52xx_qspi_h__version "$Version:3.0.2.0$"
#define __mcf52xx_qspi_h__date    "$Date:Mar-12-2009$"

#ifdef __cplusplus
extern "C" {
#endif


/*------------------------------------------------------------------------*/
/*
** QSPI  registers bit set.
*/

/* Bit definitions and macros for MCF52XX_QSPI_QMR */
#define MCF52XX_QSPI_QMR_BAUD(x)                 (((x)&0xFF)<<0)
#define MCF52XX_QSPI_QMR_CPHA                    (0x100)
#define MCF52XX_QSPI_QMR_CPOL                    (0x200)
#define MCF52XX_QSPI_QMR_BITS(x)                 (((x)&0xF)<<0xA)
#define MCF52XX_QSPI_QMR_DOHIE                   (0x4000)
#define MCF52XX_QSPI_QMR_MSTR                    (0x8000)

/* Bit definitions and macros for MCF52XX_QSPI_QDLYR */
#define MCF52XX_QSPI_QDLYR_DTL(x)                (((x)&0xFF)<<0)
#define MCF52XX_QSPI_QDLYR_QCD(x)                (((x)&0x7F)<<0x8)
#define MCF52XX_QSPI_QDLYR_SPE                   (0x8000)

/* Bit definitions and macros for MCF52XX_QSPI_QWR */
#define MCF52XX_QSPI_QWR_NEWQP(x)                (((x)&0xF)<<0)
#define MCF52XX_QSPI_QWR_CPTQP(x)                (((x)&0xF)<<0x4)
#define MCF52XX_QSPI_QWR_ENDQP(x)                (((x)&0xF)<<0x8)
#define MCF52XX_QSPI_QWR_CSIV                    (0x1000)
#define MCF52XX_QSPI_QWR_WRTO                    (0x2000)
#define MCF52XX_QSPI_QWR_WREN                    (0x4000)
#define MCF52XX_QSPI_QWR_HALT                    (0x8000)

/* Bit definitions and macros for MCF52XX_QSPI_QIR */
#define MCF52XX_QSPI_QIR_SPIF                    (0x1)
#define MCF52XX_QSPI_QIR_ABRT                    (0x4)
#define MCF52XX_QSPI_QIR_WCEF                    (0x8)
#define MCF52XX_QSPI_QIR_SPIFE                   (0x100)
#define MCF52XX_QSPI_QIR_ABRTE                   (0x400)
#define MCF52XX_QSPI_QIR_WCEFE                   (0x800)
#define MCF52XX_QSPI_QIR_ABRTL                   (0x1000)
#define MCF52XX_QSPI_QIR_ABRTB                   (0x4000)
#define MCF52XX_QSPI_QIR_WCEFB                   (0x8000)

/* Bit definitions and macros for MCF52XX_QSPI_QAR */
#define MCF52XX_QSPI_QAR_ADDR(x)                 (((x)&0x3F)<<0)
#define MCF52XX_QSPI_QAR_TRANS                   (0)
#define MCF52XX_QSPI_QAR_RECV                    (0x10)
#define MCF52XX_QSPI_QAR_CMD                     (0x20)

/* Bit definitions and macros for MCF52XX_QSPI_QDR */
#define MCF52XX_QSPI_QDR_DATA(x)                 (((x)&0xFFFF)<<0)
#define MCF52XX_QSPI_QDR_CONT                    (0x8000)
#define MCF52XX_QSPI_QDR_BITSE                   (0x4000)
#define MCF52XX_QSPI_QDR_DT                      (0x2000)
#define MCF52XX_QSPI_QDR_DSCK                    (0x1000)
#define MCF52XX_QSPI_QDR_QSPI_CS3                (0x800)
#define MCF52XX_QSPI_QDR_QSPI_CS2                (0x400)
#define MCF52XX_QSPI_QDR_QSPI_CS1                (0x200)
#define MCF52XX_QSPI_QDR_QSPI_CS0                (0x100)


/*
** MCF52XX_QSPI_STRUCT
** QSPI
*/
typedef struct mcf52xx_qspi_struct
{
   uint_16	QMR;			// QSPI mode register
   uint_16	filler1;
   uint_16	QDLYR;			// QSPI delay register
   uint_16	filler2;
   uint_16	QWR;			// QSPI wrap register
   uint_16	filler3;
   uint_16	QIR;			// QSPI interrupt register
   uint_16	filler4;
   uint_16	QAR;			// QSPI address register
   uint_16	filler5;
   uint_16	QDR;			// QSPI data register
   uchar	filler6[42];
} MCF52XX_QSPI_STRUCT, _PTR_ MCF52XX_QSPI_STRUCT_PTR;
typedef volatile struct mcf52xx_qspi_struct _PTR_ VMCF52XX_QSPI_STRUCT_PTR;


#ifdef __cplusplus
}
#endif

#endif  //__mcf52xx_fcan_h__