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

📄 readme.txt

📁 mDOC在VxWorks开发环境下的详细开发文档。
💻 TXT
📖 第 1 页 / 共 5 页
字号:
   
               /* create block device spanning entire disk (non-destructive!) */
   
               if ((pBootDev = tffsDevCreate (drive, 0)) == NULL)
                   {
                   printErr ("tffsDevCreate(%d,0) failed.\n", drive);
                   return (ERROR);
                   }
   
               /* split off boot device from boot file */
   
               devSplit (fileName, bootDir);
   
               sprintf(name, "tffsCache0");
               cbio = dcacheDevCreate ((CBIO_DEV_ID) pBootDev, NULL, (128 * 1024), name);

               if (NULL == cbio)
                   {
                   /* insufficient memory, will avoid the cache */
                   printErr ("WARNING: Failed to create disk cache. Disk configured without cache\n");
                   cbio = cbioWrapBlkDev (pBootDev);
                   /* as cbioWrapBlkDev function does not exist in VxWorks 5.4 it is possible to use instead
                   cbio = cbioDevVerify( (void *) pBootDev, FALSE );
                   */
                   }

               rawdisk = dpartDevCreate((CBIO_DEV_ID) cbio, 1, usrFdiskPartRead);

               if (NULL == rawdisk)
                   {
                   printErr ("usrTffsConfig: dpartDevCreate returned NULL.\n");
                   return (ERROR);
                   }

               if (ERROR == dosFsDevCreate(bootDir, dpartPartGet(rawdisk, 0), 20, NONE))
                   {
                   printErr ("usrTffsConfig: dosFsDevCreate returned ERROR.\n");
                   return (ERROR);
                   }
   
               return (OK);
               }
   

           LOCAL STATUS tffsLoad
               (
               int     drive,       /* TFFS handle (normally zero)  */
               int     removable,   /* 0 - nonremovable flash media */
               char    * fileName,  /* file name to download        */
               FUNCPTR * pEntry
               )
               {
               int fd;
   
               /*
                * Call tffsSetup() as appropriate for your application. See
                * Section 2.6 above for details.
                */
   
               /*
                * If you want to change mDOC driver' configuration as
                * as explained in Chapters 5 and 8, do it here.
                */

               if (tffsDrv () != OK)
                   {
                   printErr ("Could not initialize.\n");
                   return (ERROR);
                   }
   
               printf ("Attaching to TFFS... ");
   
               dosFsInit (NUM_DOSFS_FILES);        /* initialize DOS-FS */
   
               if (usrTffsConfig (drive, 0, fileName) == ERROR)
                   {
                   printErr ("usrTffsConfig failed.\n");
                   return (ERROR);
                   }
   
               printErr ("done.\n");
   
               /* load the boot file */
   
               printErr ("Loading %s...", fileName);
   
               if ((fd = open (fileName, O_RDONLY, 0)) == ERROR)
                   {
                   printErr ("\nCannot open \"%s\".\n", fileName);
                   return (ERROR);
                   }
   
               if (bootLoadModule (fd, pEntry) != OK)
                   goto tffsLoadErr;
   
               close (fd);
               return (OK);
   
           tffsLoadErr:
   
               printErr ("\nerror loading file: status = 0x%x.\n", errnoGet ());
               close (fd);
               return (ERROR);
               }

           #endif   /* INCLUDE_DISKONCHIP */


3.3.7.2. If you are not using Workbench 2.4, skip this Section, and follow instructions
         in Section 3.3.7.1 instead.

         Modify file <tornado>/target/config/all/bootConfig.c to add the following
         code fragment under #define INCLUDE_DISKONCHIP, just before routine
         usrInit():
         

           #ifdef  INCLUDE_DISKONCHIP

           #ifdef __cplusplus
           extern "C" {
           #endif

           #ifndef _ASMLANGUAGE

           #include <xbdBlkDev.h>
           #include <fsMonitor.h>
           #include "fldrvvxw.h"

           #endif  /* _ASMLANGUAGE */

           #ifdef __cplusplus
           }
           #endif

           /* forward declarations */

           #ifdef  __STDC__
           void devSplit (char *fullFileName, char *devName);
           #else
           void devSplit ();
           #endif  /* __STDC__ */


           STATUS usrTffsConfig
               (
               int     drive,     /* TFFS handle (usually zero)   */
               int     removable, /* 0 - nonremovable flash media */
               char *  fileName   /* mount point                  */
               )
               {
               BLK_DEV * pBootDev;
               char bootDir [BOOT_FILE_LEN];
               char tffsName[16];

               /* split off boot device from boot file */
               devSplit (fileName, bootDir);

               /* Create a name for the name mapping */
               sprintf(tffsName, "tffs%d:1", drive);

               /* Install name mapping */
               fsmNameInstall (tffsName, bootDir);

               /* create block device spanning entire disk (non-destructive!) */
               if ((pBootDev = tffsDevCreate (drive, 0)) == NULL)
		   {
		   printErr ("tffsDevCreate(%d,0) failed.\n", drive);
		   return (ERROR);
		   }

               sprintf(tffsName, "tffs%d", drive);

               /* Create an XBD wrapper */
               xbdBlkDevCreateSync (pBootDev, tffsName);

	       return (OK);
               }


           LOCAL STATUS tffsLoad
               (
               int     drive,       /* TFFS handle (normally zero)  */
               int     removable,   /* 0 - nonremovable flash media */
               char    * fileName,  /* file name to download        */
               FUNCPTR * pEntry
               )
               {
               int fd;

               /*
                * Call tffsSetup() as appropriate for your application. See
                * Section 2.6 above for details.
                */

               /*
                * If you want to change mDOC driver' configuration as
                * as explained in Chapters 5 and 8, do it here.
                */

               if (tffsDrv () != OK)
                   {
                   printErr ("Could not initialize.\n");
                   return (ERROR);
                   }

               printf ("Attaching to TFFS... ");

               if (usrTffsConfig (drive, 0, fileName) == ERROR)
                   {
                   printErr ("usrTffsConfig failed.\n");
                   return (ERROR);
                   }

               printErr ("done.\n");

               /* load the boot file */

               printErr ("Loading %s...", fileName);

               if ((fd = open (fileName, O_RDONLY, 0)) == ERROR)
                   {
                   printErr ("\nCannot open \"%s\".\n", fileName);
                   return (ERROR);
                   }

               if (bootLoadModule (fd, pEntry) != OK)
                   goto tffsLoadErr;

               close (fd);
               return (OK);

           tffsLoadErr:

               printErr ("\nerror loading file: status = 0x%x.\n", errnoGet ());
               close (fd);
               return (ERROR);
               }

           #endif   /* INCLUDE_DISKONCHIP */


