VxWorks BSP Developer's Reference : VxWorks BSP Validation Test Suite

sysClock

NAME

sysClock - system clock tests

SYNOPSIS

bspVal options sysClock

DESCRIPTION

This test verifies the functionality of the BSP's system clock. The entire test takes approximately 7-10 minutes to run. See bspVal.sh for an explanation of options.

The tests within this script connect a routine to the system clock interrupt handler using the sysClkConnect( ) routine, which uses the sysClkRoutine function pointer variable. This call to sysClkConnect( ) for sysClkRoutine disconnects any routine the BSP might have previously connected as the system clock ISR.

NOTE: This reference entry lists the most likely reasons for a test's failure. However, it does not list all possible reasons.
Tests one through four check the accuracy of the system clock at several frequencies: an optional extra rate, minimum, maximum, and the default rate, respectively. To measure the rate of the system clock, a simple callback routine is connected to the system clock ISR using sysClkConnect( ). This callback routine increments a counter on every clock tick. The counter is then cleared, and the system clock is enabled at the rate being tested. The counter is read after 10 seconds and again after 130 seconds. The counter values are used to calculate the average interrupt rate of the system clock. Three measurements are taken to cancel the fixed portion of measurement latency error. The computed clock rate error is reported with one percent resolution. If the measured clock rate is more than 10 percent off the value being tested, the test for that rate fails.

If any of these tests fail, check that the timer chip is properly initialized and, if appropriate, that it is programmed with an appropriate scaling factor. Interrupts should be enabled in sysClkEnable( ) before the timer is started. Check that the sysClkRoutine is getting connected by sysClkConnect( ), and that sysClkRoutine( ) is called on every system clock interrupt.

The fifth test verifies the operation of sysClkDisable( ). This is done by periodically checking the same counter incremented by the first four tests. After sysClkDisable( ) is called, this counter should not continue to increment. If this test fails, check that the sysClkDisable( ) routine is disabling timer interrupts, turning off the timer, and setting the running flag to FALSE.

The sixth test performs parameter checking of the sysClkRateSet( ) routine. This test checks that the proper return value is given for erroneous input parameters. If this test fails, check that sysClkRateSet( ) performs error checking based on the SYS_CLK_RATE_MIN and SYS_CLK_RATE_MAX macros.

The seventh test checks the return values of the sysClkRateSet( ) and sysClkRateGet( ) routines when first passed valid rates followed by erroneous rates. If this test fails, check that sysClkRateSet( ) is setting the global rate variable and that sysClkRateGet( ) is reading the same variable.

Barring serious hardware or software limitations (such as an identifiable VxWorks problem), the target board must pass all tests for the BSP to be validated.

CONFIGURATION PARAMETERS

T1_EXTRA_SYSCLK 20
Another rate to test (optional).

EXAMPLE

Output consists of:

                         BSP VALIDATION TEST
                         -------------------

    Target server                     : t53-160
    BSP                               : mv147
    Log file                          : /tmp/bspValidationLog.5219



    System Clock Test :
    sysClk at 4321 hertz (rate = 4325  error = 0%)            : PASS
    sysClk at 3 hertz (rate = 3  error = 0%)                  : PASS
    sysClk at 5000 hertz (rate = 5002  error = 0%)            : PASS
    sysClk at 60 hertz (rate = 60  error = 0%)                : PASS
    sysClkDisable() disables sysClk                           : PASS
    sysClkRateSet() parameter checking                        : PASS
    sysClkRateGet() return value                              : PASS

                      Tests RUN           7
                      Tests PASSED        7
                      Tests FAILED        0
                      Tests SKIPPED       0

SEE ALSO

bspVal.sh, bspPkCommonProc.tcl, envLib.tcl, clockLib.tcl, pkLib.c