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

📄 davobj.c

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

/* ###########################################################################
###  OBJECT
###
###  Module: davobj.c - Object module for user objects (not for internal)
###
###  $Workfile: davobj.c $
###  $Revision: 2 $
###  $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.                             
 *****************************************************************
 */
 
/*### Include Files
#########################*/
#include "DavLib.h"

#if (DIRECT_ACCESS_VOLUME == TRUE)

#include "davobj.h"

/*### Local Declarations
#########################*/

/*### Global Declarations
#########################*/

/*### Local Functions
#########################*/

#define ExitOnError(status) \
   if (status != ERR_NONE) \
   {  return status;  }

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

/*#################################################################
 ### OBJ_ReadObjectData
 ### 
 ### DESCRIPTION:
 ###   This function will load "aPtr" with the object data.
 ### PARAMETERS:   
 ###   aFlashPtr     - Contains handle(address) of object in flash;
 ###                   this should point at the beginning of the
 ###                   object leader header.
 ###   aPtr          - IN:  Must point to a valid buffer of size aSize.
 ###                   OUT: Object data is stored in the buffer.
 ###   aSize         - Size of object data to read.
 ### 
 ### RETURNS:
 ###   ERR_CODE.
 ###*/ 
ERR_CODE OBJ_ReadObjectData(FDI_Handle aFlashPtr, UINT8* aPtr, UINT32 aSize)
{
   ERR_CODE   status   = ERR_PARAM;

   /* Insure that pointers make sense */
   if(aFlashPtr != 0 && aPtr != 0)
   {
      /* Read the object data */
      status = FLASH_ReadBuffer(aFlashPtr, aPtr, aSize);
      ExitOnError(status);
   }

   return status;
}

/*#################################################################
 ### OBJ_WriteObjectData
 ### 
 ### DESCRIPTION:
 ###   This function will write the object data to flash.
 ### 
 ### PARAMETERS:   
 ###   aHandle    - Contains destination handle(address) for flash.
 ###   aPtr       - Must point to the object data.
 ###   aSize      - Size of the data pointed to by aPtr
 ### RETURNS:
 ###   ERR_CODE.
 ###*/ 
ERR_CODE OBJ_WriteObjectData(FDI_Handle aFlashPtr, UINT8* aPtr, UINT32 aSize)
{
   ERR_CODE status = ERR_NONE;

   /* Insure that pointers make sense */
   if(aFlashPtr != 0 && aPtr != 0)
   {
	   status = FLASH_WriteBuffer(aFlashPtr, aPtr, aSize);
      ExitOnError(status);
   }
   return status;                                            
}

#endif /* DIRECT_ACCESS_VOLUME */

⌨️ 快捷键说明

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