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.

5<br />

Driver <strong>Guide</strong>lines<br />

5.4 Design <strong>Guide</strong>lines<br />

This section discusses guidelines you should follow when designing a driver for<br />

use with Wind River products. Included are discussions of function naming<br />

conventions, documentation standards, per-device and per-driver data structures,<br />

interrupt service routines, and access macros for chip registers.<br />

5<br />

Names and Locations<br />

Follow the Wind River driver naming convention. Be very careful about routine<br />

and variable names. Each module should have a distinctive prefix and every<br />

routine and variable declared must start with that prefix. The coding conventions<br />

document suggests the module-noun-verb method of name construction. You can<br />

also consider it as being proceeding from generic to specific going from left to<br />

right. Related routines must have a common root and be distinct from each other<br />

by their suffixes.<br />

A poor example:<br />

STATUS fooStartPoll (void);<br />

STATUS fooStopPoll (Void);<br />

Should be (assuming they both are related to a polling operation):<br />

STATUS fooPollStart (void);<br />

STATUS fooPollStop (void);<br />

Only Wind River generic drivers are stored in target/src/drv/xxx. This implies that<br />

all drivers are used by more than one <strong>BSP</strong>, or are expected to be used by more than<br />

one <strong>BSP</strong>. Third party <strong>BSP</strong> writers frequently assume that these directories are for<br />

all drivers, including theirs. Because the future is unpredictable, Wind River<br />

reserves all rights with respect to these directories. Third parties must place their<br />

drivers in the same directory as the <strong>BSP</strong>.<br />

Even Wind River special drivers are placed in the <strong>BSP</strong> directory. Usually these are<br />

modified versions of a generic driver. Sometimes they are just wrappers that<br />

declare a specialized set of macros and then #include the generic driver.<br />

95

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

Saved successfully!

Ooh no, something went wrong!