⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flsystem.h

📁 电子盘DEMO板程序
💻 H
📖 第 1 页 / 共 2 页
字号:
#include "flmalloc.h"
#define FL_MALLOC    flMalloc 
#define FL_FREE(a)   flFree((void *)a)
#else /* FL_TRUEFFS_HEAP_SIZE > 0*/
#define FL_MALLOC    malloc 
#define FL_FREE(a)   free((void *)a)
#endif /* FL_TRUEFFS_HEAP_SIZE > 0*/



/* Debug mode
 *
 * Customize the various TrueFFS debug print macros, to suite your application needs. 
 */

#define DBG_PRINT_ERR(zone,str)      printf (str)
#define DBG_PRINT_ERR_PRM(zone,str)  printf str
#define DBG_PRINT_WRN(zone,str)      /* printf (str) */
#define DBG_PRINT_WRN_PRM(zone,str)  /* printf str   */
#define DBG_PRINT_FLOW(zone,str)     /* printf (str) */
#define DBG_PRINT_FLOW_PRM(zone,str) /* printf 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.
 *
 */

#ifdef FL_IOCTL_INTERFACE
#define FL_IOCTL_START  0
#endif



/* 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.
 */





/* System clean up routine
 *
 * This routine will be called every time TrueFFS exists. 
 * The implementation is found in flsystem.c
 */

extern void flSysfunExit(void);

#define FL_SYS_FUNC_RELEASE flSysfunExit()


/* TrueFFS Yield CPU routine
 *
 * Allows the CPU to process other tasks while TrueFFS is waiting for the 
 * flash/DiskOnChip to complete an operation. The estimated amount of time,
 * is supplied as an argument. 
 * The amount of time spend in the routine can be longer or shorted then 
 * the given argument.
 *
 * Note: This routine can be used in conjunction with the interrupt mechanism.
 */

#define FL_TFFS_SLEEP(handle,microseconds) /* Do nothing - simply pole the R/B */


/* Optionally you can define TrueFFS basic types:
 *
 * FLByte, FLWord, FLDword, FLSByte, FLSWord, FLSDword, 
 */


/* Initialization for H/W configuration routine
 *
 * Some of the DiskOnChip H/W properties can be configured using the
 * flHWConfig() routine. 
 *
 * However it is usually more convenient to just code the SDK defaults here
 * and save the trouble of calling the actual routine.
 *
 * #define FL_IRQ_RB_INIT(wSockeNo)             FL_INT_RB_DISABLED
 * #define FL_DMA_INIT(wSockeNo)				FL_DMA_HW_DISABLED
 */



/************************************************************************************/
/*************************   Access Layer Customization   ***************************/
/************************************************************************************/

/*********************************/
/* Runtime customization options */
/*********************************/


/*                                                                   
 * 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 */



/**************************************/
/* Compile time customization options */
/**************************************/

/* Remove runtime control over memory access routines 
 *
 * When defined , SDK will use your own macros , for accessing the mDOC memory window
 * This implementation will provide better performance, at the expense of automatic detection
 * and ease of integration.
 *
 * Default macros can be found in _DOCSYS.H
 *
 * #define flDirectWrite16BitReg(flash,offset,val)          : Write 16  bit val to flash->win+offset
 * #define flDirectRead16BitReg(flash,offset)               : Read  16  bit val from flash->win+offset
 * #define flReadEvenNumberOfBytes(flash,offset,dest,count) : Read  count bytes from flash->win+offset to dest
 * #define flWriteEvenNumberOfBytes(flash,offset,src,count) : Write count bytes to flash->win+offset from dest
 */

/* #define FL_NO_USE_FUNC */



/* Physical access to the device.
 *
 * While the routines above return either actual data to the higher layer S/W
 * the routines bellow provides the means for those accesses. 
 *
 * Note: Default macros can be found in FLCHKDEFS.H
 *
 * FLWRITE_IO_BYTE        , FLREAD_IO_BYTE
 * FLWRITE_IO_WORD        , FLREAD_IO_WORD
 * FLWRITE_IO_DWORD       , FLREAD_IO_DWORD
 * TFFSCPY_FROM_IO_8_BITS , TFFSCPY_FROM_IO_16_BITS 
 * TFFSCPY_TO_IO_8_BITS   , TFFSCPY_TO_IO_16_BITS   
 * TFFSSET_IO_8_BITS      , TFFSSET_IO_16_BITS
 */

/******************************************************************************/
extern void * flcpy(void * dest,const void *src,size_t count);

#define TFFSCPY_TO_IO_16_BITS(dest,src,count)   flcpy((void *)(dest),src,count)
#define TFFSCPY_TO_IO_8_BITS(dest,src,count)    flcpy((void *)(dest),src,count)

#define TFFSCPY_FROM_IO_16_BITS(dest,src,count) flcpy(dest,(void *)(src),count)
#define TFFSCPY_FROM_IO_8_BITS(dest,src,count)  flcpy(dest,(void *)(src),count)



/******************************************************************************/


/* Burst mode configuration
 *
 * The following configurations are required for activating the burst support
 * of the DiskOnChip.
 */
/* #define FL_USE_BURST_MODE_READ */

#ifdef FL_USE_BURST_MODE_READ
 #define BURST_WAIT_STATE 1
#define BURST_LENGTH  3 /* 2^3 = 8 Words */
#define BURST_LATENCY 0
#define BURST_CLK_INV 0
#define BURST_HOLD    0
#define BURST_FIFO    0
#define BURST_EBRA    0

#define FL_HOST_ENTER_BURST_MODE flHostEnterBurstMode
#define FL_HOST_EXIT_BURST_MODE  flHostExitBurstMode

#define DOCH_HOST_ENTER_READ_BURST_MODE FL_HOST_ENTER_BURST_MODE();
#define DOCH_HOST_EXIT_READ_BURST_MODE FL_HOST_EXIT_BURST_MODE();

#endif /* FL_USE_BURST_MODE_READ */


/************************/
/* HW DMA Configuration */
/************************/

/* #define FL_DMA_CONFIG(bDMA_ParamsPtr) */


/************************/
/* DOCH Specific		*/
/************************/

/*DOCH_32K_SLIDING_WINDOW Should be defined for msystems PCI/PortaDoc EVB*/
#define DOCH_32K_SLIDING_WINDOW

/*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(FLBoolean using8KB, volatile FLByte * baseAddr);
#define DOCH_SET_WINDOW_OFFSET(using8KB, baseAddress)	(setWindowOffset(using8KB, baseAddress))


#endif /* FLSYSTEM_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -