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

📄 drv_conf.c

📁 有线电视系统前端设备复用器原代码。 用语接受卫星信号
💻 C
📖 第 1 页 / 共 4 页
字号:
        #error "SC_DEV_SCSI_TAPE cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_SCSI_TAPE, SdrvInit, StapeOpen, StapeClose,
                  StapeRead, StapeWrite, SdrvCntrl, 0, 0, IO_BLOCK_DEV);
 
    PsosNumDntEnts++;
#endif

/*---------------------------------------------------------------------*/
/* Setup pSOSystem CMOS clock driver                                   */
/*---------------------------------------------------------------------*/
#if (SC_DEV_CMOS && BSP_CLOCK)
    #if (SC_DEV_CMOS >SC_DEVMAX)
    #error "SC_DEV_CMOS cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_CMOS, NULLF, NULLF, NULLF, CmcRead,
                  CmcWrite, NULLF, 0, 0, IO_CHAR_DEV);
    PsosNumDntEnts++;
#endif

/*---------------------------------------------------------------------*/
/* Setup pSOSystem printer driver                                      */
/*---------------------------------------------------------------------*/
#if (SC_DEV_PARALLEL && BSP_PARALLEL)
    #if (SC_DEV_PARALLEL >SC_DEVMAX)
    #error "SC_DEV_PARALLEL cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_PARALLEL, ParInit, ParOpen, ParClose, NULLF,
                  ParWrite, ParCntrl, 0, 0, IO_CHAR_DEV);
    PsosNumDntEnts++;
#endif
 
/*---------------------------------------------------------------------*/
/* Setup pSOSystem floppy diskette driver                              */
/* NOTE: This driver must be called from a task it cannot use the      */
/*       auto initialization freature of pSOS+                         */
/*---------------------------------------------------------------------*/
#if (SC_DEV_FLOPPY && BSP_FLOPPY)
    #if (SC_DEV_FLOPPY >SC_DEVMAX)
    #error "SC_DEV_FLOPPY cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_FLOPPY, FlpInit, NULLF, NULLF, FlpRead,
                  FlpWrite, NULLF, 0, 0, IO_BLOCK_DEV);
    PsosNumDntEnts++;
#endif
 
/*---------------------------------------------------------------------*/
/* Setup pSOSystem IDE disk driver                                     */
/* NOTE: This driver must be called from a task it cannot use the      */
/*       auto initialization freature of pSOS+                         */
/*---------------------------------------------------------------------*/
#if (SC_DEV_IDE && BSP_IDE)
    #if (SC_DEV_IDE >SC_DEVMAX)
    #error "SC_DEV_IDE cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_IDE, IDEInit, NULLF, NULLF, IDERead,
                  IDEWrite, IDECntrl, 0, 0, IO_BLOCK_DEV);
    PsosNumDntEnts++;
#endif

/*---------------------------------------------------------------------*/
/* Install the pSOSystem TFTP driver.                                  */
/* NOTE: This driver must be called from a task it cannot use the      */
/*       auto initialization freature of pSOS+                         */
/*---------------------------------------------------------------------*/
#if (SC_DEV_TFTP)
    #if(SC_DEV_TFTP > SC_DEVMAX)
        #error "SC_DEV_TFTP cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_TFTP, TftpInit, TftpOpen, TftpClose, TftpRead,
                  NULLF, TftpCntl, 0, 0, IO_CHAR_DEV);
    PsosNumDntEnts++;
#endif

/*---------------------------------------------------------------------*/
/* Install the pSOSystem New TFTP driver that follows the new interface*/
/* NOTE: This driver must be called from a task it cannot use the      */
/*       auto initialization freature of pSOS+                         */
/*---------------------------------------------------------------------*/
#if (SC_DEV_NTFTP)
    #if(SC_DEV_NTFTP > SC_DEVMAX)
        #error "SC_DEV_NTFTP cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_NTFTP, TftpInit, StdTftpOpen, TftpClose, TftpRead,
                  NULLF, TftpCntl, 0, 0, IO_CHAR_DEV);
    PsosNumDntEnts++;
