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

📄 bootconfig.c

📁 motorola mpc系列 mpc852cpu bsp
💻 C
📖 第 1 页 / 共 5 页
字号:
#endif  /* INCLUDE_ELC */
#ifdef  INCLUDE_ULTRA
    { "ultra", ultraattach, (char*)IO_ADRS_ULTRA, INT_VEC_ULTRA,
      INT_LVL_ULTRA, MEM_ADRS_ULTRA, MEM_SIZE_ULTRA, CONFIG_ULTRA
    },
#endif  /* INCLUDE_ULTRA */
#ifdef  INCLUDE_EEX
    { "eex", eexattach, (char*)IO_ADRS_EEX, INT_VEC_EEX, INT_LVL_EEX,
      NTFDS_EEX, CONFIG_EEX
    },
#endif  /* INCLUDE_EEX */
#ifdef  INCLUDE_ELT
    { "elt", eltattach, (char*)IO_ADRS_ELT, INT_VEC_ELT, INT_LVL_ELT,
      NRF_ELT, CONFIG_ELT
    },
#endif  /* INCLUDE_ELT */
#ifdef  INCLUDE_ENE
    { "ene", eneattach, (char*)IO_ADRS_ENE, INT_VEC_ENE, INT_LVL_ENE
    },
#endif  /* INCLUDE_ELT */
#ifdef  INCLUDE_ESMC
    { "esmc", esmcattach, (char*)IO_ADRS_ESMC, INT_VEC_ESMC, INT_LVL_ESMC,
      CONFIG_ESMC, RX_MODE_ESMC
    },
#endif  /* INCLUDE_ESMC */
#ifdef  INCLUDE_QU
    { "qu", quattach, (char*)IO_ADRS_QU_EN, INT_VEC_QU_EN, QU_EN_SCC,
      QU_EN_TX_BD, QU_EN_RX_BD, QU_EN_TX_OFF, QU_EN_RX_OFF, QU_EN_MEM
    },
#endif  /* INCLUDE_QU */
#ifdef  INCLUDE_SN
    { "sn", snattach, (char*)IO_ADRS_SN, INT_VEC_SN
    },
#endif  /* INCLUDE_SN */
#ifdef  INCLUDE_FN
    { "fn", fnattach },
#endif  /* INCLUDE_FN */

#ifdef  INCLUDE_SM_NET          /* 定义 */
    { "sm", smNetAttach, 0, 0, 0, 0,  0, 0 },
#endif  /* INCLUDE_SM_NET */

#ifdef  INCLUDE_PCMCIA
    { "pcmcia", pcmciaattach, 0, 0, 0, 0, 0, 0 },
#endif  /* INCLUDE_PCMCIA */

#ifdef  INCLUDE_PPP
    {"ppp", 0, 0, 0, 0, 0},
#endif  /* INCLUDE_PPP */
#ifdef  INCLUDE_SLIP
    { "sl", 0, 0, 0, 0, 0 },
#endif  /* INCLUDE_SLIP */

    { "lo", loattach, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0 },
};

#endif  /* INCLUDE_NETWORK */

/* global variables */

SYMTAB_ID   sysSymTbl;
int         consoleFd;          /* fd of initial console device */
char        consoleName [20];   /* console device name, eg. "/tyCo/0" */
int         sysStartType;       /* BOOT_CLEAR, BOOT_NO_AUTOBOOT, ... */

BOOL    scsiInitialized      = FALSE;
int     bootCmdTaskPriority  = 1;
int     bootCmdTaskOptions   = VX_SUPERVISOR_MODE;
int     bootCmdTaskStackSize = 7000;

#ifdef  INCLUDE_NETWORK

/* network protocol configuration parameters */

#ifdef INCLUDE_TCP
TCP_CFG_PARAMS tcpCfgParams =       /* tcp configuration parameters */
    {
        TCP_FLAGS_DFLT,             /* include rfc1323 support */
        TCP_SND_SIZE_DFLT,          /* default send buffer size */
        TCP_RCV_SIZE_DFLT,          /* default recv buffer size */
        TCP_CON_TIMEO_DFLT,         /* initial connection time out */
        TCP_REXMT_THLD_DFLT,        /* retransmit threshold */
        TCP_MSS_DFLT,               /* default maximum segment size */
        TCP_RND_TRIP_DFLT,          /* default round trip time */
        TCP_IDLE_TIMEO_DFLT,        /* idle timeouts before first probe */
        TCP_MAX_PROBE_DFLT          /* max no. probes before dropping */
    };
