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

📄 flcommon.h

📁 电子盘DEMO板程序
💻 H
📖 第 1 页 / 共 2 页
字号:
#define FL_ENABLED                      0x1
#define FL_DISABLED                     0x0

/* Protection attributes */
#define PROTECTABLE           1   /* partition can recieve protection */
#define READ_PROTECTED        2   /* partition is read protected      */
#define WRITE_PROTECTED       4   /* partition is write protected     */
#define LOCK_ENABLED          8   /* HW lock signal is enabled        */
#define LOCK_ASSERTED         16  /* HW lock signal is asserted       */
#define KEY_INSERTED          32  /* key is inserted (not currently   */
#define CHANGEABLE_PROTECTION 64  /* changeable protection area type  */
#define OTW_PROTECTED         128 /* partition is locked forever      */
#define STICKY_LOCK_ASSERTED  256 /* Sticky lock is activated         */


#ifdef BDK_ACCESS
/*BDK API defines */
#define BDK_COMPLETE_IMAGE_UPDATE       16
#define BDK_PARTIAL_IMAGE_UPDATE        0
#define BDK_SIGNATURE_NAME              4
#endif /*BDK_ACCESS*/

/* BUS setting interface */
#define FL_BUS_HAS_8BIT_ACCESS     0x00000001L /* Bus can access 8-bit  */
#define FL_BUS_HAS_16BIT_ACCESS    0x00000002L /* Bus can access 16-bit */
#define FL_BUS_HAS_32BIT_ACCESS    0x00000004L /* Bus can access 32-bit */

#define FL_NO_ADDR_SHIFT           0x00000000L /* No address shift     */
#define FL_SINGLE_ADDR_SHIFT       0x00000010L /* Single address shift */
#define FL_DOUBLE_ADDR_SHIFT       0x00000020L /* Double address shift */

/* TrueFFS Debug modes */
#define FL_QUICK_MOUNT_DO_NOT_READ    0x01 /* Do not use the quick mount when mounting */
#define FL_QUICK_MOUNT_DO_NOT_WRITE   0x02 /* Do not write the quick mount on dismount */
#define FL_QUICK_MOUNT_DISABLED       0x03 /* Mask for the above 2 flags               */

/*power management commands*/
#define FL_PREPARE_FOR_RESUME    1

/*defined for logical format*/
#define FL_MEDIA_WITHOUT_MBR			(1 << 12)	/* used by LogMount & formatFS */
#define FL_MOUNT_ON_GIVEN_RANGE			(1 << 13)	/* used by LogMount & formatFS */
#define FL_MOUNT_FOR_BLOCK_IO			(1 << 14)	/* used by LogMount only */

#define FL_MARK_PARTITION_BOOTABLE	0x80

#define VOLUME_12BIT_FAT	4  /* Volume uses 12-bit FAT                     */

/**************************************************************************/
/*  DMA Interface:                                                        */
/*    The following types are used for interfacing the DMA handling       */
/*    module and TrueFFS module                                           */
/**************************************************************************/
typedef struct __DMA_Params_S
{
  FLWord wDiskOnChip_Offset ;
  FLWord wFrameSize ;
  FLWord wFramesInBlock ;
  FLWord wFramesXferred ;
  FLByte *bDiskOnChip_BasePtr ; 
  FLByte *bDestAddrPtr ; 
  FLByte bOpType ;
  FLByte bIrHandle ;
  FLBoolean fDmaStatus ;
  void *DrvParamsPtr ;
} DMA_Params_S  ;