#endif

/*---------------------------------------------------------------------*/
/* Install the pSOSystem HTTP driver.                                  */
/* NOTE: This driver must be called from a task it cannot use the      */
/*       auto initialization freature of pSOS+                         */
/*---------------------------------------------------------------------*/
#if (SC_DEV_HTTP)
    #if(SC_DEV_HTTP > SC_DEVMAX)
        #error "SC_DEV_HTTP cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_HTTP, HttpInit, HttpOpen, HttpClose, HttpRead,
                  NULLF, HttpCntl, 0, 0, IO_CHAR_DEV);
    PsosNumDntEnts++;
#endif

/*---------------------------------------------------------------------*/
/* Install the SPI driver                                              */
/* NOTE: This driver must be called from a task it cannot use the      */
/*       auto initialization freature of pSOS+                         */
/*---------------------------------------------------------------------*/
#if (SC_DEV_SPI)
    #if(SC_DEV_SPI > SC_DEVMAX)
        #error "SC_DEV_SPI cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_SPI, SPI_init, SPI_open, SPI_close, NULLF,
                  NULLF, SPI_io, 0, 0, IO_CHAR_DEV);
    PsosNumDntEnts++;
#endif

/*---------------------------------------------------------------------*/
/* Install DLPI drivers                                                */
/*---------------------------------------------------------------------*/

