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.

F<br />

Generic Drivers<br />

Define SIO_CALLBACK_GET_TX_CHAR to point to a function that fetches a<br />

new character for output. The driver calls this callback routine with the<br />

supplied argument and an additional argument that is the address to receive<br />

the new output character if any. The called function returns OK to indicate that<br />

a character was delivered, or ERROR to indicate that no more characters are<br />

available.<br />

Define SIO_CALLBACK_PUT_RCV_CHAR to point to a function the driver can<br />

use to send characters upward. For each incoming character, the callback<br />

routine is called with the supplied argument, and the new character as a<br />

second argument. Drivers normally do not care about the return value from<br />

this call. There is usually nothing that the driver could do but to drop a<br />

character if the higher level is not able to receive it.<br />

pollInput and pollOutput<br />

Provide an interface to polled mode operations of the driver. Do not call these<br />

functions unless the device has already been placed into polled mode<br />

operation by an SIO_MODE_SET operation.<br />

See target/src/drv/sio/templateSio.c for more information on the internal<br />

workings of a typical SIO device driver.<br />

F.4 Timer<br />

F<br />

The generic timer drivers reside in the directory target/src/drv/timer. Included in<br />

this directory is templateTimer.c. When writing a timer driver, base the driver on<br />

this template, then modify the <strong>BSP</strong>’s sysLib.c file to include the driver as needed.If<br />

a <strong>BSP</strong> has access to only a single timer, that <strong>BSP</strong> must support the system clock and<br />

not the auxiliary clock. This means that sysAuxClkConnect( ) must return<br />

ERROR.<br />

The following macros are used for parameter checking in VxWorks timer drivers,<br />

and must be defined in each <strong>BSP</strong>’s bspname.h file:<br />

SYS_CLK_RATE_MIN<br />

Defines the minimum rate at which the system clock can run. Unless hardware<br />

constraints dictate otherwise, SYS_CLK_RATE_MIN must be less than or equal<br />

to 60 Hz.<br />

251

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

Saved successfully!

Ooh no, something went wrong!