www.pudn.com > efs.rar > fs_ftl_cache.h
#ifndef __FTL_CACHE_H__
#define __FTL_CACHE_H__
/******************************************************************************
* fs_ftl_cache.h
*
* This file declares externally available interface for the FTL cache layer.
*
* Copyright (C) 2006 Qualcomm, Inc. All Rights Reserved
*
*****************************************************************************/
/*=============================================================================
EDIT HISTORY FOR MODULE
This section contains comments describing changes made to the module.
Notice that changes are listed in reverse chronological order.
$Header: //depot/asic/MSMSHARED/services/efs/MSM_EFS.01.02/fs_ftl_cache.h#5 $
$DateTime: 2006/10/12 11:35:50 $
$Author: davidb $
when who what, where, why
-------- --- ----------------------------------------------------------
2006-10-10 yg Changed periodic sync function proto.
2006-09-14 sh Removed unused Benchmark hook.
2006-09-01 yg Fixed compilation issue for non FTL enabled builds.
2006-08-31 dlb Fix RCS header.
2006-07-21 yg Initial file for FTL cache layer
=============================================================================*/
/*
* NOTE:
*
* SECTOR : Is a 512 byte page unit.
* Page : Is the smallest writable unit of the flash device (can be 2k).
*
*/
#include "comdef.h"
#include "fs_ftl.h"
#ifdef FEATURE_EFS_FTL
/******************************************************************************
FUNCTION ftl_cache_init
DESCRIPTION Initialize the FTL Cache layer.
PARAMETERS None
RETURN VALUE 0
******************************************************************************/
int ftl_cache_init (void);
/******************************************************************************
FUNCTION ftl_cache_read
DESCRIPTION Read specified number of sectors from mentioned sector onwards.
Get the contents from either cache or directly from flash
depending on the availability.
PARAMETERS
dn : Currently not used by the FTL layer.
sector : Starting Sector number to read from.
buffer : buffer where read data has to be placed.
count : Number of sectors to read starting from mentioned sector.
RETURN VALUE
0 : Success
Error code : Failure
******************************************************************************/
int ftl_cache_read (uint16 dn, uint32 sector, byte* buffer, uint16 count);
/******************************************************************************
FUNCTION ftl_cache_write
DESCRIPTION Cached Write multiple logical sectors starting from
the specified one.
PARAMETERS
dn : Currently not used by the FTL layer.
sector : Starting Sector number to write to.
buffer : buffer where new data to be written is available.
count : Number of sectors to write starting from mentioned sector.
RETURN VALUE Success / Failure
******************************************************************************/
int ftl_cache_write (uint16 dn, uint32 sector, byte* buffer, uint16 count);
/******************************************************************************
FUNCTION ftl_cache_periodic_sync
DESCRIPTION Do periodic sync. This call will sync one oldest cached block
and return if there are more blocks to sync.
PARAMETERS None
RETURN VALUE
0 : If no more blocks are cached.
1 : If there are more blocks in cache need to be flushed.
******************************************************************************/
int ftl_cache_periodic_sync (void);
/******************************************************************************
FUNCTION ftl_cache_force_sync_all
DESCRIPTION
Sync all the cache contents to flash. This would be done before
power down.
PARAMETERS
None
RETURN VALUE
0 : Success
******************************************************************************/
int ftl_cache_force_sync_all (void);
/******************************************************************************
FUNCTION ftl_cache_get_size
DESCRIPTION Gets the geometry of the FTL device.
PARAMETERS
drive_num : Currently not used by the FTL layer.
pblk_cnt : Pointer to location to store the maximum available number
of Sectors in this device (# of pages in flash term).
ppg_size : Pointer to location to store the page size.
RETURN VALUE 0
******************************************************************************/
int ftl_cache_get_size (uint16 drive_num, uint32* pblk_cnt, uint16* ppg_size);
#endif /* FEATURE_EFS_FTL */
#endif /* __FTL_CACHE_H__ */