#if (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP)
    {
#include "enetcfg.h"

int dlpi_setinitroutine = 0;
int dlpi_nicount = 0;	/* number of ni's below this DLPI */ 
void (*init_fn)();	/* Ethernet driver initialization routine */
                        /* Call this function only once */
char *DlpiErrMsg = "DlpiAddNI failed: NI Error";

#if (SC_DEV_DLPI)
    {
    #if(SC_DEV_DLPI> SC_DEVMAX)
        #error "SC_DEV_DLPI cannot be > SC_DEVMAX"
    #endif
    static const psedrvparam_t eth0param = {"eth0", DT_CLONE, &enetinfo, 0, 0};
    init_fn = NULLF;
    if (!dlpi_setinitroutine)
    {
        init_fn = (void (*)())enetinit;
        dlpi_setinitroutine = 1;
    }
    InstallDriver(SC_DEV_DLPI, init_fn, NULLF, NULLF, NULLF,
                  NULLF, NULLF, (long)&eth0param, 0, IO_STREAM_DEV);
    dlpi_nicount++;
    PsosNumDntEnts++;
    }
#endif /* SC_DEV_DLPI */

#if SC_DEV_DLPI_PPP
    {
    #if(SC_DEV_DLPI_PPP > SC_DEVMAX)
        #error "SC_DEV_DLPI_PPP cannot be > SC_DEVMAX"
    #endif
    static const psedrvparam_t pppparam = {"ppp", DT_CLONE, &enetinfo, 0, 0};
    init_fn = NULLF;
    if (!dlpi_setinitroutine)
    {
        init_fn = (void (*)())enetinit;
        dlpi_setinitroutine = 1;
    }
    InstallDriver(SC_DEV_DLPI_PPP, init_fn, NULLF, NULLF, NULLF,
                  NULLF, NULLF, (long)&pppparam, 0, IO_STREAM_DEV);
    dlpi_nicount++;
    PsosNumDntEnts++;
    }
#endif /* SC_DEV_DLPI_PPP */

#if SC_DEV_DLPI_SLIP
    {
    #if(SC_DEV_DLPI_SLIP > SC_DEVMAX)
        #error "SC_DEV_DLPI_SLIP cannot be > SC_DEVMAX"
    #endif
    static const psedrvparam_t slipparam = {"slip", DT_CLONE, &enetinfo, 0, 0};
    init_fn = NULLF;
    if (!dlpi_setinitroutine)
    {
        init_fn = (void (*)())enetinit;
        dlpi_setinitroutine = 1;
    }
    InstallDriver(SC_DEV_DLPI_SLIP, init_fn, NULLF, NULLF, NULLF,
                  NULLF, NULLF, (long)&slipparam, 0, IO_STREAM_DEV);
    dlpi_nicount++;
    PsosNumDntEnts++;
    }
#endif /* SC_DEV_DLPI_SLIP */

/*
 * User has defined other DLPI drivers locally. Include user
 * file drv_conf.idl that installs user's own ENETDLPI drivers
 */
#if SC_DEV_DLPI_OTHER
#include "drv_conf.idl"
#endif

    /*-------------------------------------------------------------*/
    /* Call DlpiInit to initialize the Streams DLPI driver         */
    /*   Arguments passed to DlpiInit are:                         */
    /*     1. Free memory address                                  */
    /*     2. Maximum NI interface number                          */
    /*     3. Maximum number of streams per interface              */
    /*-------------------------------------------------------------*/
    FreeMemPtr = DlpiInit(FreeMemPtr, dlpi_nicount, SE_DLPI_MAXSTR_PERNI);

    /*-------------------------------------------------------------*/
    /* Call DlpiAddNI to add an NI interface to the Streams DLPI   */
    /* driver.  DlpiAddNI must be called for each NI driver        */
    /* interface used with the Streams DLPI driver.                */
    /*   Arguments passed to DlpiAddNI are:                        */
    /*     1. NI interface number (should correspond to the pNA+   */
    /*          interface number if driver is shared with pNA+)    */
    /*     2. NI entry point                                       */
    /*     3. NI flags                                             */
    /*          DLPI_IFF_SELFLOOP 0x0001  loopback for selfaddress */
    /*          DLPI_IFF_POLL_NI  0x0002  driver must be polled    */
    /*          DLPI_IFF_RAWMEM   0x2000  driver accepts mblk      */
    /*          DLPI_IFF_NONIINIT 0x4000  Don't send NI_INIT       */
    /*                                    during enetinit() call   */
    /*     4. NI major device number                               */
    /*     5. NI multicast address (NOT SUPPORTED)                 */
    /*     6. NI poll frequency (every # of elapsed ticks)         */
    /*-------------------------------------------------------------*/

#if (SC_DEV_DLPI)
    /* 
     * If this lan NI is not shared, use a loopback DLPI with interface
     * number 0. NI entry point is set to DlpiNullNI().
     */
#if (SE_SHARE_NI)
    if (DlpiAddNI(SE_DLPI_ETH_IFNO, (long(*)())BSP_LAN1_ENTRY,
                  SE_DLPI_ETH_IFFLAGS, SC_DEV_DLPI, 0, SE_DLPI_ETH_POLLFREQ))
        SysInitFail(DlpiErrMsg);
#else
    if (DlpiAddNI(0, (long(*)())DlpiNullNI, 0, SC_DEV_DLPI, 0, 0))
        SysInitFail(DlpiErrMsg);
#endif /* SE_SHARE_NI */

#endif /* SC_DEV_DLPI */

#if (SC_DEV_DLPI_PPP)
    if (DlpiAddNI(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ENTRY, SE_DLPI_PPP_IFFLAGS,
                  SC_DEV_DLPI_PPP, 0, SE_DLPI_PPP_POLLFREQ))
        SysInitFail(DlpiErrMsg);
    if (DlpiAddParams(SE_DLPI_PPP_IFNO, SE_DLPI_PPP_ADDRSIZE,
                      SE_DLPI_PPP_MAXMTU, SE_DLPI_PPP_MINMTU, (char *)NULL))
        SysInitFail(DlpiErrMsg);
#endif /* SC_DEV_DLPI_PPP */

#if (SC_DEV_DLPI_SLIP)
    if (DlpiAddNI(SE_DLPI_SLIP_IFNO,SE_DLPI_SLIP_ENTRY, SE_DLPI_SLIP_IFFLAGS,
                  SC_DEV_DLPI_SLIP, 0, SE_DLPI_SLIP_POLLFREQ))
        SysInitFail(DlpiErrMsg);
    if (DlpiAddParams(SE_DLPI_SLIP_IFNO, SE_DLPI_SLIP_ADDRSIZE,
                      SE_DLPI_SLIP_MAXMTU, SE_DLPI_SLIP_MINMTU, (char *)NULL))
        SysInitFail(DlpiErrMsg);
#endif /* SC_DEV_DLPI_SLIP */

/*
 * User has defined other DLPI drivers locally. Include user
 * file drv_conf.adl that adds user Dlpi drivers to the system.
 */
#if SC_DEV_DLPI_OTHER
#include "drv_conf.adl"
#endif

    }
#endif /* (SC_DEV_DLPI || SC_DEV_PPP || SC_DEV_SLIP) */

#if (SC_DEV_LOG)
  {
    extern void loginit();
    extern struct streamtab loginfo;
    static const psedrvparam_t log_drv = {"log", DT_CLONE,   &loginfo, 0, 0};
 
    InstallDriver(SC_DEV_LOG,   loginit,       NULLF, NULLF, NULLF,
                  NULLF, NULLF, (long)&log_drv, 0, IO_STREAM_DEV);
    PsosNumDntEnts++;
  }
#endif

/*-------------------------------------------------------------------*/
/* Install pSOSystem Watchdog driver                                 */
/*-------------------------------------------------------------------*/
#if (SC_DEV_WATCHDOG)
    #if(SC_DEV_WATCHDOG > SC_DEVMAX)
    #error "SC_DEV_WATCHDOG cannot be > SC_DEVMAX"
    #endif
    InstallDriver(SC_DEV_WATCHDOG, WdtInit, NULLF, NULLF, NULLF,
                  NULLF, NULLF, 0, 0, IO_CHAR_DEV);
    PsosNumDntEnts++;
#endif

#if (SC_DEV_OTCP)
    {
extern void otcp_ipspace_init(), otcp_arpspace_init(), otcp_rawspace_init(), 
	    otcp_udpspace_init(), otcp_tcpspace_init(), otcp_loopspace_init();
extern struct streamtab otcp_ipinfo, otcp_arpinfo, otcp_rawinfo, otcp_udpinfo, 
			otcp_tcpinfo, otcp_loopinfo;

#if (SC_IP)
    static const psedrvparam_t ip_drv   = {"ip",   DT_CLONE, &otcp_ipinfo, 0, 0};
#endif
#if (SC_ARP)
    static const psedrvparam_t arp_drv  = {"arp",  DT_CLONE, &otcp_arpinfo, 0, 0};
#endif
#if (SC_TCP)
    static const psedrvparam_t tcp_drv  = {"tcp",  DT_CLONE, &otcp_tcpinfo, 0, 0};
#endif
#if (SC_UDP)
    static const psedrvparam_t udp_drv  = {"udp",  DT_CLONE, &otcp_udpinfo, 0, 0};
#endif
#if (SC_RAW)
    static const psedrvparam_t raw_drv  = {"raw",  DT_CLONE, &otcp_rawinfo, 0, 0};
#endif
#if (SC_LOOP)
    static const psedrvparam_t loop_drv = {"loop", DT_CLONE, &otcp_loopinfo, 0, 0};
#endif

#if (SC_IP)
    InstallDriver(SC_IP, otcp_ipspace_init, NULLF, NULLF, NULLF,
                  NULLF, NULLF, (long)&ip_drv, 0, IO_STREAM_DEV);
    PsosNumDntEnts++;
#endif
#if (SC_ARP)
    InstallDriver(SC_ARP, otcp_arpspace_init, NULLF, NULLF, NULLF,
                  NULLF, NULLF, (long)&arp_drv, 0, IO_STREAM_DEV);
    PsosNumDntEnts++;
#endif
#if (SC_RAW)
    InstallDriver(SC_RAW, otcp_rawspace_init, NULLF, NULLF, NULLF,
                  NULLF, NULLF, (long)&raw_drv, 0, IO_STREAM_DEV);
    PsosNumDntEnts++;

⌨️ 快捷键说明

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