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

📄 netrecognize.c

📁 lwIP-Softools-11Jul2002-alpha
💻 C
字号:
/* * Function to set up RTK8019 driver variable based on the board type. * * (C) 2002 Compendium Technologies, Inc. * (C) 2002 Softools, Inc. * All rights reserved. * * This software is the proprietary information of Compendium Technologies, Inc. * and Softools, Inc. Use is subject to license terms. */#include <Rabbit2000.h>#include <SoftoolsIDBlock.h>#include "RTK8019AS.h"/** * The following definitions apply to the productID field in the SystemIDBlock. * They do not account for all types of boards or core modules available. */#define PRODUCT_ID_TCPDEVKIT 0x0301 /* TCP/IP Dev kit, 128K SRAM/512K Flash                                       18Mhz */ #define PRODUCT_ID_RCM2100   0x0700 /* Ethernet core module 512K SRAM/512K Flash                                       22Mhz */#define PRODUCT_ID_RCM2110   0x0701 /* Ethernet core module 128K SRAM/256K Flash                                       22Mhz */#define PRODUCT_ID_RCM2120   0x0702 /* Core module 512K SRAM/512K Flash                                       22Mhz */#define PRODUCT_ID_RCM2130   0x0703 /* Core module 128K SRAM/256K Flash                                       22Mhz */ #define PRODUCT_ID_RCM2115   0x0704 /* Ethernet core module 128K SRAM/256K Flash                                       22Mhz */#define PRODUCT_ID_RCM2200   0x0900 /* Micro ethernet core module 128K/256K                                       22Mhz *//** * Attempt to recognize the hardware being run on based on interpreting the * SystemIDBlock, if one exists. */int netRecognize(){#ifdef DEBUG    printf("idBlock magic: %lu\n", idBlock->magic);    printf("should be: %lu\n", SOFTOOLS_ID_BLOCK_MAGIC);#endif    if (idBlock->magic == SOFTOOLS_ID_BLOCK_MAGIC)    {        switch(idBlock->productID)        {            case PRODUCT_ID_RCM2100:            case PRODUCT_ID_RCM2110:            case PRODUCT_ID_RCM2115:            case PRODUCT_ID_RCM2200:#ifdef DEBUG                printf("ethernet core module recognized\n");#endif                // For external IO addressing -- enables the Rabbit 2K to                // read data from the RTK8019as                rtkReadAddress = 0x4000;                // The ethernet (MAC) address extracted from the ID block                // (no EEPROM to get it from on later Rabbit Semiconductor                // boards)                memcpy(&rtkEthernetAddress, idBlock->macAddr,                       sizeof(rtkEthernetAddress));                // Use the parallel port D for the lines hooked up to the                 // EEPROM lines of the RTK8019as. This is used for the                 // Rabbit 2K to emulate 9346 EEPROM protocol sequence                // needed to initialize the RTK8019as.                rtkEEPORT = PDDR;                if (idBlock->productID == PRODUCT_ID_RCM2200)                {                    // The line hookups are different on the micro core                    // modules                        // Turn on the ethernet LEDs (link light)                    rtkLEDs = 0x03;                    // Output line for 9346 EEPROM emulation                    rtkEEDO = PEB3R;                    // Input bit on parallel port for 9346 EEPROM emulation                    rtkEEDI = 0x02;                    // Clock bit on parallel port for detecting RTK8019as                    // clock pulse.                     rtkEESK = 0x01;                    // Set the board type for the right initialization sequence                    rtkBoardType = RTK_BOARD_TYPE_RCM2200;                }                else                {                    // Turn on the ethernet LEDs (link light)                    rtkLEDs = 0x30;                    // Output line for 9346 EEPROM emulation                    rtkEEDO = PDB7R;                    // Input bit on parallel port for 9346 EEPROM emulation                    rtkEEDI = 0x40;                    // Clock bit on parallel port for detecting RTK8019as                    // clock pulse.                     rtkEESK = 0x20;                    // Set the board type for the right initialization sequence                    rtkBoardType = RTK_BOARD_TYPE_RCM2100;                }                break;            default:                // Otherwise we will assume that the device is a TCP/IP dev kit,                // which is the default configuration.#ifdef DEBUG                printf("assuming TCP/IP dev kit\n");#endif                break;        }        return idBlock->productID;    }    else    {#ifdef DEBUG        printf("failed magic test\n");#endif        return 0;    }}

⌨️ 快捷键说明

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