#endif /* INCLUDE_TCP */

#ifdef INCLUDE_UDP
UDP_CFG_PARAMS udpCfgParams =       /* udp configuration parameters */
    {
        UDP_FLAGS_DFLT,
        UDP_SND_SIZE_DFLT,          /* send buffer size */
        UDP_RCV_SIZE_DFLT           /* recv buffer size */
    };
#endif /* INCLUDE_UDP */

#ifdef INCLUDE_ICMP
ICMP_CFG_PARAMS icmpCfgParams =     /* icmp configuration parameters */
    {
        ICMP_FLAGS_DFLT             /* no icmp mask replies by default */
    };
#endif  /* INCLUDE_ICMP */

IP_CFG_PARAMS ipCfgParams =     /* ip configuration parameters */
    {
        IP_FLAGS_DFLT,              /* default ip flags */
        IP_TTL_DFLT,                /* ip default time to live */
        IP_QLEN_DFLT,               /* default ip intr queue len */
        IP_FRAG_TTL_DFLT            /* default ip fragment time to live */
    };

/* Network buffers configuration */

/*
 * mBlk, clBlk configuration table for network stack data pool.
 * Only used for data transfer in the network stack.
 */
M_CL_CONFIG mClBlkConfig =
    {
        /*
        no. mBlks       no. clBlks      memArea     memSize
        -----------     ----------      -------     -------
        */
        NUM_NET_MBLKS_MIN,  NUM_CL_BLKS_MIN,    NULL,       0
    };

/*
 * network stack data cluster pool configuration table
 * Only used for data transfer in the network stack.
 */
CL_DESC clDescTbl [] =
    {
    /*
    clusterSize     num                 memArea         memSize
    -----------     ----                -------         -------
    */
    {64,            NUM_64_MIN,     NULL,           0},
    {128,           NUM_128_MIN,        NULL,           0},
    {256,           NUM_256_MIN,        NULL,           0},
    {512,           NUM_512_MIN,        NULL,           0},
    {1024,          NUM_1024_MIN,       NULL,           0},
    };
int clDescTblNumEnt = (NELEMENTS(clDescTbl));

/*
 * mBlk, clBlk configuration table for network stack system pool.
 * Used for network stack system structures such as routes, sockets,
 * protocol control blocks, interface addresses, mulitcast addresses,
 * and multicast routing entries.
 */
M_CL_CONFIG sysMclBlkConfig =
    {
    /*
    no. mBlks       no. clBlks      memArea     memSize
    -----------     ----------      -------     -------
    */
    NUM_SYS_MBLKS_MIN,  NUM_SYS_CL_BLKS_MIN,    NULL,       0
    };

/*
 * network stack system cluster pool configuration table
 * Used for network stack system structures such as routes, sockets,
 * protocol control blocks, interface addresses, mulitcast addresses,
 * and multicast routing entries.
 */
CL_DESC sysClDescTbl [] =
    {
    /*
    clusterSize     num         memArea     memSize
    -----------     ----            -------     -------
    */
    {64,        NUM_SYS_64_MIN,     NULL,       0},
    {128,       NUM_SYS_128_MIN,    NULL,       0},
    {256,       NUM_SYS_256_MIN,    NULL,       0},
    {512,       NUM_SYS_512_MIN,    NULL,       0},
    };
int sysClDescTblNumEnt = (NELEMENTS(sysClDescTbl));

#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)

#ifdef  STREAMS_PROTO_INIT_RTN
FUNCPTR strmProtoInitRtn = (FUNCPTR) STREAMS_PROTO_INIT_RTN;
#endif  /* STREAMS_PROTO_INIT_RTN */

#endif /* INCLUDE_STREAMS || INCLUDE_STREAMS_ALL */

#ifdef  INCLUDE_PPP

