📄 pcdisk.h
字号:
/************************************************************************
*
* Copyright (c) 2002 by Accelerated Technology, Inc.
*
* PROPRIETARY RIGHTS of Accelerated Technology are involved in
* the subject matter of this material. All manufacturing,
* reproduction, use, and sales rights pertaining to this subject
* matter are governed by the license agreement. The recipient of
* this software implicitly accepts the terms of the license.
*
*
*************************************************************************
*************************************************************************
* FILE NAME VERSION
*
* PCDISK.H FILE 2.3.2
*
* COMPONENT
*
* Nucleus File
*
* DESCRIPTION
*
* This file contains Nucleus File2 constants common to both the
* application and the actual Nucleus File components. This file
* also contains data structure definitions that hide internal
* information from the application.
*
* DATA STRUCTURES
*
* FATSWAP Fat blocks structure.
* DDRIVE Block 0 image.
* DOSINODE Dos Directory Entry.
* BLKBUFF Block buffer.
* LNAMINFO Long file name information.
* LNAMENT Long file name Directory
* Entry.
* FINODE DOS entry.
* DIRBLK Directory information.
* DROBJ Object used to find a dirent
* on a disk and its parent's.
* DATESTR Date stamping buffer.
* PC_FILE Internal file representation.
* DSTAT File search structure.
* FMTPARMS Format parameter blcok.
* pcblk0 Block 0. Not use.
* FILE_SYSTEM_USER File system user structure.
* _PC_BDEVSW Device driver dispatch table.
* _NUF_FSTBL File system dispatch table.
* PTABLE_ENTRY Partition table descriptions.
* PTABLE Boot Record structure.
*
* FUNCTIONS
*
* None.
*
* DEPENDENCIES
*
* nucleus.h System definitions
*
*************************************************************************/
#ifndef __PCDISK__
#define __PCDISK__ 1
#include <stddef.h>
#ifndef NUCLEUS
#include "plus\nucleus.h" /* System definitions */
#endif
/* #define DEBUG */
/* ============================= MNT port ============================= */
#include <stdio.h>
#undef FAR
#define FAR
#define PRINT_STRING printf
#define DEBUG_PRINT printf
#define SWAP_ALIGN 0
#undef TEXT
#ifdef DEBUG
#define DEBUG0 /* Disk Info */
/* #define DEBUG1 */ /* DROBJ Info */
#define DEBUG2 /* Warning */
/* #define DEBUG3 *//* Block Info */
#else
#undef PRINT_STRING
#define PRINT_STRING
#endif /* ifdef DEBUG */
/* Use the x86 processor. */
#define X86 0 /* 1 : Use 0 : Not use */
/* ============= ATI DRIVERS =============== */
/* Set the following line to 1 if you purchased the IDE driver */
#define EBS_IDE 0
/* If using ATA hard disk, define BOTH EBS_IDE and IDE_ATA */
#define IDE_ATA 0
/* Set the following line to 1 if you purchased the FLOPPY driver */
#define EBS_FLOPPY 0
/* Set the following line to 1 if you purchased the RAMDISK driver */
#define RAMDISK 1
/* ============ OTHER CONSTANTS ============ */
/* Set this to total number of drives to support. This value (4) supports
(A,B,C,D). If you are going to use the RAM Disk in addition to these
four drives, set NDRIVES to 5. */
#define NDRIVES 1
#ifndef PLUS_VERSION_COMP
typedef char INT8; /* 1 1 */
typedef unsigned char UINT8; /* 1 1 */
typedef signed short INT16; /* 2 2 */
typedef unsigned short UINT16; /* 2 2 */
#endif /* PLUS_VERSION_COMP */
/* ================ Port Select MNT,CADUL or ARM ================ */
#ifdef BIG_ENDIAN
#define SWAP16(X,Y) _swap16(X,Y)
#define SWAP32(X,Y) _swap32(X,Y)
#else
#if (SWAP_ALIGN) /* Little endian alignment care */
#define SWAP16(X,Y) _through16(X,Y)
#define SWAP32(X,Y) _through32(X,Y)
#else
#define SWAP16(X,Y) *(UINT16 *)(X) = *(UINT16 *)(Y)
#define SWAP32(X,Y) *(UINT32 *)(X) = *(UINT32 *)(Y)
#endif
#endif /* ifdef BIG_ENDIAN */
#define YES 1
#define NO 0
#define BLOCKEQ0 0L
/* =========== User tunable section ================ */
/* ============ Device drivers =============== */
/* ============= RAMDISK =============== */
/* For the demonstration port we create a 50K ram disk. If you purchased
ATI's RAM Disk Driver, you can change the following definitions to
any size you desire (with the exceptions as listed below).
Note on Intel the RAM Disk is always in the far heap. So you may create
a large ram disk even in small model. Note the ram disk driver will
allocate this much core when it is first mounted.
If you don't need a ramdisk eliminate it from devtable.c
*/
/* Set the following to one if you wish to allocate ram disk memory from
a PLUS memory pool. This affects code in nufp.c and ramdisk.c. This should
be set to 1 for 32 bit systems where it is possible to use allocate > 64K
to a memory pool. If you wish to allocate a RAM Disk larger than 48K on
an Intel real-mode based Nucleus PLUS port, then you should set this
manifest to 0. In that case, the pool will be created by using a DOS
malloc call.
*/
#define RAMDISK_FROMPOOL 1 /* Plus only */
#if (RAMDISK_FROMPOOL)
/* Nucleus PLUS: If allocating the ram disk from a partition pool we
allocated 12 pages (48K). This is because 8086 real mode ports under plus
may only allocate 64K at a time for a pool. For 32 bit ports this
restriction does not exist. */
#define NUM_RAMDISK_PAGES 12 /* (Must be at least 1) */
#else
#define NUM_RAMDISK_PAGES 16 /* (Must be at least 1) */
#endif
#define RAMDISK_PAGE_SIZE 8 /* 8 blocks ='s 4 k (dont exceed 32) */
#define NRAMDISKBLOCKS (NUM_RAMDISK_PAGES * RAMDISK_PAGE_SIZE)
/* ======== MULTI TASKING SUPPORT =============== */
/* Maximum # of tasks that may use the file system. */
#define NUM_USERS 10
/* Blocks in the buffer pool. Uses 532 bytes per block.
impacts performance during directory traversals 20 to 30 is optimal */
#define NBLKBUFFS 20
/* Maximum Number of open Files */
#define NUSERFILES 30
/* Directory Object Needs. Conservative guess is One CWD per user per drive +
One per file + one per User for directory traversal */
#define NFINODES (NUM_USERS*NDRIVES + NUM_USERS + NUSERFILES)
#define NDROBJS (NUM_USERS*NDRIVES + NUM_USERS + NUSERFILES)
#define EMAXPATH 255 /* Maximum path length Change if you like */
#define MAXSECTORS 256 /* Maximum sectors */
/* Number of maximum file sectors(2GB) */
#define MAXFILE_SIZE 4194304 /* (2GB / 512) */
/* NOTE: See the end of this file for more tunable constants which pertain
to the Nucleus environment, specifically allocating memory. */
/*=============== END TUNABLE CONSTANTS ==========================*/
/*=============== MULTI TASKING DATA STRUCTURES and MACROS =======*/
#if (NUM_USERS == 1)
#define LOCK_METHOD 0
/* These macros are API call prolog and epilogs. In multitasking mode
they lock/unlock the RTFS semaphore and check if the user is registered
via pc_rtfs_become_user() respectively. In single tasking mode they do nothing */
#define PC_FS_ENTER()
#define PC_FS_EXIT()
#define CHECK_USER(X, Y)
#define VOID_CHECK_USER()
#define NU_Become_File_User() YES
#else
/* Num users > 1 */
/* These macros are API call prolog and epilogs. In multitasking mode
they lock/unlock the RTFS semaphore and check if the user is registered
via pc_rtfs_become_user() respectively. In single tasking mode they do nothing */
#define PC_FS_ENTER() UINT16 process_flags = pc_fs_enter();
#define PC_FS_EXIT() pc_fs_exit(process_flags);
#define CHECK_USER(X, Y) if (!NU_Check_File_User()) \
{ pc_fs_exit(process_flags); \
return((X) Y);}
#define VOID_CHECK_USER() if (!NU_Check_File_User()) \
{ pc_fs_exit(process_flags); \
return;}
/* This is the type of a unique number that is associated with each task. It
could be a process ID as in unix or a task control block address or
index in a real time exec. It is used to validate tasks as registered
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -