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

📄 davcghdr.h

📁 FDI Intel开发的FLASH文件系统,功能很强大
💻 H
字号:
/* Copyright (c) 1995-2002 Intel Corporation */
/* Intel Confidential                        */

/* ###########################################################################
###  DAV - Direct Volume Enhancement to FDI
###
###  Module: davcghdr.h - DAV Configuration Header types, 
###                       definitions & prototypes
###
###  $Workfile: davcghdr.h $
###  $Revision: 51 $
###  $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_cfghdr_h  /* sentry header */
#define __dav_cfghdr_h

#include "davmath.h"
/*### Global Declarations
#########################*/
#if (DIRECT_ACCESS_VOLUME == TRUE)

/* Max number of configuration headers available */
#define CFGHDR_MaxConfigurationEntries 15  

/* Configuration Table Entry Structure */
typedef struct
{
     UINT32 Offset;
     UINT32 Status;
}CFGHDR_ConfigurationEntry, __FAR_ * CFGHDR_ConfigurationEntryPtr;

#define Init_CFGHDR_ConfigurationEntry {0xFFFFFFFF, 0xFFFFFFFF}    

#define CFGHDR_ConfigurationEntrySize sizeof(CFGHDR_ConfigurationEntry)

/*## Masks for checking the configuration entry */
/* MASKS */
#define CFGHDR_MASK_ReclaimComplete         0x000000C0
/* Object Modified State Mask */
#define CFGHDR_MASK_ObjectModified          0x00000300
#define CFGHDR_MASK_OffsetStatus            0x0000003C
#define CFGHDR_MASK_ReclaimInProgress       0x0000000C
#define CFGHDR_MASK_ReclaimTableType        0x00000003
#define CFGHDR_MASK_ReclaimEntryState       0x0000000F

/* Object Modified States */
#define CFGHDR_STATUS_ObjectModified        0x00000000
#define CFGHDR_STATUS_ObjectUnModified      0x00000300

/* Reclaim Complete States */
#define CFGHDR_STATUS_ReclaimComplete       0x00000000
#define CFGHDR_STATUS_ReclaimIncomplete     0x000000C0

/* Offset State Values */
#define CFGHDR_STATUS_ValidOffset           0x00000000
#define CFGHDR_STATUS_InvalidOffset         0x00000030

/* Reclaim In Progress States */
#define CFGHDR_STATUS_ReclaimInProgress     0x00000000
#define CFGHDR_STATUS_ReclaimNotInProgress  0x0000000C

/* Reclaim Table Types */
#define CFGHDR_TYPE_ReAllocateTable         0x00000000
#define CFGHDR_TYPE_ReclaimTable            0x00000003
  
/* Reclaim Entry States */
#define CFGHDR_STATE_ReAllocateInProgress   0x00000000
#define CFGHDR_STATE_ReclaimInProgress      0x00000003

/*## Macro for setting Configuration Table Entry fields to unused values */
#define CFGHDR_SetUnusedConfigurationEntry(table_entry) \
   (table_entry).Offset = 0xFFFFFFFF; (table_entry).Status = 0xFFFFFFFF

/*## Macro for checking if Configuration Table Entry is a unused entry */
#define CFGHDR_IsUnusedConfigurationEntry(table_entry) \
   (((table_entry).Offset == 0xFFFFFFFF) && \
    ((table_entry).Status == 0xFFFFFFFF))                                                 
                                                 
/*## Macro for setting/getting the Offset in Configuration Table Entry */
#define CFGHDR_SetOffset(cfg_entry, value) \
   ((cfg_entry).Offset = value)

#define CFGHDR_GetOffset(cfg_entry)        \
   ((cfg_entry).Offset)              /* This was masking the lower 4 bits*/ 
                                     /*   before                         */


/*## Macros for setting/getting the Reclaim Complete State */
#define CFGHDR_SetReclaimComplete(cfg_entry, value) \
   ((cfg_entry).Status = (((cfg_entry).Status &     \
                  ~CFGHDR_MASK_ReclaimComplete) | value))
 
#define CFGHDR_GetReclaimComplete(cfg_entry) \
   ((cfg_entry).Status & CFGHDR_MASK_ReclaimComplete)

/*## Macros for setting/getting the ObjectModified State */
#define CFGHDR_SetObjectModified(cfg_entry, value) \
   ((cfg_entry).Status = (((cfg_entry).Status &     \
                  ~CFGHDR_MASK_ObjectModified) | value))