#ifndef PPP_OPTIONS_FLAGS
#define PPP_OPTIONS_FLAGS ((PPP_OPT_NO_ALL << PPP_S_NO_ALL)  | \
    (PPP_OPT_PASSIVE_MODE << PPP_S_PASSIVE_MODE)             | \
    (PPP_OPT_SILENT_MODE << PPP_S_SILENT_MODE)               | \
    (PPP_OPT_DEFAULTROUTE << PPP_S_DEFAULTROUTE)             | \
    (PPP_OPT_PROXYARP << PPP_S_PROXYARP)                     | \
    (PPP_OPT_IPCP_ACCEPT_LOCAL << PPP_S_IPCP_ACCEPT_LOCAL)   | \
    (PPP_OPT_IPCP_ACCEPT_REMOTE << PPP_S_IPCP_ACCEPT_REMOTE) | \
    (PPP_OPT_NO_IP << PPP_S_NO_IP)                           | \
    (PPP_OPT_NO_ACC << PPP_S_NO_ACC)                         | \
    (PPP_OPT_NO_PC << PPP_S_NO_PC)                           | \
    (PPP_OPT_NO_VJ << PPP_S_NO_VJ)                           | \
    (PPP_OPT_NO_VJCCOMP << PPP_S_NO_VJCCOMP)                 | \
    (PPP_OPT_NO_ASYNCMAP << PPP_S_NO_ASYNCMAP)               | \
    (PPP_OPT_NO_MN << PPP_S_NO_MN)                           | \
    (PPP_OPT_NO_MRU << PPP_S_NO_MRU)                         | \
    (PPP_OPT_NO_PAP << PPP_S_NO_PAP)                         | \
    (PPP_OPT_NO_CHAP << PPP_S_NO_CHAP)                       | \
    (PPP_OPT_REQUIRE_PAP << PPP_S_REQUIRE_PAP)               | \
    (PPP_OPT_REQUIRE_CHAP << PPP_S_REQUIRE_CHAP)             | \
    (PPP_OPT_LOGIN << PPP_S_LOGIN)                           | \
    (PPP_OPT_DEBUG << PPP_S_DEBUG)                           | \
    (PPP_OPT_DRIVER_DEBUG << PPP_S_DRIVER_DEBUG))
#endif  /* PPP_OPTIONS_FLAGS */

PPP_OPTIONS pppOptions =
    {
        PPP_OPTIONS_FLAGS,          /* flags field */
        PPP_STR_ASYNCMAP,           /* Set the desired async map */
        PPP_STR_ESCAPE_CHARS,       /* Set chars to escape on transmission */
        PPP_STR_VJ_MAX_SLOTS,       /* Set maximum VJ compression header slots */
        PPP_STR_NETMASK,            /* Set netmask value for negotiation */
        PPP_STR_MRU,                /* Set MRU value for negotiation */
        PPP_STR_MTU,                /* Set MTU value for negotiation */
        PPP_STR_LCP_ECHO_FAILURE,   /* Set max # consecutive LCP echo failures */
        PPP_STR_LCP_ECHO_INTERVAL,  /* Set time for LCP echo requests */
        PPP_STR_LCP_RESTART,        /* Set timeout for LCP */
        PPP_STR_LCP_MAX_TERMINATE,  /* Set max # xmits for LCP term-reqs */
        PPP_STR_LCP_MAX_CONFIGURE,  /* Set max # xmits for LCP conf-reqs */
        PPP_STR_LCP_MAX_FAILURE,    /* Set max # conf-naks for LCP */
        PPP_STR_IPCP_RESTART,       /* Set timeout for IPCP */
        PPP_STR_IPCP_MAX_TERMINATE, /* Set max # xmits for IPCP term-reqs */
        PPP_STR_IPCP_MAX_CONFIGURE, /* Set max # xmits for IPCP conf-reqs */
        PPP_STR_IPCP_MAX_FAILURE,   /* Set max # conf-naks for IPCP */
        PPP_STR_LOCAL_AUTH_NAME,    /* Set local name for authentication */
        PPP_STR_REMOTE_AUTH_NAME,   /* Set remote name for authentication */
        PPP_STR_PAP_FILE,           /* Set the PAP secrets file */
        PPP_STR_PAP_USER_NAME,      /* Set username for PAP auth with peer */
        PPP_STR_PAP_PASSWD,         /* Set password for PAP auth with peer */
        PPP_STR_PAP_RESTART,        /* Set timeout for PAP */
        PPP_STR_PAP_MAX_AUTHREQ,    /* Set max # xmits for PAP auth-reqs */
        PPP_STR_CHAP_FILE,          /* Set the CHAP secrets file */
        PPP_STR_CHAP_RESTART,       /* Set timeout for CHAP */
        PPP_STR_CHAP_INTERVAL,      /* Set interval for CHAP rechallenge */
        PPP_STR_CHAP_MAX_CHALLENGE  /* Set max # xmits for CHAP challenge */
    };

