/* 2009-08-20: File added by Sony Corporation */
/*
 * File Name       : /drivers/video/mp200/nts/ntsc.h
 * Function        : NTS MMIO definitions
 * Release Version : Ver 1.00
 * Release Date    : 2008/10/29
 *
 * Copyright (C) NEC Electronics Corporation 2008
 *
 *
 * This program is free software;you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by Free Softwere
 * Foundation; either version 2 of License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warrnty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; If not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */

#ifndef _NTS_H_
#define _NTS_H_


/*****************************************************************************
 * NTSC MMIO definitions
 *****************************************************************************/

#include <asm/arch/hardware.h>
#define NTSC_OFFSET	MP200_NTSC_OFFSET
#define NTSC_BASE	MP200_NTSC_BASE
#define NTSC_SIZE	MP200_NTSC_SIZE


//                                                           R/W   Bit  Reset
/*----------------------------------------------------------------------------
 * Output Settings Register
 */
// Control for NTSC                                          R/W   3:0  0x0
#define NTS_CONTROL             (0x00)

// NTS Output                                                R/W   1:0  0x0
#define NTS_OUT                 (0x04)

// Status for NTSC                                            R    1:0  0x0
#define NTS_STATUS              (0x08)

// AREA Address for Frame Buffer A (Y Plane)                 R/W  31:2  0x0000_0000
#define NTS_YAREAAD_A           (0x0C)

// AREA Address for Frame Buffer B (Y Plane)                 R/W  31:2  0x0000_0000
#define NTS_YAREAAD_B           (0x10)

// AREA Address for Frame Buffer C (Y Plane)                 R/W  31:2  0x0000_0000
#define NTS_YAREAAD_C           (0x14)

// AREA Address for Frame Buffer A (UV Interleave)           R/W  31:2  0x0000_0000
#define NTS_UVAREAAD_A          (0x18)

// AREA Address for Frame Buffer B (UV Interleave)           R/W  31:2  0x0000_0000
#define NTS_UVAREAAD_B          (0x1C)

// AREA Address for Frame Buffer C (UV Interleave)           R/W  31:2  0x0000_0000
#define NTS_UVAREAAD_C          (0x20)

// Horizontal OFFSET Size                                    R/W  12:2  0x0000
#define NTS_HOFFSET             (0x24)

// Frame Select                                              R/W   1:0  0x1
#define NTS_FRAMESEL            (0x28)

/*----------------------------------------------------------------------------
 * Interuppt Setting Register
 */
// Interrupt Status                                           R    4:0  0x0
#define NTS_INTSTATUS           (0x60)

// Interrupt Raw Status                                       R    4:0  0x0
#define NTS_INTRAWSTATUS        (0x64)

// Interrupt Enable Set                                      R/W   4:0  0x0
#define NTS_INTENSET            (0x68)

// Interrupt Enable Clear                                     W    4:0  0x0
#define NTS_INTENCLR            (0x6C)

// Interrupt Status Clear                                     W    4:0  0x0
#define NTS_INTFFCLR            (0x70)

// Error Address                                             R/W  31:0  0x0000_0000
#define NTS_ERRORADR            (0x74)

// NTS Software Reset                                        R/W   0:0  0x0
#define NTS_SWRESET             (0x78)










/*----------------------------------------------------------------------------
 * Output Settings Register
 */
//------------------------------
// NTS_CONTROL
//------------------------------
#define NTS_UPSCALE_BIT		0x00000008
#define NTS_UPSCALE_SFT		0x03
#define NTS_UPSCALE_ON		0x08
#define NTS_UPSCALE_OFF		0x00

#define NTS_OUTMODE_BIT		0x00000004
#define NTS_OUTMODE_SFT		0x02
#define NTS_OUTMODE_PAL		0x04
#define NTS_OUTMODE_NTSC	0x00

#define NTS_CLKPOL_BIT		0x00000002
#define NTS_CLKPOL_SFT		0x01

