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

📄 fdi_pckt.h

📁 FDI Intel开发的FLASH文件系统,功能很强大
💻 H
字号:
/* ###########################################################################
###  Intel Confidential
###  Copyright (c) Intel Corporation 1995-2002
###  All Rights Reserved.
###  -------------------------------------------------------------------------
###  Project: Flash Data Integrator
###
###  Module: FDI_pckt.H - This file defines prototypes for mutex.c
###
###  $Archive: /FDI/SRC/INCLUDE/fdi_pckt.h $
###  $Revision: 61 $
###  $Date: 3/03/03 12:46a $
###  $Author: Xhuang4 $
###  $NoKeywords $
########################################################################### */

/*                                                               
 *****************************************************************
 * NOTICE OF LICENSE AGREEMENT                                    
 *                                                                
 * This code is provided by Intel Corp., and the use is governed  
 * under the terms of a license agreement. See license agreement  
 * for complete terms of license.                                 
 *                                                                
 * YOU MAY ONLY USE THE SOFTWARE WITH INTEL FLASH PRODUCTS.  YOUR 
 * USE OF THE SOFTWARE WITH ANY OTHER FLASH PRODUCTS IS EXPRESSLY 
 * PROHIBITED UNLESS AND UNTIL YOU APPLY FOR, AND ARE GRANTED IN  
 * INTEL'S SOLE DISCRETION, A SEPARATE WRITTEN SOFTWARE LICENSE   
 * FROM INTEL LICENSING ANY SUCH USE.                             
 *****************************************************************
 */
 

#if (PACKET_DATA == TRUE)

#define     WRITE_RSRVPCKT   5

typedef struct  {
     WORD_PTR    *TagRAMp;
     WORD        ID;
     WORD        FragSize;
     WORD        Count;
              /* number of packets, added by Young Wang on Jun 29, 1999 */
              /* when WRITE_RSRVPCKT, it is used as an index of TagRAMp */
     BYTE        InProg;
     BYTE        type;
}        FDI_OPEN_PACKET;

extern  FDI_OPEN_PACKET FDI_Pckt;

/* ### Global Declarations
###################### */
extern ERR_CODE
FDI_InitPacket(WORD_PTR *buf_p,
               WORD fragsize,
               WORD count,
               WORD_PTR identifier,
               BYTE type
              );

extern ERR_CODE FDI_ReleasePacket();

extern ERR_CODE FDI_WritePacket(volatile WORD_PTR flash_p, WORD_PTR buf_p, WORD size);

/* extern ERR_CODE ScanEntryTables(UNIT_HDR_PTR, DWORD, WORD, WORD, WORD); */

/* Defines for FDI_InitPacket, FDI_Write use */
#define   FDI_PACKETDATA_PRIORITY         FDI_MIN_PRIORITY

                      /* can be any valid priority and have no impact */
#define   FDI_MAX_RSRV_BYTES_PER_ITEM   \
          (((WORDMAX-sizeof(COMMAND))/UNIT_GRANULARITY)*UNIT_GRANULARITY)
      /* 96*UNIT_GRANULARITY, must be multiples of UNIT_GRANULARITY
         and multiples of every valid PACKETSIZE, also must be less than
         64K-sizeof(COMMAND) */

#define  FDI_SET_TAGRAM_P(index,frag_unit_addr)                \
                FDI_Pckt.TagRAMp[index] =                      \
                        (WORD_PTR) (FLASH_START_ADDRESS        \
                        + frag_unit_addr);
                /** index: fragment number,  offset: relative in this block */
                /** block_addr: relative in device not in CPU space */

#define OPTIMAL_TASKDELAY    FALSE

#if (OPTIMAL_TASKDELAY == TRUE) /* OPTIMAL_TASKDELAY */
extern  SEM_ID SEM_QueueEmpty;
#define FDI_WAIT_FORQUEUE_EMPTY(x)                        \
                  for(;;) {                             \
                      FDI_Status (&x);                    \
                      if ( x & FDI_Q_PEND ) {             \
                          SEM_WAIT(SEM_QueueEmpty);       \
                      }                                   \
                      else {                              \
                          break;                          \
                      }                                   \
                  };
#else
#define    FDI_WAIT_FORQUEUE_EMPTY(x)                     \
                  for(;;) {                             \
                      FDI_Status (&x);                    \
                      if ( x & FDI_Q_PEND ) {             \
                          TaskDelay (FDI_TASKDELAY_TICKS);\
                      }                                   \
                      else {                              \
                          break;                          \
                      }                                   \
                  };
#endif /* OPTIMAL_TASKDELAY */

#define  FDI_TASKDELAY_TICKS      1   /* 1 tick is 1/60s */

   /* this macro is used to avoid 2 RECL_Request/RECL_Enable
    * semaphore is given, wait for the 1st reclaim done.
    */
#define   FDI_WAIT_FORRECLM_DONE                        \
          while ( RECL_GetState() != RECL_DONE ) {      \
              TaskDelay (FDI_TASKDELAY_TICKS);        \
          };
          /* RECL_ENABLED state should be set before RECL_Enable is given
             to avoid issue mentioned in mail with Rick */
extern void RECL_SetState(RECL_STATES a);
#define   FDI_RESET_RECLMSTATE     RECL_SetState(RECL_ENABLED);

/* ### Declarations for packet reference code ### */

/*#define       PACKET_REFERENCE */

#ifdef       PACKET_REFERENCE

#include "taskLib.h"
#define     PACKET_PRIORITY      160
#define     PCKTISR_PRIORITY     140
#define     THIRDTASK_PRIORITY   170
#define     PACKET_STACK_SIZE    2000 /* stack size of packet write task */
#define     PCKTISR_STACK_SIZE   1000 /* stack size of packet ISR task */
#define     THIRDTASK_STACK_SIZE 1000 /* stack size of 3rd interleave call task task */

#define      MAXTAGRAMSIZE         1024
#define      CURPACKETNUM          (257)
#define      PACKETSIZE            (UNIT_GRANULARITY*MAX_NUM_UNITS_PER_FRAG)

extern SEM_ID    SEM_PcktISR_Enable;   /* binary semaphore for enabling packet-ISR */
extern SEM_ID    SEM_3rdWrite_cntrl;   /* binary semaphore for enabling 3rd party APIs */
extern DWORD   Pckt_ObjectSize;      /* total size of a packet object */
extern DWORD   Pckt_Size;            /* size of each packet */
extern BYTE    Pckt_DataBuf[PACKETSIZE];

extern void EnableFlowControl (BOOL flag);
extern HW_ERROR Pckt_Terminate(void);
extern ERR_CODE Pckt_Init(void);
extern RECL_STATES RECL_GetState(void);

#endif /* PACKET_REFERENCE */


#endif /* PACKET_DATA */

⌨️ 快捷键说明

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