02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

F<br />

Generic Drivers<br />

F.1 Introduction<br />

This appendix provides guidelines for writing generic drivers for the handful of<br />

devices that are common to most <strong>BSP</strong>s. Although <strong>BSP</strong>s can differ considerably in<br />

detail, there are some needs that are common to almost all. For example, most <strong>BSP</strong>s<br />

require a serial device driver or a timer driver. Ideally, the drivers for these devices<br />

would be generic enough to port to a new <strong>BSP</strong> with a simple recompilation. This<br />

reuse of code reduces your maintenance overhead and lets you focus your testing<br />

efforts, which results in better tested code. For example, using generic drivers let<br />

Wind River save 500 lines of C source code in three similar <strong>BSP</strong>s. 1<br />

To help you use generic drivers across multiple similar <strong>BSP</strong>s, the <strong>BSP</strong> kit includes<br />

source for generic drivers in the target/src/drv directory. At compile time, sysLib.c<br />

(a file duplicated in every <strong>BSP</strong>) can include generic drivers from the target/src/drv<br />

directory as needed. As you develop drivers for your <strong>BSP</strong>s, you should strive to<br />

create drivers that are generic enough to service multiple <strong>BSP</strong>s. You can add such<br />

drivers to those in the target/src/drv directory.<br />

However, when dealing with atypical hardware or legacy code, it might not be<br />

practical to use a generic driver. Some hardware designs are just too different to<br />

work with a generic driver. In the case of legacy code, it might be possible to use a<br />

generic driver. Unfortunately, reworking the <strong>BSP</strong> to use a generic driver might not<br />

be worth the effort, especially if you are just upgrading the <strong>BSP</strong> to a new release of<br />

VxWorks. In either case, you must create or maintain a <strong>BSP</strong>-specific driver. Such a<br />

1. VxWorks network and SCSI device drivers (distributed in object form) are not discussed<br />

here, but are covered in other appendices in this manual.<br />

247

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!