#endif  /* INCLUDE_PPP */

#endif  /* INCLUDE_NETWORK */

/* forward declarations */

#ifdef __STDC__

void        usrRoot (char *pMemPoolStart, unsigned memPoolSize);
void        usrClock (void);
void        usrKernelInit (void);
LOCAL void  bootCmdLoop (void);
LOCAL void  printBootLogo (void);
LOCAL void  go (FUNCPTR entry);
LOCAL void  bootHelp (void);
LOCAL STATUS    bootLoad (char *bootString, FUNCPTR *pEntry);
LOCAL char  autoboot (int timeout);
LOCAL void  m (char *adrs);
LOCAL void  d (char *adrs, int nwords);
LOCAL void  skipSpace (char **strptr);
LOCAL STATUS    getArg (char **ppString, int *pValue, BOOL defaultHex,
            BOOL optional);
LOCAL STATUS    usrBootLineCrack (char *bootString, BOOT_PARAMS *pParams);

LOCAL void  printExcMsg (char *string);
LOCAL void  usrBootLineInit (int startType);
LOCAL void  bootExcHandler (int tid);
#ifdef  INCLUDE_NETWORK
LOCAL STATUS    netLoad (char *hostName, char *fileName, char *usr,
                         char *passwd, FUNCPTR *pEntry);
LOCAL void      netifAdrsPrint (char *ifname);
LOCAL STATUS    checkInetAddrField (char *pInetAddr, BOOL subnetMaskOK);
LOCAL STATUS    usrNetIfAttach (char *devName, int unitNum, char *inetAdrs);
LOCAL STATUS    usrNetIfConfig (char *devName, int unitNum, char *inetAdrs,
                                char *inetName, int netmask);
LOCAL STATUS    usrBpInit (char *devName, int unitNum, u_long startAddr);
LOCAL STATUS    usrSlipInit (char *pBootDev, int unitNum, char *localAddr,
                             char *peerAddr);
LOCAL STATUS    usrPPPInit (char *pBootDev, int unitNum, char *localAddr,
                            char *peerAddr);
LOCAL STATUS    bootpGet (char *pNetDev, char *pBootDevAddr, char *pBootFile,
                          char *pHostAddr, int *pMask);

#ifdef INCLUDE_DHCPC
LOCAL STATUS    dhcpGet (char *pNetDev, char *pBootDevAddr, char *pBootFile,
                         char *pHostAddr, int  *pMask,
                         DHCP_LEASE_DATA *pDhcpLease);
#endif

#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)
LOCAL STATUS    usrStrmInit (void);
#endif /* INCLUDE_STREAMS || INCLUDE_STREAMS_ALL */
#endif /* INCLUDE_NETWORK */

#ifdef  INCLUDE_SCSI_BOOT
LOCAL STATUS    scsiLoad (int bootDevId, int bootDevLUN, char *fileName,
                          FUNCPTR *pEntry);
#endif  /* INCLUDE_SCSI_BOOT */

#ifdef  INCLUDE_FD
LOCAL STATUS    fdLoad (int drive, int type, char *fileName, FUNCPTR *pEntry);
#endif  /* INCLUDE_FD */

#ifdef  INCLUDE_IDE
LOCAL STATUS    ideLoad (int drive, int type, char *fileName, FUNCPTR *pEntry);
#endif  /* INCLUDE_IDE */

#ifdef  INCLUDE_ATA
LOCAL STATUS    ataLoad (int ctrl, int drive, char *fileName, FUNCPTR *pEntry);
#endif  /* INCLUDE_ATA */

