⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 devtable.c

📁 nucleus file NUCLEUS的文件系统源代码
💻 C
字号:
/************************************************************************
*                                                                       
*       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                 
*                                                                       
*       DEVTABLE.C                              FILE  2.3.2              
*                                                                       
* COMPONENT                                                             
*                                                                       
*       Nucleus File                                                    
*                                                                       
* DESCRIPTION                                                           
*                                                                       
*       User supplied Device driver.                                    
*                                                                       
*       When you have your device drivers written plug them into this   
*       table.                                                          
*                                                                       
*                                                                       
* DATA STRUCTURES                                                       
*                                                                       
*       _PC_BDEVSW                          Device driver dispatch table.
*       NUF_Drive_Fat_Size                  Drive FAT bufffer size list.
*                                                                       
* FUNCTIONS                                                             
*                                                                       
*       nodev_ioctl                         Dummy device I/O control.   
*       nodev_init_drive                    Dummy device init drive.    
*       nodev_open                          Dummy device open.          
*       nodev_raw_open                      Dummy device raw open.      
*       nodev_close                         Dummy device close.         
*       nodev_io                            Dummy device I/O.           
*                                                                       
* DEPENDENCIES                                                          
*                                                                       
*       pcdisk.h                            File common definitions     
*                                                                       
* NOTE: This module is linked in with File.lib.  After you make   *
*       changes, you must rebuild File.lib.                       *
*******************************************************************/

#include        "file\pcdisk.h"


/* External device functions. Replace these with your drivers. */
/* RAMDISK, EBS_FLOPPY, etc are defined in pcdisk.h            */

/* Ramdisk */
#if (RAMDISK)
extern INT pc_rd_open(UINT16 driveno);
extern INT pc_rd_raw_open(UINT16 driveno);
extern INT pc_rd_close(UINT16 driveno);
extern INT pc_rd_io(UINT16 driveno, UINT32 block, VOID FAR *buffer, UINT16 count, INT do_read);
extern INT pc_rd_ioctl(UINT16 driveno, UINT16 command, VOID *buffer);
#endif


/* Bios */
#if ( (EBS_FLOPPY == 0) && (EBS_IDE == 0) )
extern INT bios_open(UINT16 driveno);
extern INT bios_raw_open(UINT16 driveno);
extern INT bios_close(UINT16 driveno);
extern INT bios_io(UINT16 driveno, UINT32 block, VOID FAR *buffer, UINT16 count, INT do_read);
extern INT bios_ioctl(UINT16 driveno, UINT16 command, VOID *buffer);
#endif


/* ide */
#if (EBS_IDE)
extern INT ide_ioctl(UINT16 driveno, UINT16 command, VOID *buffer);
extern INT ide_init_drive(INT16 driveno);
extern INT ide_open(UINT16 driveno);
extern INT ide_raw_open(UINT16 driveno);
extern INT ide_close(UINT16 driveno);
extern INT ide_io(UINT16 driveno, UINT32 sector, VOID FAR *buffer, UINT16 count, INT reading);
#endif


/* floppy */
#if (EBS_FLOPPY)
extern INT floppy_ioctl(UINT16 driveno, UINT16 command, VOID *buffer);
extern INT floppy_init_drive(INT16 driveno);
extern INT floppy_open(UINT16 driveno);
extern INT floppy_raw_open(UINT16 driveno);
extern INT floppy_close(UINT16 driveno);
extern INT floppy_io(UINT16 driveno, UINT32 sector, VOID FAR *buffer, UINT16 count, INT reading);
#endif


/* Dummy device */
INT nodev_ioctl(UINT16 driveno, UINT16 command, VOID *buffer) { return(NO); }
INT nodev_init_drive(INT16 driveno) { return(NO); }
INT nodev_open(UINT16 driveno) { return(NO); }
INT nodev_raw_open(UINT16 driveno) { return(NO); }
INT nodev_close(UINT16 driveno) { return(NO); }
INT nodev_io(UINT16 driveno, UINT32 sector, VOID FAR *buffer, UINT16 count, INT reading) { return(NO); }


    /* Note:
        The first field in each of these records (0,0,0,0,4) is the lowest
        drive number that shares the same lock. In the bios driver, only one
        device may be accessed at a time so all locks are done on drive "A:"
        0. */


#if (RAMDISK)
/* ============================= RAMDISK ============================= */
_PC_BDEVSW pc_bdevsw[] =
{
    {0,  pc_rd_open, pc_rd_raw_open, pc_rd_close, pc_rd_io, pc_rd_ioctl,(int(*)(UINT16))0}          /* A: */
};

INT  NUF_Drive_Fat_Size[NDRIVES] =
{ 
    NUF_FATSIZE_A,
};


#elif (IDE_ATA)
/* ============================ IDE_ATA disk ============================ */
_PC_BDEVSW pc_bdevsw[] =
{
    {0,  floppy_open, floppy_raw_open, floppy_close, floppy_io, floppy_ioctl, (int(*)(UINT16))0},   /* A: */
    {1,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0},        /* B: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* C: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* D: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* E: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* F: */
    {5,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0}         /* G: */
};

INT  NUF_Drive_Fat_Size[NDRIVES] =
{ 
    NUF_FATSIZE_A,
    NUF_FATSIZE_B,
    NUF_FATSIZE_C,
    NUF_FATSIZE_D,
    NUF_FATSIZE_E,
    NUF_FATSIZE_F
};


#elif (IDE_PCM)
/* ============================= IDE w/PCMCIA card ============================= */
_PC_BDEVSW pc_bdevsw[] =
{
    {0,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0},        /* A: */
    {1,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0},        /* B: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* C: */
    {3,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* D: */
    {4,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0},        /* E: */
    {5,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0},        /* F: */
    {6,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0}         /* G: */
};

INT  NUF_Drive_Fat_Size[NDRIVES] =
{ 
    NUF_FATSIZE_A,
    NUF_FATSIZE_B,
    NUF_FATSIZE_C,
    NUF_FATSIZE_D,
    NUF_FATSIZE_E,
    NUF_FATSIZE_F
};

#endif/* ================ Device Select ================ */


#if (0)
/* ============================= User port ============================ */
_PC_BDEVSW pc_bdevsw[] =
{
    {0,  floppy_open, floppy_raw_open, floppy_close, floppy_io, floppy_ioctl, (int(*)(UINT16))0},   /* A: */
    {1,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0},        /* B: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* C: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* D: */
    {2,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* E: */
    {4,  ide_open, ide_raw_open, ide_close, ide_io, ide_ioctl, (int(*)(UINT16))0},                  /* F: */
    {5,  nodev_open, nodev_raw_open, nodev_close, nodev_io, nodev_ioctl, (int(*)(UINT16))0}         /* G: */
};

INT  NUF_Drive_Fat_Size[NDRIVES] =
{ 
    NUF_FATSIZE_A,
    NUF_FATSIZE_B,
    NUF_FATSIZE_C,
    NUF_FATSIZE_D,
    NUF_FATSIZE_E,
    NUF_FATSIZE_F
};
#endif

⌨️ 快捷键说明

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