GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > RAD750 / V1-3-1

Constituent: rad750_unit_test     Tag: rad750


Interface   Compound List   File List   Compound Members   File Members  

RAD750_unit_test_pid.c File Reference

RAD750 unit test functions for PID hardware and software interface. More...

#include <vxWorks.h>
#include <stdio.h>
#include <tickLib.h>
#include <logLib.h>
#include <semLib.h>
#include <sysLib.h>
#include <errnoLib.h>
#include "RAD750_unit_test.h"
#include "drv/ppci/ppciRegs.h"
#include "drv/ppci/ppciPid.h"

Include dependency graph for RAD750_unit_test_pid.c:

Include dependency graph

Data Structures

struct  _rad750_PUTPidInfo
struct  _rad750_PUTRegisterSet

Defines

#define rad750_PUT_SWAP(__i__)
#define rad750_PUT_BAD_PID_COUNT   (sizeof(rad750_PUTBadPids)/sizeof(*rad750_PUTBadPids))
#define rad750_PUT_BAD_PID_TYPE_COUNT   (sizeof(rad750_PUTBadPidTypes)/sizeof(*rad750_PUTBadPidTypes))
#define rad750_PUT_BAD_PID_VALUE_COUNT   (sizeof(rad750_PUTBadPidValues)/sizeof(*rad750_PUTBadPidValues))
#define rad750_PUT_BAD_PID_INPUT_TYPE_COUNT   (sizeof(rad750_PUTBadPidInputTypes)/sizeof(*rad750_PUTBadPidInputTypes))
#define rad750_PUT_BAD_PID_OUTPUT_TYPE_COUNT   (sizeof(rad750_PUTBadPidOutputTypes)/sizeof(*rad750_PUTBadPidOutputTypes))
#define rad750_PUT_PID_COUNT   (sizeof(rad750_PUTData)/sizeof(*rad750_PUTData))
#define rad750_PUT_TEST_ITERATIONS   (1000)

Typedefs

typedef _rad750_PUTPidInfo rad750_PUTPidInfo
typedef _rad750_PUTRegisterSet rad750_PUTRegisterSet
typedef enum _rad750_PUTRegisterMaskType rad750_PUTRegisterMaskType

Enumerations

enum  _rad750_PUTRegisterMaskType {
  rad750_PUT_MASK_OUTPUT_ENABLE = 0x00000001,
  rad750_PUT_MASK_OUTPUT_SELECT = 0x00000002,
  rad750_PUT_MASK_OUTPUT = 0x00000004,
  rad750_PUT_MASK_INPUT_ENABLE = 0x00000008,
  rad750_PUT_MASK_INPUT_SELECT = 0x00000010,
  rad750_PUT_MASK_INT_ENABLE = 0x00000020,
  rad750_PUT_MASK_VEC_ENABLE = 0x00000040,
  rad750_PUT_MASK_INPUT = 0x00000080,
  rad750_PUT_MASK_ALL = 0xFFFFFFFF
}

Functions

void rad750_PUTSaveRegs (rad750_PUTRegisterSet *regs)
 Save PID registers to register set.

void rad750_PUTRestoreRegs (rad750_PUTRegisterSet *regs)
 Restore PID registers to to contents of a register set.

int rad750_PUTCheckValueChange (unsigned long oldValue, unsigned long newValue, const char *regName, unsigned long cmpMask)
 Determine if a PID register value has changed.

int rad750_PUTCheckPidChanges (const rad750_PUTRegisterSet *oldRegValues, rad750_PUTRegisterMaskType registerMask, unsigned long pidMaskValue)
 Determine if any PID registers have changed.

rad750_PUTPidInforad750_PUTGetInfo (int pidNum)
 Return a PID INFO structure for a PID number.

int rad750_PUTSetup ()
 Setup PID Unit Tests.

int rad750_PUTCnfRange ()
 Run pidCnf() argument range tests.

int rad750_PUTCnfInLevel (const rad750_PUTPidInfo *pidInfo)
 Run pidCnf() input level tests.

int rad750_PUTCnfInEdge (const rad750_PUTPidInfo *pidInfo)
 Run pidCnf() input edge detect tests.

int rad750_PUTCnfOutReg (const rad750_PUTPidInfo *pidInfo)
 Run pidCnf() output register tests.

int rad750_PUTCnfOutTimer (const rad750_PUTPidInfo *pidInfo)
 Run pidCnf() output timer tests.

int rad750_PUTCnf ()
 Run pidCnf() tests.

int rad750_PUTIORange ()
 Run pidSet() and pidGet() input range tests.

int rad750_PUTIOVerify (const rad750_PUTPidInfo *pidInfo, const rad750_PUTRegisterSet *regSave, int setValue, int expectedGet)
 Verify PID I/O test results.