/**************************************************************************/
/*  trueFFS environment variables definitions:                            */
/*    The following type defines all the TrueFFS environment variables    */
/*    Which can ce controlled by the SetEnv commands.                     */
/**************************************************************************/
typedef enum {        /* Variable type code for flSetEnv routine */
      FL_ENV_VARS_PER_SYSTEM           = 0,
      FL_IS_RAM_CHECK_ENABLED          = 1, /* No longer supported from 6.1 */
      FL_TL_CACHE_ENABLED              = 2, /* No longer supported from 6.1 */
      FL_DOC_8BIT_ACCESS               = 3,
      FL_MULTI_DOC_ENABLED             = 4, /* No longer supported from 6.1 */
      FL_SET_MAX_CHAIN                 = 5, /* For internal use only        */
      FL_MARK_DELETE_ON_FLASH          = 6, /* No longer supported from 6.1 */
      FL_MTL_POLICY                    = 7, /* No longer supported from 6.1 */
      FL_SECTORS_VERIFIED_PER_FOLDING  = 8, /* No longer supported from 6.1 */

      FL_ENV_VARS_PER_SOCKET           = 100,
      FL_VERIFY_WRITE_OTHER            = 101,
      FL_MTD_BUS_ACCESS_TYPE           = 102,
      FL_SUSPEND_MODE                  = 103,
	  FL_SET_AUTO_DPD_MODE             = 104, /* Added in TrueFFS 6.3.0     */
      FL_ENV_ATA_DEBUG                 = 105,
	  FL_SET_ACTIVE_DPD_MODE		   = 106,
	  FL_SET_INACTIVE_DPD_MODE		   = 107,
	  FL_SET_TIMEOUT_DPD			   = 108,
	  FL_SET_TRANSFER_MODE			   = 109,

      FL_ENV_VARS_PER_VOLUME           = 200,

      FL_SET_POLICY                    = 201, /* No longer supported from 6.1 */
      FL_VERIFY_WRITE_BDTL             = 202,
      FL_VERIFY_WRITE_BINARY           = 203,
      FL_MAX_CACHE_SIZE                = 204,
      FL_DO_NOT_WAIT_FOR_READY         = 205, /* No longer supported from 6.1 */
      FL_NO_STATIC_FILES_WEAR_LEVELING = 206,
	  FL_DEBUG_MODES                   = 207, /* Added in TrueFFS 6.3 alpha 1 */
	  FL_HW_STATUS                     = 208, /* Added in TrueFFS 6.3 alpha 2 */
     
	  FL_ENV_VARS_PER_COMPILATION_FLAG = 300, /* Compilation flag replacement */
	  FL_DIMAGE_CFG                    = 301 
} FLEnvVars;





/* These defines allow the user to add a prefix to the exported API */
#ifndef NAMING_CONVENTION
#define NAMING_CONVENTION 
#endif /* NAMING_CONVENTION */
#ifndef TFFS_DLL_API
#define TFFS_DLL_API
#endif /* TFFS_DLL_API */


/**************************************************************************/
/*  Memory access routine interface:                                      */
/*    The following types and defines sets the API for the TrueFFS memory */
/*    access routines control.                                            */
/**************************************************************************/

/* Backward competible x86 pointer definitions (far and huge) */
#ifndef HUGE
#define HUGE
#endif /* HUGE */
#ifndef FAR0
#define FAR0 
#endif /* FAR0 */

#ifndef FAR1
#define FAR1
#endif /* FAR1 */

#ifndef FAR2
#define FAR2
#endif /* FAR2 */


/* Doc memory read routine         */
typedef  void (FAR1 FLMemRead)(volatile FLByte FAR1* win,FLWord regOffset,FLByte FAR1* dest,FLWord count);
/* Doc memory write routine        */
typedef  void (FAR1 FLMemWrite)(volatile FLByte FAR1* win,FLWord regOffset,FLByte FAR1* src,FLWord count);
/* Doc memory set routine          */
typedef  void (FAR1 FLMemSet)(volatile FLByte FAR1* win,FLWord regOffset,FLWord count, FLByte val);
/* Doc memory 8 bit read routine   */
typedef  FLByte (FAR1 FLMemRead8bit)(volatile FLByte FAR1* win,FLWord offset);
/* Doc memory 8 bit write routine  */
typedef  void (FAR1 FLMemWrite8bit)(volatile FLByte FAR1* win,FLWord offset,FLByte Data);
/* Doc memory 16 bit read routine  */
typedef  FLWord (FAR1 FLMemRead16bit)(volatile FLByte FAR1* win,FLWord offset);
/* Doc memory 16 bit write routine */
typedef  void (FAR1 FLMemWrite16bit)(volatile FLByte FAR1* win,FLWord offset,FLWord Data);
/* Doc memory window size */
typedef  FLDword (FAR1 FLMemWindowSize)(void);
/* Interleave change event Call back routine */
typedef  FLStatus (FAR1 FLMemSetGetMode)(FLByte interleave, FLByte socketNo , FLDword flag);

typedef struct {        /* DiskOnChip memory access routines */
  FLDword               access; /* Output only */
  FLMemRead       * memRead;
  FLMemWrite      * memWrite;
  FLMemSet        * memSet;
  FLMemRead8bit   * memRead8bit;
  FLMemWrite8bit  * memWrite8bit;
  FLMemRead16bit  * memRead16bit;
  FLMemWrite16bit * memWrite16bit;
  FLMemWindowSize * memWindowSize;
  FLMemSetGetMode * memSetGetMode;
}FLAccessStruct;

