⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p2.h

📁 WINDOWS CE BSP用于SBC2440开发板
💻 H
📖 第 1 页 / 共 2 页
字号:
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-2000 Microsoft Corporation.  All rights reserved.

Module Name:  

  p2.h

Abstract:  

  this file provides headers used for the p2 HAL routines

  
Functions:

  
Notes:


Revision History:

--*/

#ifndef _P2_H_
#define _P2_H_

#define READ_REGISTER_ULONG(reg) (*(volatile unsigned long * const)(reg))
#define WRITE_REGISTER_ULONG(reg, val) (*(volatile unsigned long * const)(reg)) = (val)
#define READ_REGISTER_USHORT(reg) (*(volatile unsigned short * const)(reg))
#define WRITE_REGISTER_USHORT(reg, val) (*(volatile unsigned short * const)(reg)) = (val)
#define READ_REGISTER_UCHAR(reg) (*(volatile unsigned char * const)(reg))
#define WRITE_REGISTER_UCHAR(reg, val) (*(volatile unsigned char * const)(reg)) = (val)


/* Defines for Reference Platform control registers */

#undef SYSTEM_ASIC_REGS_BASE
#define SYSTEM_ASIC_REGS_BASE	0xB0000000
//#define DMA_BUFFER_BASE			0xAC000000
//#define DMA_PHYSICAL_BASE		0x30000000  // S3C2410



#define CPU_BASE		(SYSTEM_ASIC_REGS_BASE + 0x00000800)
#define CPU_RR			0x00000008		/* Soft reset register (requires HW mods) */
#define CPU_MR			0x00000004		/* cpu mask register offset */
#define CPU_ISR			0x00000000  		/* cpu interrupt status register offset */

#define CPU_STATUS_BASE		(SYSTEM_ASIC_REGS_BASE + 0x400)


#define CPU_CSR			0x00
#define FLASH_BUSY		0x80
#define FLASH_POWER_DOWN	0x40
#define DISCHARGE_RECHARGE	0x20
#define AUX_POWER_ENABLE	0x10
#define ERROR_LED		0x08
#define BOOT_RESET		0x04
#define DOCKED			0x02
#define POWER_OFF_INTR		0x01

/* 
 * Interrupt bit positions are determined by the slot numbers of 
 * the cards in the system.  This information is in the VHDL file.
 */

#define SYSTEM_INTR		0x00000001  /* PCMCIA or On/Off switch */
#define DEBUG_SER_INTR		0x00000004  /* it is not really used */
#define PRODUCT_SER_INTR	0x00000008
#define IR_INTR			0x00000080
#define ETHER_INTR		0x00000100
#define KEYB_INTR		0x00000040
#define TOUCH_AUDIO_ADC_INTR	0x00000020


/*
 * The "SLOTs" correspond to "Master" fields in the VHDL file
 * They have to be renamed to avoid the confusion.
 */
#define DEBUG_SER_SLOT      0 
#define DISP_SLOT           1	
#define IR_SLOT             3
#define PRODUCT_SER_SLOT    4
#define TOUCH_SOUND_SLOT	   2


/* 
 * Display defines.
 * The address for the display DMA locations on the P2 are the same as the PeRP.
 */

#define DISP_BASE   		(SYSTEM_ASIC_REGS_BASE + 0x1000)
#define DISP_CSR		0x0004		/* offset from display base reg */
#define DISP_XSIZE		0x0008		/* offset from display base reg */
#define DISP_YSIZE		0x000C		/* offset from display base reg */
#define DISP_WR_DMA 		(CPU_BASE + (DISP_SLOT * 2 * 0x10000) + 0x10000)	
#define DISP_DMA_LOW		0x0010
#define DISP_DMA_HIGH		0x0014
#define DISP_CSR		0x0004
#define LCD_BIAS_ON		0x0002
#define LCD_ON			0x0004
#define LCD_DISPLAY_ENABLE	0x0008

// This buff is now offset via a constant
//#define DISP_DMA_BASE		(DMA_BUFFER_BASE + 0x00100000)  // S3c2400x01
//#define DISP_DMA_PHYS		(DMA_PHYSICAL_BASE + 0x00100000)

/* 
 * Serial and IR defines
 */

#define PRODUCT_SER_BASE	(SYSTEM_ASIC_REGS_BASE + 0x4000)		
#define DEBUG_SER_BASE		(SYSTEM_ASIC_REGS_BASE + 0x2000)		
#define IR_BASE		        (SYSTEM_ASIC_REGS_BASE + 0x8000)		

#define SER_CSR_A		0x0000		/* offset from serial base reg */
#define SER_CSR_B		0x0004		/* offset from serial base reg */

#define DEBUG_SER_RX_DMA_LOW    (CPU_BASE + \
				 (DEBUG_SER_SLOT * 2 * 0x10000 + 0x0010))
#define DEBUG_SER_RX_DMA_HIGH   (CPU_BASE + \
				 (DEBUG_SER_SLOT * 2 * 0x10000 + 0x0014))
#define DEBUG_SER_TX_DMA_LOW    (CPU_BASE + \
				 (DEBUG_SER_SLOT * 2 * 0x10000 + 0x10010))