#define NTS_ENDIAN_BIT		0x00000001
#define NTS_ENDIAN_SFT		0x00
#define NTS_ENDIAN_BIGEN	0x01
#define NTS_ENDIAN_LITTLEEN	0x00

//------------------------------
// NTS_OUT
//------------------------------
#define NTS_NTSOUT_BIT		0x00000003
#define NTS_NTSOUT_SFT		0x00
#define NTS_NTSOUT_ENABLE	0x03
#define NTS_NTSOUT_ENABLE_BLUE	0x02
#define NTS_NTSOUT_ENABLE_BLACK	0x01
#define NTS_NTSOUT_DISABLE	0x00

//------------------------------
// NTS_STATUS
//------------------------------
#define NTS_STATUS_BIT		0x00000003
#define NTS_STATUS_SFT		0x00
#define NTS_STATUS_ENABLE	0x03
#define NTS_STATUS_ENABLE_BLUE	0x02
#define NTS_STATUS_ENABLE_BLACK	0x01
#define NTS_STATUS_DISABLE	0x00

//------------------------------
// NTS_AREAAD
//------------------------------
#define NTS_AREAAD_A		0x00
#define NTS_AREAAD_B		0x04
#define NTS_AREAAD_C		0x08

//------------------------------
// NTS_YAREAAD
//------------------------------
#define NTS_YAREAADR_BIT	0xFFFFFFFF
#define NTS_YAREAADR_SFT	0x00
#define NTS_YAREAADR_ALINE	0x03

//------------------------------
// NTS_UVAREAAD
//------------------------------
#define NTS_UVAREAADR_BIT	0xFFFFFFFF
#define NTS_UVAREAADR_SFT	0x00
#define NTS_UVAREAADR_ALINE	0x03

//------------------------------
// NTS_HOFFSET
//------------------------------
#define NTS_HOFFSET_BIT		0x00001FFF
#define NTS_HOFFSET_SFT		0x00
#define NTS_HOFFSET_ALINE	0x03

//------------------------------
// NTS_FRAMESEL
//------------------------------
#define NTS_AREASTATUS_BIT	0x0000000C
#define NTS_AREASTATUS_SFT	0x02
#define NTS_AREASTATUS_BUFC	0x0C
#define NTS_AREASTATUS_BUFB	0x08
#define NTS_AREASTATUS_BUFA	0x04
#define NTS_AREASTATUS_BUFINIT	0x00

#define NTS_AREASEL_BIT		0x00000003
#define NTS_AREASEL_SFT		0x00
#define NTS_AREASEL_BUFC	0x03
#define NTS_AREASEL_BUFB	0x02
#define NTS_AREASEL_BUFA	0x01
#define NTS_AREASEL_BUFDISABLE	0x00

/*----------------------------------------------------------------------------
 * Interuppt Setting Register
 */
#define INT_UNDERRUN_BIT	0x00000008
#define INT_UNDERRUN_SFT	0x03
#define INT_DMASTOP_BIT		0x00000004
#define INT_DMASTOP_SFT		0x02
#define INT_DMAERR_BIT		0x00000002
#define INT_DMAERR_SFT		0x01
#define INT_NTSVS_BIT		0x00000001
#define INT_NTSVS_SFT		0x00

//------------------------------
// NTS_INTSTATUS
//------------------------------
#define NTS_UNDERRUN_BIT	INT_UNDERRUN_BIT
#define NTS_UNDERRUN_SFT	INT_UNDERRUN_SFT
#define NTS_DMASTOP_BIT		INT_DMASTOP_BIT
#define NTS_DMASTOP_SFT		INT_DMASTOP_SFT
#define NTS_DMAERR_BIT		INT_DMAERR_BIT
#define NTS_DMAERR_SFT		INT_DMAERR_SFT
#define NTS_NTSVS_BIT		INT_NTSVS_BIT
#define NTS_NTSVS_SFT		INT_NTSVS_SFT

