📄 pcdisk.h
字号:
#define PSEEK_CUR 1 /* offset from current file pointer*/
#define PSEEK_END 2 /* offset from end of file*/
/* Arguments to po_extend_file */
#define PC_FIRST_FIT 1
#define PC_BEST_FIT 2
#define PC_WORST_FIT 3
/* Define service completion status constants. */
/* Nucleus FILE status value */
#define NUF_BAD_USER -3000 /* Not a file user. */
#define NUF_BADDRIVE -3001 /* Bad drive number. */
#define NUF_BADPARM -3002 /* Invalid parametor given */
/* Disk */
#define NUF_NOT_OPENED -3003 /* The disk is not opened yet. */
#define NUF_NO_DISK -3004 /* Disk is removed. */
#define NUF_DISK_CHANGED -3005 /* Disk is changed. */
#define NUF_INVALID_CSIZE -3006 /* The Disk has invalid clluster size. */
#define NUF_FATCORE -3007 /* Fat cache table too small. */
#define NUF_DEFECTIVEC -3008 /* Defective cluster detected. */
#define NUF_BADDISK -3009 /* Bad Disk */
#define NUF_NO_PARTITION -3010 /* No partition in disk. */
#define NUF_ROOT_FULL -3011 /* Root directry full */
/* Format */
#define NUF_NOFAT -3012 /* No FAT type in this partition. Can't Format */
#define NUF_FMTCSIZE -3013 /* Too many clusters for this partition. Can't Format */
#define NUF_FMTFSIZE -3014 /* File allocation table too small. Can't Format. */
#define NUF_FMTRSIZE -3015 /* Numroot must be an even multiple of 16 */
#define NUF_FORMAT -3016 /* Not formatted this disk. */
/* Path */
#define NUF_LONGPATH -3017 /* Path or filename too long */
#define NUF_INVNAME -3018 /* Path or filename is invalid. */
/* File */
#define NUF_PEMFILE -3019 /* No file descriptors available (too many files open). */
#define NUF_BADFILE -3020 /* Invalid file descriptor */
#define NUF_ACCES -3021 /* Attempt to open a read only file or a special (directory). */
#define NUF_NOSPC -3022 /* Write failed. Presumably because of no space. */
#define NUF_SHARE -3023 /* The access conflict from multiple task to a specific file. */
#define NUF_NOFILE -3024 /* File not found or path to file not found. */
#define NUF_EXIST -3025 /* Exclusive access requested but file already exists. */
#define NUF_NVALFP -3026 /* Seek to negative file pointer attempted. */
#define NUF_MAXFILE_SIZE -3027 /* Over the maximum file size. */
#define NUF_NOEMPTY -3028 /* Directory is not empty. */
#define NUF_INVPARM -3029 /* Invalid parameter is specified. */
#define NUF_INVPARCMB -3030 /* Invalid parameter combination is specified. */
/* Memory */
#define NUF_NO_MEMORY -3031 /* Can't allocate internal buffer. */
#define NUF_NO_BLOCK -3032 /* No block buffer available */
#define NUF_NO_FINODE -3033 /* No FINODE buffer available */
#define NUF_NO_DROBJ -3034 /* No DROBJ buffer available */
#define NUF_IO_ERROR -3035 /* Driver IO function routine returned error */
#define NUF_INTERNAL -3036 /* Nucleus FILE internal error */
/* IDE Driver Error code */
#define NUF_IDE_ASSIGN -3100 /* Logical drive assign error. */
#define NUF_IDE_NUM_LOGICAL -3101 /* NUM_LOGICAL_DRIVES set error. */
#define NUF_IDE_NUM_PHYSICAL -3102 /* NUM_PHYSICAL_DRIVES set error. */
#define NUF_IDE_LOG_TABLE -3103 /* LOG_DISK_TABLE setup error. */
#define NUF_IDE_PHYS_TALBE -3104 /* PHYS_DISK_TABLE setup error. */
#define NUF_IDE_INITIALIZE -3105 /* Initialize error. See c_s[].err_code */
#define NUF_IDE_NOT_SETCOUNT -3106 /* Read/Write sector count is zero. */
#define NUF_IDE_NOT_LOG_OPENED -3107 /* Logical drive is not opened. */
#define NUF_IDE_NOT_PHYS_OPENED -3108 /* Physical drive is not opened. */
#define NUF_IDE_DISK_SIZE -3109 /* illegal partition size. */
#define NUF_IDE_FAT_TYPE -3110 /* illegal FAT type. */
#define NUF_IDE_NO_DOSPART -3111 /* NO DOS partition in disk. */
#define NUF_IDE_NO_EXTPART -3112 /* NO Extension partition in disk. */
#define NUF_IDE_NOT_CAPACITY -3113 /* Partition capacity error. */
#define NUF_IDE_OVER_PART -3114 /* Over the partition end sectors. */
#define NUF_IDE_MAX_BLOCKS -3115 /* More than max blocks access. */
#define NUF_IDE_RESET -3116 /* Controller reset failed in initialize. */
#define NUF_IDE_DIAG_FAILED -3117 /* Drive diagnostic failed in initialize. */
#define NUF_IDE_SETMULTIPLE -3118 /* Set multiple mode command failed. */
#define NUF_IDE_INITPARMS -3119 /* initialize parmaters failed in initialize */
#define NUF_IDE_NOT_READY -3120 /* Drive not ready. */
#define NUF_IDE_CMDERROR -3121 /* IDE command error. See error register. */
#define NUF_IDE_BUSERROR -3122 /* DRQ should be asserted but it isn't. */
#define NUF_IDE_EVENT_TIMEOUT -3123 /* Event timeout. */
/* Device driver dispatch table */
typedef struct _pc_bdevsw
{
/* Specify a lock number for this entry. If a driver controls multiple
drives this should be set to the lowest driveno controlled by that
driver for each drive controlled. see pc_drive_enter in lowl.c
Note: In non multitasking or coarse grained multitasking ignore this
*/
INT16 lock_no;
/* Block IO open call. Opens a drive and sets up partitions */
INT (*open_proc)(UINT16 driveno);
/* Special open call. Opens a drive doesn't set up partitions */
INT (*raw_open_proc)(UINT16 driveno);
/* Close */
INT (*close_proc)(UINT16 driveno);
/* Read & Write sector offset from partition base. If raw_open the
logical == physical. */
INT (*io_proc)(UINT16 driveno, UINT32 sector, VOID *buffer, UINT16 count, INT reading);
/* ioctl. User function call to device driver. RTFS does nothing
with this but we have provided the hook for device maintenance
(such as format and special error returns */
INT (*ioctl_proc)(UINT16 driveno, UINT16 command, VOID *buffer);
INT (*dskchk_proc)(UINT16 driveno);
} _PC_BDEVSW;
/* File system dispatch table */
typedef struct _nf_fstbl
{
STATUS (* fs_init)(INT16 driveno);
} _NUF_FSTBL;
/* Partition table descriptions. */
typedef struct ptable_entry
{
UINT8 boot; /* BootSignature */
UINT8 s_head; /* StartHead */
UINT8 s_sec; /* StartSector(Bit0-5) Bit6 and 7 are cylinder number */
UINT8 s_cyl; /* StartCylinder Upper two bit of starting clyinder number are in StartSector field. */
UINT8 p_typ; /* Partition Type */
UINT8 e_head; /* EndHead */
UINT8 e_sec; /* EndSector(Bit0-5) Bit6 and 7 are cylinder number*/
UINT8 e_cyl; /* EndCylinder Upper two bit of ending clyinder number are in StartSector field. */
UINT32 r_sec; /* Relativity sector */
UINT32 p_size; /* Size of partition */
} PTABLE_ENTRY;
/* (Master) Boot Record structure */
typedef struct ptable
{
PTABLE_ENTRY ents[4]; /* Entry table */
UINT16 signature; /* should be 0xAA55 */
} PTABLE;
/* NUCLEUS file constants that are needed to create IN_DATA.C and are
needed by NUCLEUS File.
The following Values are user changable. See below for instructions:
NUF_FILE_SYSTEM_MUTEX
NUF_FLOPPY_EVENT .. or .. NUF_FIRST_EVENT_NUMBER
NUF_FATSIZE_A
NUF_FATSIZE_B
NUF_FATSIZE_C
NUF_FATSIZE_D
NUF_FATSIZE_E
*/
/* NUCLEUS - fs_user is a function call under nucleus. See pc_users.c */
#define fs_user ((PFILE_SYSTEM_USER)(fs_current_user_structure()))
/* Nucleus FILE uses event groups to synchronize access to file system objects,
via calls to NU_Retrieve_Events() and NU_Set_Events() in Nucleus PLUS.
NUF_FIRST_EVENT_NUMBER is used by pc_memory_init to assign event handles to
various file system objects.
If device drivers are being built, we grab a few event channels for interrupt
processing in the drivers.
NUF_NUM_EVENTS is the total number of events used by NUCLEUS File.
IN_System_Event_Groups must be at least this large.
*/
#define NUF_FIRST_EVENT_NUMBER 0 /* May be changed */
#if (EBS_FLOPPY)
#define NUF_FLOPPY_EVENT (NUF_FIRST_EVENT_NUMBER + (NDRIVES*3) + NFINODES)
#define NUF_FLOPPY_TIMER_EVENT (NUF_FLOPPY_EVENT+1)
#define NUF_NUM_EVENTS (2 + (NDRIVES*3) + NFINODES)
#else
#define NUF_NUM_EVENTS ((NDRIVES*3) + NFINODES)
#endif
/* File allocation table buffer size in blocks. We reserve 9 blocks for the
A & B drives. (enough for a 1.44M floppy). 32 blocks each for the C and
D drives. And 9 blocks for the ram disk. Modify these values to suit your
application. Make the C and D FAT Buffers larger or smaller depending on
your hard disk configuration. Larger buffers give better performance, but
making the buffers larger than the actual fat provides no benefit and wastes
memory.
*/
#define HEAPGRAN 1
#define NUF_FATSIZE_A 9
#define NUF_FATSIZE_B 9
#define NUF_FATSIZE_C 32
#define NUF_FATSIZE_D 32
#define NUF_FATSIZE_E 32
#define NUF_FATSIZE_F 32
#if (RAMDISK)
extern NU_PARTITION_POOL NUF_RAMDISK_PARTITION;
#endif
#define ALLOC_SIZE 20
#define PARTITION_SIZE 20
#if (RAMDISK)
/* The ram disk memory is allocate from the fixed parttition at
NUF_RAMDISK_PARTITION . There are NUM_RAMDISK_PAGES equal sized
memory blocks of size NUF_RAMDISK_PARTITION_SIZE. This value need not
be changed. To modify the ram disk size you should modify
RAMDISK_PAGE_SIZE */
#define NUF_RAMDISK_PARTITION_SIZE (RAMDISK_PAGE_SIZE*512/HEAPGRAN)
#endif
/* This declaration is only used in pc_user.c */
signed int NUFP_Current_Task_ID(void);
/* This external declaration is for the conversion between
event group IDs and the pointers used by Nucleus PLUS. */
extern NU_EVENT_GROUP NUFP_Events[NUF_NUM_EVENTS];
#define FAT_FILE_SYSTEM 1
#include "file\inc\proto.h"
#endif /* __PCDISK__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -