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

📄 usrfdc.c

📁 cpc-1631的BSP包for VxWorks操作系统
💻 C
字号:
/* usrFdc.c - floppy disk initialization */

/* Copyright 1992-1998 Wind River Systems, Inc. */

/*
modification history
--------------------
01b,02oct01,jkf  updated cbioDevVerify for SPR#69031.
01a,15may01,pch  Sandpoint version written (from 01e of dosfs2/usrFd.c)
*/

/*
DESCRIPTION
This file is used to configure and initialize the VxWorks floppy disk support.
This file is included by the prjConfig.c configuration file created by thge Project Manager.

NOMANUAL
*/

#include "vxWorks.h"        
#include "dosFsLib.h"       
#include "dcacheCbio.h"     

/*******************************************************************************
*
* usrFdcConfig - mount a DOS file system from a floppy disk
*
* This routine mounts a DOS file system from a floppy disk device.
*
* The <drive> parameter is the drive number of the floppy disk;
* valid values are 0 to 3.
*
* The <type> parameter specifies the type of diskette, which is described
* in the structure table `fdTypes[]' in sysLib.c.  <type> is an index to
* the table.  Currently the table contains two diskette types:
* .iP "" 4
* A <type> of 0 indicates the first entry in the table (3.5" 2HD, 1.44MB);
* .iP
* A <type> of 1 indicates the second entry in the table (5.25" 2HD, 1.2MB).
* .LP
*
* The <fileName> parameter is the mount point, e.g., `/fd0/'.
*
* RETURNS: OK or ERROR.
*
* SEE ALSO:
* .pG "I/O System, Local File Systems, Intel i386/i486 Appendix"
*/

STATUS usrFdConfig
    (
    int     drive,	/* drive number of floppy disk (0 - 3) */
    int     type,	/* type of floppy disk */
    char *  fileName	/* mount point */
    )
    {
    BLK_DEV *pBootDev;
    CBIO_DEV_ID cbio ;
    char bootDir [BOOT_FILE_LEN];

    if(type == NONE)
	return (ERROR);

    if ((UINT)drive >= FD_MAX_DRIVES)
	{
	printErr ("drive is out of range (0-%d).\n", FD_MAX_DRIVES - 1);
	return (ERROR);
	}

    /* create a block device spanning entire disk (non-distructive!) */

    if ((pBootDev = fdcDevCreate (drive, type, 0, 0)) == NULL)
	{
        printErr ("fdcDevCreate failed.\n");
        return (ERROR);
	}

    /* create a disk cache to speed up Floppy operation */
    cbio = dcacheDevCreate( (void *) pBootDev, NULL, FD_CACHE_SIZE, bootDir );

    if( cbio == NULL )                                 
        {                                              
        /* insufficient memory, will avoid the cache */
        cbio = cbioWrapBlkDev (pBootDev);              
        }                                              

    /* split off boot device from boot file */

    devSplit (fileName, bootDir);

    /* initialize device as a dosFs device named <bootDir> */

    if (dosFsDevCreate (bootDir, cbio, 20, NONE) == ERROR)
	{
        printErr ("dosFsDevCreate failed.\n");
        return (ERROR);
	}

    return (OK);
    }

⌨️ 快捷键说明

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