VxWorks
DEVICE DRIVER DEVELOPER'S GUIDE
Volume 2: Writing Class-Specific Device Drivers
6.8
®
VxWorks Device Driver Developer's Guide, 6.8
Copyright © 2009 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:
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 Headquarters
Wind River
500 Wind River Way
Alameda, CA 94501-1153
U.S.A.
Toll free (
U.S.A.): 800-545-WIND
Telephone: 510-748-4100
Facsimile: 510-749-2010
For additional contact information, see the Wind River Web site:
www.windriver.com
For information on how to contact Customer Support, see:
www.windriver.com/support
VxWorks
Device Driver Developer's Guide
6.8
29 Oct 09
iii
Contents
1 Class-Specific Driver Development .......................................................... 1
1.1 About VxBus Driver Classes ........................................................................................ 1
1.2 Before You Begin ............................................................................................................. 1
1.3 About this Document .................................................................................................... 2
Navigating this Documentation Set ............................................................... 2
2 Bus Controller Drivers ................................................................................ 3
2.1 Introduction ..................................................................................................................... 3
2.2 Overview .......................................................................................................................... 3
2.3 VxBus Driver Methods .................................................................................................. 5
2.3.1 {busCtlrDevCfgRead}( ) ................................................................................... 5
2.3.2 {busCtlrCfgRead}( ) ........................................................................................... 6
2.3.3 {busCtlrDevCfgWrite}( ) ................................................................................... 7
2.3.4 {busCtlrCfgWrite}( ) .......................................................................................... 7
2.3.5 {busCtlrDevCtlr}( ) ............................................................................................ 8
2.3.6 {busCtlrAccessOverride}( ) .............................................................................. 9
Override for (*busCfgRead)( ) ......................................................................... 10
Override for (*busCfgWrite)( ) ........................................................................ 10
Override for (*vxbDevControl)( ) ................................................................... 10
2.3.7 {busCtlrCfgInfo}( ) ............................................................................................. 11
2.3.8 {busCtlrBaseAddrCvt}( ) .................................................................................. 11
2.3.9 {vxbDevRegMap}( ) ........................................................................................... 12
Specifying a Predefined Transaction Type ..................................................... 13
Providing a New Transaction Type ............................................................... 15
2.3.10 {vxbIntDynaVecProgram}( ) ............................................................................. 16
2.4 Header Files ..................................................................................................................... 16
VxWorks
Device Driver Developer's Guide, 6.8
iv
2.5 BSP Configuration .......................................................................................................... 17
2.5.1 PCI Configuration ............................................................................................ 17
2.5.2 PCI Autoconfiguration .................................................................................... 18
2.6 Available Utility Routines ............................................................................................ 19
2.6.1 PCI Configuration ............................................................................................ 19
2.6.2 PCI Autoconfiguration ..................................................................................... 19
2.6.3 vxbBusAnnounce( ) ........................................................................................... 20
2.6.4 vxbPciBusTypeInit( ) ......................................................................................... 20
2.7 Initialization .................................................................................................................... 21
2.7.1 Initialization Example ..................................................................................... 22
vxbBusAnnounce( ) ........................................................................................... 23
vxbDeviceAnnounce( ) ..................................................................................... 23
vxbDevStructAlloc( ) ........................................................................................ 23
vxbDevStructFree( ) .......................................................................................... 24
2.8 Debugging ........................................................................................................................ 24
3 Direct Memory Access Drivers .................................................................. 25
3.1 Introduction ..................................................................................................................... 25
3.2 Overview ........................................................................................................................... 25
3.3 VxBus Driver Methods ................................................................................................... 26
3.3.1 {vxbDmaResourceGet}( ) .................................................................................. 26
3.3.2 {vxbDmaResourceRelease}( ) ........................................................................... 27
3.3.3 {vxbDmaResDedicatedGet}( ) .......................................................................... 27
3.4 Header Files ...................................................................................................................... 27
3.5 BSP Configuration .......................................................................................................... 28
3.6 Available Utility Routines ............................................................................................. 28
3.7 Initialization ..................................................................................................................... 28
3.8 DMA System Structures and Routines ....................................................................... 28
3.8.1 (*dmaRead)( ) ..................................................................................................... 29
3.8.2 (*dmaReadAndWait)( ) ..................................................................................... 29
3.8.3 (*dmaWrite)( ) .................................................................................................... 29
3.8.4 (*dmaWriteAndWait)( ) .................................................................................... 29
3.8.5 (*dmaCancel)( ) .................................................................................................. 30
3.8.6 (*dmaPause)( ) ................................................................................................... 30
3.8.7 (*dmaResume)( ) ................................................................................................ 30
Contents
v
3.8.8 (*dmaStatus)( ) ................................................................................................... 30
3.9 Debugging ....................................................................................................................... 31
4 Interrupt Controller Drivers ........................................................................ 33
4.1 Introduction ..................................................................................................................... 33
4.2 Overview .......................................................................................................................... 34
Interrupt Identification .................................................................................... 34
Interrupt Controller Driver Responsibilities ................................................. 34
Interrupt Controller Configurations ............................................................... 35
Dynamic Vectors ................................................................................................ 35
Interrupt Controller Drivers and Multiprocessing ....................................... 36
4.3 VxBus Driver Methods .................................................................................................. 36
4.3.1 Basic Methods .................................................................................................... 36
{vxbIntCtlrConnect}( ) ...................................................................................... 36
{vxbIntCtlrDisconnect}( ) ................................................................................. 36
{vxbIntCtlrEnable}( ) ......................................................................................... 37
{vxbIntCtlrDisable}( ) ........................................................................................ 37
4.3.2 Dynamic Vector Methods ................................................................................ 37
{vxbIntDynaVecConnect}( ) ............................................................................. 37
4.3.3 Multiprocessor Methods ................................................................................. 38
{vxbIntCtlrIntReroute}( ) .................................................................................. 38
{vxbIntCtlrCpuReroute}( ) .............................................................................. 38
{vxIpiControlGet}( ) .......................................................................................... 39
4.4 Header Files ...................................................................................................................... 39
vxbIntrCtlr.h ....................................................................................................... 39
vxbIntCtlrLib.h .................................................................................................. 39
4.5 BSP Configuration .......................................................................................................... 40
4.5.1 Interrupt Input Table ........................................................................................ 40
4.5.2 Dynamic Vector Table ....................................................................................... 42
4.5.3 CPU Routing Table ............................................................................................ 42
4.5.4 Interrupt Priority ............................................................................................... 43
4.5.5 Crossbar Routing Table .................................................................................... 43
4.6 Available Utility Routines ............................................................................................. 44
4.6.1 intCtlrHwConfGet( ) ......................................................................................... 45
4.6.2 intCtlrISRAdd( ) ................................................................................................ 45
4.6.3 intCtlrISRDisable( ) ........................................................................................... 45
4.6.4 intCtlrISREnable( ) ............................................................................................ 45
4.6.5 intCtlrISRRemove( ) .......................................................................................... 45