📄 flsystem.h
字号:
* memory to handle the Flash media. The required size depends on the media
* being handled.
*
* You may choose to use the standard 'malloc' and 'free' to handle such
* memory allocations, provide your own equivalent routines, or you may
* choose not to define any memory allocation routine. In this case, the
* memory will be allocated statically at compile-time on the assumption of
* the largest media configuration you need to support. This is the simplest
* choice, but may cause your RAM requirements to be larger than you
* actually need.
*
* If you define routines other than malloc & free, they should have the
* same parameters and return types as malloc & free. You should either code
* these routines in flcustom.c or include them when you link your application.
*/
extern void* flmalloc (size_t nBytes);
extern void flfree (void *p);
#define FL_MALLOC(bytes) flmalloc((size_t)(bytes))
#define FL_FREE(p) flfree((p))
/* Debug mode
*
* Customize the various TrueFFS debug print macros, to suite your application needs.
*/
typedef int (*FLMsgHandler) (const char *str, ...);
extern FLMsgHandler tffsMsgHandler; /* pointer to TrueFFS message handler */
extern int tffsMsgSave (const char *msg, ...); /* default TrueFFS message handler */
extern int tffsMsgErrZone; /* active zones for TrueFFS error messages */
extern int tffsMsgWarnZone; /* active zones for TrueFFS warnings */
extern int tffsMsgFlowZone; /* active zones for TrueFFS control flow messages */
extern int tffsMsgBufSize; /* size of diagnostic buffer in KBytes */
#define DBG_PRINT_ERR(zone,str) if(tffsMsgErrZone & zone) tffsMsgHandler(str)
#define DBG_PRINT_ERR_PRM(zone,str) if(tffsMsgErrZone & zone) tffsMsgHandler str
#define DBG_PRINT_WRN(zone,str) if(tffsMsgWarnZone & zone) tffsMsgHandler(str)
#define DBG_PRINT_WRN_PRM(zone,str) if(tffsMsgWarnZone & zone) tffsMsgHandler str
#define DBG_PRINT_FLOW(zone,str) if(tffsMsgFlowZone & zone) tffsMsgHandler(str)
#define DBG_PRINT_FLOW_PRM(zone,str) if(tffsMsgFlowZone & zone) tffsMsgHandler str
/*
* First IOCTL function number
*
* When using TrueFFS' IOCTL functions you have to define the code of the first
* TrueFFS IOCTL function (after that the functions get consecutive increasing numbers).
* This number should be out of the range of the standard IOCTL codes used by your
* operating system.
*
*/
#define FL_IOCTL_START 0x9000
/* Default calling convention
*
* C compilers usually use the C calling convention to routines (cdecl), but
* often can also use the pascal calling convention, which is somewhat more
* economical in code size. Some compilers also have specialized calling
* conventions which may be suitable. Use compiler switches or insert a
* #pragma here to select your favorite calling convention.
*/
/* using compiler's default calling convention */
/* Naming convention
*
* In case the calling application uses a different convention then the one
* used to compile TrueFFS you can use the NAMING_CONVENTION definition.
* The NAMING_CONVENTION definition is added as a qualifier to all TrueFFS
* exported API. A good example is a c++ application that uses TrueFFS,
* which was compiled using standard C.If this is not the case simply leave
* the NAMING_CONVENTION defined as empty macro.
*/
#define NAMING_CONVENTION
/* System clean up routine
*
* This routine will be called every time TrueFFS exist.
* The implementation is found in flsysvxw.c
*/
extern void flSysfunExit(void);
#define FL_SYS_FUNC_RELEASE flSysfunExit()
/* Control over the priority of the TrueFFS thread
*
* Some of TrueFFS time is spend on polling the flash ready\busy signal.
* TrueFFS supplies a verity of ways to utilize this time, one of which is
* to inform the OS that TrueFFS priority can be lowered for the time being.
*/
#define FL_LowerPriorityThread(flashPtr) { /* not used */ }
#define FL_RaisePriorityThread(flashPtr) { /* not used */ }
/*
* Uncomment the FL_NO_INIT_MMU_PAGES definition for:
*
* In order to skip initialization of first and last byte of the given buffer.
* When the user buffer resides on separated memory pages the read
* operation may cause a page fault. Some CPU's return from a page
* fault (after loading the new page) and reread the bytes that caused
* the page fault from the new loaded page. In order to prevent such a
* case the first and last bytes of the buffer are written.
*
*/
#define FL_NO_INIT_MMU_PAGES
/* Improve BCH performance
*
* You can improove the way TrueFFS utilizes 32bit (or larger) native variables
* by uncommenting the defintion bellow.
*/
#define FL_ASSUME_NATIVE_IS_32BITS
/* Remove older basic types.
*
* TrueFFS 5.x used the byte, word, dword, Sbyte, Sword and Sdword basic types.
* Since these names are used by several major OSs, such as Windows and
* VxWorks, it was decided to rename these types with less general names
* (See the FLxxx types below). As many TrueFFS-based applications already
* use these types, TrueFFS still automatically defines them. If these
* definitions cause your compiler to report redefinition errors, simple
* define FL_DISABLE_OLD_TRUEFFS_TYPES and TrueFFS will automatically remove
* the definition.
*/
#define FL_DISABLE_OLD_TRUEFFS_TYPES
/* Alignment of structure members
*
*
* Pack all the structures for now.
*/
/* should be defined in Makefile */
#if 0
extern void flDelayMsecs(unsigned millisec);
#define FL_DELAY_MSEC(interval) flDelayMsecs(interval)
#endif
extern void flsleep(unsigned long microsec);
#define FL_TFFS_SLEEP(handle,microseconds) flsleep(microseconds)
#ifdef __cplusplus
}
#endif
/************************/
/* DOCH Specific */
/************************/
/*PCI EVB specific*/
#define HIB_PCI_INTERRUPT_COUNTER 0x7FFC /*Constant, No offset*/
#define HIB_PCI_CONTROL_REGISTER 0x7FFE /*Constant, No offset*/
/* PCI Memory windows */
typedef enum {
PCI_MEM_WIN_0 = 0x0, /*0..32KB*/
PCI_MEM_WIN_1 = 0x1, /*32.64KB*/
PCI_MEM_WIN_2 = 0x2, /*64..96KB*/
PCI_MEM_WIN_3 = 0x3 /*96.1282KB*/
} DOCH_PCIMemoryWindow;
/* PCI Window Size */
typedef enum {
PCI_WIN_SIZE_8K = 0x00, /*Generate CS only for first 8KB*/
PCI_WIN_SIZE_32K = 0x40
} DOCH_PCIWinSize;
#define PCI_HW_RST 0x10
/* PCI Master/Slave */
typedef enum {
PCI_MASTER = 0x00,
PCI_SLAVE = 0x20
} DOCH_PCIMasterSlave;
/* PCI Bus Access */
typedef enum {
BUS_ACESS_8_BIT = 0x80,
BUS_ACESS_16_BIT = 0x00
} DOCH_PCIBusAccess;
#define PCI_LOCK_SIGNAL 0x1000
#define PCI_IRQ_SIGNAL 0x2000
#define PCI_DMA_SIGNAL 0x4000
#define PCI_BUSY_SIGNAL 0x8000
void setWindowOffset(int using8KB, volatile unsigned char * baseAddr);
#define DOCH_SET_WINDOW_OFFSET(using8KB, baseAddress) (setWindowOffset(using8KB, baseAddress))
#endif /* FLSYSTEM_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -