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

📄 drv_conf.c

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的操作系统pSOS。包括全部源码
💻 C
📖 第 1 页 / 共 4 页
字号:
#endif#if (SC_DEV_OTCP)#if (SC_IP)        dnt_add("ip", DEV_IP);#endif#if (SC_ARP)        dnt_add("arp", DEV_ARP);#endif#if (SC_TCP)        dnt_add("tcp", DEV_TCP);#endif#if (SC_UDP)        dnt_add("udp", DEV_UDP);#endif#if (SC_RAW)        dnt_add("raw", DEV_RAW);#endif#if (SC_LOOP)        dnt_add("loop", DEV_LOOP);#endif#endif#if (SC_DEV_OLAP)#if (SC_PHPI)        dnt_add("phpi", DEV_PHPI);#endif#if (SC_LAPB)        dnt_add("lapb", DEV_LAPB);        dnt_add("clapb", DEV_CLAPB);#endif#endif#if (SC_DEV_OX25)#if (SC_X25)        dnt_add("x25", DEV_X25);        dnt_add("cx25", DEV_CX25);#endif#if (SC_SNDCF)        dnt_add("sndcf", DEV_SNDCF);        dnt_add("csndcf", DEV_CSNDCF);#endif#if (SC_IPCONV)        dnt_add("ipconv", DEV_IPCONV);        dnt_add("cipconv", DEV_CIPCONV);#endif#endif    /*-----------------------------------------------------------------*/    /* Names for additional drivers may be added here.                 */    /*-----------------------------------------------------------------*/ #endif /* SC_INIT_DNTENT */}#endif /* SC_PSOS || SC_PSOSM */#if (SC_PNA || SC_PNET)/***********************************************************************//*     SetUpNI: Set up Network Interfaces for pNA+                     *//*                                                                     *//*       INPUT: FreeMemPtr = A pointer to unused memory that can be    *//*                           used to allocate space for a driver.      *//*                           NOTE: Be sure to advance FreeMemPtr if    *//*                           memory is allocates!                      *//*                                                                     *//*     RETURNS: The new address of free memory after the drivers have  *//*              allocated space.                                       *//*                                                                     *//*       NOTES: This function does many precompile checks so errors    *//*              can be found during compile-time rather then at run-   *//*              time.                                                  *//*                                                                     *//*              Also, the Network Interface Table must be allocated    *//*              before this function can be called.  There cannot be   *//*              more then NC_NNI entries in this table.  NC_NNI is set *//*              in sys_conf.h.  Before adding another interface, be    *//*              sure to check sys_conf.h to see if NC_NNI is set to    *//*              accommodate another one!                               *//*                                                                     *//*              See the pSOSystem Programmers Reference Manual         *//*              for more information.                                  *//*                                                                     *//* To add a Network driver to pSOSystem, call InstallNi().  This adds  *//* the Network Interface to the pNA+ Network Interface Table.          *//* InstallNi() takes the following arguments:                          *//*                                                                     *//*     int (*entry)();        address of NI entry point                *//*     int ipadd;             IP address                               *//*     int mtu;               maximum transmission length              *//*     int hwalen;            length of hardware address               *//*     int flags;             intErface flags                          *//*     int subnetaddr;        subnet mask                              *//*     int dstipaddr;         destination ip address                   *//*                                                                     *//* See pSOSystem Programmer`s Reference Manual, Configuration Tables   *//* Section, for more information about the Network Interface Table.    *//* InstallNi() does not return a value.                                *//*                                                                     *//* If you are adding a driver that needs to be initialized before      *//* either pSOS+ is initialized or the driver's init function is        *//* called, then you can call a setup function (that you create) for    *//* the driver (for example, see the CnslSetup call for the serial      *//* device driver).  If your initialization function needs to allocate  *//* memory, you may pass it the FreeMemPtr.  The function should return *//* a new FreeMemPtr which points to the end of the memory it has       *//* allocated.                                                          *//*                                                                     *//* When adding code to install a new driver, it is a good idea to add  *//* precompile checks so errors can be found during compile-time rather *//* then at run-time.  Precompile checks are used, for example, in the  *//* code that installs the pSOSystem serial device driver below.        *//*                                                                     *//***********************************************************************/UCHAR *SetUpNI(UCHAR *FreeMemPtr){/*---------------------------------------------------------------------*//* Install the pSOSystem NI.                                           *//*---------------------------------------------------------------------*/#if BSP_LAN1{    int IPaddr;    if (SysVars.Lan1)        {        /*-------------------------------------------------------------*/        /* If RARP is specified for the IP address, use it now to      */        /* obtain the IP address for this interface.                   */        /*-------------------------------------------------------------*/        IPaddr = SysVars.Lan1IP;        #if (SC_DEV_DLPI && SE_SHARE_NI)            InstallNi((int (*)())DlpiEnet, IPaddr,        #else            InstallNi((int (*)())NiLan, IPaddr,        #endif                  BSP_LAN1_MTU, BSP_LAN1_HWALEN, BSP_LAN1_FLAGS,                  SysVars.Lan1SubnetMask, 0);            FreeMemPtr = SetupLanParams(BSP_LAN1_PKB, FreeMemPtr);        }}#endif/*---------------------------------------------------------------------*//* Install the shared memory NI.                                       *//*---------------------------------------------------------------------*/#if BSP_SMEM    #if ((SC_NISM_LEVEL != 1) && (SC_NISM_LEVEL != 2))        #error "Illegal value for SC_NISM_LEVEL"    #endif    if (SysVars.Nism)        {        InstallNi((int (*)())NiSmem, SysVars.NismIP, NISM_MTU, 4, 0x8002,                  SysVars.NismSubnetMask, 0);        }#endif/*---------------------------------------------------------------------*//* Additional Network drivers may be installed here.                   *//*---------------------------------------------------------------------*/return FreeMemPtr;}#endif /* (SC_PNA || SC_PNET) */#if SC_INIT_DNTABLE/***********************************************************************//* GenerateString: A feature limited sprintf clone.                    *//*                                                                     *//*      INPUTS: dest   = character array to hold the output.           *//*              format = point to the format string.                   *//*              ...    = zero or more unsigned longs to be used for    *//*                       %x output.                                    *//*     RETURNS: none                                                   *//*     OUTPUTS: none                                                   *//*     NOTE(S): This is not a full clone of sprintf. Only the only     *//*              two conversions supported in the format string are %x  *//*              and %.<1-8>x . <1-8> means a single digit in the range *//*              1 through 8. Also unlike a real sprintf the number of  *//*              digits output is exactlyspecified by .<digit>, not the *//*              minimum number. For example:                           *//*                      GenerateString(MyDest, "%.1x", 0x1234);        *//*              will only place the single digit '4' into the          *//*              destination string (and the null terminator). %x is    *//*              the same as %.1x .                                     *//*                                                                     *//*              The result of specifying a '%' without a valid         *//*              conversion type following it is unspecified.           *//*                                                                     *//***********************************************************************/static long GenerateString(char *dest, char *format, ...){register ULONG value, position;register char ch;va_list ap;const char NibbleToHex[17] = "0123456789abcdef";va_start(ap, format);while ((ch = *format++) != NULL)    {    if (ch != '%')        {        /*-------------------------------------------------------------*/        /* If the current character isn't a '%' just copy it.          */        /*-------------------------------------------------------------*/        *dest++ = ch;        }    else        {        /*-------------------------------------------------------------*/        /* The current character is a '%'. See if it is one of the     */        /* supported formatting options.                               */        /*-------------------------------------------------------------*/        switch (ch = *format++)            {            case 'x':                /*-----------------------------------------------------*/                /* Output a single nibble.                             */                /*-----------------------------------------------------*/                value = va_arg(ap, ULONG);                *dest++ = NibbleToHex[value & 0xf];                break;            case '.':                /*-----------------------------------------------------*/                /* Have %. so far. See if the next characters are a    */                /* digit (1 through 8) and an 'x'.                     */                /*-----------------------------------------------------*/                if ((ch = *format) == 0)                    break;                position = ch - '0';                ch = *(++format);                if ((position < 1) || (position > 8) ||                    (ch == 0) || (ch != 'x'))                    break;                /*-----------------------------------------------------*/                /* Output the requested number of nibbles, from most   */                /* to least significant.                               */                /*-----------------------------------------------------*/                value = va_arg(ap, ULONG);                while (position-- > 0)                    *dest++ = NibbleToHex[(value>>(position<<2)) & 0xf];                format++;                break;            default:                if (ch != 0)                    *dest++ = ch;                else                    format--;                break;            }        }    }*dest = 0;va_end(ap);}#endif /* SC_INIT_DNTABLE */

⌨️ 快捷键说明

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