#define CFGHDR_GetObjectModified(cfg_entry) \
   ((cfg_entry.Status) & CFGHDR_MASK_ObjectModified)


/*## Macros for setting/getting the Offset State */
#define CFGHDR_SetOffsetStatus(cfg_entry, value) \
   ((cfg_entry).Status = (((cfg_entry).Status &     \
                                  ~CFGHDR_MASK_OffsetStatus) | value))
                                  
#define CFGHDR_GetOffsetStatus(cfg_entry) \
   ((cfg_entry).Status & CFGHDR_MASK_OffsetStatus)
   

/*## Macros for setting/getting the Reclaim In Progress State */
#define CFGHDR_SetReclaimInProgress(cfg_entry, value) \
   ((cfg_entry).Status = (((cfg_entry).Status &      \
                              ~CFGHDR_MASK_ReclaimInProgress) | value))
        
#define CFGHDR_GetReclaimInProgress(cfg_entry) \
   (((cfg_entry).Status) & CFGHDR_MASK_ReclaimInProgress)


/*## Macros for setting/getting the Reclaim Table Type */
#define CFGHDR_SetReclaimTableType(cfg_entry, value) \
   ((cfg_entry).Status = (((cfg_entry).Status &      \
                              ~CFGHDR_MASK_ReclaimTableType) | value))
        
#define CFGHDR_GetReclaimTableType(cfg_entry) \
   (((cfg_entry).Status) & CFGHDR_MASK_ReclaimTableType)


/*## Macros for getting the Reclaim Entry State                 */
/*## Note that this is set at the bit level, not multiple bits. */
#define CFGHDR_GetReclaimEntryState(cfg_entry) \
   (((cfg_entry).Status) & CFGHDR_MASK_ReclaimEntryState)


/*## Configuration Header Structure                      */
/*DAV Configuration Structure (Fixed Header Table Entry) */

typedef struct
{
   UINT16     UniqueId1;
   UINT16     word_align1;
   CFGHDR_ConfigurationEntry ReclaimEntries[CFGHDR_MaxConfigurationEntries];
   UINT16     UniqueId2;
   UINT16     word_align2;
   UINT16     HeaderId;
   UINT16     Attr16;
   UINT16     LoSize;
   UINT8      NameSize;
   UINT8      Attr8;
   UINT32     ObjectType;
   UINT32     dword_align;  /* Align structure to paragraph boundary */
} CFGHDR_ConfigHeader, __FAR_ * CFGHDR_ConfigHeaderPtr;

#define CFGHDR_ConfigHeaderSize (sizeof(CFGHDR_ConfigHeader))

/* Create macro that defines the size of the config
 * header information (data).
 */
#define CFGHDR_ConfigTableSize (offsetof(CFGHDR_ConfigHeader, HeaderId))
#define CFGHDR_UniqueId1Offset ((FDI_LastObjectAddress - CFGHDR_ConfigHeaderSize) + 1)
#define CFGHDR_UniqueId2Offset (offsetof(CFGHDR_ConfigHeader, UniqueId2))

/* This is offset past the unique id */

#define CFGHDR_EntryArrayOffset (offsetof(CFGHDR_ConfigHeader, ReclaimEntries))

#define CFGHDR_UniqueIdSize sizeof(UINT16)

#define CFGHDR_UniqueIdentifierValue  0xF0F0

/*### Global Functions
#########################*/

/*## Functions for using a configuration entry */
ERR_CODE CFGHDR_AllocateConfigurationEntry(UINT8_PTR     entry_index_ptr,
                                           CFGHDR_ConfigurationEntryPtr cfg_entry_ptr,
                                           UINT32  reclaim_table_type, BOOLEAN restart);
                                    
ERR_CODE CFGHDR_WriteTableOffset(UINT8 entry_index, UINT32 offset);

ERR_CODE CFGHDR_WriteReclaimComplete(UINT8 entry_index);
                                        
/*## Functions used for restart */
ERR_CODE CFGHDR_ScanConfigurationEntry(UINT8_PTR entry_index_ptr, 
                            CFGHDR_ConfigurationEntryPtr cfg_entry_ptr,
                            FDI_Handle    base_address_of_entry_array, BOOLEAN restart);
                            
ERR_CODE CFGHDR_ConfigurationHeaderReclaim(BOOLEAN restart);
                            

/*## Functions used for initial format */
ERR_CODE CFGHDR_CreateConfigurationHeader(void);

#endif /* sentry */

#endif /* DIRECT_ACCESS_VOLUME */

⌨️ 快捷键说明

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