#define DEBUG_SER_TX_DMA_HIGH   (CPU_BASE + \
				 (DEBUG_SER_SLOT * 2 * 0x10000 + 0x10014))

#define PRODUCT_SER_RX_DMA_LOW    (CPU_BASE + \
				 (PRODUCT_SER_SLOT * 2 * 0x10000 + 0x0010))
#define PRODUCT_SER_RX_DMA_HIGH   (CPU_BASE + \
				 (PRODUCT_SER_SLOT * 2 * 0x10000 + 0x0014))
#define PRODUCT_SER_TX_DMA_LOW    (CPU_BASE + \
				 (PRODUCT_SER_SLOT * 2 * 0x10000 + 0x10010))
#define PRODUCT_SER_TX_DMA_HIGH   (CPU_BASE + \
				 (PRODUCT_SER_SLOT * 2 * 0x10000 + 0x10014))


#define IR_RX_DMA_LOW    (CPU_BASE + \
				 (IR_SLOT * 2 * 0x10000 + 0x0010))
#define IR_RX_DMA_HIGH   (CPU_BASE + \
				 (IR_SLOT * 2 * 0x10000 + 0x0014))
#define IR_TX_DMA_LOW    (CPU_BASE + \
				 (IR_SLOT * 2 * 0x10000 + 0x10010))
#define IR_TX_DMA_HIGH   (CPU_BASE + \
				 (IR_SLOT * 2 * 0x10000 + 0x10014))

// serialCsrA's fields:
#define SERA_RX_CHARACTER_INTR	 0x8000
#define SERA_RX_INTR 	    	 0x4000
#define SERA_RX_END_INTR     	 0x2000
#define SERA_RX_FRAME_ERROR_INTR 0x1000
#define SERA_RX_CHANGED_INTR 	 0x0400
#define SERA_RX_OVERRUN_INTR     0x0200
#define SERA_RI                  0x0080
#define SERA_DSR                 0x0040
#define SERA_TX_FULL             0x0020
#define SERA_TX_INTR		 0x0010
#define SERA_TX_END_INTR	 0x0008
#define SERA_CTS                 0x0004
#define SERA_CD                  0x0002
#define SERA_SERIAL_ON           0x0001


#define SERA_INTR_MASK  (SERA_RX_CHARACTER_INTR | SERA_RX_INTR | \
			 SERA_RX_END_INTR | SERA_RX_FRAME_ERROR_INTR | \
			 SERA_RX_CHANGED_INTR | SERA_RX_OVERRUN_INTR | \
			 SERA_TX_INTR | SERA_TX_END_INTR)

// serialCsrB's fields:
#define SERB_SERIAL_POWER 	  0x8000
#define SERB_RX_EN    	          0x4000
#define SERB_TX_EN		  0x2000
#define SERB_TX_STOP_AT_PAGE      0x1000
#define SERB_CTS_FLOW	          0x0800
#define SERB_NOT_SERIAL_RESET     0x0400
#define SERB_RTS                  0x0200
#define SERB_DTR                  0x0100
#define SERB_BREAK                0x0080
#define SERB_STOP_BITS            0x0040
#define SERB_BIT_FORMAT_MASK      0x0030
#define SERB_BAUD_RATE_MASK       0x000f

// The following values are stored in SERB_BAUD_RATE_MASK
#define SER_BAUD_9600   11 
#define SER_BAUD_14400   7 
#define SER_BAUD_19200   5 
#define SER_BAUD_38400   2 
#define SER_BAUD_57600   1
#define SER_BAUD_115200  0

// The following values are stored in SERB_BIT_FORMAT_MASK. 
#define SER_BIT_FORMAT_6 0x20
#define SER_BIT_FORMAT_7 0x10
#define SER_BIT_FORMAT_8 0x00
  
/*
 * Keyboard defines 
 */

#define KB_BASE			(SYSTEM_ASIC_REGS_BASE + 0xc000)		
#define KB_ISR			0x0004		/* offset from keyboard base reg */
#define KB_CSR			0x0000		/* offset from keyboard base reg */
#define KB_INTR_MASK     	0x0001
#define KB_RDRF			0x0001
#define KB_PARITY		0x0100			
#define KB_DATA_RD		0x0200
#define KB_CLK_RD		0x0400
#define KB_DATA_DR		0x0800
#define KB_CLK_DR		0x1000
#define KB_DATA_DR_EN		0x2000
#define KB_CLK_DR_EN		0x4000
#define KB_CLK_EN		0x8000

/* 
 * Touch and Sound defines
 */

// Only define _ONE_ of the following.  If changing Touch/Audio hardware, you
// also _MUST_ make a change in ...\platform\p2\kernel\hal\sh3\fwp2.src
#define TOUCH_AUDIO_CRYSTAL 1
//#define TOUCH_AUDIO_UCB1100 1

#define TOUCH_SOUND_BASE		(SYSTEM_ASIC_REGS_BASE + 0xA000)	
#define IO_ADCCNTR			0x0000
#define IO_ADCSTR			0x0004
#define UCBCNTR				0x0008
#define UCBSTR				0x000C
#define UCBREGISTER			0x0010
#define IO_SOUNDCNTR			0x0014
#define IO_SOUNDSTR			0x0018
#define INTR_MASK			0x001C

/*

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -