📄 attrib.c
字号:
/*
================================================================================
* Texas Instruments OMAP(TM) Platform Software
* (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
*
* Use of this software is controlled by the terms and conditions found
* in the license agreement under which this software has been supplied.
*
================================================================================
*/
//------------------------------------------------------------------------------
//
// File: attrib.c
//
// This file implements OALSetMemoryAttributes function
//
#include <windows.h>
#include <nkintr.h>
#include <ceddk.h>
#include <oal.h>
//
// Defines
//
#define CACHE_MASK 0x0C
#define CACHE_WRITETHRU 0x08
//
// Functions
//
//
// Globals
//
//------------------------------------------------------------------------------
//
// Function: OALSetMemoryAttributes
//
// This function supports setting memory attributes via the CeSetMemoryAttributes
// The only attributes supported are:
//
// PAGE_WRITECOMBINE - Maps to Cache Write Thru / Buffered / No write allocate
//
BOOL
OALSetMemoryAttributes(
LPVOID pVirtAddr, // Virtual address of region
LPVOID pPhysAddrShifted, // PhysicalAddress >> 8 (to support up to 40 bit address)
DWORD cbSize, // Size of the region
DWORD dwAttributes // attributes to be set
)
{
BOOL bResult = FALSE;
OALMSG(OAL_MEMORY&&OAL_VERBOSE, (
L"+OALSetMemoryAttributes()\r\n"
));
// Set the specific atrributes for the given address
switch( dwAttributes )
{
case PAGE_WRITECOMBINE:
// Set the write combine attributes
bResult = NKVirtualSetAttributes(pVirtAddr, cbSize, CACHE_WRITETHRU, CACHE_MASK, &dwAttributes );
break;
default:
// Ignore
break;
}
OALMSG(OAL_MEMORY&&OAL_VERBOSE, (L"-OALSetMemoryAttributes\r\n"));
return bResult;
}
//------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -