Common Functions


Functions

void fwSpecs_clear ()
void fwSpecs_get (dyn_string &pSPECSList)
bool fwSpecs_add (string pSPECS)
bool fwSpecs_remove (string pSPECS)
bool fwSpecs_getMasterIDs (string pSPECS, dyn_int &pMasterIDsList)
bool fwSpecs_getMasterCardsInfo (string pSPECS, dyn_int &pMasterCardsPCIList, dyn_dyn_int &pMasterCardsDateList)
bool fwSpecs_setClockFrequency (string pSPECS, int pMasterID, int pClockFrequency)
int fwSpecs_resetMaster (string pSPECS, int pMasterID, int hardResetFlag=0)
int fwSpecs_resetSlave (string pSPECS, int pMasterID, int pSlaveAddress, int pMode)
int fwSpecs_slaveLeds (string pSPECS, int pMasterID, int pSlaveAddress, int pMode)
bool fwSpecs_saveScript (string pScriptName, string pScript="")
bool fwSpecs_removeScript (string pScriptName)
bool fwSpecs_getScripts (dyn_dyn_string &pScriptsList)
bool fwSpecs_executeScript (string pScriptName, dyn_string pParametersList=makeDynString())
bool fwSpecs_removeRegisters (dyn_string pRegistersList)
bool fwSpecs_getRegisters (dyn_dyn_string &pRegistersList, int pRegisterType=-1)

Detailed Description

List of common functions to operate with SPECS.

Function Documentation

bool fwSpecs_add ( string  pSPECS  ) 

This function adds the specified SPECS and, also, subscribes all the DIM services & commands that are needed to communicate with that SPECS. Note: this function just needs to be called once and only once for every new SPECS.

Parameters:
[in] pSPECS name of the SPECS to be added.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_add("pclbcecs03"))   // add the SPECS 'pclbcecs03'
     (...)
  else
     DebugTN("Error found!");
  (...)



void fwSpecs_clear (  ) 

This function clears the entire system (datapoints will be removed and all the DIM services & commands will be unsubscribed). This function should be used with EXTREME CAUTION, since all data will be LOST.

Returns:
void (nothing)
Example:

  (...)
  fwSpecs_clear();   // clear the entire system
  DebugTN("The system is clear!");
  (...)



bool fwSpecs_executeScript ( string  pScriptName,
dyn_string  pParametersList = makeDynString() 
)

This function executes the specified script.

Parameters:
[in] pScriptName name of the script to be executed.
[in] pParametersList list of parameters to be passed to the main function of the script. Note: this parameter is optional (if not specified, then an empty parameters list will be passed).
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_executeScript("myScript"))   // execute the script 'myScript' with no parameters
     (...)
  else
     DebugTN("Error found!");
  (...)



void fwSpecs_get ( dyn_string &  pSPECSList  ) 

This function returns a list of SPECS servers running in the moment. If there is no SPECS server running, then the returned list will be empty.

Parameters:
[out] pSPECSList list containing the SPECS server running in the moment.
Returns:
void (nothing)
Example:

  (...)
  dyn_string myList;
  int        i;

  fwSpecs_get(myList);   // get a list of SPECS servers running in the moment
  DebugTN("SPECS servers: " + dynlen(myList));   // display number of SPECS servers running in the moment
  for(i = 1; i <= dynlen(myList); i++)
     DebugTN(myList[i]);
  (...)



bool fwSpecs_getMasterCardsInfo ( string  pSPECS,
dyn_int &  pMasterCardsPCIList,
dyn_dyn_int &  pMasterCardsDateList 
)

This function returns information about the master card(s) founded in the specified SPECS.

Parameters:
[in] pSPECS SPECS where to get the information about the master card(s).
[out] pMasterCardsPCIList list containing the PCI number of the master cards(s) founded.
[out] pMasterCardsDateList list containing the PROM date of the master cards(s) founded.
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_int     myPCIList;
  dyn_dyn_int myDateList;
  int         i;

  if (fwSpecs_getMasterCardsInfo("pclbcecs03", myPCIList, myDateList))   // get a list with information about the master card(s) of 'pclbcecs03'
  {
     DebugTN("Master card(s) founded: " + dynlen(myPCIList));   // display number of master card(s) founded
     for(i = 1; i <= dynlen(myPCIList); i++)
     {
        DebugTN("PCI number: " + (string) myPCIList[i]);   // display PCI number where the master card is installed
        DebugTN("PROM date : " + (string) myDateList[i][1] + " (month), " + (string) myDateList[i][2] + " (day)");   // display master card PROM date
     }
  }
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_getMasterIDs ( string  pSPECS,
dyn_int &  pMasterIDsList 
)

This function returns the list of master IDs that have been found in the specified SPECS. If there is no master IDs, then the returned list will be empty.

Parameters:
[in] pSPECS SPECS where to get the master IDs.
[out] pMasterIDsList list containing the master IDs.
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_int myList;
  int     i;

  if (fwSpecs_getMasterIDs("pclbcecs03", myList))   // get a list of master IDs existing in 'pclbcecs03'
  {
     DebugTN("Master IDs found: " + dynlen(myList));   // display number of master IDs found
     for(i = 1; i <= dynlen(myList); i++)
        DebugTN(myList[i]);
  }
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_getRegisters ( dyn_dyn_string &  pRegistersList,
int  pRegisterType = -1 
)

This function returns a list containing registers of type I2C, PBUS, REG or DCU (or all).

Parameters:
[out] pRegistersList list containing the existing registers (with their respective settings) of a certain type.
[in] pRegisterType type of the registers to be returned. These types are represented by the constants FWSPECS_I2C, FWSPECS_PBUS, FWSPECS_REG, and FWSPECS_DCU. Note: this parameter is optional (if not specified, then all registers will be returned without regarding their types).
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_dyn_string myList;
  int            i;

  if (fwSpecs_getRegisters(myList, FWSPECS_I2C))   // get a list of the existing I2C registers
  {
     DebugTN("Existing I2C registers: " + dynlen(myList));   // display number of existing I2C registers
     for(i = 1; i <= dynlen(myList); i++)
     {
        DebugTN("Register: " + myList[i][1]);   // display I2C register name
        DebugTN("Settings: " + myList[i][2]);   // display I2C register settings
     }
  }
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_getScripts ( dyn_dyn_string &  pScriptsList  ) 

Get a list with the existing scripts.

Parameters:
[out] pScriptsList returned list containing the scripts.
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_dyn_string myList;
  int            i;

  if (fwSpecs_getScripts(myList))   // get a list of the existing scripts
  {
     DebugTN("Existing scripts: " + dynlen(myList));   // display number of existing scripts
     for(i = 1; i <= dynlen(myList); i++)
     {
        DebugTN("Name  : " + myList[i][1]);   // display script name
        DebugTN("Script: " + myList[i][2]);   // display script
     }
  }
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_remove ( string  pSPECS  ) 

This function removes the specified SPECS and, also, unsubscribes all the DIM services & commands associated with that SPECS.

Parameters:
[in] pSPECS name of the SPECS to be removed.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_remove("pclbcecs03"))   // remove the SPECS 'pclbcecs03'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_removeRegisters ( dyn_string  pRegistersList  ) 

Remove (delete) a set of registers.

Parameters:
[in] pRegistersList list containing the registers to be removed (deleted). Note: if the register is being used for monitoring, the monitoring will be stopped before removing the register.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_removeRegisters(makeDynString("myReg01", "myReg02")))   // remove (delete) the registers 'myReg01' and 'myReg02'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_removeScript ( string  pScriptName  ) 

Remove the specified script.

Parameters:
[in] pScriptName name of the script to be removed.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_removeScript("myScript"))   // remove the script named 'myScript'
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_resetMaster ( string  pSPECS,
int  pMasterID,
int  hardResetFlag = 0 
)

This function resets a master ID located in the specified SPECS.

Parameters:
[in] pSPECS SPECS where the master ID is located.
[in] pMasterID master ID to be reset.
[in] hardResetFlag (optional). 0 = Soft Reset (default), 1 = Hard Reset.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_resetMaster("pclbcecs03", 1) == 0)   // reset master ID '1' from 'pclbcecs03'
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_resetSlave ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pMode 
)

This function resets a slave in a internal or external (equivalent to press the reset button of the mezzanine) mode located in the specified SPECS.

Parameters:
[in] pSPECS SPECS where the slave is located.
[in] pMasterID master ID of the slave to be reset.
[in] pSlaveAddress address of the slave to be reset.
[in] pMode reset mode (FWSPECS_SLAVE_RESET_INTERNAL for internal mode, FWSPECS_SLAVE_RESET_EXTERNAL for external mode ot FWSPECS_SLAVE_RESET_EXTERNAL_SHORT for external mode short pulse).
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_resetSlave("pclbcecs03", 1, 2, FWSPECS_SLAVE_RESET_INTERNAL) == 0)   // reset slave (internal mode) located
     (...)                                                                         // in 'pclbcecs03', on master ID '1' and address '2'
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_saveScript ( string  pScriptName,
string  pScript = "" 
)

Create and save the specified script.

Parameters:
[in] pScriptName name of the script.
[in] pScript the script to be saved. Note: this parameter is optional (if not specified, then an empty script will be saved).
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_saveScript("myScript", "main()\n {\n DebugTN(1);\n }\n"))   // save the script under the name 'myScript'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_setClockFrequency ( string  pSPECS,
int  pMasterID,
int  pClockFrequency 
)

This function sets a master ID to the specified clock frequency.

Parameters:
[in] pSPECS SPECS where the master ID is located.
[in] pMasterID master ID to set the new clock frequency.
[in] pClockFrequency new clock frequency (16 Khz, 32 Khz, 64 Khz, 128 Khz, 256 Khz, 512 Khz or 1024 KHz). Note: these frequencies are represented by the constants FWSPECS_CLOCK_16, FWSPECS_CLOCK_32, FWSPECS_CLOCK_64, FWSPECS_CLOCK_128, FWSPECS_CLOCK_256, FWSPECS_CLOCK_512 and FWSPECS_CLOCK_1024.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_setClockFrequency("pclbcecs03", 1, FWSPECS_CLOCK_512))   // set the master ID '1' (located in 'pclbcecs03') to a clock frequency of 512 KHz
     DebugTN("Clock frequency set to 512 KHz!");
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_slaveLeds ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pMode 
)

This function turns the leds of the slave (mezzanine) ON/OFF.

Parameters:
[in] pSPECS SPECS where the slave is located.
[in] pMasterID master ID of the slave to turn the leds ON/OFF.
[in] pSlaveAddress address of the slave to turn the leds ON/OFF.
[in] pMode turn the leds ON/OFF (FWSPECS_SLAVE_LEDS_ON to turn the leds ON or FWSPECS_SLAVE_LEDS_OFF to turn the leds OFF).
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_slaveLeds("pclbcecs03", 1, 2, FWSPECS_SLAVE_LEDS_ON) == 0)   // turn the leds ON of the slave (mezzanine) located
     (...)                                                                 // in 'pclbcecs03', on master ID '1' and address '2'
  else
     DebugTN("Error found!");
  (...)




Generated on Fri Mar 28 13:36:50 2008 for FwSpecs by  doxygen 1.4.7