//------------------------------
// NTS_INTRAWSTATUS
//------------------------------
#define NTS_UNDERRUNRAW_BIT	INT_UNDERRUN_BIT
#define NTS_UNDERRUNRAW_SFT	INT_UNDERRUN_SFT
#define NTS_DMASTOPRAW_BIT	INT_DMASTOP_BIT
#define NTS_DMASTOPRAW_SFT	INT_DMASTOP_SFT
#define NTS_DMAERRRAW_BIT	INT_DMAERR_BIT
#define NTS_DMAERRRAW_SFT	INT_DMAERR_SFT
#define NTS_NTSVSRAW_BIT	INT_NTSVS_BIT
#define NTS_NTSVSRAW_SFT	INT_NTSVS_SFT

//------------------------------
// NTS_INTENSET
//------------------------------
#define NTS_UNDERRUNEN_BIT	INT_UNDERRUN_BIT
#define NTS_UNDERRUNEN_SFT	INT_UNDERRUN_SFT
#define NTS_DMASTOPEN_BIT	INT_DMASTOP_BIT
#define NTS_DMASTOPEN_SFT	INT_DMASTOP_SFT
#define NTS_DMAERREN_BIT	INT_DMAERR_BIT
#define NTS_DMAERREN_SFT	INT_DMAERR_SFT
#define NTS_NTSVSEN_BIT		INT_NTSVS_BIT
#define NTS_NTSVSEN_SFT		INT_NTSVS_SFT

#define NTS_INTENSET_ALL_BIT   (NTS_UNDERRUNEN_BIT | NTS_DMASTOPEN_BIT | NTS_DMAERREN_BIT | NTS_NTSVSEN_BIT)

//------------------------------
// NTS_INTENCLR
//------------------------------
#define NTS_UNDERRUNMASK_BIT	INT_UNDERRUN_BIT
#define NTS_UNDERRUNMASK_SFT	INT_UNDERRUN_SFT
#define NTS_DMASTOPMASK_BIT	INT_DMASTOP_BIT
#define NTS_DMASTOPMASK_SFT	INT_DMASTOP_SFT
#define NTS_DMAERRMASK_BIT	INT_DMAERR_BIT
#define NTS_DMAERRMASK_SFT	INT_DMAERR_SFT
#define NTS_NTSVSMASK_BIT	INT_NTSVS_BIT
#define NTS_NTSVSMASK_SFT	INT_NTSVS_SFT

#define NTS_INTENCLR_ALL_BIT   (NTS_UNDERRUNMASK_BIT | NTS_DMASTOPMASK_BIT | NTS_DMAERRMASK_BIT | NTS_NTSVSMASK_BIT)

//------------------------------
// NTS_INTFFCLR
//------------------------------
#define NTS_UNDERRUNCLR_BIT	INT_UNDERRUN_BIT
#define NTS_UNDERRUNCLR_SFT	INT_UNDERRUN_SFT
#define NTS_DMASTOPCLR_BIT	INT_DMASTOP_BIT
#define NTS_DMASTOPCLR_SFT	INT_DMASTOP_SFT
#define NTS_DMAERRCLR_BIT	INT_DMAERR_BIT
#define NTS_DMAERRCLR_SFT	INT_DMAERR_SFT
#define NTS_NTSVSCLR_BIT	INT_NTSVS_BIT
#define NTS_NTSVSCLR_SFT	INT_NTSVS_SFT

#define NTS_INTFFCLR_ALL_BIT   (NTS_UNDERRUNCLR_BIT | NTS_DMASTOPCLR_BIT | NTS_DMAERRCLR_BIT | NTS_NTSVSCLR_BIT)

//------------------------------
// NTS_ERRORADR
//------------------------------
#define NTS_ERRADR_BIT		0xFFFFFFFC
#define NTS_FCCLR_SFT		0x02

#define NTS_LOCK_BIT		0x00000001
#define NTS_LOCK_SFT		0x00

//------------------------------
// NTS_SWRESET
//------------------------------
#define NTS_SWRESET_BIT		0x00000001
#define NTS_SWRESET_SFT		0x00
#define NTS_SWRESET_ON		0x01
#define NTS_SWRESET_OFF		0x00



#endif /* _NTS_H_ */