int rad750_PUTIOLevel (const rad750_PUTPidInfo *pidInfo)
 Run pidSet() and pidGet() tests for level input.

int rad750_PUTIOEdge (const rad750_PUTPidInfo *pidInfo)
 Run pidSet() and pidGet() tests for edge input.

int rad750_PUTIO ()
 Run pidSet() and pidGet() tests.

void rad750_PUTIsr (int pidNum)
 PID unit test ISR.

int rad750_PUTIntRange ()
 Run PID interrupt functions range tests.

int rad750_PUTIntDriver (const rad750_PUTPidInfo *pidInfo, int mustWork)
 Run PID interrupt must tests.

int rad750_PUTInt ()
 Run PID interrupt tests.

int rad750_PidUnitTest ()
 RAD750 PID library unit test.


Variables

LOCAL int rad750_PUTBadPids [] = {-2, -1, 32, 256}
LOCAL int rad750_PUTBadPidTypes [] = {-2, -1, 4, 257}
LOCAL int rad750_PUTBadPidValues [] = {-1, 2, 4, 257}
LOCAL int rad750_PUTBadPidInputTypes [] = {-2, -1, 2, 3, 256}
LOCAL int rad750_PUTBadPidOutputTypes [] = {-2, -1, 2, 3, 257}
LOCAL rad750_PUTPidInfo rad750_PUTData []
LOCAL int rad750_PUTSpuriousIsrCount = 0
LOCAL SEM_ID rad750_PUTSem

Detailed Description

RAD750 unit test functions for PID hardware and software interface.

Author:
: Ray Caperoon
Date:
: Mon Apr 14 15:52:35 2003

Date
2004/05/05 20:21:52
Source
/nfs/slac/g/glast/flight/archive/RAD750/ptd/RAD750_unit_test_pid.c,v
Author
dwood
Revision
1.2
Log
RAD750_unit_test_pid.c,v
Revision 1.2 2004/05/05 20:21:52 dwood Corrected and updated doxygen comments and markers.

Revision 1.1 2003/12/02 21:16:33 dwood Moved unit test source code from src directory to ptd directory.

Revision 1.2 2003/09/03 19:38:40 ray fix documentation to appease doxygen, fix ISR synchronization, change id pidCnf arguments

Revision 1.1 2003/05/20 20:14:02 dwood Added in unit test for RAD750; just starts testing PID interface.


Define Documentation

#define rad750_PUT_BAD_PID_COUNT   (sizeof(rad750_PUTBadPids)/sizeof(*rad750_PUTBadPids))
 

Number of bad PIDs in bad PID list.

#define rad750_PUT_BAD_PID_INPUT_TYPE_COUNT   (sizeof(rad750_PUTBadPidInputTypes)/sizeof(*rad750_PUTBadPidInputTypes))
 

Number of bad PID input types in bad PID input type list.

#define rad750_PUT_BAD_PID_OUTPUT_TYPE_COUNT   (sizeof(rad750_PUTBadPidOutputTypes)/sizeof(*rad750_PUTBadPidOutputTypes))
 

Number of bad PID output types in bad PID output type list.

#define rad750_PUT_BAD_PID_TYPE_COUNT   (sizeof(rad750_PUTBadPidTypes)/sizeof(*rad750_PUTBadPidTypes))
 

Number of bad PID types in bad PID type list.

#define rad750_PUT_BAD_PID_VALUE_COUNT   (sizeof(rad750_PUTBadPidValues)/sizeof(*rad750_PUTBadPidValues))
 

Number of bad PID values in bad PID value list.

#define rad750_PUT_PID_COUNT   (sizeof(rad750_PUTData)/sizeof(*rad750_PUTData))
 

Number of PID entry in rad750_PUTData list.

#define rad750_PUT_SWAP __i__   ) 
 

Value:

((((__i__) >> 24) & 0x000000ff) | \
                                  (((__i__) >>  8) & 0x0000ff00) | \
                                  (((__i__) <<  8) & 0x00ff0000) | \
                                  (((__i__) << 24) & 0xff000000))
Reverses the bytes of a 32 bit quadlet from ABCD to DCBA. Used to convert from PPC to PCI conventions.

Parameters:
__i__ 32-bit input word to be swapped
Returns:
swapped 32-bit word

#define rad750_PUT_TEST_ITERATIONS   (1000)
 

Number of interations to execute I/O and interrupt tests.


Typedef Documentation

rad750_PUTPidInfo
 

Typedef for struct _rad750_PUTPidInfo

rad750_PUTRegisterMaskType
 

Typedef for enum _rad750_PUTRegisterMaskType

rad750_PUTRegisterSet
 

Typedef for struct _rad750_PUTRegisterSet


Enumeration Type Documentation

enum _rad750_PUTRegisterMaskType
 

Set of masks for defining a collection of PID registers. Used to drive the function rad750_PUTCheckRegs()


