VLSI Solution Oy / MegaLib Documentation

mapperflash.h

Go to the documentation of this file.
00001 
00016 #ifndef FS_MAP_FLASH
00017 #define FS_MAP_FLASH
00018 
00019 #define FS_MAP_FLASH_PAGE_SIZE 256
00020 
00021 #define FS_MAP_FLASH_MAX_ERASE_PAGES 256
00022 
00023 #ifndef ASM
00024 #include <vstypes.h>
00025 #include <mapper.h>
00026 
00027 struct FsPhysical;
00028 
00030 struct FmfMeta {
00031   u_int16 ecc01;
00032   u_int16 ecc2AndType;
00033   u_int16 reservedAndBadBlock;
00034   u_int16 unused;
00035   u_int32 logicalPageNo;        /* For root node, this is last used */
00036   s_int32 newBranch;            /* Page # for root node, non- -1 for others */
00037 };
00038 
00039 
00040 #define FS_MAP_NON_FULL 4
00041 
00046 struct FsMapperFlash {
00048   struct FsMapper m;
00050   u_int32 root;
00052   s_int16 blocksPerErase;
00054   s_int32 lastUsed;
00056   struct FmfCache *cache;
00058   s_int32 physPages;
00060   s_int32 emptyBlock[FS_MAP_NON_FULL];
00062   s_int16 nonFullLimit;
00064   s_int32 skipped;
00066   s_int32 freed;
00067 };
00068 #endif /* !ASM */
00069 
00070 
00071 
00072 
00073 #ifndef ASM
00074 
00075 struct FsMapper *FsMapFlCreate(struct FsPhysical *physical, u_int16 format);
00077 s_int16 FsMapFlDelete(struct FsMapper *map);
00079 s_int16 FsMapFlRead(struct FsMapper *map, u_int32 firstLogicalBlock,
00080                     u_int16 logicalBlocks, u_int16 *data);
00082 s_int16 FsMapFlWrite(struct FsMapper *map, u_int32 firstLogicalBlock,
00083                      u_int16 logicalBlocks, u_int16 *data);
00086 s_int16 FsMapFlFlush(struct FsMapper *map, u_int16 hard);
00088 s_int16 FsMapFlFree(struct FsMapper *m, u_int32 logicalBlockNo,
00089                     u_int32 logicalBlocks);
00090 
00091 /* Debug functions (fsMapFlDebug.h) */
00092 void FsMapFlDump(struct FsMapper *map, s_int32 maxBlocks);
00093 void FsMapFlCacheDump(struct FsMapper *map);
00094 void FsMapFlPrint(s_int32 page); /* If page == 0, print from root node */
00095 
00096 #ifndef __VSDSP__
00097 #  define memcpyXY memcpy
00098 #  define memcpyYX memcpy
00099 #  define memcpyYY memcpy
00100 #  define memsetY memset
00101 #  define qsorty qsort
00102 #endif
00103 
00104 #endif /* !ASM */
00105 
00106 #endif /* !FS_MAP_FLASH */

All software copyright 2005-2006 VLSI Solution OY. Redistribution of this software is strictly forbidden.