fdi_type.h
来自「FDI Intel开发的FLASH文件系统,功能很强大」· C头文件 代码 · 共 554 行 · 第 1/2 页
H
554 行
#define FDV_BLOCKCOUNT 16 /* number of data storage blocks */
#define FDV_BLOCK_SIZE 0x20000 /* number of bytes in each block of
* the data volume. */
#define UNIT_GRANULARITY 128 /* minimum unit size in bytes */
#define FDI_QUEUE_SIZE 1024 /* bytes of memory used by queue */
#define FDI_QUEUE_START 0 /* does not require changing */
#define MIN_INSTANCES 3 /* min number in multi-instance unit,
* used to calculate the unit size */
#define BUFFER_SIZE 64 /* size of internal flash buffer */
#define RELOCATE_CODE FALSE /* to have FDI relocate the low-level
* functions, set to TRUE. to have
* the boot loader or application
* relocate the low-level functions,
* set to FALSE. */
#if (RELOCATE_CODE == TRUE)
#define FDI_RAM_START 0x00000000 /* RAM address where low-lvl funcs
* will be copied. If 0, the start
* address will be automatically
* determined. If non-zero the
* non-zero value is assumed to be
* the start address. */
#endif /* RELOCATE_CODE */
#define SYSTEM_THRESHOLD FDI_THRESHOLD /* This defines the free space
* limit before reclaim is requested*/
#define RECL_PRIORITY 190 /* OS priority of reclaim task */
#define RECL_STACK_SIZE 2000 /* stack size of reclaim task */
#define BKGD_PRIORITY 180 /* OS priority of background task */
#define BKGD_STACK_SIZE 3000 /* stack size of background task */
#define NUM_TYPE0_PARMS 100
#define NUM_TYPE1_PARMS 20
#define NUM_TYPE2_PARMS 21
#define NUM_TYPE3_PARMS 22
#define NUM_TYPE4_PARMS 23
#define NUM_TYPE5_PARMS 24
#define NUM_TYPE6_PARMS 25
#define NUM_TYPE7_PARMS 26
#define NUM_TYPE8_PARMS 27
#define NUM_TYPE9_PARMS 28
#define NUM_TYPE10_PARMS 29
#define NUM_TYPE11_PARMS 30
#define NUM_TYPE12_PARMS 31
#define NUM_TYPE13_PARMS 32
/*
* FDI has been optimized to work with the Phone.com UP.Browser(tm). If the
* browser is installed, you should not use Type 14. It is reserved for the
* browser. If the browser is not installed, Type 14 is available to your
* application.
*/
#define NUM_TYPE14_PARMS 33
#if (FILE_MANAGER == TRUE)
/* !!! DO NOT MODIFY DEFINES BELOW IF FILE_MANAGER == TRUE. !!! */
/* !!! NUM_FILES will override user defined values for types !!! */
/* !!! FILE_SUPPORT_INFO_TYPE and FILE_SUPPORT_DATA_TYPE. !!! */
#if ((FILE_SUPPORT_INFO_TYPE == 0) || (FILE_SUPPORT_DATA_TYPE == 0))
#undef NUM_TYPE0_PARMS
#define NUM_TYPE0_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 1) || (FILE_SUPPORT_DATA_TYPE == 1))
#undef NUM_TYPE1_PARMS
#define NUM_TYPE1_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 2) || (FILE_SUPPORT_DATA_TYPE == 2))
#undef NUM_TYPE2_PARMS
#define NUM_TYPE2_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 3) || (FILE_SUPPORT_DATA_TYPE == 3))
#undef NUM_TYPE3_PARMS
#define NUM_TYPE3_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 4) || (FILE_SUPPORT_DATA_TYPE == 4))
#undef NUM_TYPE4_PARMS
#define NUM_TYPE4_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 5) || (FILE_SUPPORT_DATA_TYPE == 5))
#undef NUM_TYPE5_PARMS
#define NUM_TYPE5_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 6) || (FILE_SUPPORT_DATA_TYPE == 6))
#undef NUM_TYPE6_PARMS
#define NUM_TYPE6_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 7) || (FILE_SUPPORT_DATA_TYPE == 7))
#undef NUM_TYPE7_PARMS
#define NUM_TYPE7_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 8) || (FILE_SUPPORT_DATA_TYPE == 8))
#undef NUM_TYPE8_PARMS
#define NUM_TYPE8_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 9) || (FILE_SUPPORT_DATA_TYPE == 9))
#undef NUM_TYPE9_PARMS
#define NUM_TYPE9_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 10) || (FILE_SUPPORT_DATA_TYPE == 10))
#undef NUM_TYPE10_PARMS
#define NUM_TYPE10_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 11) || (FILE_SUPPORT_DATA_TYPE == 11))
#undef NUM_TYPE11_PARMS
#define NUM_TYPE11_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 12) || (FILE_SUPPORT_DATA_TYPE == 12))
#undef NUM_TYPE12_PARMS
#define NUM_TYPE12_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 13) || (FILE_SUPPORT_DATA_TYPE == 13))
#undef NUM_TYPE13_PARMS
#define NUM_TYPE13_PARMS NUM_FILES
#endif
#if ((FILE_SUPPORT_INFO_TYPE == 14) || (FILE_SUPPORT_DATA_TYPE == 14))
#undef NUM_TYPE14_PARMS
#define NUM_TYPE14_PARMS NUM_FILES
#endif
/* !!! DO NOT MODIFY DEFINES ABOVE IF FILE_MANAGER == TRUE. !!! */
/* !!! NUM_FILES will override user defined values for types !!! */
/* !!! FILE_SUPPORT_INFO_TYPE and FILE_SUPPORT_DATA_TYPE. !!! */
#endif
#define NUM_OPEN_PARAMS 16 /* Number of simultaneous open streams
* supported. If FILE_MANAGER is set
* to FALSE, then NUM_OPEN_PARAMS must
* be greater than 0 and less than or
* equal to 127.
* If FILE_MANAGER is set to TRUE,
* then (NUM_OPEN_FILES +
* NUM_OPEN_PARAMS) must be greater
* than 0 and less than or equal to
* 127. */
#define WEARLEVELING_LIMIT 1000 /* difference between most and least
* erased block for reclamation */
/*
* ### FDI abstraction typedefs and macros section:
* ############################################################################
*/
/*
* If your system does not have definition for the following you must define
* them here
*/
/* typedef void * SEM_ID; */
/* E.5.0.708 START */
/* Change PACKED to FDI_PACKED */
#ifndef CUSTOM_SEM_MTX
#define SEM_MTX_ID SEM_ID
#else
typedef struct
{
int current_task_id;
WORD wait_count;
SEM_ID binary_sem;
BYTE used;
BYTE reserved;
} FDI_PACKED(SEM_MTX);
typedef SEM_MTX * SEM_MTX_ID;
#endif
/* E.5.0.708 END */
/*E.5.0.598.START*/
/* Semaphore Routine Macros: */
/*
* TASK_CREATE_DESTROY - If TRUE, FDI can dynamically create and destroy
* the BKGD_Task and the RECL_Task. Customers using operating systems that
* don't allow dynamic creation and destruction of tasks can statically
* define their tasks. Test_GSM will create and destroy these two tasks
* on startup and shutdown if this is FALSE
*/
#define TASK_CREATE_DESTROY TRUE /* default is TRUE */
/*
* SEM_CREATE_DESTROY - If TRUE, FDI can dynamically create and destroy
* the semaphores for background and reclaim. Customers using operating
* systems that don't allow dynamic creation and destruction of semaphores
* can statically define their semaphores. Test_GSM will create and destroy
* these semaphores on startup and shutdown if this is FALSE
*/
#define SEM_CREATE_DESTROY TRUE /* default is TRUE */
/*
* Static tasks and dynamic semaphores is not supported at this time.
* Do not set TASK_CREATE_DESTROY to FALSE and SEM_CREATE_DESTROY to
* TRUE.
*/
/*
* The following macro, OS_MACROS, should initialy be undefined
* for stand alone FDI and customer use. Define it only if the following
* macros are defined else where.
*/
#if(SEM_CREATE_DESTROY == TRUE)
#ifndef OS_MACROS
#define SEM_TRY_WAIT(a) semTake(a, NO_WAIT)
#define SEM_WAIT(a) semTake(a, WAIT_FOREVER)
#define SEM_WAIT_TIME(a,b) semTake(a, b)
#define SEM_POST(a) semGive(a)
#define SEM_BIN_CREATE() semBCreate(SEM_Q_FIFO, SEM_EMPTY)
#define SEM_DESTROY(a) semDelete(a); a = SEM_NULL
#endif /*OS_MACROS*/
#endif /* SEM_CREATE_DESTROY */
#ifndef SEM_MTX_CREATE
#ifndef OS_MACROS
#define SEM_MTX_CREATE() Sem_Mtx_Create()
#define SEM_MTX_POST(a) Sem_Mtx_Post(a)
#define SEM_MTX_TRY_WAIT(a) Sem_Mtx_Try_Wait(a)
#define SEM_MTX_WAIT(a) Sem_Mtx_Wait(a)
#define SEM_MTX_DESTROY(a) Sem_Mtx_Destroy(a); a = SEM_NULL
#define Q_STATIC_SEM_CNT 9
#endif /*OS_MACROS*/
#endif /*SEM_MTX_CREATE*/
#if (TASK_CREATE_DESTROY == TRUE)
#ifndef OS_MACROS
#define SPAWN(a,b,c,d,e) taskSpawn(a,b,c,d,(FUNCPTR)e, 0,0,0,0,\
0,0,0,0,0,0)
#define SPAWN_ERROR ERROR
#define TASK_OPTIONS VX_FP_TASK
#define TASK_DESTROY(a) taskDelete(a); a = 0
#endif /* OS_MACROS */
#endif /*TASK_CREATE_DESTROY*/
/*E.5.0.598.END*/
#ifndef offsetof
#define offsetof(type, member) ((unsigned int)&((type *)0)->member)
#endif
#ifndef mFDI_MemberSize
#define mFDI_MemberSize(type, member) (sizeof(((type *)0)->member))
#endif
#define Current_Task_Pointer() taskIdSelf()
#define Interupt_Level_Set intLevelSet
#define TaskDelay(a) taskDelay(a)
/* size_t is defined in stdio.h. If your OS does not have this
* uncomment the following
*/
/* typedef unsigned int size_t */
/*
* ### Debug section:
* ############################################################################
*/
/*#define writeToFile*/ /* If logMsgs from screen need to be
* logged to a file. If you want the
* timing info logged, you have to
* also uncomment TIMING define
* above */
#ifdef TESTING
#ifdef writeToFile
FILE *rw;
#endif
#endif
/* #define TIMING */ /* uncomment this if timing needs to
* occur - requires FDI_DEVELOPMENT */
/* #define TEST_MSGS 1 */ /* uncomment this to display test
* messages. */
/*
* ### Globaly used includes:
* ############################################################################
*/
#include "fdi_err.h"
#endif /* Sentry Header */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?