/*----------------------------------------------------------------------*/
/*                  f l S e t D o c B u s R o u t i n e                 */
/*                                                                      */
/* Set user defined memory access routines for DiskOnChip.               */
/*                                                                      */
/* Parameters:                                                          */
/*      socket      : Socket number to install routine for.             */
/*      structPtr   : Pointer to function structure.                    */
/*                                                                      */
/* Returns:                                                             */
/*      FLStatus        : 0 on success, otherwise failed                */
/*----------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
TFFS_DLL_API FLStatus NAMING_CONVENTION flSetDocBusRoutine(FLByte  socket, FLAccessStruct FAR1 * structPtr);
#ifdef __cplusplus
}
#endif /* __cplusplus */

/*----------------------------------------------------------------------*/
/*                  f l G e t D o c B u s R o u t i n e                 */
/*                                                                      */
/* Get currently installed memory access routines for DiskOnChip.       */
/*                                                                      */
/* Parameters:                                                          */
/*      socket      : Socket number to install routine for.             */
/*      structPtr   : Pointer to function structure.                    */
/*                                                                      */
/* Returns:                                                             */
/*      FLStatus        : 0 on success, otherwise failed                */
/*----------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
TFFS_DLL_API FLStatus NAMING_CONVENTION flGetDocBusRoutine(FLByte  socket, FLAccessStruct FAR1 * structPtr);

extern FLDword  flBusConfig[FL_SOCKETS];
#ifdef __cplusplus
}
#endif /* __cplusplus */

/**************************************************************************/
/*  Endian conversion support :                                           */
/*    The following types and defines sets the endian dependant types.    */
/*    TrueFFS interface has some endian dependant API which contain data  */
/*    written on the flash. To support compatability between various      */
/*    systems, thses interfaces contain types which are not dependant in  */
/*    the endianess of the systems. This types and translation macroes   */
/*    are defined in this section.                                        */
/**************************************************************************/
extern void toUNAL(FLByte FAR0 *unal, FLWord n);
extern FLWord fromUNAL(FLByte const FAR0 *unal);
extern void toUNALLONG(FLByte FAR0 *unal, FLDword n);
extern FLDword fromUNALLONG(FLByte const FAR0 *unal);

#ifndef FL_BIG_ENDIAN

typedef FLWord   LEushort;
typedef FLDword  LEulong;

#define LE2(arg)         	arg
#define toLE2(to,arg)    	(to) = (arg)
#define LE4(arg)         	arg
#define toLE4(to,arg)    	(to) = (arg)

typedef FLByte        Unaligned[2];
typedef Unaligned     Unaligned4[2];

#define FL_REF_1(arg, offs)		(((FLByte *)(arg))[offs])
#define FL_REF_2(arg, offs)	 	(*((FLWord *)(((FLByte *)(arg)) + (offs))))
#define FL_REF_4(arg, offs)	 	(*((FLDword *)(((FLByte *)(arg)) + (offs))))

#define FL_GET_LE2(arg, offs)	 	FL_REF_2(arg, offs)
#define FL_GET_LE4(arg, offs)	 	FL_REF_4(arg, offs)
#define FL_SET_LE2(to, offs, arg)	FL_REF_2(to, offs) = (arg)
#define FL_SET_LE4(to, offs, arg)	FL_REF_4(to, offs) = (arg)

#else	/* FL_BIG_ENDIAN */

typedef FLByte LEushort[2];
typedef FLByte LEulong[4];

#define FL_REF_1(arg, offs)		(((FLByte *)(arg))[offs])
#define FL_REF_2(arg, offs)	 	(LE2((FLWord *)(((FLByte *)(arg)) + (offs))))
#define FL_REF_4(arg, offs)	 	(LE4((FLDword *)(((FLByte *)(arg)) + (offs))))

#define LE2(arg)		fromUNAL(arg)
#define toLE2(to,arg)		toUNAL(to, (FLWord)(arg))
#define LE4(arg)		fromUNALLONG((FLByte const FAR0 *)(arg))
#define toLE4(to,arg)		toUNALLONG((FLByte FAR0 *)(to), (arg))

#define Unaligned     LEushort
#define Unaligned4    LEulong

#define FL_GET_LE2(arg, offs)		LE2((((FLByte *)(arg)) + (offs)))
#define FL_GET_LE4(arg, offs)		LE4((((FLByte *)(arg)) + (offs)))
#define FL_SET_LE2(to, offs, arg)	toLE2((((FLByte *)(to)) + (offs)), arg)
#define FL_SET_LE4(to, offs, arg)	toLE4((((FLByte *)(to)) + (offs)), arg)
#endif /* FL_BIG_ENDIAN */



#endif /* FLCOMMON_H */

⌨️ 快捷键说明

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