avdevice.h

来自「ST5518机顶盒系统文件系统源代码!绝对超值!」· C头文件 代码 · 共 89 行

H
89
字号
/******************************************************************************File Name :  avdevice.hDescription: Device related types, definitions and structures.******************************************************************************/#ifndef  DEVICE_H#define  DEVICE_H    /* Includes ------------------------------------------------------------ */#include "stcommon.h"#include "stavfs.h"#include "internal.h"#include "hal.h"    /* Exported Constants -------------------------------------------------- */#define CLOSED_FILE             NULL#define ROOT_SECTOR_AREA_SIZE   (2)      /* Number of sectors in the root area in each partition */#define MAX_CLUSTERS_PER_BLOCK  (255)    /* Exported Types ------------------------------------------------------ */typedef struct{    /* Device administration */            ST_DeviceName_t  DeviceName;    BOOL             DeviceActive;   /* If the device is not active you have a stale handle */    semaphore_t      DeviceLock;     /* Protect against multi-reentrant calls */    partition_t     *MemoryPartition;    int              OpenHandles;    /* The number of open handles on the device */    /* Disk partition access */            void            *HALData;    U16              Partition;      /* This is our partition number */                                                  /* Root sector info */        U64              RootSectorLBA;   /* LBA address of the root sector  */    U16              ClusterSize;     /* Size = 2^ClusterSize sectors    */    U32              NumClusterBlock; /* The number of cluster block in the file area */    U64              RootDirLBA;      /* LBA address of the Root Directory */    U64              DataStartLBA;    /* LBA address of file data area   */    U64              DataSize;        /* Size in sectors.                */        void            *RWCache;        /* Internal data for the R/W Cache */    void            *RootDir;        /* Internal data for the Root Directory */    void            *MCat;           /* Internal data for the Master CAT */}stavfs_Device_t;    /* Exported Variables -------------------------------------------------- */    /* Exported Macros ----------------------------------------------------- */#define FILE_BACKUP_SIZE(Device_p)   ((LOCAL_CAT_SIZE > (Device_p)->ClusterSize)?(LOCAL_CAT_SIZE):((Device_p)->ClusterSize))#define CLUSTERS_PER_BLOCK(Device_p) (MAX_CLUSTERS_PER_BLOCK)#define CLUSTER_BLOCK_SIZE(Device_p) (LOCAL_CAT_SIZE + FILE_BACKUP_SIZE(Device_p) + (Device_p)->ClusterSize*CLUSTERS_PER_BLOCK(Device_p))                                           /* Exported Function Prototypes ---------------------------------------- */void stavfs_GetBackupLBA  (stavfs_Device_t *Device_p, U64 const *LBA_p, U64 *BackupLBA_p);void stavfs_GetLocalCatLBA(stavfs_Device_t *Device_p, U64 const *LBA_p, U64 *CatLBA_p);void stavfs_GetClusterIdx (stavfs_Device_t *Device_p, U32 *BlockId_p, U32 *Idx_p, U64 const *LBA_p);void stavfs_GetClusterLBA (stavfs_Device_t *Device_p, U32  BlockId,   U8   Idx,   U64 *LBA_p);void stavfs_GetLCatLBA    (stavfs_Device_t *Device_p, U32  BlockId,   U64 *LBA_p);/* Utility functions from stavfs.c */stavfs_Device_t *stavfs_GetDevice     (ST_DeviceName_t Name);ST_ErrorCode_t   stavfs_ValidateDevice(stavfs_Device_t *Device_p);#endif

⌨️ 快捷键说明

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