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

📄 bootconfig.c

📁 motorola mpc系列 mpc852cpu bsp
💻 C
📖 第 1 页 / 共 5 页
字号:
        NULL
    };

    FAST char **pMsg;
#ifdef  INCLUDE_NETWORK
    FAST NETIF *pNif;
#endif  /* INCLUDE_NETWORK */

#ifdef INCLUDE_END
    int        count;
    char       muxDevName[8];
    END_TBL_ENTRY* pDevTbl;
#endif /* INCLUDE_END */

    Drv_Print ("\n");

    for (pMsg = helpMsg; *pMsg != NULL; pMsg += 2)
    {
        Drv_Print (" %-21s %s\n", *pMsg, *(pMsg + 1));
    }
#ifdef  INCLUDE_NETWORK

    Drv_Print ("\navailable boot devices:");

#ifdef INCLUDE_END

    Drv_Print ("Enhanced Network Devices\n");
    for (count = 0, pDevTbl = endDevTbl; pDevTbl->endLoadFunc != END_TBL_END;
         pDevTbl++, count++)
    {
        if (!pDevTbl->processed)
        {
            muxDevName [0] = NULL;
            pDevTbl->endLoadFunc (muxDevName, NULL);
            Drv_Print (" %s%d", muxDevName, pDevTbl->unit);
        }
    }
#endif /* INCLUDE_END */

    for (pNif = netIf; pNif->ifName != 0; pNif++)
    {
        if (strncmp (pNif->ifName, "lo", 2) != 0)
        {
            Drv_Print (" %s", pNif->ifName);
        }
    }


#endif  /* INCLUDE_NETWORK */

#ifdef  INCLUDE_SCSI_BOOT
    Drv_Print (" scsi");
#endif  /*INCLUDE_SCSI_BOOT*/

#ifdef  INCLUDE_FD
    Drv_Print (" fd");
#endif  /* INCLUDE_FD */

#ifdef  INCLUDE_IDE
    Drv_Print (" ide");
#endif  /* INCLUDE_IDE */

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

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

#ifdef  INCLUDE_TSFS_BOOT
    Drv_Print (" tsfs");
#endif  /* INCLUDE_TSFS_BOOT */

    Drv_Print ("\n");
}

/*******************************************************************************
*
* bootLoad - load a module into memory
*
* Description:
*
* Calls:    usrBootLineCarck(), bootParamsShow(),
*           sysProcNumSet(),
*           fdLoad(), ideLoad(), netLoad(), tsfsLoad(),
*           pcmciaInit(), pcmciaLoad()
* Called by: autoboot(), bootCmdLoop()
* Input:    bootString
*           pEntry - entry of memory to save loaded module
* Output:   show parameters
* Return:   OK or ERROR
*******************************************************************************/


LOCAL STATUS bootLoad
    (
    char *   bootString,
    FUNCPTR *pEntry
    )
{
    BOOT_PARAMS     params;
#ifdef  INCLUDE_SCSI_BOOT           /* 未定义 */
#ifdef  INCLUDE_SCSI2
    SCSI_OPTIONS    options;
    UINT            which;
    int             devBusId;
#endif  /* INCLUDE_SCSI2 */
#endif  /* INCLUDE_SCSI_BOOT */
#ifdef  INCLUDE_NETWORK             /* 定义 */
    char            nad [20];       /* host's network internet addr */
    int             netmask = 0;    /* temporary storage */
    int             result;         /* classification of address string */
    unsigned long   leaseLen;       /* lease length field (optional) */
#ifdef INCLUDE_DHCPC                /* 未定义 */
    DHCP_LEASE_DATA dhcpLease;
#endif  /* INCLUDE_DHCPC */

    char        buf [30];   /* string of netmask and timestamps */
    char        netDev [BOOT_DEV_LEN + 1];
    char        bootDev [BOOT_DEV_LEN];
    BOOL        backplaneBoot;
    char *      pBootAddr;
    BOOL        attached = FALSE;   /* driver is attached */

#ifdef INCLUDE_END                  /* 未定义 */
    char        muxDevName[8];
#endif /* INCLUDE_END */

#endif  /* INCLUDE_NETWORK */

    /* copy bootString to low mem address, if specified */

    if ((bootString != NULL) && (*bootString != EOS))
    {
	
    	strcpy (BOOT_LINE_ADRS, bootString);
    }

    /* interpret boot command */

    if (usrBootLineCrack (BOOT_LINE_ADRS, &params) != OK)
    {
        return (ERROR);
    }

    /* Display boot parameters */
    /*Drv_Print("display bootline\r\n");
    Drv_Print("%s\r\n",BOOT_LINE_ADRS);
    */
    bootParamsShow (BOOT_LINE_ADRS);
    /* set our processor number: may establish vme access, etc. */

    sysFlags = params.flags;
    sysProcNumSet (params.procNum);

#ifdef  INCLUDE_SCSI_BOOT           /* 未定义 */

    /*
     * initialize either the SCSI1 or SCSI2 interface; initialize SCSI2 when
     * the SCSI2 interface is available.
     */

#ifndef INCLUDE_SCSI2
    scsi1IfInit ();
#else
    scsi2IfInit ();
#endif

    if (strncmp (params.bootDev, "scsi", 4) == 0)
    {
        int     bootDevId = NONE;
        int     bootDevLUN = NONE;

#ifdef INCLUDE_SCSI2
        /* Set all devices to asynchronous data transfer */

        which = SCSI_SET_OPT_XFER_PARAMS;
        options.maxOffset = 0;
        options.minPeriod = SCSI_SYNC_XFER_MIN_PERIOD;

        for (devBusId = 0; devBusId < 8; devBusId++)
        {
            scsiTargetOptionsSet (pSysScsiCtrl, devBusId, &options, which);
        }
#endif /* INCLUDE_SCSI2 */

    /* check for absence of bus ID and LUN, in which case
     * auto-configure and display results
     */

        if (strlen (params.bootDev) == 4)
        {
            if (!scsiInitialized)
            {
                if (sysScsiInit () == ERROR)
                {
                    printErr ("Could not initialize SCSI.\n");
                    return (ERROR);
                }
                scsiInitialized = TRUE;
            }

            scsiAutoConfig (pSysScsiCtrl);
            scsiShow (pSysScsiCtrl);

        /* return ERROR to indicate that no file was loaded */
            return (ERROR);
        }

        sscanf (params.bootDev, "%*4s%*c%d%*c%d", &bootDevId, &bootDevLUN);

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

        return (OK);
    }

#endif  /* INCLUDE_SCSI_BOOT */

#ifdef  INCLUDE_FD                  /* 未定义 */

    if (strncmp (params.bootDev, "fd", 2) == 0)
    {
        int type = 0;
        int drive = 0;

        if (strlen (params.bootDev) == 2)
        {
            return (ERROR);
        }
        else
        {
            sscanf (params.bootDev, "%*2s%*c%d%*c%d", &drive, &type);
        }
        if (fdLoad (drive, type, params.bootFile, pEntry) != OK)
        {
            printErr ("\nError loading file: errno = 0x%x.\n", errno);
            return (ERROR);
        }

        return (OK);
    }

#endif  /* INCLUDE_FD */

#ifdef  INCLUDE_IDE                     /* 未定义 */

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

        if (strlen (params.bootDev) == 3)
        {
            return (ERROR);
        }
        else
        {
            sscanf (params.bootDev, "%*3s%*c%d%*c%d", &drive, &type);
        }
        if (ideLoad (drive, type, params.bootFile, pEntry) != OK)
        {
            printErr ("\nError loading file: errno = 0x%x.\n", errno);
            return (ERROR);
        }

        return (OK);
    }

