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

📄 hw.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
字号:
/* -*- c-file-style: "img" -*-
<module>
 * Name         : hw.c
 * Title        : Hardware Register Access
 * Author       : Marcus Shawcroft
 * Created      : 14 May 2003
 *
 * Copyright    : 2003 by Imagination Technologies Limited.
 *                All rights reserved.  No part of this software, either
 *                material or conceptual may be copied or distributed,
 *                transmitted, transcribed, stored in a retrieval system
 *                or translated into any human or computer language in any
 *                form by any means, electronic, mechanical, manual or
 *                other-wise, or disclosed to third parties without the
 *                express written permission of Imagination Technologies
 *                Limited, Unit 8, HomePark Industrial Estate,
 *                King's Langley, Hertfordshire, WD4 8LZ, U.K.
 *
 * Description :
 *
 * Implements basic access to core registers.
 * 
 * Platform     : ALL
 *
</module>
*/

#ifndef _HW_H_
#define _HW_H_

#include "img_defs.h"
#include "hostfunc.h"

#define MBX1_GLOBREG_MMU_PAGE0_ADDR  0x1000
#define MBX1_GLOBREG_MMU_PAGE1_ADDR  0x1004
#define MBX1_GLOBREG_MMU_PAGE2_ADDR  0x1008
#define MBX1_GLOBREG_MMU_PAGE3_ADDR  0x100c
#define MBX1_GLOBREG_MMU_PAGE4_ADDR  0x1010
#define MBX1_GLOBREG_MMU_PAGE5_ADDR  0x1014
#define MBX1_GLOBREG_MMU_PAGE6_ADDR  0x1018
#define MBX1_GLOBREG_MMU_PAGE7_ADDR  0x101c
#define MBX1_GLOBREG_MMU_ENABLE      0x1020
#define MBX1_GLOBREG_MMU_IDX_INVAL   	 0x1024
#define MBX1_GLOBREG_MMU_PHYSADD_INVAL   0x1028

#define MMU_ENABLE_MASK              (1<< 0)
#define MMU_INVALIDATE_MASK          (1<< 8)
#define MMU_READY_MASK               (1<<16)
#define MMU_INVAL_STATUS_MASK        (1<<24)

#define MBX1_CONFIGURATION_MMU_PRESENT	(0x00000002)


#define MBX1_MMU_IDX_INVAL_TAG_SHIFT		(8)

#define MBX1_MMU_IDX_INVAL_INDEX_SHIFT		(0)

#define MBX1_MMU_PHYSADD_INVAL_ADDR_SHIFT	(12)


struct device_tag
{
	volatile IMG_UINT32 *pRegisters;
	volatile IMG_UINT32 *p2DSlaveport;
	IMG_BOOL bHaveMMU;
};

/*----------------------------------------------------------------------------
<function>
	FUNCTION:   HW_Define

	PURPOSE:    Initialise a device descriptor.
	                	
	PARAMETERS:	Out: pDev - pointer to an empty device descriptor.
	            In:  registers - host virtual address of device registers.
	            In: slaveports - cpu virtual address for the slaveports.
    			In: ui32CoreConfig - the configuration word of the device.
	RETURNS:	None.
</function>
------------------------------------------------------------------------------*/
void
HW_Define (	struct device_tag *pDev, 
			IMG_CPU_VIRTADDR registers,
			IMG_CPU_VIRTADDR slaveports,
			IMG_UINT32       ui32CoreConfig);

/*----------------------------------------------------------------------------
<function>
	FUNCTION:   HW_ReadReg

	PURPOSE:    Read a register.
	                	
	PARAMETERS:	In:  pDev - device descriptor.
	            In:  uOffset - register offset.
	RETURNS:	Out: read register value.
</function>
-----------------------------------------------------------------------------*/
IMG_UINT32
HW_ReadReg (struct device_tag* pDev, IMG_UINT32 uOffset);

/*----------------------------------------------------------------------------
<function>
	FUNCTION:   HW_WriteReg

	PURPOSE:    Write a register.
	                	
	PARAMETERS:	In:  pDev - device descriptor.
	            In:  uOffset - register offset.
	            In:  uValue - register value to write.
	RETURNS:	None.
</function>
-----------------------------------------------------------------------------*/
void 
HW_WriteReg (struct device_tag* pDev, unsigned uOffset, IMG_UINT32 uValue);

/*----------------------------------------------------------------------------
<function>
	FUNCTION:   HW_ModifyReg

	PURPOSE:    Modify a register.
	                	
	PARAMETERS:	In:  pDev - device descriptor.
	            In:  uOffset - register offset.
	            In:  uMask - mask of bits to modify.
	            In:  uValue - register value to write.
	RETURNS:	None.
</function>
-----------------------------------------------------------------------------*/
void 
HW_ModifyReg (struct device_tag* pDev,
			  IMG_UINT32 uOffset,
			  IMG_UINT32 uMask,
			  IMG_UINT32 uValue);

/*----------------------------------------------------------------------------
<function>
	FUNCTION:   HW_Write2DSlavePort

	PURPOSE:    Write to 2D slave port.
	                	
	PARAMETERS:	In:  pDev - device descriptor.
	            In:  uValue - register value to write.
	RETURNS:	None.
</function>
-----------------------------------------------------------------------------*/
void 
HW_Write2DSlavePort (struct device_tag* pDev, IMG_UINT32 uValue);

/*----------------------------------------------------------------------------
<function>
	FUNCTION:   HW_FlushFifo

	PURPOSE:    Flush the contents of the slaveport fifo.

	PARAMETERS:	In:  pDev - device descriptor.
	RETURNS:	None.
</function>
-----------------------------------------------------------------------------*/
void
HW_FlushFifo (struct device_tag *pDev);

#endif

⌨️ 快捷键说明

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