Function Documentation

int rad750_PidUnitTest  ) 
 

RAD750 PID library unit test.

Run RAD750 PID library unit tests.

Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTCheckPidChanges const rad750_PUTRegisterSet oldRegValues,
rad750_PUTRegisterMaskType  registerMask,
unsigned long  pidMaskValue
[static]
 

Determine if any PID registers have changed.

This function is used to confirm that a selected PID registers have not unexpectedly changed. The original value of the PID registers are stored at oldRegValues. registerMask is a bit mask defining the set of registers that should be compared.

Parameters:
oldRegValues Old register set
registerMask Bit mask define which registers to test
pidMaskValue Bit mask for PID under test. Bits set in this mask are allowed to change
Return values:
0 if no changes detected
-1 if changes detected.

Here is the call graph for this function:

int rad750_PUTCheckValueChange unsigned long  oldValue,
unsigned long  newValue,
const char *  regName,
unsigned long  cmpMask
[static]
 

Determine if a PID register value has changed.

This function is used to confirm that a PID register has not change unexpectedly. The arguments oldValue and newValue are the register values (not a register address) to be compared. cmpMask is a bit mask used to exclude from bits in oldValue and newValue from the comparison. regName is a text string to be put in the error messages.

Parameters:
oldValue Old register value
newValue New register value
regName Value name for error messages
cmpMask Bit mask to apply to both registers that are not checked for changes
Return values:
0 if no changes detected
-1 if changes detected.

int rad750_PUTCnf  )  [static]
 

Run pidCnf() tests.

Run pidCnf() range and register configuration tests.

Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTCnfInEdge const rad750_PUTPidInfo pidInfo  )  [static]
 

Run pidCnf() input edge detect tests.

Check that pidCnf() configures the ppci PID registers properly for IN / IN_EDGE configurations.

Parameters:
pidInfo PID info block.
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTCnfInLevel const rad750_PUTPidInfo pidInfo  )  [static]
 

Run pidCnf() input level tests.

Check that pidCnf() configures the ppci PID registers properly for IN / IN_LEVEL configurations.

Parameters:
pidInfo PID info block.
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTCnfOutReg const rad750_PUTPidInfo pidInfo  )  [static]
 

Run pidCnf() output register tests.

Check that pidCnf() configures the ppci PID registers properly for OUT / OUT_REG configurations.

Parameters:
pidInfo PID info block.
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTCnfOutTimer const rad750_PUTPidInfo pidInfo  )  [static]
 

Run pidCnf() output timer tests.

Check that pidCnf() configures the ppci PID registers properly for OUT / OUT_TIMER configurations.

Parameters:
pidInfo PID info block.
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTCnfRange  )  [static]
 

Run pidCnf() argument range tests.

Check that pidCnf() returns ERROR if any arguments violate the vlaid input ranges.

Return values:
0 on success
-1 on faliure.

rad750_PUTPidInfo * rad750_PUTGetInfo int  pidNum  )  [static]
 

Return a PID INFO structure for a PID number.

Lookup an entry in rad750_PUTData for an entry that had a pid number of pidNum. Return a pointer to that entry, or return NULL if not found.

Parameters:
pidNum PID number to look up.
Return values:
NULL if no matching record was found.
pointer to matching PID Info entry.

int rad750_PUTInt  )  [static]
 

Run PID interrupt tests.

Run PID interrupt tests. Test PID interrupt functionality as well as pidIntEnable(), pidIntDisable() and pidIntConnect().

Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTIntDriver const rad750_PUTPidInfo pidInfo,
int  mustWork
[static]
 

Run PID interrupt must tests.

Driver to PID interrupt tests.

Parameters:
pidInfo PID info block.
mustWork non-zero if this is a must-work test
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTIntRange  )  [static]
 

Run PID interrupt functions range tests.

Range check for PID functions pidIntConnect(), pidIntEnable(), pidIntDisable(), pidIntEmcEnable(), and pidIntEmcDisable().

Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTIO  )  [static]
 

Run pidSet() and pidGet() tests.

Run pidPut(), pidGet() range, register configuration and functionality tests.

Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTIOEdge const rad750_PUTPidInfo pidInfo  )  [static]
 

Run pidSet() and pidGet() tests for edge input.

from the test plan... 1) Configure as in/out, input edge, output reg. 2) Use pidSet() to test edge detect. Use pidGet() and register peeking to and check values.

This function test pidSet()/pidGet() for negative edge inputs. It runs through a sequence of calls to pidSet() and rad750_PUTIOVerify(). A sequence of high and low values for the PID I/O is driven by the array setValues[]. This generates a "stream" of high or low values that may or may not generate a negative edge. rad750_PUTIOVerify() is called after each call to pidSet() to make sure the right result has occurred. The array getValues[] drives the expected results.

