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.

2<br />

<strong>BSP</strong> Organization<br />

further board initialization that could not be completed in sysHwInit( ); for<br />

example, an intConnect( ) of additional devices may be done in sysHwInit2( ).<br />

The 60 Hz system clock is set up by calling sysClkRateSet( ) and sysClkEnable( ).<br />

VxWorks can be booted without the system clock running. However, network<br />

drivers, when they attach, usually execute a taskDelay( ) to allow hardware reset<br />

to complete. If the system clock is not running, the delay does not expire, causing<br />

the system to hang.<br />

The system clock can be dynamically changed from the shell or application<br />

programs. However, facilities that take a “snapshot” of the clock rate (for example,<br />

spyLib) can be broken by such an unexpected rate change.<br />

If INCLUDE_IO_SYSTEM is defined in configAll.h, the VxWorks I/O system is<br />

initialized by calling the routine iosInit( ). The arguments specify the maximum<br />

number of drivers that can be subsequently installed, the maximum number of<br />

files that can be open in the system simultaneously, and the desired name of the<br />

“null” device that is included in the VxWorks I/O system. This null device is a<br />

“bit-bucket” on output and always returns end-of-file for input.<br />

The inclusion or exclusion of INCLUDE_IO_SYSTEM also affects whether the<br />

console devices are created, and whether standard in, standard out, and standard<br />

error are set; see the next two sections for more information.<br />

If the driver for the on-board serial ports is included (INCLUDE_TTY_DEV), it is<br />

installed in the I/O system by calling the driver’s initialization routine, typically<br />

ttyDrv( ). The actual devices are then created and named by calling the driver’s<br />

device-creation routine, typically ttyDevCreate( ). The arguments to this routine<br />

include the device name, a serial I/O channel descriptor (from the <strong>BSP</strong>), and input<br />

and output buffer sizes.<br />

The macro NUM_TTY specifies the number of tty ports (default is 2);<br />

CONSOLE_TTY specifies which port is the console (default is 0); and<br />

CONSOLE_BAUD_RATE specifies the bps rate (default is 9600). These macros are<br />

specified in configAll.h, but can be overridden in config.h for boards with a<br />

nonstandard number of ports.<br />

PCs can use an alternative console with keyboard input and VGA output; see your<br />

PC workstation documentation for details.<br />

The excInit( ) routine is called to initialize exception handling. Other facilities are<br />

optionally initialized at this point, as specified by macros in configAll.h. (See also<br />

VxWorks Programmer’s <strong>Guide</strong>: Configuration.)<br />

If INCLUDE_WDB is defined, wdbConfig( ) in src/config/usrWdb.c is called. This<br />

routine initializes the agent’s communication interface, then starts the agent. For<br />

2<br />

37

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

Saved successfully!

Ooh no, something went wrong!