www.pudn.com > efs.rar > fs_ftl_device.h


/***********************************************************************
 * fs_ftl_device.h
 *
 * FTL device operation wrappers/counters.
 * Copyright (C) 2006 QUALCOMM, Inc.
 *
 * Wrap the main flash operations to make debugging problems easier, as
 * well as to implement counters.
 *
 ***********************************************************************/

/*===========================================================================

                        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_device.h#1 $ $DateTime: 2006/10/12 21:20:47 $ $Author: davidb $

when         who   what, where, why
----------   ---   ---------------------------------------------------------
2006-09-12    yg   Create

===========================================================================*/

#ifndef __FS_FTL_DEVICE_COUNTER_H__
#define __FS_FTL_DEVICE_COUNTER_H__

#include "comdef.h"
#include "flash.h"

#ifdef FEATURE_EFS_FTL

typedef struct __ftl_dev_stat_type
{
  uint32 ftl_read_op_count;
  uint32 ftl_write_op_count;
  uint32 ftl_copy_op_count;
  uint32 ftl_erase_op_count;
  uint32 ftl_read_sector_count;
  uint32 ftl_write_sector_count;
  uint32 ftl_copy_sector_count;
}
ftl_dev_stat_type;

/* Types of ftl categorizations. */
typedef enum {
  FTL_OP_RAW,
  FTL_OP_CACHE,
  FTL_OP_FLASH,
  NUM_FTL_OP_CATEGORIES,
}fs_ftl_op_category ;


/* Standard Flash driver API interface */
uint32 ftl_dev_block_count (fs_device_t dev);
uint32 ftl_dev_block_size (fs_device_t dev);
uint32 ftl_dev_page_size (fs_device_t dev);
int ftl_dev_bad_block_check (fs_device_t dev, block_id block);
int ftl_dev_mark_block_bad (fs_device_t dev, block_id block);
int ftl_dev_write_page (fs_device_t dev, page_id page, void* data);
int ftl_dev_erase_block (fs_device_t dev, block_id block);
int ftl_dev_read_page (fs_device_t dev, page_id page, void* data);
int ftl_dev_is_erased (fs_device_t dev, page_id page);
int ftl_dev_copy_page (fs_device_t dev, page_id src_page, page_id dst_page);
int ftl_dev_get_spare_corrected_bytes (fs_device_t dev);
int ftl_dev_write_page_and_udata (fs_device_t dev, page_id page, void* data,
                                  void* spare_data, uint32 len);
int ftl_dev_read_spare_udata (fs_device_t dev, page_id page, void* spare_ptr,
                              uint32 len);

/* Device counters interface for Cache level and Raw FTL level counters. */
void ftl_device_reset_counters (void);

int ftl_device_write_counter (uint32 sector, uint32 count,
                              fs_ftl_op_category category);

int ftl_device_read_counter (uint32 sector, uint32 count,
                             fs_ftl_op_category category);

void ftl_device_get_stats (ftl_dev_stat_type* op_stats,
                        fs_ftl_op_category category);

#endif  /* FEATURE_EFS_FTL */
#endif  /* __FS_FTL_DEVICE_COUNTER_H__ */