original files of m241
This commit is contained in:
@@ -0,0 +1,291 @@
|
||||
/* ftlBm.h - FTL BM/BBM Head File */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012, 2013 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01e,11oct13,ghs Correct compile error (WIND00438400)
|
||||
01d,08jun13,jxu added ftlBmCopy to help copy pages for gc/wl/bbm
|
||||
added a block mark for bbm to identify runtime bad blocks
|
||||
01c,08nov12,jxu added more device geometry info to bm identity.
|
||||
01b,01sep12,jxu rewritten for conceptual integrity.
|
||||
01a,15may12,x_z created.
|
||||
*/
|
||||
|
||||
#ifndef __INCftlBmh
|
||||
#define __INCftlBmh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <private/ftl/ftlLibP.h>
|
||||
#include <drv/mtd/mtd.h>
|
||||
|
||||
/* defines */
|
||||
|
||||
#define BM_STATUS_NOTIFIED 0x0
|
||||
#define BM_STATUS_FORMATTING 0x1
|
||||
#define BM_STATUS_MOUNTED 0x2
|
||||
|
||||
#define AVL_NODE_TO_BBMT_ENTRY(pNode) \
|
||||
CONTAINER_OF(pNode, struct bbmt_entry_ram, avlNode)
|
||||
|
||||
/* erase options */
|
||||
|
||||
#define BM_ERASE_OPT 0x01
|
||||
|
||||
#define BM_MAGIC 0x42424d54 /* 'B' 'B' 'M' 'T' */
|
||||
|
||||
#define BBMT_TYPE_INIT 0
|
||||
#define BBMT_TYPE_ID 0x11
|
||||
#define BBMT_TYPE_START_REPL 0x22
|
||||
#define BBMT_TYPE_CANCEL_REPL 0x33 /* cancel the on-going replacement */
|
||||
#define BBMT_TYPE_FINISH_REPL 0x44 /* runtime bad block table */
|
||||
#define BBMT_TYPE_UNDO_REPL 0x55 /* undo the finished replacement */
|
||||
|
||||
#define BBMT_NUM_COPY 2
|
||||
#define BM_NUM_ID_BLKS 2
|
||||
#define BBMT_NUM_BLK_MARK 8
|
||||
|
||||
#define BBM_FLAG_CHECK_BAD_BLK 0x1 /* check if the error block is bad */
|
||||
|
||||
/* block copy related definitions */
|
||||
|
||||
struct copy_info;
|
||||
typedef int (*COPY_FUNC) (FTL_DESC * pFtl, struct copy_info * pCopyInfo);
|
||||
typedef struct copy_info
|
||||
{
|
||||
FTL_ADDR srcAddr;
|
||||
BOOL multiSrc; /* pages from multiple blocks */
|
||||
FTL_ADDR destAddr;
|
||||
MAP_BLK_INFO destBlkInfo;
|
||||
fpage_t nPages;
|
||||
char * pPageBuf;
|
||||
int flags;
|
||||
COPY_FUNC start; /* callback before read the src page */
|
||||
COPY_FUNC check; /* callback before write to the dest page */
|
||||
long priv; /* private to caller */
|
||||
BOOL stopped; /* stop copy */
|
||||
BOOL skipped; /* TRUE if not copy current page */
|
||||
fpage_t curPageNo; /* last page copied well */
|
||||
fpage_t copiedLast; /* last page copied well */
|
||||
fpage_t copiedPages; /* # of copied pages */
|
||||
fpage_t stopBlankPage; /* stop blank starting from this page */
|
||||
}COPY_INFO;
|
||||
|
||||
#define DECLARE_COPY_INFO(name) \
|
||||
COPY_INFO name = {INVALID_ADDR, FALSE, INVALID_ADDR, INVALID_BLKINFO, \
|
||||
0, NULL, 0, NULL, NULL, 0, FALSE, FALSE, FTL_INVALID_PPN, \
|
||||
FTL_INVALID_PPN, 0, FTL_INVALID_PPN};
|
||||
|
||||
#define ERASE_MARK 0 /* bitflip safe */
|
||||
#define BAD_MARK 0 /* bitflip safe */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef struct blk_mark
|
||||
{
|
||||
UINT8 erase;
|
||||
UINT8 bad;
|
||||
}_FTL_PACK_ALIGN(1) BLK_MARK;
|
||||
|
||||
/* bad block check parameter */
|
||||
|
||||
typedef struct bbmt_blk_mark /* block mark for bbmt blocks */
|
||||
{
|
||||
UINT32 bbmtId; /* bbmt identity */
|
||||
UINT32 crc32; /* checksum of this block mark */
|
||||
}_FTL_PACK_ALIGN(4) BBMT_BLK_MARK;
|
||||
|
||||
typedef struct bbmt_entry /* bad block replacement entry */
|
||||
{
|
||||
UINT32 badBlkNo; /* bad block */
|
||||
UINT32 replBlkNo; /* replacement block */
|
||||
}_FTL_PACK_ALIGN(4) BBMT_ENTRY;
|
||||
|
||||
typedef struct bbmt_header /* bbmt header */
|
||||
{
|
||||
UINT32 magic; /* bbmt magic number */
|
||||
UINT8 extFlags; /* set to 0 if no extension flag is set */
|
||||
UINT8 type; /* replacement or undo-replacement */
|
||||
UINT8 nPagesPerBbmt; /* currently not used */
|
||||
UINT8 copyNo; /* copy number */
|
||||
UINT32 seqNo; /* sequence number */
|
||||
INT32 error; /* error type */
|
||||
UINT32 nBbmtEntry; /* # of bbmt entries */
|
||||
UINT32 bbmtOff; /* offset of the bbmt entries */
|
||||
UINT32 bbmtLen; /* length of the bbmt entries */
|
||||
BBMT_ENTRY newEntry; /* new bbmt entry to be added */
|
||||
UINT8 reserved[4]; /* reserved for future */
|
||||
UINT32 dataChksum; /* checksum of bbmt data */
|
||||
UINT32 hdrChksum; /* checksum of bbmt header */
|
||||
}_FTL_PACK_ALIGN(4) BBMT_HEADER; /* 48 bytes in total */
|
||||
|
||||
typedef struct bbmt_entry_ram /* bbmt entry in ram */
|
||||
{
|
||||
AVL_NODE avlNode; /* node in tree */
|
||||
UINT32 badBlkNo; /* bad block number */
|
||||
UINT32 replBlkNo; /* replacement block number */
|
||||
}BBMT_ENTRY_RAM;
|
||||
|
||||
/* ftl BM (block management) desc */
|
||||
|
||||
typedef struct ftl_bm_desc
|
||||
{
|
||||
DL_NODE bmNode; /* linked to BM list */
|
||||
|
||||
/* FTL information */
|
||||
|
||||
char devName[FTL_DEV_NAME_LEN_MAX + 1];
|
||||
FTL_DESC * pFtlDesc; /* related FTL descriptor */
|
||||
void * pDevDesc; /* descriptor of flash devices */
|
||||
|
||||
UINT32 bmFlag; /* flag for BM and FTL core */
|
||||
UINT32 status; /* BM status */
|
||||
char * pPageBuf; /* page buffer (OOB included) */
|
||||
|
||||
/* geometry information */
|
||||
|
||||
FLASH_TYPE_T flashType; /* flash type */
|
||||
FLASH_CELL_T cellType; /* for nand flash only */
|
||||
|
||||
UINT64 totalSize; /* total size of this device */
|
||||
fpsize_t pageSize; /* page size in bytes */
|
||||
fpsize_t pageSizeShift; /* page size in bytes */
|
||||
fbsize_t blkSize; /* block size in bytes */
|
||||
fpage_t pagesPerBlk; /* number of pages per block */
|
||||
fblock_t blkStart; /* starting block number */
|
||||
fblock_t nBlks; /* total number of flash blocks */
|
||||
fpsize_t oobSize; /* oob size */
|
||||
fpsize_t oobSizeAvail; /* available oob size to FTL */
|
||||
fpsize_t pageOobSize; /* page size plus oob available size */
|
||||
|
||||
fpage_t blkMarkPageNo; /* the page for writting bad mark */
|
||||
fpsize_t blkMarkOffset; /* bad mark offset in the page */
|
||||
|
||||
/* BBM stuff */
|
||||
|
||||
FTL_LOCK_T bbmLock; /* bad block management lock */
|
||||
FTL_LOCK_T bbmTrLock; /* bad block management tree lock */
|
||||
|
||||
fblock_t replBlkStart; /* start block of consecutive */
|
||||
/* replacement blocks */
|
||||
fblock_t nReplBlks; /* number of good replacement blocks */
|
||||
/* in bbm area */
|
||||
|
||||
fblock_t freeReplBlkStart; /* first free block in bbm area */
|
||||
fblock_t freeReplBlkEnd; /* last free block in bbm area */
|
||||
|
||||
fblock_t bbmtBlkStart; /* start block of saving bbmt */
|
||||
|
||||
fblock_t * pStBbt; /* static bad block table */
|
||||
size_t stBadBlkCnt; /* # of bad blocks in bbm area */
|
||||
BBMT_ENTRY * pStBbmt; /* static bad block map table */
|
||||
size_t stBadBlkMapCnt; /* # of bad blocks in non-bbm area */
|
||||
|
||||
AVL_TREE badBlkTree; /* bad block replacment search tree */
|
||||
|
||||
/* address of next bbmt for each copy */
|
||||
|
||||
FTL_ADDR copyInfo[BBMT_NUM_COPY];
|
||||
|
||||
UINT32 seqNo; /* sequence number to track the */
|
||||
/* latest bbmt */
|
||||
|
||||
char * pBbmtBuf; /* buffer */
|
||||
size_t bbmtSize; /* current size of bbmt data */
|
||||
size_t bbmtSizeAl; /* aligned size of bbmt data */
|
||||
|
||||
#ifdef FTL_DEBUG
|
||||
struct {
|
||||
FTL_ATOMIC32_T errorCnt;
|
||||
FTL_ATOMIC32_T writeErrorCnt;
|
||||
FTL_ATOMIC32_T eraseErrorCnt;
|
||||
FTL_ATOMIC32_T eccRecvErrorCnt;
|
||||
FTL_ATOMIC32_T eccIrrecvErrorCnt;
|
||||
FTL_ATOMIC32_T knownEccIrrecvErrorCnt;
|
||||
FTL_ATOMIC32_T unknownErrorCnt;
|
||||
FTL_ATOMIC32_T stBadBlkCnt; /* static bad block */
|
||||
FTL_ATOMIC32_T rtBadBlkCnt; /* run-time bad block */
|
||||
|
||||
FTL_ATOMIC32_T memUseHigh;
|
||||
FTL_ATOMIC32_T memUseCur;
|
||||
}dbgStat;
|
||||
#endif
|
||||
}FTL_BM_DESC;
|
||||
|
||||
/* function declarations */
|
||||
|
||||
STATUS ftlBmSaveId (FTL_DESC * pFtl, FTL_DEV_ID * pFtlId);
|
||||
int ftlFormatBm (void * pBm, size_t sizeBBM, BOOL bPreserve);
|
||||
int ftlMountBm (void * pBm, FTL_DEV_ID * pFtlId);
|
||||
int ftlUnmountBm (FTL_BM_DESC * pBm);
|
||||
int ftlBmNotify (MTD_DESC * pMtdDesc, void * pArg);
|
||||
int ftlBmCleanup (FTL_BM_DESC * pBm);
|
||||
FTL_BM_DESC * ftlBmFind (const char * pFtlDevName);
|
||||
int ftlBmRead (FTL_DESC * pFtl, FTL_ADDR * pFromAddr,
|
||||
size_t dataLen, char * pBuf, int rwFlags);
|
||||
int ftlBmWrite (FTL_DESC * pFtl, FTL_ADDR * pFromAddr,
|
||||
size_t dataLen, char * pBuf, int rwFlags);
|
||||
int ftlBmRW (FTL_DESC * pBm, FTL_ADDR * pFromAddr,
|
||||
size_t dataLen, char * pBuf, int rwFlags);
|
||||
#ifdef obsolete
|
||||
int ftlBmEraseBlk (FTL_DESC * pFtl, fblock_t blkNo, int option);
|
||||
#endif
|
||||
int ftlBmErase (FTL_DESC * pFtl, fblock_t blkNo,
|
||||
fblock_t nBlks, int flags);
|
||||
int ftlBmIsBadBlk (FTL_DESC * pFtl, fblock_t blkNo, int option);
|
||||
int ftlBmFillBlankPages (FTL_DESC * pFtl, FTL_ADDR * pFromAddr,
|
||||
fpage_t nPages, MAP_BLK_INFO * pBlkInfo);
|
||||
int ftlBmIsBlankBlk (FTL_DESC * pFtl, fblock_t blkNo, int flags);
|
||||
int ftlBmIsBlankPage (FTL_DESC * pFtl, FTL_ADDR * pAddr, int option);
|
||||
int ftlBmIsFilledBlankPage (FTL_DESC * pFtl, FTL_ADDR * pAddr, int option);
|
||||
int ftlBmScanPages (FTL_DESC * pFtl, FTL_ADDR * pFromAddr,
|
||||
fpage_t nPages, char * pBuf, FTL_ADDR * pOkAddr,
|
||||
FTL_ADDR * pBlankAddr, int flags);
|
||||
int ftlBmCopyPages (FTL_DESC * pFtl, FTL_ADDR * pDestAddr,
|
||||
FTL_ADDR * pSrcAddr, fpage_t nPages, int flags);
|
||||
int ftlBmCopyBlk (FTL_DESC * pFtl, fblock_t destBlk,
|
||||
fblock_t srcBlk, int flags);
|
||||
UINT16 ftlBmBlkNextFpn (FTL_DESC * pFtl, fblock_t blkNo);
|
||||
|
||||
extern __inline__ MTD_DESC * ftlFindMtd (FTL_BM_DESC * pBm, fblock_t blkNo);
|
||||
int bmIsBlankPage (FTL_BM_DESC * pBm, fblock_t blkNo,
|
||||
fpage_t pageNo);
|
||||
int ftlBbmCleanup (FTL_BM_DESC * pBm);
|
||||
int bbmReplace (FTL_BM_DESC * pBm, BBMT_ENTRY * pBbmtEntry, int error);
|
||||
int bbmBadBlkMap (FTL_BM_DESC * pBm, fblock_t blkNo,
|
||||
fblock_t * pReplBlkNo);
|
||||
int bbmUndoReplace (FTL_BM_DESC * pBm, BBMT_ENTRY * pBbmtEntry, int error);
|
||||
int copyCheckFunc (FTL_DESC * pFtl, COPY_INFO * pInfo);
|
||||
int ftlBmCopy (FTL_DESC * pFtl, COPY_INFO * pInfo);
|
||||
int ftlBmWriteRaw (FTL_BM_DESC * pBm, FTL_ADDR * pFromAddr,
|
||||
size_t dataLen, char * pBuf, int flags);
|
||||
int ftlBmReadRaw (FTL_BM_DESC * pBm, FTL_ADDR * pFromAddr,
|
||||
size_t dataLen, char * pBuf, int flags);
|
||||
int ftlBmCheckSeqPgMap (FTL_DESC * pFtl, fblock_t blkNo, fpage_t pageNo,
|
||||
int nPages);
|
||||
int checkBlank (FTL_BM_DESC * pBm, const char * pBuf, size_t len, int flags);
|
||||
#ifdef FTL_DEBUG
|
||||
int ftlBmCheckBlankPages (FTL_DESC * pFtl, fblock_t blkNo, fpage_t pageNo,
|
||||
int nPages);
|
||||
int ftlBmCheckAnyBlankPages (FTL_DESC * pFtl, fblock_t blkNo, fpage_t pageNo,
|
||||
int nPages);
|
||||
#endif /* FTL_DEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCftlBmh */
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/* ftlCacheP.h - ftl data cache private header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01b,04sep13,jxu turn off the trace of io pattern.
|
||||
01a,15jun12,jxu written.
|
||||
*/
|
||||
|
||||
#ifndef __INCftlCachePh
|
||||
#define __INCftlCachePh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <private/ftl/ftlOsIf.h>
|
||||
#include <private/ftl/ftlLibP.h>
|
||||
|
||||
/* defines */
|
||||
|
||||
/* #define TRACE_IO_PATTERN */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef DL_LIST FBIO_LIST;
|
||||
typedef DL_NODE FBIO_NODE;
|
||||
|
||||
#ifdef TRACE_IO_PATTERN
|
||||
typedef struct io_window
|
||||
{
|
||||
UINT16 start; /* start of this window */
|
||||
UINT16 end; /* end of this window */
|
||||
UINT32 lastHit; /* save the "time" when this window is hit */
|
||||
}IO_WINDOW;
|
||||
#endif /* TRACE_IO_PATTERN */
|
||||
|
||||
typedef struct ftl_data_cache
|
||||
{
|
||||
size_t nPageBufs; /* how many page buffers */
|
||||
void * pPageBuf; /* memory used for flash page buffers in */
|
||||
/* data cache */
|
||||
DL_LIST freeFpioList; /* free fpio list */
|
||||
FTL_ATOMIC32_T nDirtyPageBufs; /* # of dirty page buffers */
|
||||
|
||||
/*
|
||||
* Following two lists are protected by lbn tree lock instead of
|
||||
* data cache lock. It's a little weird, but simplifies things.
|
||||
*/
|
||||
|
||||
FBIO_LIST usedFbioList; /* used fbios */
|
||||
int repPolicy; /* cache replacement policy */
|
||||
|
||||
FTL_LOCK_T dataCacheLock; /* lock for protecting following stuff */
|
||||
|
||||
#ifdef TRACE_IO_PATTERN
|
||||
/* Statistics to help determine the current access pattern */
|
||||
|
||||
int ioPattern; /* random or sequential access pattern */
|
||||
|
||||
/* total I/O count under the current access pattern */
|
||||
|
||||
UINT32 ioCnt;
|
||||
|
||||
/*
|
||||
* If cache miss rate since the last cache hit goes higher than
|
||||
* the threshold, the access pattern is determined as sequential.
|
||||
*/
|
||||
|
||||
int missCnt; /* cache miss rate */
|
||||
int missRateThresh; /* cache miss rate threshold */
|
||||
|
||||
/*
|
||||
* We use a couple of I/O windows to track the changing access
|
||||
* pattern.
|
||||
*/
|
||||
|
||||
UINT16 nIoWindows; /* number of I/O windows */
|
||||
IO_WINDOW * pIoWindows; /* pointer to the I/O windows */
|
||||
UINT16 maxInterval; /* the maximum "time" between two consecutive */
|
||||
/* hits in the same window */
|
||||
#endif /* #ifdef TRACE_IO_PATTERN */
|
||||
}FTL_DATA_CACHE;
|
||||
|
||||
/* function declarations */
|
||||
|
||||
_ftl_inline BOOL ftlIsCacheEnabled (FTL_DESC * pFtl);
|
||||
int ftlCacheInit (FTL_DESC * pFtl);
|
||||
int ftlCacheCleanup (FTL_DESC * pFtl);
|
||||
STATUS ftlCacheFlush (FTL_DESC * pFtl, int option);
|
||||
STATUS ftlCacheDiscard (FTL_DESC * pFtl,
|
||||
FTL_BLK_DISCARD_INFO * pBlkDiscardInfo);
|
||||
int ftlCacheBlkRW(FTL_DESC * pFtl, fblock_t blkAddr,
|
||||
fbsize_t blkOff, fbsize_t ioLen, char * pDataBuf,
|
||||
int rwFlag);
|
||||
_ftl_inline STATUS ftlCacheCheckFlush (FTL_DESC * pFtl);
|
||||
_ftl_inline int fbioCacheDelete (FBIO_LIST * pPool, FBIO_NODE * pNode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCftlCachePh */
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/* ftlFlashIf.h - interfaces between ftl and underlying flash drivers */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01a,15jun12,jxu written.
|
||||
*/
|
||||
|
||||
#ifndef __INCftlFlashIfh
|
||||
#define __INCftlFlashIfh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <private/ftl/ftlOsIf.h>
|
||||
#include <private/ftl/ftlBm.h>
|
||||
#include <private/ftl/ftlLibP.h>
|
||||
|
||||
/* defines */
|
||||
|
||||
/* declarations */
|
||||
|
||||
/* ftl flash interfaces */
|
||||
|
||||
int ftlFlashErase (FTL_BM_DESC * pBm, fblock_t blkNo, int option);
|
||||
int ftlFlashRW (FTL_BM_DESC * pBm, FTL_ADDR * pFromAddr,
|
||||
size_t dataLen, char * pBuf, FTL_ADDR * pErrorAddr,
|
||||
size_t * pRetIoLen, int rwFlag);
|
||||
BOOL ftlIsFactBadBlk (FTL_BM_DESC * pBm, fblock_t blkNo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCftlFlashIfh */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,221 @@
|
||||
/* ftlOsIf.h - FTl OS-dependent definitions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012, 2013 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01b,11oct13,ghs Correct compile error (WIND00438400)
|
||||
01a,29feb12,jxu written.
|
||||
*/
|
||||
|
||||
#ifndef __INCftlOsIfh
|
||||
#define __INCftlOsIfh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <vsbConfig.h>
|
||||
#include <sys/types.h>
|
||||
#include <types/vxTypes.h>
|
||||
#include <memLib.h>
|
||||
#include <ioLib.h>
|
||||
#include <string.h>
|
||||
#include <errnoLib.h>
|
||||
#include <unistd.h>
|
||||
#include <taskLib.h>
|
||||
#include <taskLibCommon.h>
|
||||
#include <semLib.h>
|
||||
#include <semLibCommon.h>
|
||||
#include <avlLib.h>
|
||||
#include <private/memPartLibP.h>
|
||||
#include <dllLib.h>
|
||||
#include <edrLib.h>
|
||||
#include <edrLibCommon.h>
|
||||
#include <private/sigLibP.h> /* _sigCtxSave */
|
||||
#include <cacheLib.h> /* cacheDmaMalloc/Free */
|
||||
#include <vxAtomicLib.h>
|
||||
#include <private/vxAtomicLibP.h> /* _WRS_ATOMIC_XXX() */
|
||||
#include <private/vxPortableP.h> /* vxAtomic64Xxx */
|
||||
#include <tickLib.h> /* tickGet() */
|
||||
|
||||
/* defines */
|
||||
|
||||
#define _ftl_inline extern __inline__
|
||||
#define FTL_LOCK_NULL SEM_ID_NULL
|
||||
#define FTL_LOCK_RW_NULL SEM_ID_NULL
|
||||
#define FTL_SEM_NULL SEM_ID_NULL
|
||||
#define FTL_TASK_NULL TASK_ID_NULL
|
||||
|
||||
/* additional flag for semaphore taking */
|
||||
|
||||
#define FTL_SEM_TAKE_FAIL_PANIC 0x1
|
||||
|
||||
/* memory allocation and free */
|
||||
|
||||
#define FTL_MEM_ALLOC(nBytes) ftlMemAlloc(nBytes)
|
||||
#define FTL_MEM_FREE(pChar) ftlMemFree((char *)pChar)
|
||||
#define FTL_CACHE_DMA_ALLOC(nBytes) ftlCacheDmaMalloc(nBytes)
|
||||
#define FTL_CACHE_DMA_FREE(pChar) ftlCacheDmaFree((char *)pChar)
|
||||
|
||||
/* atomic variable operations */
|
||||
|
||||
#define FTL_ATOMIC32_INC(atomicVar) ftlAtomic32Inc(atomicVar)
|
||||
#define FTL_ATOMIC32_DEC(atomicVar) ftlAtomic32Dec(atomicVar)
|
||||
#define FTL_ATOMIC32_GET(atomicVar) ftlAtomic32Get(atomicVar)
|
||||
#define FTL_ATOMIC32_CLEAR(atomicVar) ftlAtomic32Clear(atomicVar)
|
||||
#define FTL_ATOMIC32_SET(atomicVar, value) ftlAtomic32Set(atomicVar, value)
|
||||
#define FTL_ATOMIC32_ADD(atomicVar, value) ftlAtomic32Add(atomicVar, value)
|
||||
#define FTL_ATOMIC32_SUB(atomicVar, value) ftlAtomic32Sub(atomicVar, value)
|
||||
|
||||
#define FTL_ATOMIC64_GET(atomicVar) ftlAtomic64Get(atomicVar)
|
||||
#define FTL_ATOMIC64_SET(atomicVar, value) ftlAtomic64Set(atomicVar, value)
|
||||
#define FTL_ATOMIC64_ADD(atomicVar, value) ftlAtomic64Add(atomicVar, value)
|
||||
#define FTL_ATOMIC64_SUB(atomicVar, value) ftlAtomic64Sub(atomicVar, value)
|
||||
|
||||
/* task creation and deletion */
|
||||
|
||||
#define FTL_TASK_CREATE(name, prio, option, stackSize, func, pArg) \
|
||||
ftlTaskCreate (name, prio, option, stackSize, func, pArg)
|
||||
#define FTL_TASK_DELETE(taskId) ftlTaskDelete(taskId)
|
||||
|
||||
/* maximum readers for reader/writer lock */
|
||||
|
||||
#define FTL_RW_SEM_MAX_READERS 8
|
||||
|
||||
/* semaphore operations */
|
||||
|
||||
#define FTL_SEM_C_CREATE(initCnt) ftlSemCCreate( \
|
||||
SEM_Q_PRIORITY, initCnt)
|
||||
#define FTL_SEM_B_CREATE(option, initStat) ftlSemBCreate( \
|
||||
option, initStat)
|
||||
|
||||
#define FTL_SEM_TAKE_TRY(semId) ftlSemTakeTry (semId)
|
||||
#define FTL_SEM_TAKE_TIMEOUT (semId, ticks) \
|
||||
ftlSemTake(semId, ticks, 0)
|
||||
#define FTL_SEM_TAKE(semId) \
|
||||
ftlSemTake(semId, WAIT_FOREVER, FTL_SEM_TAKE_FAIL_PANIC)
|
||||
#define FTL_SEM_TAKE_NO_PANIC(semId, ticks) \
|
||||
ftlSemTake(semId, ticks, 0)
|
||||
#define FTL_SEM_GIVE(semId) ftlSemGive(semId)
|
||||
|
||||
#ifdef notyet
|
||||
#define FTL_LOCK_RW_CREATE() ftlSemRWCreate( \
|
||||
SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE, \
|
||||
FTL_RW_SEM_MAX_READERS)
|
||||
#define FTL_LOCK_R(rwLock) ftlSemRTake(rwLock, WAIT_FOREVER)
|
||||
#define FTL_LOCK_W(rwLock) ftlSemWTake(rwLock, WAIT_FOREVER)
|
||||
#define FTL_TRY_LOCK_R(rwLock) ftlSemRTake(rwLock, NO_WAIT)
|
||||
#define FTL_TRY_LOCK_W(rwLock) ftlSemWTake(rwLock, NO_WAIT)
|
||||
#define FTL_UNLOCK_RW(rwLock) ftlSemRWGive(rwLock)
|
||||
#define FTL_LOCK_RW_DELETE(rwLock) ftlSemDelete(rwLock)
|
||||
#else /* !notyet */
|
||||
#define FTL_LOCK_RW_CREATE() FTL_LOCK_CREATE()
|
||||
#define FTL_LOCK_R(rwLock) FTL_LOCK(rwLock)
|
||||
#define FTL_LOCK_W(rwLock) FTL_LOCK(rwLock)
|
||||
#define FTL_TRY_LOCK_R(rwLock) FTL_TRY_LOCK(rwLock)
|
||||
#define FTL_TRY_LOCK_W(rwLock) FTL_TRY_LOCK(rwLock)
|
||||
#define FTL_UNLOCK_RW(rwLock) FTL_UNLOCK(rwLock)
|
||||
#define FTL_LOCK_RW_DELETE(rwLock) FTL_LOCK_DELETE(rwLock)
|
||||
#endif /* notyet */
|
||||
|
||||
/* mutual exclusive lock */
|
||||
|
||||
#define FTL_LOCK_CREATE() ftlSemMCreate( \
|
||||
SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE)
|
||||
#define FTL_LOCK(lock) ftlSemTake(lock, WAIT_FOREVER,\
|
||||
FTL_SEM_TAKE_FAIL_PANIC)
|
||||
#define FTL_TRY_LOCK(lock) ftlSemTake(lock, NO_WAIT, 0)
|
||||
#define FTL_UNLOCK(lock) ftlSemGive(lock)
|
||||
#define FTL_LOCK_DELETE(lock) ftlSemDelete(lock)
|
||||
|
||||
#define FTL_SEM_DELETE(semId) ftlSemDelete(semId)
|
||||
|
||||
#define FTL_DIAGNOSTIC
|
||||
#ifdef FTL_DIAGNOSTIC
|
||||
#define FTL_PANIC(...) ftlPanic(__FILE__, __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
#define FTL_PANIC(...) /* nothing */
|
||||
#endif /* FTL_DIAGNOSTIC */
|
||||
|
||||
#define FTL_TICK_GET() ftlTickGet()
|
||||
#define FTL_SYS_CLK_RATE_GET() ftlSysClkRateGet()
|
||||
|
||||
#define FTL_SET_ERRNO(errNo) ftlSetErrno(errNo)
|
||||
|
||||
/* typedefs */
|
||||
|
||||
typedef SEM_ID FTL_LOCK_RW_T; /* reader/writer lock type */
|
||||
typedef SEM_ID FTL_LOCK_T; /* mutual exclusive lock */
|
||||
typedef SEM_ID FTL_SEM_T; /* mutual exclusive lock */
|
||||
typedef TASK_ID FTL_TASK_T; /* task type */
|
||||
|
||||
typedef atomic32_t FTL_ATOMIC32_T; /* atomic variable */
|
||||
|
||||
#ifdef _WRS_PORTABLE_vxAtomicLib
|
||||
typedef atomic64_t FTL_ATOMIC64_T; /* atomic variable */
|
||||
#else
|
||||
typedef atomic32_t FTL_ATOMIC64_T; /* atomic variable */
|
||||
#endif
|
||||
|
||||
typedef _Vx_ticks_t FTL_TICK_T;
|
||||
|
||||
typedef _Vx_usr_arg_t FTL_USR_ARG_T;
|
||||
|
||||
/* function declarations */
|
||||
|
||||
IMPORT __inline__ void * ftlMemAlloc (size_t nBytes);
|
||||
IMPORT __inline__ int ftlMemFree (char * pMem);
|
||||
IMPORT __inline__ void * ftlCacheDmaMalloc (size_t nBytes);
|
||||
IMPORT __inline__ int ftlCacheDmaFree (char * pMem);
|
||||
IMPORT __inline__ FTL_ATOMIC32_T ftlAtomic32Inc (FTL_ATOMIC32_T * pVar);
|
||||
IMPORT __inline__ FTL_ATOMIC32_T ftlAtomic32Dec (FTL_ATOMIC32_T * pVar);
|
||||
IMPORT __inline__ FTL_ATOMIC32_T ftlAtomic32Clear (FTL_ATOMIC32_T * pVar);
|
||||
IMPORT __inline__ FTL_ATOMIC32_T ftlAtomic32Get (FTL_ATOMIC32_T * pVar);
|
||||
IMPORT __inline__ FTL_ATOMIC32_T ftlAtomic32Set (FTL_ATOMIC32_T * pVar,
|
||||
FTL_ATOMIC32_T value);
|
||||
IMPORT __inline__ FTL_ATOMIC32_T ftlAtomic32Add (FTL_ATOMIC32_T * pVar,
|
||||
FTL_ATOMIC32_T value);
|
||||
IMPORT __inline__ FTL_ATOMIC32_T ftlAtomic32Sub (FTL_ATOMIC32_T * pVar,
|
||||
FTL_ATOMIC32_T value);
|
||||
IMPORT __inline__ FTL_ATOMIC64_T ftlAtomic64Get (FTL_ATOMIC64_T * pVar);
|
||||
IMPORT __inline__ FTL_ATOMIC64_T ftlAtomic64Set (FTL_ATOMIC64_T * pVar,
|
||||
FTL_ATOMIC64_T value);
|
||||
IMPORT __inline__ FTL_ATOMIC64_T ftlAtomic64Add (FTL_ATOMIC64_T * pVar,
|
||||
FTL_ATOMIC64_T value);
|
||||
IMPORT __inline__ FTL_ATOMIC64_T ftlAtomic64Sub (FTL_ATOMIC64_T * pVar,
|
||||
FTL_ATOMIC64_T value);
|
||||
IMPORT __inline__ FTL_TASK_T ftlTaskCreate (char * name, int priority,
|
||||
int options, size_t stackSize, FUNCPTR entryPt,
|
||||
FTL_USR_ARG_T pArg);
|
||||
IMPORT __inline__ int ftlTaskDelete (FTL_TASK_T taskId);
|
||||
IMPORT __inline__ FTL_SEM_T ftlSemMCreate (int options);
|
||||
IMPORT __inline__ FTL_SEM_T ftlSemCCreate (int options, int initCnt);
|
||||
IMPORT __inline__ FTL_SEM_T ftlSemBCreate (int options, int initStat);
|
||||
IMPORT __inline__ int ftlSemDelete (FTL_SEM_T semId);
|
||||
IMPORT __inline__ int ftlSemTakeTry (FTL_SEM_T semId);
|
||||
IMPORT __inline__ int ftlSemTake (FTL_SEM_T semId, FTL_TICK_T ticks, int flags);
|
||||
IMPORT __inline__ int ftlSemGive (FTL_SEM_T semId);
|
||||
IMPORT __inline__ int ftlSysClkRateGet (void);
|
||||
IMPORT __inline__ FTL_TICK_T ftlTickGet (void);
|
||||
IMPORT __inline__ int ftlSetErrno (int errNo);
|
||||
void ftlPanic (const char * file, int line, const char * fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCftlOsIfh */
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
/* ftlUtilP.h - generic ftl utility private header */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
--------------------
|
||||
|
||||
01d,04sep13,jxu turned off debug.
|
||||
01c,20jun13,jxu supported finer control over the debug log
|
||||
01b,30nov12,jxu added endian conversion macros.
|
||||
01a,10aug12,jxu written.
|
||||
*/
|
||||
|
||||
#ifndef __INCftlUtilPh
|
||||
#define __INCftlUtilPh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <private/ftl/ftlOsIf.h>
|
||||
|
||||
|
||||
/* defines */
|
||||
|
||||
/*
|
||||
* as a convention, ftl saves data on flash in little endian order becuase
|
||||
* the first platform it get ready to run is little endian.
|
||||
*/
|
||||
|
||||
#define SWAP16(var16) ((((var16) & 0x00FF) << 8) | \
|
||||
(((var16) & 0xFF00) >> 8))
|
||||
#define SWAP32(var32) ((SWAP16((var32) & 0x0000FFFF) << 16) | \
|
||||
(SWAP16(((var32) & 0xFFFF0000) >> 16)))
|
||||
#define SWAP64(var64) ((SWAP32((var64) & 0x00000000FFFFFFFF) << 32) | \
|
||||
(SWAP32(((var64) & 0xFFFFFFFF00000000) >> 32)))
|
||||
#if _BYTE_ORDER ==_LITTLE_ENDIAN
|
||||
#define FTL_TO_FLASH_LE16(var) (var) /* nothing to do */
|
||||
#define FTL_TO_FLASH_LE32(var) (var) /* nothing to do */
|
||||
#define FTL_TO_FLASH_LE64(var) (var) /* nothing to do */
|
||||
#define FLASH_LE16_TO_FTL(var) (var) /* nothing to do */
|
||||
#define FLASH_LE32_TO_FTL(var) (var) /* nothing to do */
|
||||
#define FLASH_LE64_TO_FTL(var) (var) /* nothing to do */
|
||||
#else
|
||||
#define FTL_TO_FLASH_LE16(var) SWAP16(var)
|
||||
#define FTL_TO_FLASH_LE32(var) SWAP32(var)
|
||||
#define FTL_TO_FLASH_LE64(var) SWAP64(var)
|
||||
#define FLASH_LE16_TO_FTL(var) SWAP16(var)
|
||||
#define FLASH_LE32_TO_FTL(var) SWAP32(var)
|
||||
#define FLASH_LE64_TO_FTL(var) SWAP64(var)
|
||||
#endif /* #if _BYTE_ORDER ==_LITTLE_ENDIAN */
|
||||
|
||||
#define FTL16(var) FLASH_LE16_TO_FTL(var)
|
||||
#define FTL32(var) FLASH_LE32_TO_FTL(var)
|
||||
#define FTL64(var) FLASH_LE64_TO_FTL(var)
|
||||
#define FLASH16(var) FTL_TO_FLASH_LE16(var)
|
||||
#define FLASH32(var) FTL_TO_FLASH_LE32(var)
|
||||
#define FLASH64(var) FTL_TO_FLASH_LE64(var)
|
||||
|
||||
/* CRC */
|
||||
|
||||
#define FTL_INITIAL_CRC32 0xffffffff /* Initial 32 bit FCS value */
|
||||
#define FTL_GOOD_CRC32 0xdebb20e3 /* Good final 32 bit FCS value */
|
||||
|
||||
/* fbio bitmap related helper definitions */
|
||||
|
||||
#define BPB 8 /* bits per byte */
|
||||
#define BMP_SHIFT 3 /* shift of a byte */
|
||||
#define BMP_MASK ((BPB)- 1)
|
||||
|
||||
#ifdef notyet
|
||||
#define RAW_TO_FTL_ADDR(addr64, ftlAddr) do { \
|
||||
ftlAddr.offset = (addr64) & 0xFFFF; \
|
||||
ftlAddr.pageno = ((addr64) >> 16) & 0xFFFF; \
|
||||
ftlAddr.blkNo = ((addr64) >> 32 & 0xFFFFFFFF); \
|
||||
}while(0)
|
||||
#define FTL_TO_RAW_ADDR(addr64, ftlAddr) do { \
|
||||
addr64 = (ftlAddr.offset & 0xFFFF) | \
|
||||
((ftlAddr.pageNo & 0xFFFF) << 16) | \
|
||||
((ftlAddr.blkNo & 0xFFFFFFFF) << 32); \
|
||||
}while(0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* the size of bitmap which tracks the status of each page of a cached
|
||||
* block, whether the page presents in cache or not.
|
||||
*/
|
||||
|
||||
#define BLK_BMP_SIZE(nPages) ((nPages) >> BMP_SHIFT)
|
||||
|
||||
/* AVL library does not provide the function for initializing a avl tree */
|
||||
|
||||
#define AVL_INIT(pTree) do { \
|
||||
pTree = NULL; \
|
||||
}while(0)
|
||||
|
||||
/* helper macros for operating flags */
|
||||
|
||||
#define IS_FLAG_SET(flags, flag) (((flags) & (flag)) == (flag))
|
||||
#define SET_FLAG(flags, flag) ((flags) |= (flag))
|
||||
#define CLEAR_FLAG(flags, flag) ((flags) &= (~(flag)))
|
||||
|
||||
/*
|
||||
* helper macro for iterating a doubly linked list. Note it is not
|
||||
* circular linked list.
|
||||
*/
|
||||
|
||||
#define FTL_DLL_FOREACH(pNode, list) \
|
||||
for (((pNode) = (DLL_FIRST ((list)))); \
|
||||
((pNode) != NULL); \
|
||||
((pNode) = (DLL_NEXT ((pNode)))))
|
||||
|
||||
#define FTL_DLL_FOREACH_INVERSE(pNode, list) \
|
||||
for (((pNode) = (DLL_LAST ((list)))); \
|
||||
((pNode) != NULL); \
|
||||
((pNode) = (DLL_PREVIOUS ((pNode)))))
|
||||
|
||||
#define FTL_TEST
|
||||
|
||||
/* #define FTL_DEBUG */
|
||||
|
||||
#ifdef FTL_DEBUG
|
||||
|
||||
#define DBG_QUIET 0x1 /* quiet */
|
||||
#define DBG_MUST 0x2 /* always print */
|
||||
#define DBG_BUG 0x4 /* fatal error */
|
||||
#define DBG_FATAL 0x8 /* fatal error */
|
||||
#define DBG_ERROR 0x10 /* normal error */
|
||||
#define DBG_WARN 0x20 /* warning */
|
||||
#define DBG_FLOW 0x40 /* monitor where i am */
|
||||
#define DBG_INFO 0x80 /* informative message for debug */
|
||||
#define DBG_MASK 0x7F /* */
|
||||
|
||||
#define DEBUG_MON (DBG_BUG | DBG_FATAL | DBG_ERROR | DBG_WARN)
|
||||
/* monitored debug set */
|
||||
#define DEBUG_DEF (DBG_MUST | DBG_FATAL | DBG_ERROR | DBG_WARN)
|
||||
/* default debug set */
|
||||
#define DEBUG_CFG (DBG_INFO)
|
||||
/* configurable debug set */
|
||||
#define DEBUG_SET (DEBUG_DEF | DEBUG_CFG)
|
||||
|
||||
/*
|
||||
* the highest bit the level controls whether to print the msg for a
|
||||
* module, and the lower bits gives the type of the msg
|
||||
*/
|
||||
#define DEBUG_ON (0x1U << 31)
|
||||
#define DBG_LEVEL(dbgOn, level) (((dbgOn != 0)? DEBUG_ON : 0) | (level))
|
||||
#define DEBUG_ENABLED(level) (((((level) & DEBUG_ON) != 0) && \
|
||||
(((level) & (DEBUG_SET)) != 0)) || \
|
||||
(((level) & DEBUG_DEF) != 0))
|
||||
|
||||
#ifdef obsolete
|
||||
#define FTL_DBG_PRINTF(level, format, args...) do { \
|
||||
if(DEBUG_ENABLED(level)) \
|
||||
{ \
|
||||
dbgLogMonitor (level); \
|
||||
printf ("TID(0x%lx): %d: %s:" format, \
|
||||
(long)taskIdCurrent, __LINE__, __FUNCTION__, \
|
||||
## args); \
|
||||
} \
|
||||
}while(0)
|
||||
#else
|
||||
#define FTL_DBG_PRINTF(level, format, args...) do { \
|
||||
if(DEBUG_ENABLED(level)) \
|
||||
{ \
|
||||
dbgPrintf (level, "TID(0x%lx): %d: %s:" format, \
|
||||
(long)taskIdCurrent, __LINE__, __FUNCTION__, \
|
||||
## args); \
|
||||
} \
|
||||
}while(0)
|
||||
#endif
|
||||
|
||||
/* logMsg is preferred to avoid msg interveling */
|
||||
|
||||
#define FTL_DBG_MSG (level, msg, a1, a2, a3, a4, a5, a6) do { \
|
||||
if(DEBUG_ENABLED (level)) { \
|
||||
dbgLogMonitor (level); \
|
||||
logMsg("%d:%s: "msg, \
|
||||
(_Vx_usr_arg_t)__LINE__, \
|
||||
(_Vx_usr_arg_t)__FUNCTION__, \
|
||||
(_Vx_usr_arg_t)var1, \
|
||||
(_Vx_usr_arg_t)var2, \
|
||||
(_Vx_usr_arg_t)var3, \
|
||||
(_Vx_usr_arg_t)var4); \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define FTL_DBG(level, format, args...) \
|
||||
FTL_DBG_PRINTF(DEBUG_ON | level, format, ## args)
|
||||
|
||||
#define FTL_DBG_I_AM_HERE() FTL_DBG_PRINTF(DBG_FLOW, "I'm here!\n")
|
||||
|
||||
#define FTL_PARAM_CHECK_RETURN(var, value, retVal) do { \
|
||||
if ((var) == (value)) return ((retVal)); \
|
||||
}while(0)
|
||||
|
||||
#define FTL_DBG_ATOMIC32_SET(cnt, value) FTL_ATOMIC32_SET(cnt, value)
|
||||
#define FTL_DBG_ATOMIC32_ADD(cnt, value) FTL_ATOMIC32_ADD(cnt, value)
|
||||
#define FTL_DBG_ATOMIC32_SUB(cnt, value) FTL_ATOMIC32_SUB(cnt, value)
|
||||
#define FTL_DBG_ATOMIC64_SET(cnt, value) FTL_ATOMIC64_SET(cnt, value)
|
||||
#define FTL_DBG_ATOMIC64_ADD(cnt, value) FTL_ATOMIC64_ADD(cnt, value)
|
||||
#define FTL_DBG_ATOMIC64_SUB(cnt, value) FTL_ATOMIC64_SUB(cnt, value)
|
||||
#define FTL_DBG_VAR_SET(var, value) ((var) = (value))
|
||||
#define FTL_DBG_VAR_ADD(var, value) ((var) += (value))
|
||||
#define FTL_DBG_VAR_SUB(var, value) ((var) -= (value))
|
||||
|
||||
#else /* !FTL_DEBUG */
|
||||
|
||||
#define FTL_PARAM_CHECK_RETURN(var, value, retVal) /* nothing */
|
||||
#define FTL_DBG_I_AM_HERE() /* nothing */
|
||||
#define FTL_DBG_MSG(level, format, a1, a2, a3, a4, a5, a6) /* nothing */
|
||||
#define FTL_DBG_PRINTF(level, format, args...) /* nothing */
|
||||
#define FTL_DBG FTL_DBG_PRINTF
|
||||
#define FTL_DBG_ATOMIC32_SET(cnt, value) /* nothing */
|
||||
#define FTL_DBG_ATOMIC32_ADD(cnt, value) /* nothing */
|
||||
#define FTL_DBG_ATOMIC32_SUB(cnt, value) /* nothing */
|
||||
#define FTL_DBG_ATOMIC64_SET(cnt, value) /* nothing */
|
||||
#define FTL_DBG_ATOMIC64_ADD(cnt, value) /* nothing */
|
||||
#define FTL_DBG_ATOMIC64_SUB(cnt, value) /* nothing */
|
||||
#define FTL_DBG_VAR_SET(var, value) /* nothing */
|
||||
#define FTL_DBG_VAR_ADD(var, value) /* nothing */
|
||||
#define FTL_DBG_VAR_SUB(var, value) /* nothing */
|
||||
|
||||
#endif /* #ifdef FTL_DEBUG */
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
_ftl_inline BOOL bmpTest (UINT8 * addr, UINT32 bitPos);
|
||||
_ftl_inline BOOL bmpIsAllClear (UINT8 * addr, UINT32 length);
|
||||
_ftl_inline void bmpSet (UINT8 * addr, UINT32 bitPos);
|
||||
_ftl_inline void bmpClear (UINT8 * addr, UINT32 bitPos);
|
||||
_ftl_inline int bmpFfsLsb (UINT8 * addr, UINT32 length);
|
||||
_ftl_inline int bmpFfsLsbHint (UINT8 * addr, UINT32 length, UINT32 hintPos);
|
||||
|
||||
UINT32 ftlChkSum (const char * data, UINT32 crcIn, size_t size);
|
||||
UINT32 ftlCrc32 (const char * data, UINT32 crcIn, size_t size);
|
||||
UINT8 ftlCrc8 (const char * data, size_t size);
|
||||
|
||||
#ifdef FTL_DEBUG
|
||||
int dbgLogMonitor (unsigned logLevel);
|
||||
int dbgPrintf (unsigned logLevel, const char * fmt, ...);
|
||||
int dbgLogDump (const char * pFileName);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __INCftlUtilPh */
|
||||
|
||||
Reference in New Issue
Block a user