#endif  /* INCLUDE_IDE */

#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_PCMCIA                  /* 未定义 */

    pcmciaInit ();          /* init PCMCIA Lib */

    if (strncmp (params.bootDev, "pcmcia", 6) == 0)
    {
        int sock    = NONE;

        if (strlen (params.bootDev) == 6)
        {
            return (ERROR);
        }
        else
        {
            sscanf (params.bootDev, "%*6s%*c%d", &sock);
        }
        if (pcmciaLoad (sock, params.bootFile, pEntry) == OK)
        {
            return (OK);
        }

    /* fall through if the PC card is not a block device.
     * let's try to boot it from an ethernet device.
     */
    }

#endif  /* INCLUDE_PCMCIA */

#ifdef  INCLUDE_TFFS                /* 未定义 */

    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);
        }
    /* tffsLoad () should be after pcmciaInit () */

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

        return (OK);
    }

#endif  /* INCLUDE_TFFS */

#ifdef  INCLUDE_TSFS_BOOT           /* 未定义 */

    if (strncmp (params.bootDev, "tsfs", 4) == 0)
    {
        if (tsfsLoad (params.bootFile, pEntry) != OK)
        {
            printErr ("\nError loading file: errno = 0x%x.\n", errno);
            return (ERROR);
        }

        return (OK);
    }

#endif  /* INCLUDE_TSFS_BOOT */

#ifndef  INCLUDE_NETWORK            /* 定义, 无效 */

    Drv_Print ("\nError loading file: networking code not present.\n");
    return (ERROR);
}

#else  /* INCLUDE_NETWORK */        /* 定义 */

    /* start the network */

    /* initialize the generic socket library */

    if (sockLibInit (NUM_FILES) == ERROR)
    {
        return (ERROR);
    }

#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)    /* 未定义 */
    if (usrStrmInit() == ERROR)         /* init Streams subsystem */
    {
        return (ERROR);
    }
#endif

#if defined(INCLUDE_BSD) || defined(INCLUDE_BSD_SOCKET)         /* 未定义 */
    /* add the BSD socket library interface */
    if (sockLibAdd ((FUNCPTR) bsdSockLibInit, AF_INET_BSD, AF_INET) == ERROR)
    {
        return (ERROR);
    }
    if (sockLibAdd ((FUNCPTR) bsdSockLibInit, AF_ROUTE, AF_ROUTE) == ERROR)
    {
        return (ERROR);
    }
#endif  /* INCLUDE_BSD || INCLUDE_BSD_SOCKET */

    /* install default socket library interface */

#ifndef DEFAULT_STREAMS_SOCKET          /* 未定义, 有效 */
    if (sockLibAdd ((FUNCPTR) bsdSockLibInit, AF_INET, AF_INET) == ERROR)
    {
        return (ERROR);
    }
#endif  /* DEFAULT_STREAMS_SOCKET */

    hostTblInit ();                 /* initialize host table */
    usrNetProtoInit ();             /* initialize various protocols */
    netLibInit ();
#ifdef  INCLUDE_PPP                 /* 未定义 */
#ifdef  INCLUDE_PPP_CRYPT
	cryptRtnInit (&ppp

⌨️ 快捷键说明

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