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 />

If this test is run between two targets using shared memory, make sure the target is<br />

configured to include shared memory show routines. To do this, add<br />

INCLUDE_SHOW_ROUTINES to config.h of the <strong>BSP</strong>s or include the component<br />

INCLUDE_SM_NET_SHOW, if using project facility.<br />

NOTE: This reference entry lists the most likely reasons for a test’s failure. However, it<br />

does not list all possible reasons.<br />

The script does not reboot the targets. It assumes that the two targets and their respective<br />

target servers are up and running.<br />

By default the test assumes that T1 target is the system controller on the common VME<br />

backplane. An optional configuration parameter T1_BUS_MASTER can be set to FALSE<br />

to override this default configuration. In this case the T2 target is assumed to be the<br />

system controller. It is necessary to make sure that T1_BUS_MASTER has the correct<br />

value in case targets have to be rebooted before running any test.<br />

The test starts by obtaining two cache-coherent memory locations by calls to<br />

cacheDmaMalloc( ) on the master. These two memory locations are used for the<br />

semaphore and the access counter. The pkTestRamByte function checks that the<br />

addresses returned by cacheDmaMalloc( ) are readable and writable.<br />

Next, the local addresses are used to compute the bus addresses by calling the function<br />

sysLocalToBusAdrs( ) on the master. The bus addresses returned by<br />

sysLocalToBusAdrs( ) are passed to the slave, which uses the function<br />

sysBusToLocalAdrs( ) to get its own local addresses that it must apply to access the<br />

semaphore and counter locations on the master’s shared memory. The smAdrsFind<br />

procedure is called to verify that the counter and semaphore locations are seen by both the<br />

master and the slave. The memory locations are then initialized and the test is started by<br />

spawning the pkTasTest task on both master and slave. The functions<br />

wtxContextCreate( ) and wtxContextResume( ) are used here to spawn and start the<br />

tasks. The function pkTasTest( ) uses the semaphore location for mutual exclusion. When<br />

the master gets the semaphore, it increments the counter, if it is odd, and runs a busy-wait<br />

loop until it finally clears the semaphore. The slave runs the same way except that it<br />

increments the counter if it is even. This scheme ensures that the two tasks take turns<br />

grabbing the semaphore and incrementing the counter.<br />

The counter is monitored from the script, which takes two readings of the counter one<br />

second apart. If the second reading is larger than the first one, the short-term test is<br />

successful. After a pause of ten minutes, the two readings are retaken. If the counter is still<br />

increasing, the long-term test is successful.<br />

If this test fails, check that the master and slave are both accessing the same two master<br />

memory locations. If the master sysLocalToBusAdrs( ) or the slave sysBusToLocalAdrs( )<br />

routines are not functioning properly, the test will not be able to find appropriate slave<br />

addresses that access the master memory locations. The master memory locations must be<br />

cache-coherent and must be writable. The VME controller chips must be initialized to<br />

378

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

Saved successfully!

Ooh no, something went wrong!