📄 efd_def.h
字号:
/* ###########################################################################
### Intel Confidential
### Copyright (c) Intel Corporation 2007
### All Rights Reserved.
### ----------------------------------------------------------------------
### Project: Intel Flash Driver
###
### Module: efd_def.h
###
### $Archive: $
### $Revision: $
### $Date: $
###
### $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 SUBJECT TO THE TERMS OF THE
### INTEL SOFTWARE LICENSE AGREEMENT.
###
########################################################################### */
#ifndef _EFD_DEF_H_
#define _EFD_DEF_H_
#ifndef TRUE
#define TRUE (1 == 1)
#endif /* TRUE */
#ifndef FALSE
#define FALSE (1 == 0)
#endif /* FALSE */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/*
The source code defines hardware independent datatypes
*/
/*
* If any of the integral types below : UINT8, UINT16, UINT32
* UINT8_PTR, UINT16_PTR, UINT32_PTR have already
* been defined elsewhere, the conflicts must be manually
* resolved to ensure the existing definitions produce
* data types of the proper size and sign. Note that
* this check may not work under all compilers.
*/
typedef unsigned char UINT8; /* 8-bit unsigned integer */
typedef char INT8; /* 8-bit signed integer */
typedef unsigned short UINT16; /* 16-bit unsigned integer */
typedef short INT16; /* 16-bit signed integer */
typedef unsigned long UINT32; /* 32-bit unsigned integer */
typedef long INT32; /* 32-bit signed integer */
typedef UINT8 * UINT8_PTR; /* pointer to 8-bit unsigned integer */
typedef UINT16 * UINT16_PTR; /* pointer to 16-bit unsigned integer */
typedef UINT32 * UINT32_PTR; /* pointer to 32-bit unsigned integer */
/*
The structure describing Device
*/
#pragma pack( push, 1 )
typedef struct
{
UINT16 VendorId; /* Manufacturer Code */
UINT16 DeviceId; /* Device ID Code */
} FLASH_ID;
#pragma pack( pop )
/*
The list of offsets inside CFI table
*/
#define CFI_QRY_OFFSET 0x0
#define CFI_PRI_OFFSET 0x1
#define CFI_CODE( Table, Offset ) (((Table) << 8) | (Offset))
#define CFI_GET_TABLE( Code ) (((UINT16)(Code & 0xFF00)) >> 8)
#define CFI_GET_OFFSET( Code ) ((UINT16)(Code & 0x00FF))
typedef enum {
FLASH_CFI_QRY = CFI_CODE( CFI_QRY_OFFSET, 0x10 ),
FLASH_CFI_CMD_SET_1 = CFI_CODE( CFI_QRY_OFFSET, 0x13 ),
FLASH_CFI_EXT_QRY_ADDR_1 = CFI_CODE( CFI_QRY_OFFSET, 0x15 ),
FLASH_CFI_CMD_SET_2 = CFI_CODE( CFI_QRY_OFFSET, 0x17 ),
FLASH_CFI_EXT_QRY_ADDR_2 = CFI_CODE( CFI_QRY_OFFSET, 0x19 ),
FLASH_CFI_DEVICE_SIZE = CFI_CODE( CFI_QRY_OFFSET, 0x27 ),
FLASH_CFI_BUFFER_SIZE = CFI_CODE( CFI_QRY_OFFSET, 0x2A ),
FLASH_CFI_NUM_ERASE_REGION_X = CFI_CODE( CFI_QRY_OFFSET, 0x2C ),
FLASH_CFI_NUM_ERASE_REGION_1 = CFI_CODE( CFI_QRY_OFFSET, 0x2D ),
FLASH_CFI_SIZE_ERASE_REGION_1 = CFI_CODE( CFI_QRY_OFFSET, 0x2F ),
FLASH_CFI_NUM_ERASE_REGION_2 = CFI_CODE( CFI_QRY_OFFSET, 0x31 ),
FLASH_CFI_SIZE_ERASE_REGION_2 = CFI_CODE( CFI_QRY_OFFSET, 0x33 ),
FLASH_CFI_PRI = CFI_CODE( CFI_PRI_OFFSET, 0x00 ),
FLASH_CFI_MJ_VERSION = CFI_CODE( CFI_PRI_OFFSET, 0x03 ),
FLASH_CFI_MN_VERSION = CFI_CODE( CFI_PRI_OFFSET, 0x04 )
} FLASH_CFI;
/*
ANY = Arbitrary Address
*/
#ifndef ANY_ADDR
#define ANY_ADDR (0x0)
#endif
/*
DBA = Device Base Address
*/
#ifndef DBA_ADDR
#define DBA_ADDR (0x0)
#endif
#ifndef UNREFERENCED_PARAMETER
#define UNREFERENCED_PARAMETER(P) ((void)P)
#endif
#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef POWER_2
#define POWER_2(exp) (1 << (exp))
#endif
#endif /* _EFD_DEF_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -