02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

VxWorks 5.5<br />

<strong>BSP</strong> Developer’s <strong>Guide</strong><br />

Documentation and Standards<br />

Describe the entire chip with all of its features and operating modes. Code<br />

maintainers need to determine the basis of the chip without resorting to a complete<br />

library search. Most manufacturers now have their data sheets on the World Wide<br />

Web. This makes finding data sheets easier, but a good one paragraph summary of<br />

the chip can save a lot of time spent searching and reading.<br />

Describe the driver modes and limitations. The module description should be an<br />

introduction to both the chip and the driver.<br />

Follow the Wind River coding standard. This enhances readability and eases<br />

maintenance. Have a technical writer review the documentation for clarity and<br />

grammar.<br />

Do a formal code review to check for adherence to the coding standards. There is<br />

no better way to insure quality and readability than to have someone else look at<br />

your code.<br />

Concentrate on documenting how the device and the driver work together. In<br />

addition to missing documentation, there is the problem of useless documentation.<br />

It is not unusual to see documentation that is trivial and redundant. A typical<br />

example would be:<br />

x = 0; /* clear x */<br />

fooReset (&myFoo); /* reset myFoo */<br />

These are not unusual examples. Assembly level programmers are used to<br />

documenting each line of code. In the C era, programmers tend to write comments<br />

preceding the code. The line by line comment model tends to have more useless<br />

documentation. Programmers are warned to avoid the problems with line by line<br />

running comments.<br />

Another point to consider is that the documentation that goes into the generated<br />

man pages is usually more important than comments in the body of the code. This<br />

is information for the user. It must be accurate and clear. Done right, the reader will<br />

understand what the code intends to accomplish. It becomes much easier to spot<br />

problems in code when you understand its goals clearly.<br />

Documentation should tell the engineer how to integrate the driver into the overall<br />

<strong>BSP</strong> package. All special external routines should be documented. Instructions on<br />

initializing the driver should be included. Actual examples of <strong>BSP</strong> integration code<br />

would be very helpful.<br />

96

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

Saved successfully!

Ooh no, something went wrong!