📄 apdevsys.h
字号:
/*****************************************************************************//* *//* <C> STMicroelectronics - copyright information *//* *//* *//* COMMENT }DOCUMENTATION *//* File Name :: devsys.h.asm *//* Creation Date :: September 2005 *//* Author :: Ondrej Trubac *//* Version :: $Revision: 1.28 $ *//* Last change :: $Date: 2007/09/21 05:29:14 $ by $Author: hara $ *//* Description :: Device management for Accordo+, structures, error codes *//* } *//*****************************************************************************//*************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * **************************************************** * * STM CVS Log: * * $Log: apdevsys.h,v $ * Revision 1.28 2007/09/21 05:29:14 hara * Initial implementation for WMDRM feature into A+. * * Revision 1.27 2007/02/23 11:38:17 sedmik * added DEV_IPOD_ID in t_duid structure * * Revision 1.26 2006/12/12 19:15:31 trubac * change of uin16 to int32 of directory parsing offset * * Revision 1.25 2006/11/27 19:44:12 belardi * Host Update protocol addition * - added new return value used by XAR_TestFileExtension * * Revision 1.24 2006/10/17 09:56:16 trubac * toc reading and mounting improvement by BB * * Revision 1.23 2006/09/18 09:55:22 belardi * Corrected CVS keyword usage * * Revision 1.22 2006/09/18 09:24:01 belardi * Added Log CVS keyword into file header * * ***************************************************/#ifndef DEFINE_APDEVSYS_H#define DEFINE_APDEVSYS_H#include "accordoptypes.h" //"aptypes.h"typedef char DUID; // unique device identifier , any value < 1 is invalid#define NO_DEVICE_ID 0#define CD_DEVICE_ID 1#define USB_DEVICE_ID 2#define SDC_DEVICE_ID 3#if (0 != HAVE_SDC)#define SYS_MAX_NUMBER_DEVICES 3#else#define SYS_MAX_NUMBER_DEVICES 2#endiftypedef int16 FDID; // unique file device identifier , any value < 1 is invalid#include "isotypes.h"#include "FATtypes.h"#include "UDF_types.h"#define DSP 1#ifdef DSP#define PACKED __packed#include "os20.h"#else#define PACKED#endif#define MAX_FS_COUNT 10 //M.Ch.#define MAX_DEV_PARTITIONS 10 //M.Ch.// ERROR CODES / FUNCTION RESULTS#define S_OK 0 // success#define S_TRUE 1#define S_FALSE 0#define S_ZERO_ARGUMENT 2#define S_NOT_FOUND 0 // invalid X_array index (not allowed for files or dirs)#define S_DIR_FOUND 2#define S_FILE_FOUND 3#define S_FILE_SKIP 9#define S_FILE_UPDATE_ITEM 4 //M.Ch.#define S_FILE_ADD_EXTEND 5 //M.Ch.#define S_SEARCHED_DIR_FILE_ENTRY_FOUND 6 //M.Ch.#define S_SPECIAL_FILE_FOUND 7#define S_UDF_FILE_ENTRY_FOUND 64 //JS#define S_PARENT_DIR 65 //JS#define OP_DYN_MALLOC 10 //DYN_malloc#define OP_FIND_FREE_CLUSTER 11 //DYN_malloc#define DEV_STATUS_UNKNOWN 0#define DEV_STATUS_ASSIGNED 1//#define DEV_STATUS_#define wmin(a,b) (((a)<(b))?(a):(b))#define wmax(a,b) (((a)>(b))?(a):(b))// here are device HW type specifiers (NOT identifiers)typedef enum{ DEV_NO_DEVICE = 0, DEV_CD_ID = 1, DEV_USB_ID = 2, DEV_SDC_ID = 4, DEV_IPOD_ID = 8} t_duid;// File System Typestypedef enum{ FS_INVALID = -1, FS_TOC = 0x00, FS_ISO9660_TYPE = 0x01, FS_UDF_TYPE = 0x02, FS_FAT_TYPE = 0x03, //M.Ch.#if (1 == HAVE_WMDRM) FS_WMDRM_TYPE = 0x04,#endif } t_FStype;typedef struct{ uint32 PartitionLBA; // partition offset from address 0 in large blocks t_FStype FSType; // FAT16,FAT32,ISO9660,.... uint8 Partition; // number to device's partition list uint16 LargeBlockSize; // size of block for addressing partition uint8 VolumeNameLength; uint8 VolumeName[34]; UInt attributes; DUID did; // i/o device identifier union { PRIVATE_DATA_ISO9660 ISO_pd; PRIVATE_DATA_FAT FAT_pd; //M.Ch. PRIVATE_DATA_UDF UDF_pd; //JS // here other filesystems can have their structures } PD;}FS_DESCRIPTOR;typedef struct{ DUID DeviceID; t_duid DeviceType; UInt DeviceAttr; UInt DeviceStatus; UInt NumPartitions; uint16 LargeBlockSize; uint32 PartitionLBA[MAX_DEV_PARTITIONS]; UInt FS_list[MAX_FS_COUNT]; FS_DESCRIPTOR *FS_desc[MAX_FS_COUNT]; void *vpDescript;}DeviceInfoStruct;// Device Attributes#define DEV_ATTR_READY 0x0001#define DEV_ATTR_SERIAL_ACCESS 0x0002#define DEV_ATTR_READ_ONLY 0x0004#define DEV_ATTR_FS_DEVICE 0x0080 // sw device for file access#define DEV_ATTR_ISO9660_FILESYSTEM 0x0100#define DEV_ATTR_UDF_FILESYSTEM 0x0200#define DEV_ATTR_FAT16_FILESYSTEM 0x0400#define DEV_ATTR_FAT32_FILESYSTEM 0x0800#define DEV_ATTR_MULTISESSION_CD 0x1000#define DEV_ATTR_ISO_SUPPLEM_VOL_DESCRIPTOR 0x2000#define DEV_ATTR_ISO_PRIMARY_VOL_DESCRIPTOR 0x4000#define DEV_ATTR_ISO9660_PATHTABLE 0x8000// Device Info Flags#define DEV_INFO_INVALID 0x01#define DEV_INFO_FS_DETECTED 0x02#define DEV_INFO_DESCRIPTOR_VALID 0x04typedef struct{ DUID duid; DeviceInfoStruct *di;}ACP_DeviceEntry;typedef struct{ int16 Index; int16 NameLength; uint8 Name[256]; // FILE_ITEM *FileTable; int32 DirRecordLba; uint32 ParentOffset; int32 DirRecordSize; uint16 MaxDirFiles; uint16 ParentDirNumber; uint16 Attributes; uint16 WrtDate; //M.Ch. uint16 WrtTime; //M.Ch.}DIR_STRUCT;typedef struct{ // DIR_STRUCT *Parent; int16 Index; int16 NameLength; uint8 Name[256]; int32 DirRecordLba; int32 DirRecordOffset; int32 ExtentLba; uint32 FileSize; uint32 Position; uint16 Attributes; char FileType; uint16 WrtDate; //M.Ch. uint16 WrtTime; //M.Ch.}FILE_STRUCT;typedef union{ DIR_STRUCT dir; FILE_STRUCT file;}DIR_ITEM;void SYS_DeviceTableInit(void);GRESULT SYS_DetectPartitions(t_duid dev, uint8 *sectbuf);DUID SYS_RegisterDevice(DUID did, t_duid devtype, UInt devattr, void *DeviceDescriptor);t_duid SYS_DeviceType(DUID duid);DUID SYS_GetDeviceID(t_duid dev);DeviceInfoStruct *SYS_DeviceInfoStruct(DUID duid);void *SYS_DeviceDescriptor(DUID duid);GRESULT SYS_ClearDeviceAttribute(DUID did, unsigned int flags);GRESULT SYS_SetDeviceAttribute(DUID did, unsigned int flags);UInt SYS_DeviceAttributes(t_duid dev);//void SYS_ResetDeviceInfoStruct(DeviceInfoStruct *dis);FDID SYS_DetectFileSystem(DUID did, int fstype, int partition, FS_DESCRIPTOR *fsdesc);FS_DESCRIPTOR *SYS_FSDescriptor(FDID fd);uint32 SYS_PartitionLBA(DUID id, UInt partition, UInt lbsize);t_FStype SYS_PreferedFSType(t_duid devid, uint8 check);FDID SYS_OpenFileSystem(DUID did, FS_DESCRIPTOR *fsdesc);void SYS_DeletePartitions(DUID id);void SYS_SetLargeBlockSize(DUID did, uint16 bsize);GRESULT SYS_AddPartition(DUID did, uint32 lba);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -