📄 davmath.h
字号:
/* Copyright (c) 1995-2002 Intel Corporation */
/* Intel Confidential */
/* ###########################################################################
### DAV - Direct Access Volume Enhancement for FDI
###
### Module: davmath.h - DAV Math Types & Macros Include File
###
### $Workfile: davmath.h $
### $Revision: 48 $
### $NoKeywords: $
########################################################################### */
/*
*****************************************************************
* NOTICE OF LICENSE AGREEMENT
*
* This code is provided by Intel Corp., and the use is governed
* under the terms of a license agreement. See license agreement
* for complete terms of license.
*
* YOU MAY ONLY USE THE SOFTWARE WITH INTEL FLASH PRODUCTS. YOUR
* USE OF THE SOFTWARE WITH ANY OTHER FLASH PRODUCTS IS EXPRESSLY
* PROHIBITED UNLESS AND UNTIL YOU APPLY FOR, AND ARE GRANTED IN
* INTEL'S SOLE DISCRETION, A SEPARATE WRITTEN SOFTWARE LICENSE
* FROM INTEL LICENSING ANY SUCH USE.
*****************************************************************
*/
#ifndef __dav_math_h /* sentry header */
#define __dav_math_h
#if (DIRECT_ACCESS_VOLUME == TRUE)
/*### Global Declarations
#########################*/
/*### */
/*### Handle Alignment Macros */
/*### */
#define ParagraphAlign(handle) ((handle) & 0xFFFFFFF0)
#define ParagraphInc(handle) ((handle) + 0x10)
#define ParagraphDec(handle) ((handle) - 0x10)
#define ParagraphMask(handle) ((handle) & 0xF)
/*### */
/*### Page Alignment macros */
/*### */
#define PageMask (-FDI_PageSize)
#define PageAlign(handle) ((handle) & PageMask)
#define Page2Para(page) ((page) * FDI_ParagraphsPerPage)
#define Bytes2Para(byte_count) DivRoundup(byte_count, FDI_ParagraphLength)
/*### */
/*### Block Alignment & Conversions */
/*### Block numbers run from 0...n, where n is total blocks - 1 */
/*### */
#define Handle2Block(handle) \
(((handle) - FDI_StartAddress) / FDI_BlockSize)
#define Block2Handle(block_num) \
(((block_num) * FDI_BlockSize) + FDI_StartAddress)
UINT32 BlockAlign(UINT32 address); /**/
/*#define BlockAlign(handle) \ **/
/* (((handle) / FDI_BlockSize) * FDI_BlockSize) **/
#define RoundUp(value, round_to) \
(DivRoundup(value, round_to) * round_to)
/*### */
/*### Byte 2 DWord Alignment Macro's */
/*### */
#define Bytes2Align2DWord(addr32) (~(addr32 + 1) & 0x3)
/*### Global Functions
#########################*/
UINT32 DivRoundup(UINT32 numerator, UINT32 divisor);
int IsInBlock(FDI_Handle lo_addr, FDI_Handle hi_addr, UINT32 block_num);
int GetInBlockHiLoAddress(UINT32_PTR lo_addr_ptr,
UINT32_PTR hi_addr_ptr,
UINT32 block_num);
#endif /* sentry */
#endif /* DIRECT_ACCESS_VOLUME */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -