KwikNet MPC5200 FEC Device Driver User's Guide Version 3 First Printing: November 15, 2004 Last Printing: September 15, 2005 Manual Order Number: PN383-9E Copyright © 2004 - 2005 KADAK Products Ltd.
TECHNICAL SUPPORT KADAK Products Ltd. is committed to technical support for its software products. Our programs are designed to be easily incorporated in your systems and every effort has been made to eliminate errors. Engineering Change Notices (ECNs) are provided periodically to repair faults or to improve performance. You will automatically receive these updates during the product's initial support period.
Copyright © 2004-2005 by KADAK Products Ltd. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual or otherwise, without the prior written permission of KADAK Products Ltd., Vancouver, BC, CANADA. DISCLAIMER KADAK Products Ltd.
KwikNet MPC5200 FEC Device Driver User's Guide Table of Contents Page 1. Introduction 1 2. Installation 2 3. Configuring the Network 3 4. Configuring the Device Driver 4 5. Making the KwikNet MPC5200 BestComm Library 5 6. Special Considerations 7 6.1 BestComm Initialization ...................................................................... BestComm FEC Initialization .............................................................. MPC5200 Register Support ....................................
This page left blank intentionally.
KwikNet MPC5200 FEC Device Driver 1. Introduction The Motorola PowerPC MPC5200 includes a single channel Fast Ethernet Controller (FEC) that supports 10Mbps and 100Mbps data transfer rates. The FEC can operate only in conjunction with the MPC5200 BestComm DMA Engine that provides DMA services to a number of MPC5200 subsystems. The BestComm engine is driven by its private tasks which execute from microcode located in the MPC5200 static RAM memory.
2. Installation The KwikNet MPC5200 FEC Ethernet Device Driver is provided on the KwikNet CD-ROM. The installation process installs the driver files in directory KNT303\KN5200E within an installation directory of your choice. Note that this directory is separate from the KwikNet PPC32 installation directory KNT383 or the KwikNet Porting Kit installation directory KNT713.
3. Configuring the Network You must define each network that your application supports. You can dynamically add a network interface at runtime. Alternatively, you can define your network interface in your KwikNet configuration. Networks defined in this manner will be prebuilt for you when KwikNet is started. To add a prebuilt MPC5200 Ethernet network interface definition to your KwikNet Library, use the KwikNet Configuration Manager to edit your Network Parameter File.
4. Configuring the Device Driver You must define the KwikNet device driver attached to each network interface that your application supports. If you call KwikNet procedure kn_ifadd() to dynamically add a network interface at runtime, you must provide the device driver definition as a parameter in the call. If you specify a prebuilt network, you must define its device driver by using the KwikNet Configuration Manager to edit your KwikNet Network Parameter File.
5. Making the KwikNet MPC5200 BestComm Library The make process depends upon the structure of the KwikNet MPC5200 FEC Ethernet Device Driver installation directory KN5200E. When the driver is installed, the following subdirectories are created within directory KN5200E.
Creating the Driver Library The KwikNet MPC5200 BestComm Library must be constructed from within the driver installation directory KN5200E\MAKE. To create the library, proceed as follows. From the Windows Start menu, choose the MS-DOS Command Prompt from the Programs folder. Make the driver installation KN5200E\MAKE directory the current directory. To use Microsoft's NMAKE utility, issue the following command. NMAKE -fKN5200E.
6. Special Considerations 6.1 BestComm Initialization The KwikNet MPC5200 FEC Ethernet Device Driver depends upon the BestComm API and microcode supplied by Freescale Semiconductor, Inc. The BestComm microcode must be loaded into memory and initialized once prior to initialization of any of the subsystems that it supports. Each subsystem, such as the FEC, must then start and assume control of the BestComm tasks upon which the subsystem depends.
BestComm FEC Initialization The KwikNet MPC5200 FEC device driver must initialize the BestComm FEC receive and transmit tasks to match the driver's configured requirements. Unfortunately, the BestComm FEC initialization must only be performed once. However, the MPC5200 FEC driver can be opened and closed many times as KwikNet operates. Each time the driver is opened, it must initialize the FEC hardware but it must only initialize the BestComm FEC subsystem once.
6.2 BestComm Source Code Modifications KADAK has successfully used the BestComm API and firmware source code without modification using the Metrowerks software development tools. All modules have been successfully compiled without warnings or errors. However, when the BestComm source code is compiled using the Diab (Wind River) or MetaWare tools, numerous warnings and some errors are encountered. KADAK has made no attempt to review or repair the source code which generated warnings.
6.3 MPC5200 Interrupt Exceptions The PowerPC MPC5200 interrupt management subsystem is incredibly complex. All device interrupt sources are funneled through three PowerPC exceptions in the processor Exception Vector Table. Normal interrupt sources are vectored to the external interrupt exception at offset 0x0500. Critical interrupts, including all interrupt requests generated by the BestComm DMA Engine, are vectored to the critical interrupt exception at offset 0x0A00.
The base vector for the block of interrupt vectors within the AMX Vector Table is specified by you in your AMX Target Configuration Module. Use the AMX Configuration Manager to edit your Target Parameter File and enter your definitions on the Exceptions property page. Note that a Warning will always be displayed indicating that the three MPC5200 exceptions share a common, overlapping region of the AMX Vector Table. The warning can be safely ignored.
6.4 Configuring the Physical Device The Ethernet transceiver device (PHY) is configured by function kn_5200_pcon_fec() in the driver's pin assignment and board setup module M5200EBS.C. The PHY is configured each time the device driver is called by the KwikNet Ethernet network driver to open the network interface for use by the application. The PHY wiring mode is determined by an attribute setting in the device driver parameter list (see Appendix A).
Mode 2: Periodic Sampling By default, the MPC5200 FEC device driver is configured to use a third, preferred method of operation. The driver uses a KwikNet timer to periodically sample the PHY, watching for the auto-negotiation to complete. The sampling period, the wait interval and an additional post-negotiation delay are all configurable parameters. By default, the driver samples at the KwikNet clock frequency for up to 3 seconds, with no additional delay.
Appendix A. MPC5200 FEC Device Driver Data Sheet The KwikNet Device Driver Technical Reference Manual describes the design and implementation requirements for all KwikNet device drivers. Appendix C of that manual illustrates the layout of a data sheet used to describe each unique KwikNet device driver. The KwikNet MPC5200 FEC Ethernet Device Driver conforms to the naming conventions and operating specifications presented in the KwikNet Device Driver Technical Reference Manual.
KwikNet Device Driver MPC5200 FEC Ethernet Copyright © 2004 - 2005 KADAK Products Ltd.
MPC5200 FEC Ethernet Device Driver Data Sheet Filename M5200E.C, M5200E.H, M5200EBS.C Mnemonic M5200 Description The KwikNet MPC5200 FEC Ethernet Device Driver supports the use of the MPC5200 Fast Ethernet Channel (FEC) for 10Mbps or 100Mbps Ethernet communication. The driver depends upon the BestComm DMA Engine for transmission and reception of Ethernet frames via the FEC. The driver is provided ready for use on the Motorola Lite5200 Evaluation Board.
MPC5200 FEC Ethernet Device Driver Data Sheet (continued) Parameters The KwikNet Configuration Manager can be used to define the following set of device dependent parameters. These parameters are entered in the Device Driver Definition on the Networks property page.
MPC5200 FEC Ethernet Device Driver Data Sheet (continued) Parameters (continued) Ethernet Address The 48-bit Ethernet address assigned to the network must be defined. The most significant byte (see MSB in diagram) of the high 16 bits of the Ethernet address will be transmitted first; the least significant byte (see LSB in diagram) of the low 32 bits of the address will be transmitted last.
MPC5200 FEC Ethernet Device Driver Data Sheet (continued) Parameters (continued) The driver's private receive and transmit data buffers are allocated using the standard KwikNet memory allocation services. Each buffer will be at least 1520 bytes in size, rounded up if necessary to meet your alignment and cache line requirements. Your KwikNet memory allocation method (see the OS property page in Chapter 2.
MPC5200 FEC Ethernet Device Driver Data Sheet (continued) Porting the MPC5200 FEC Ethernet Device Driver The KwikNet MPC5200 FEC Ethernet Device Driver is ready for use on the Motorola Lite5200 Evaluation Board. The default board driver module KN_BOARD.C provided with KwikNet is also ready for use with this board. To port this device driver to your MPC5200 hardware, proceed as follows. Review header file M5200E.
MPC5200 FEC Ethernet Device Driver Data Sheet (continued) Configuring the MPC5200 FEC Ethernet Device Driver Use the KwikNet Configuration Manager to edit your Network Parameter File to include this Ethernet device driver. Assume that you require the following configuration for use on the Motorola Lite5200 Evaluation Board. MPC5200 FEC is to be used operating at 10Mbps. Caching must be accommodated. The Ethernet link must operate in half duplex mode. PHY device wiring mode is 18-wire (MII).