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

📄 mmu.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
字号:
/* -*- c-file-style: "img" -*-
<module>
 * Name         : mmu.h
 * Title        : MMU Management
 * Author       : Marcus Shawcroft
 * Created      : 14 May 2003
 *
 * Copyright    : 2003, 2004 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 low level control of MMU.
 *
 * Platform     : ALL
 *
</module>
 */

#ifndef _MMU_H_
#define _MMU_H_

#include "hostfunc.h"
#include "hw.h"
#include "ra.h"
#include "dual_page.h"

typedef struct _MMU_ MMU;

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

	PURPOSE:    Initialise the mmu module.
	                	
	PARAMETERS:	None
	RETURNS:	IMG_TRUE - Success
	            IMG_FALSE - Failed
</function>
-----------------------------------------------------------------------------*/
IMG_BOOL
MMU_Initialise (void);

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

	PURPOSE:    Finalise the mmu module, deallocate all resources.
	                	
	PARAMETERS:	None.
	RETURNS:	None.
</function>
-----------------------------------------------------------------------------*/
void
MMU_Finalise (void);

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

    PURPOSE:    Create an mmu device.

    PARAMETERS: In: pDev -
                In: pRAState - 
                In: pPager - dual pager pager for working space allocation.
    RETURNS:
</function>
-----------------------------------------------------------------------------*/
MMU *
MMU_Create (struct device_tag *pDev,
            RA_STATE *pRAState,
            DP_PAGER *pPager);

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

	PURPOSE:    Delete an mmu device.
	                	
	PARAMETERS:	In:  pMMU - The mmu to delete.
	RETURNS:	
</function>
-----------------------------------------------------------------------------*/
void
MMU_Delete (MMU *pMMU);

/*----------------------------------------------------------------------------
<function>
    FUNCTION:   MMU_Alloc
    PURPOSE:    Allocate space in an mmu's virtual address space.
    PARAMETERS:	In:  pMMU - MMU to allocate on.
                In:  uSize - Size in bytes to allocate.
                Out: pActualSize - If non null receives actual size allocated. 
                In:  uFlags - Allocation flags.
                In:  uDevVAddrAlignment - Required alignment.
                Out: DevVAddr - Receives base address of allocation.
    RETURNS:	IMG_TRUE - Success
                IMG_FALSE - Failure
</function>
-----------------------------------------------------------------------------*/
IMG_BOOL
MMU_Alloc (MMU *pMMU,
           IMG_SIZE_T uSize,
           IMG_SIZE_T *pActualSize,
           IMG_UINT32 uFlags,
		   IMG_UINT32 uDevVAddrAlignment,
           IMG_DEV_VIRTADDR *pDevVAddr);

/* todo: boilerplate */
void
MMU_Free (MMU *pMMU,
          IMG_DEV_VIRTADDR DevVAddr);

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

	PURPOSE:    Enable an mmu. Establishes pages tables and takes the mmu out
	            of bypass and waits for the mmu to acknowledge enabled.
	                	
	PARAMETERS:	In:  pMMU - the mmu
	RETURNS:	None
</function>
-----------------------------------------------------------------------------*/
void 
MMU_Enable (MMU *pMMU);

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

	PURPOSE:    Disable an mmu, takes the mmu into bypass.
	                	
	PARAMETERS:	In:  pMMU - the mmu
	RETURNS:	None
</function>
-----------------------------------------------------------------------------*/
void 
MMU_Disable (MMU *pMMU);

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

	PURPOSE:    Create a linear mapping for a ranege of pages at a specified
	            virtual address.
	                	
	PARAMETERS:	In:  mmu - the mmu.
	            In:  dev_vaddr - the device virtual address.
	            In:  dev_paddr - the device physical address of the page to map.
	            In:  size - size of memory range in bytes
	RETURNS:	None
</function>
-----------------------------------------------------------------------------*/
void
MMU_MapPages (MMU *pMMU,
			  IMG_DEV_VIRTADDR devVAddr,
			  IMG_DEV_PHYADDR devPAddr,
			  IMG_SIZE_T uSize);

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

	PURPOSE:    Create a mapping for one page at a specified virtual address.
	                	
	PARAMETERS:	In:  pMMU - the mmu.
	            In:  dev_vaddr - the device virtual address.
	            In:  dev_paddr - the device physical address of the page to
	                 map.
	RETURNS:	None
</function>
-----------------------------------------------------------------------------*/
void
MMU_MapPage (MMU *pMMU,
             IMG_DEV_VIRTADDR dev_vaddr,
             IMG_DEV_PHYADDR dev_paddr);

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

	PURPOSE:    Flush a device virtual address range in the MBX MMU.
	                	
	PARAMETERS:	In:  pMMU - the mmu.
	            In:  DevVAddr - base of address range to flush.
	            In:  uSize - extent of address range to flush.
	RETURNS:	None
</function>
-----------------------------------------------------------------------------*/
void
MMU_FlushRange (MMU *pMMU,
                IMG_DEV_VIRTADDR DevVAddr,
                IMG_SIZE_T uSize);

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

	PURPOSE:    Query if a high allocation arena is present.

	PARAMETERS:	In:  mmu - the mmu
	RETURNS:	IMG_TRUE - Present
	            IMG_FALSE - Not present
</function>
-----------------------------------------------------------------------------*/
IMG_BOOL
MMU_HaveHiArena (MMU *pMMU);

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

	PURPOSE:    Query the device virtual address range for the low arena.

	PARAMETERS:	In:  pMMU - the mmu
	RETURNS:	size in bytes
</function>
-----------------------------------------------------------------------------*/
IMG_SIZE_T
MMU_LowArenaVAddrRange (MMU *pMMU);

#endif

⌨️ 快捷键说明

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