This function will bail out on first sign of trouble.

This function runs calls pidSet() many times, it probably is not really needed, but I want run it a fair number of times to coax out any mutual exclusion or H/W syncrhonization problems.

Parameters:
pidInfo PID info block.
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTIOLevel const rad750_PUTPidInfo pidInfo  )  [static]
 

Run pidSet() and pidGet() tests for level input.

From the test plan... 1) Configure as in/out, input level, output reg. 2) Use pidSet() to test input level. Use pidGet() and register peeking to and check values.

This function test pidSet()/pidGet() for level inputs. It runs through a sequence of calls to pidSet() and rad750_PUTIOVerify(). pidSet() sets the registers to the desired value, then rad750_PUTIOVerify() checks that all the pidGet() works and all of the registers are in the proper state.

This function will bail out on first sign of trouble.

This function runs calls pidSet() many times, it probably is not really needed, but I want run it a fair number of times to coax out any mutual exclusion or H/W syncrhonization problems.

Parameters:
pidInfo PID info block.
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

int rad750_PUTIORange  )  [static]
 

Run pidSet() and pidGet() input range tests.

Range check pidSet() pidGet() and pidEdgeClear(). All are range checked for bad PID numbers.

Return values:
0 on success
-1 on faliure.

int rad750_PUTIOVerify const rad750_PUTPidInfo pidInfo,
const rad750_PUTRegisterSet regSave,
int  setValue,
int  expectedGet
[static]
 

Verify PID I/O test results.

This function does the grunt work of verifying the results of a PID I/O tests. The function verfies that pidGet() returns the expected value. The function verifies the input and output registers for the PID under test are in the expected state. The function also verifies that other registers are not affected by the testing. This function does not bail out on the first error, it attempts to verify everything it can before returning.

Parameters:
pidInfo PID info block.
regSave Values of registers before tests were run. Used to verify registers/bit not adversely affected by testing
setValue The value passed to pidSet() for the test.
expectedGet Value expected to be returned by pidGet().
Return values:
0 on success
-1 on faliure.

Here is the call graph for this function:

void rad750_PUTIsr int  pidNum  )  [static]
 

PID unit test ISR.

This is the ISR that is connected to PID interrupts during PID unit testing.

Parameters:
pidNum PID number, registered as user data when pidIntConnect() is called.
Return values:
none 

Here is the call graph for this function:

void rad750_PUTRestoreRegs rad750_PUTRegisterSet regs  )  [static]
 

Restore PID registers to to contents of a register set.

This function copies the values in the register set at location regs to the the RAD750 PPCI PID registers.

Parameters:
regs Pointer to PID register set
Return values:
none 

void rad750_PUTSaveRegs rad750_PUTRegisterSet regs  )  [static]
 

Save PID registers to register set.

This function copies the current values in the RAD750 PPCI PID registers to the location at regs.

Parameters:
regs Pointer to PID register set
Return values:
none 

void rad750_PUTSetup  )  [static]
 

Setup PID Unit Tests.

To be called before PID unit tests are executed. Sets up any data needed to driver the PID tests.

Return values:
0 on success
-1 on faliure.


Variable Documentation

rad750_PUTBadPidInputTypes = {-2, -1, 2, 3, 256}
 

List of PID input type values for PID input type range checking. None of the PID input types are valid.

rad750_PUTBadPidOutputTypes = {-2, -1, 2, 3, 257}
 

List of PID output type values for PID output type range checking. None of the PID output types are valid.

rad750_PUTBadPids = {-2, -1, 32, 256}
 

List of PID values for PID range checking. None of the PID numbers are valid.

rad750_PUTBadPidTypes = {-2, -1, 4, 257}
 

List of PID type values for PID type range checking. None of the PID types are valid.

rad750_PUTBadPidValues = {-1, 2, 4, 257}
 

List of PID values to be passed to pidSet() range checking. None of the PID values are valid.

rad750_PUTData
 

Initial value:

{{1,  1, 0, 0},                 
 {2,  1, 0, 0},                 
 {5,  0, 0, 0},
 {6,  0, 0, 0},
 {7,  0, 0, 0},
 {14, 0, 0, 0},
 {15, 0, 0, 0},
 {21, 0, 0, 0},
 {22, 0, 0, 0},
 {23, 0, 0, 0},
 {24, 0, 0, 0},
 {25, 0, 0, 0},
}
Set of PIDs we will test. All tests run on these PIDs must work. See _rad750_PUTPidInfo documentation for more details.

rad750_PUTSem
 

Binary semaphore used to sychronize between test code running at task level and the ISR.

rad750_PUTSpuriousIsrCount = 0
 

A count of the number of times rad750_PUTIsr() is called for a PID that this test has not registered for.


Generated on Thu Aug 26 02:55:32 2004 by doxygen 1.3.3