#ifdef  INCLUDE_PCMCIA
LOCAL STATUS    pcmciaLoad (int sock, char *fileName, FUNCPTR *pEntry);
#endif  /* INCLUDE_PCMCIA */

#ifdef  INCLUDE_TFFS
LOCAL STATUS    tffsLoad (int drive, int removable, char *fileName,
              FUNCPTR *pEntry);
#endif  /* INCLUDE_TFFS */

#ifdef  INCLUDE_TSFS_BOOT
LOCAL STATUS    tsfsLoad (char * fileName, FUNCPTR * pEntry);
LOCAL void  wdbRebootEventGet (void * pNode, WDB_EVT_DATA * pEvtData);
#endif  /* INCLUDE_TSFS_BOOT */

#else

void            usrRoot ();
void            usrClock ();
void            usrKernelInit ();
LOCAL void      bootCmdLoop ();
char	autoboot ();
LOCAL void      printBootLogo ();
LOCAL void      bootHelp ();
LOCAL STATUS    bootLoad ();
LOCAL void	go ();
LOCAL void      m ();
LOCAL void      d ();
LOCAL void	bootExcHandler ();
LOCAL void      skipSpace ();
LOCAL void	printExcMsg ();
LOCAL STATUS    getArg ();
LOCAL void      usrBootLineInit ();
LOCAL STATUS	usrBootLineCrack ();

#ifdef  INCLUDE_NETWORK
LOCAL STATUS    netLoad ();
LOCAL void      netifAdrsPrint ();
LOCAL STATUS    checkInetAddrField ();
LOCAL STATUS    usrNetIfAttach ();
LOCAL STATUS    usrNetIfConfig ();
LOCAL STATUS    usrBpInit ();
LOCAL STATUS    usrSlipInit ();
LOCAL STATUS    usrPPPInit ();
LOCAL STATUS    bootpGet ();

#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)
LOCAL STATUS    usrStrmInit ();
#endif /* INCLUDE_STREAMS || INCLUDE_STREAMS_ALL */
#endif  /* INCLUDE_NETWORK */

#ifdef  INCLUDE_SCSI_BOOT
LOCAL STATUS    scsiLoad();
#endif  /* INCLUDE_SCSI_BOOT */

#ifdef  INCLUDE_FD
LOCAL STATUS    fdLoad ();
#endif  /* INCLUDE_FD */

#ifdef  INCLUDE_IDE
LOCAL STATUS    ideLoad ();
#endif  /* INCLUDE_IDE */

#ifdef  INCLUDE_ATA
LOCAL STATUS    ataLoad ();
#endif  /* INCLUDE_ATA */

#ifdef  INCLUDE_PCMCIA
LOCAL STATUS    pcmciaLoad ();
#endif  /* INCLUDE_PCMCIA */

#ifdef  INCLUDE_TFFS
LOCAL STATUS    tffsLoad ();
#endif  /* INCLUDE_TFFS */

#ifdef  INCLUDE_TSFS_BOOT
LOCAL STATUS    tsfsLoad ();
LOCAL void  wdbRebootEventGet ();
#endif  /* INCLUDE_TSFS_BOOT */

#endif  /* __STDC__ */


/*******************************************************************************
*
* usrInit - user-defined system initialization routine
*
* Description:
*   This routine is called by the start-up code in romStart().  It is called
* before kernel multi-tasking is enabled, with the interrupts locked out.
*
*   It starts by clearing BSS, so all variables are initialized to 0 as per
* the C specification.  Then it sets up exception vectors, initializes the
* hardware by calling sysHwInit(), and finally starts the kernel with the
* usrRoot() task to do the remainder of the initialization.
*
* Calls:    CacheLibInit(), bzero(), intVecBaseSet(),
*           ExcVecSet(), sysHwInit(), usrKernelInit(),
*           CacheEnable(), KernelInit()
* Called by: CompressedEntry()
* Input:    startType   启动参数
* Output:   None
* Return:   None
*******************************************************************************/

void usrInit( int startType )
{

    *PCPAR(INTERNAL_MEM_MAP_ADDR) &= ~(PC15 | PC13);

⌨️ 快捷键说明

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