VxWorks Device Driver Developer's Guide, 6 18755B114C87155021E  7.2.2 VxWorks OS Interface ... The

  • View
    233

  • Download
    3

Embed Size (px)

Text of VxWorks Device Driver Developer's Guide, 6 18755B114C87155021E  7.2.2 VxWorks OS Interface ......

  • VxWorks

    DEVICE DRIVER DEVELOPER'S GUIDEVolume 3: Legacy Drivers and Migration

    6.7

    VxWorks Device Driver Developer's Guide, 6.7

  • Copyright 2008 Wind River Systems, Inc.

    All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means without the prior written permission of Wind River Systems, Inc.

    Wind River, Tornado, and VxWorks are registered trademarks of Wind River Systems, Inc. The Wind River logo is a trademark of Wind River Systems, Inc. Any third-party trademarks referenced are the property of their respective owners. For further information regarding Wind River trademarks, please see:

    http://www.windriver.com/company/terms/trademark.html

    This product may include software licensed to Wind River by third parties. Relevant notices (if any) are provided in your product installation at the following location: installDir/product_name/3rd_party_licensor_notice.pdf.

    Wind River may refer to third-party documentation by listing publications or providing links to third-party Web sites for informational purposes. Wind River accepts no responsibility for the information provided in such third-party documentation.

    Corporate HeadquartersWind River Systems, Inc.500 Wind River WayAlameda, CA 94501-1153U.S.A.

    toll free (U.S.): (800) 545-WINDtelephone: (510) 748-4100facsimile: (510) 749-2010

    For additional contact information, please visit the Wind River URL:

    http://www.windriver.com

    For information on how to contact Customer Support, please visit the following URL:

    http://www.windriver.com/support

    VxWorks Device Driver Developer's Guide, 6.7

    26 Nov 08 Part #: DOC-16310-ND-00

    http://www.windriver.com/company/terms/trademark.htmlhttp://www.windriver.comhttp://www.windriver.com/support

  • iii

    Contents

    1 Introduction .......................................................................................... 1

    1.1 Migration Overview .............................................................................................. 1

    1.2 Legacy Driver Overview ....................................................................................... 2

    1.3 Before You Begin .................................................................................................... 2

    1.4 About This Documentation ................................................................................. 3

    Navigating this Documentation Set ...................................................... 3

    2 Migrating to VxBus .............................................................................. 5

    2.1 Overview .................................................................................................................. 5

    2.2 Available Resources ............................................................................................... 5

    Template Drivers ...................................................................................... 6

    2.3 Porting an Existing VxWorks Driver to VxBus ................................................. 6

    2.3.1 Verifying Your Hardware and Driver Code ......................................... 7

    2.3.2 Creating the VxBus Infrastructure ........................................................ 7

    Driver Source File .................................................................................... 8Driver Header Files (Optional) ............................................................. 8Driver Component Description File ..................................................... 9Driver Configuration Stub Files ............................................................ 10

  • VxWorksDevice Driver Developer's Guide, 6.7

    iv

    Modifying the BSP (Optional) ............................................................... 12Verifying the infrastructure ..................................................................... 12

    2.3.3 Moving Existing Code into the New Source File ................................ 14

    2.3.4 Removing Driver Code from the BSP .................................................. 15

    2.3.5 Adding Debug Code ............................................................................... 15

    2.3.6 Changing Initialization to VxBus .......................................................... 16

    2.3.7 Adding VxBus Driver Methods ............................................................ 20

    2.3.8 Updating Names Within the Source File ............................................. 21

    2.3.9 Removing BSP Dependencies ................................................................ 21

    2.3.10 Converting Register Access in Existing Code ..................................... 25

    2.3.11 Removing Global Variables ................................................................... 25

    3 Migrating to IPNET-Native Drivers ...................................................... 27

    3.1 Introduction ............................................................................................................. 27

    3.2 Converting an Existing END Driver to an IPNET-Native Driver ................. 28

    3.3 Updating the Driver to use IPNET-Native Infrastructure .............................. 29

    3.4 Updating Driver Routines .................................................................................... 37

    3.5 Building, Integrating, and Testing Your Driver ............................................... 55

    4 Adding an Existing Legacy Driver to Your BSP ................................ 61

    4.1 Introduction ............................................................................................................. 61

    4.2 BSP Support for Legacy (Non-VxBus) Device Drivers ................................... 62

    4.3 Project Facility ......................................................................................................... 62

    4.4 Component Descriptor Files ................................................................................ 63

    5 END Ethernet Drivers ........................................................................... 65

    5.1 Introduction ............................................................................................................. 65

  • Contents

    v

    5.2 END Driver Overview ........................................................................................... 66

    5.2.1 Driver Environment ................................................................................. 66

    The MUX ................................................................................................... 66Network Interface Drivers and Protocols ............................................. 67The MUX, Protocol, and Driver API ..................................................... 68Driver Components ................................................................................. 70Protocols That Use the MUX API .......................................................... 71Interactions With the MUX API ............................................................. 75Network Layer to Data Link Layer Address Resolution .................... 81

    5.2.2 VxWorks OS Interface .............................................................................. 82

    Understanding How VxWorks Launches and Uses Your Driver ...... 82Executing Calls Waiting In the Network Job Queue ........................... 86Adding Your Network Interface Driver to VxWorks .......................... 87Allocating, Initializing, and Utilizing Memory Resources ................. 89Handling Packet Reception .................................................................... 97Handling Packet Transmission ............................................................... 110Implementing Checksum Offloading .................................................... 116Implementing Required Entry Points and Structures ......................... 116

    5.3 The END Driver Development Process ............................................................. 139

    5.3.1 Driver Development Overview ............................................................. 139

    Writing a New Driver .............................................................................. 139Porting an Existing Driver From Another OS ..................................... 141Additional Development Issues ............................................................. 141

    5.3.2 Error Conditions ...................................................................................... 142

    5.3.3 Generic MIB Interface Initialization ...................................................... 144

    6 SCSI Drivers ......................................................................................... 151

    6.1 Introduction ............................................................................................................. 151

    Understanding SCSI-2 in VxWorks ....................................................... 152

    6.2 SCSI Overview ........................................................................................................ 152

    6.2.1 Layout of SCSI Modules .......................................................................... 153

    6.2.2 The VxWorks OS Interface ...................................................................... 156

    Libraries ..................................................................................................... 156Driver Programming Interface ............................................................... 159

  • VxWorksDevice Driver Developer's Guide, 6.7

    vi

    6.3 SCSI BSP Interface ................