3.3.8. Modify file <tornado>/target/config/all/bootConfig.c to add the following
       code fragment under #define INCLUDE_DISKONCHIP to helpMsg[] in routine 
       bootHelp():


           #ifdef  INCLUDE_ATA
                "boot device: ata=ctrl,drive        file name: /ata0/VxWorks","",
           #endif  /* INCLUDE_ATA */

           #ifdef  INCLUDE_DISKONCHIP
                "boot device: tffs=drive,removable  file name: /tffs0/VxWorks","",
           #endif  /* INCLUDE_DISKONCHIP */

           #ifdef  INCLUDE_PCMCIA
                "boot device: pcmcia=sock           file name: /pcmcia0/VxWorks","",
           #endif  /* INCLUDE_PCMCIA */


3.3.9. Modify file <tornado>/target/config/all/bootConfig.c to add the following
       code fragment under #define INCLUDE_DISKONCHIP to routine bootHelp():


           #ifdef  INCLUDE_ATA
               printf (" ata");
           #endif  /* INCLUDE_ATA */

           #ifdef  INCLUDE_DISKONCHIP
               printf (" tffs");
           #endif  /* INCLUDE_DISKONCHIP */

           #ifdef  INCLUDE_TFFS
               printf (" tffs");
           #endif  /* INCLUDE_TFFS */

               printf ("\n");
               }


3.3.10. If you are using Tornado versions 2.0x, 2.1, 2.2 or higher skip to
        Section 3.3.10.1. If you are using Workbench version 2.x, skip to
        Section 3.3.10.2.

3.3.10.1. If you are using Workbench 2.x, skip this Section, and follow
          instructions in Section 3.3.10.2 instead.

          Modify file <tornado>/target/config/all/bootConfig.c to add the following
          code fragment under #define INCLUDE_DISKONCHIP to routine bootLoad():


           #ifdef  INCLUDE_ATA

               if (strncmp (params.bootDev, "ata", 3) == 0)
                   {
                   int ctrl  = 0;
                   int drive = 0;

                   if (strlen (params.bootDev) == 3)
                       return (ERROR);
                   else
                       sscanf (params.bootDev, "%*3s%*c%d%*c%d", &ctrl, &drive);

                   if (ataLoad (ctrl, drive, params.bootFile, pEntry) != OK)
                       {
                       printErr ("\nError loading file: errno = 0x%x.\n", errno);
                       return (ERROR);
                       }

                   return (OK);
                   }

           #endif  /* INCLUDE_ATA */

           #ifdef  INCLUDE_DISKONCHIP
   
               if (strncmp (params.bootDev, "tffs", 4) == 0)
                   {
                   int drive = 0;
                   int removable = 0;
   
                   if (strlen (params.bootDev) == 4)
                       return (ERROR);
                   else
                       sscanf (params.bootDev, "%*4s%*c%d%*c%d", &drive, &removable);
   
                   if (tffsLoad (drive, 0, params.bootFile, pEntry) != OK)
                       {
                       printErr ("\nError loading file: errno = 0x%x.\n", errno);
                       return (ERROR);
                       }
   
                   return (OK);
                   }
   
           #endif  /* INCLUDE_DISKONCHIP */
   
           #ifdef  INCLUDE_PCMCIA
   
               pcmciaInit ();          /* init PCMCIA Lib */
   
               if (strncmp (params.bootDev, "pcmcia", 6) == 0)
                   {
      

⌨️ 快捷键说明

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