📄 pcdisk.h
字号:
open is active. */
/* Errno values */
#define PEBADF 9 /* Invalid file descriptor*/
#define PENOENT 2 /* File not found or path to file not found*/
#define PEMFILE 24 /* No file descriptors available (too many
files open)*/
#define PEEXIST 17 /* Exclusive access requested but file
already exists.*/
#define PEACCES 13 /* Attempt to open a read only file or a
special (directory)*/
#define PEINVAL 22 /* Seek to negative file pointer attempted.*/
#define PENOSPC 28 /* Write failed. Presumably because of no
space*/
#define PESHARE 30 /* Open failed do to sharing */
/* Arguments to SEEK */
#define PSEEK_SET 0 /* offset from begining of file*/
#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
/* 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
*/
COUNT lock_no;
/* Block IO open call. Opens a drive and sets up partitions */
BOOL (*open_proc)(UCOUNT driveno);
/* Special open call. Opens a drive doesn't set up partitions */
BOOL (*raw_open_proc)(UCOUNT driveno);
/* Close */
BOOL (*close_proc)(UCOUNT driveno);
/* Read & Write sector offset from partition base. If raw_open the
logical == physical. */
BOOL (*io_proc)(UCOUNT driveno, ULONG sector, VOID FAR *buffer, UCOUNT count, BOOL 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 */
BOOL (*ioctl_proc)(UCOUNT driveno, UCOUNT command, VOID *buffer);
} _PC_BDEVSW;
/* Partition table descriptions. */
/* One disk partition table */
typedef struct ptable_entry {
UTINY boot;
UTINY s_head;
UCOUNT s_cyl;
UTINY p_typ;
UTINY e_head;
UCOUNT e_cyl;
ULONG r_sec; /* Relative sector of start of part */
ULONG p_size; /* Size of partition */
} PTABLE_ENTRY;
typedef struct ptable {
PTABLE_ENTRY ents[4];
UCOUNT signature; /* should be 0xaa55 */
} PTABLE;
#define x86_SIZEOF_PTABLE 66
/* 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
Note: If you have less than five drives and/or you don't need a ramdisk
you should modify IN_Fixed_Partitions[] in IN_Data.c for Nucleus RTX or
NUFP.C for Nucleus PLUS. In addition you should modify pc_bdevsw[] in
devtable.c to not contain entries for these devices, and you can eliminate
some of the cases in PC_MEMRY.C.
*/
/* NUCLEUS - fs_user is a function call under nucleus. See pc_users.c */
#define fs_user fs_current_user_structure()
/* This is a resource handle that will be used as an argument to
NU_Request_Resource() and NU_Release_Resource(). It must be less than
IN_System_Resources in in_data.c
We set it to one for the reference port. You should set it to whatever
value is convenient.
*/
/* Nucleus PLUS uses pointers to semaphores rather than the IDs used by
Nucleus RTX. The following conditional compilation defines the
pointer externally for the Nucleus FILE system use. The actual value
is defined in NUFP.C. */
#if (PLUS)
IMPORT NU_SEMAPHORE NUF_FILE_SYSTEM_MUTEX;
#define NUF_NUM_RESOURCES 1
#else
#define NUF_FILE_SYSTEM_MUTEX 0 /* If this is changed, make
sure the entry in IN_DATA.C
changes position in the
table as this is an
index. */
#define NUF_NUM_RESOURCES 1
#endif
/* Nucleus FILE uses event groups to synchronize access to file system objects,
via calls to NU_Wait_For_Events() and NU_Set_Events() in Nucleus RTX and
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.
In Nucleus RTX if the manifest NUF_FIRST_EVENT_NUMBER is changed, the
corresponding event allocations based on the number of events in IN_DATA.C
will also change. Therefore, take this into consideration when adding your
own events. The best bet is to leave this at 0 and add your event IDs after
the file system's events (i.e., NUF_NUM_EVENTS).
*/
#if (PLUS)
#define NUF_FIRST_EVENT_NUMBER 0 /* May be changed */
#if (EBS_IDE || EBS_FLOPPY)
#define NUF_FLOPPY_EVENT (NUF_FIRST_EVENT_NUMBER + (NDRIVES*3) + NFINODES)
#define NUF_FLOPPY_TIMER_EVENT (NUF_FLOPPY_EVENT+1)
#define NUF_IDE_EVENT (NUF_FLOPPY_EVENT+2)
#define NUF_NUM_EVENTS (3 + (NDRIVES*3) + NFINODES)
#else
#define NUF_NUM_EVENTS ((NDRIVES*3) + NFINODES)
#endif
#else /* RTX */
#define NUF_FIRST_EVENT_NUMBER 0 /* May be changed */
#if (EBS_IDE || EBS_FLOPPY)
#define NUF_FLOPPY_EVENT (NUF_FIRST_EVENT_NUMBER + (NDRIVES*3) + NFINODES)
#define NUF_FLOPPY_TIMER_EVENT (NUF_FLOPPY_EVENT+1)
#define NUF_IDE_EVENT (NUF_FLOPPY_EVENT+2)
#define NUF_NUM_EVENTS (3 + (NDRIVES*3) + NFINODES)
#else
#define NUF_NUM_EVENTS ((NDRIVES*3) + NFINODES)
#endif
#endif /* elseif RTX */
/* 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.
If you have fewer drives remove some entries from the memory partition table
in IN_DATA.C for Nucleus RTX or the actual creation of pools in NUFP.C for
Nucleus PLUS to free up memory resources.
*/
#define NUF_FATSIZE_A 9
#define NUF_FATSIZE_B 9
#define NUF_FATSIZE_C 32
#define NUF_FATSIZE_D 32
#define NUF_FATSIZE_E 9
#define NUF_FAT_PARTITION_A_SIZE (NUF_FATSIZE_A*512)
#define NUF_FAT_PARTITION_B_SIZE (NUF_FATSIZE_B*512)
#define NUF_FAT_PARTITION_C_SIZE (NUF_FATSIZE_C*512)
#define NUF_FAT_PARTITION_D_SIZE (NUF_FATSIZE_D*512)
#if (RAMDISK)
#define NUF_FAT_PARTITION_E_SIZE (NUF_FATSIZE_E*512)
#endif
#if (PLUS)
IMPORT NU_PARTITION_POOL NUF_USER_PARTITION;
IMPORT NU_PARTITION_POOL NUF_DRIVE_PARTITION;
IMPORT NU_PARTITION_POOL NUF_FILE_PARTITION;
IMPORT NU_PARTITION_POOL NUF_BLOCK_PARTITION;
IMPORT NU_PARTITION_POOL NUF_DROBJ_PARTITION;
IMPORT NU_PARTITION_POOL NUF_FINODE_PARTITION;
IMPORT NU_PARTITION_POOL NUF_FAT_PARTITION_A;
IMPORT NU_PARTITION_POOL NUF_FAT_PARTITION_B;
IMPORT NU_PARTITION_POOL NUF_FAT_PARTITION_C;
IMPORT NU_PARTITION_POOL NUF_FAT_PARTITION_D;
IMPORT NU_PARTITION_POOL NUF_FAT_PARTITION_E;
#if (RAMDISK)
IMPORT NU_PARTITION_POOL NUF_RAMDISK_PARTITION;
#endif
#else /* RTX */
#define NUF_USER_PARTITION 1
#define NUF_DRIVE_PARTITION (NUF_USER_PARTITION+1)
#define NUF_FILE_PARTITION (NUF_USER_PARTITION+2)
#define NUF_BLOCK_PARTITION (NUF_USER_PARTITION+3)
#define NUF_DROBJ_PARTITION (NUF_USER_PARTITION+4)
#define NUF_FINODE_PARTITION (NUF_USER_PARTITION+5)
#define NUF_FAT_PARTITION_A (NUF_USER_PARTITION+6)
#define NUF_FAT_PARTITION_B (NUF_USER_PARTITION+7)
#define NUF_FAT_PARTITION_C (NUF_USER_PARTITION+8)
#define NUF_FAT_PARTITION_D (NUF_USER_PARTITION+9)
#define NUF_FAT_PARTITION_E (NUF_USER_PARTITION+10)
#if (RAMDISK)
#define NUF_RAMDISK_PARTITION (NUF_USER_PARTITION+11)
#endif
#endif
#if (PLUS)
#define HEAPGRAN 1
#else
#define HEAPGRAN 2
#endif
#define ALLOC_SIZE 20
#define PARTITION_SIZE 20
#define NUF_USER_PARTITION_SIZE ( ((sizeof(FILE_SYSTEM_USER)+1)/HEAPGRAN) * \
NUM_USERS)
#define NUF_DRIVE_PARTITION_SIZE ( ((sizeof(DDRIVE)+1)/HEAPGRAN) * NDRIVES)
#define NUF_FILE_PARTITION_SIZE ( ((sizeof(PC_FILE)+1)/HEAPGRAN) * NUSERFILES)
#define NUF_BLOCK_PARTITION_SIZE ( ((sizeof(BLKBUFF)+1)/HEAPGRAN) * NBLKBUFFS)
#define NUF_DROBJ_PARTITION_SIZE ( ((sizeof(DROBJ)+1)/HEAPGRAN) * NDROBJS)
#define NUF_FINODE_PARTITION_SIZE ( ((sizeof(FINODE)+1)/HEAPGRAN) * NFINODES)
#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
#if (PLUS)
/* This declaration is only used in pc_user.c */
signed int NUFP_Current_Task_ID(void);
/* This external declaration is for the conversion between Nucleus RTX
event group IDs and the pointers used by Nucleus PLUS. */
IMPORT NU_EVENT_GROUP NUFP_RTX_To_PLUS_Events[NUF_NUM_EVENTS];
#endif /* PLUS */
#include "proto.h"
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -