Register Related Functions (needed for fwHw)


Functions

 fwCcpc_setWriteReadTimeout (int tmout=30)
bool fwCcpc_write (dyn_string pRegistersList, dyn_dyn_anytype pDataList, dyn_dyn_anytype pMaskList, dyn_int &pStatusList, bool pWaitFlag=true)
bool fwCcpc_read (dyn_string pRegistersList, dyn_dyn_anytype &pDataList, dyn_int &pStatusList)
bool fwCcpc_writeRead (dyn_string pRegistersList, dyn_dyn_anytype pDataWriteList, dyn_dyn_anytype pMaskList, dyn_dyn_anytype &pDataReadList, dyn_int &pStatusList)
bool fwCcpc_writeChkOnSrvr (dyn_string pRegistersList, dyn_dyn_anytype pDataList, dyn_dyn_anytype pMaskList, dyn_int &pStatusList, bool pWaitFlag=true)
bool fwCcpc_startMonitoring (dyn_string pRegistersList, dyn_int pRefreshRateList=makeDynInt(), dyn_bool pDataChangeList=makeDynBool())
bool fwCcpc_stopMonitoring (dyn_string pRegistersList)
bool fwCcpc_isMonitoring (dyn_string pRegistersList, dyn_bool &pStatusList, dyn_int &pRefreshRateList)

Detailed Description

List of common (not linked to a specific bus system) functions to operate with CCPC.

These functions are related to the fwHw library and are kept for historic reasons within this framework. Registers have to be created and subscribed via the fwHw library. After subscribtion all necessary DIM commands and services are created and the registers can be accessed via this set of functions.

NOTE: Previously also this library contained functions to create registers. It is not recommended to use these functions any longer!!! Although they would be still accessible and are just removed from the documentation. Registers created with these functions share a common datapoint for communication via DIM - which is not the case when using the fwHw library, where every register has its own datapoints for communication. The creation of registers inside this framework was just intended for debugging reasons.

Also historic reasons has the fact that when registers are not yet subscribed (see fwHw) the monitoring of registers can be started and a read service is automatically created by the server used for monitoring. However no write or read commands can be sent to this register - just the read service is launched which is regularly updated.

Link to the fwHw documentation: http://lhcb-online.web.cern.ch/lhcb-online/ecs/FWHW/default.html


Function Documentation

bool fwCcpc_isMonitoring ( dyn_string  pRegistersList,
dyn_bool &  pStatusList,
dyn_int &  pRefreshRateList 
)

This functions is obsolete, it used to return a list containing the status of the monitoring of registers.

Parameters:
[in] pRegistersList list containing the register(s) to check if they are being used for monitoring or not.
[out] pStatusList list containing the status of the monitoring of registers. If true, the register is being used for monitoring, otherwise (false) the register is not being used for monitoring.
[out] pRefreshRateList list containing the refresh rate monitoring of the register(s) (in seconds).
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_string registers;
  dyn_bool   status;
  dyn_int    refresh;
  int        i;

  dynAppend(registers, "myReg01");
  dynAppend(registers, "myReg02");

  if (fwCcpc_isMonitoring(registers, status, refresh))   // check if registers 'myReg01' and 'myReg02' are being used for monitoring
     for(i = 1; i <= dynlen(registers); i++)
        if (status[i])
           DebugTN("Register " + registers[i] + " is being used for monitoring with a refresh rate of " + refresh[i] + " second(s)");
        else
           DebugTN("Register " + registers[i] + " is not being used for monitoring"); 
  else
     DebugTN("Error found!");
  (...)



bool fwCcpc_read ( dyn_string  pRegistersList,
dyn_dyn_anytype &  pDataList,
dyn_int &  pStatusList 
)

Read data from the specified register(s), using the settings stored in that/those register(s).

Parameters:
[in] pRegistersList list containing the name of the register(s) where to get the settings and to store the data read.
[out] pDataList list with the data read from the specified register(s).
[out] pStatusList list with the returned value(s) of the reading(s). The return value can be: equal to 0 (no error found); greater than 0 (error found and related with CCPC Server); equal to -1 (error found and related with PVSS).
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_dyn_char data;
  dyn_string   registers;
  dyn_int      status;
  int          i;

  dynAppend(registers, "myBoard.I2Creg");
  dynAppend(registers, "myBoard.LBUSreg");

  if (fwCcpc_read(registers, data, status))   // read data from registers 
     for(i = 1; i <= dynlen(status); i++)
     {
        DebugTN("Data: " + fwCcpc_convertByteToHex(data[i]));
        DebugTN("Status: " + status[i]);
     }
  else
     DebugTN("Error found!");
  (...)



fwCcpc_setWriteReadTimeout ( int  tmout = 30  ) 

Set the Timeout for fwCcpc_write, fwCcpc_read and fwCcpc_writeRead Operations. Can be used before any of these functions or before applying a recipe, for example fwHw_getApplyRecipe().

Parameters:
[in] tmout The timeout in seconds (default is 30 seconds).

bool fwCcpc_startMonitoring ( dyn_string  pRegistersList,
dyn_int  pRefreshRateList = makeDynInt(),
dyn_bool  pDataChangeList = makeDynBool() 
)

Start monitoring a set of register(s), using the settings stored in that/those register(s). If registers are not yet subscribed a read service is created to allow monitoring.

Parameters:
[in] pRegistersList list containing the registers(s) where to get the settings and to store the data coming from the monitoring.
[in] pRefreshRateList list containing the refresh rate monitoring (in seconds). Note: this parameter is optional (if not specified, it will take the value specified in the specific settings of the register).
[in] pDataChangeList list containing the data change enable/disable option. If true, the server will send data when it change, otherwise (false) the server will not send data (even if it change). Note: this parameter is optional (if not specified, it will take the value specified in the specific settings of the register).
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_string registers;
  dyn_int    refreshRate;
  dyn_bool   dataChange;

  dynAppend(registers, "myReg01");
  dynAppend(registers, "myReg02");
  dynAppend(refreshRate, 5);
  dynAppend(refreshRate, 10);
  dynAppend(dataChange, false);
  dynAppend(dataChange, true);

  if (fwCcpc_startMonitoring(registers, refreshRate, dataChange))   // start monitoring registers 'myReg01' and 'myReg02'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwCcpc_stopMonitoring ( dyn_string  pRegistersList  ) 

Stop monitoring a set of registers.

Parameters:
[in] pRegistersList list containing the register(s) to stop monitoring.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwCcpc_stopMonitoring(makeDynString("myReg01", "myReg02")))   // stop monitoring registers 'myReg01' and 'myReg02'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwCcpc_write ( dyn_string  pRegistersList,
dyn_dyn_anytype  pDataList,
dyn_dyn_anytype  pMaskList,
dyn_int &  pStatusList,
bool  pWaitFlag = true 
)

Write data into the specified register(s), using the settings stored in that/those register(s).

Parameters:
[in] pRegistersList list containing the name of the register(s) where to get the settings and to write the specified data.
[in] pDataList list containing the data to be written in the specified register(s).
[in] pMaskList list containing the masks that are going to be used for the writings. Note: if the mask is empty, then no masking operation will be performed.
[out] pStatusList list with the returned value(s) of the writing(s). The return value can be: equal to 0 (no error found); greater than 0 (error found and related with CCPC Server); equal to -1 (error found and related with PVSS).
[in] pWaitFlag if true, the function will wait for the return value, otherwise (false) the function will not wait for the return value (in this case, the return value will be always equal to 0 or -1). Note: this parameter is optional (if not specified, the default will be true).
Returns:
true no error found.

false error found.

Example:

  (...)
 dyn_dyn_char data;  
 dyn_dyn_char mask;  
 dyn_string   registers;  
 dyn_int      status;  
 int          i;  
    
 dynAppend(registers, "myBoard.I2Creg");  
 dynAppend(registers, "myBoard.LBUSreg");  
 dynAppend(data,fwCcpc_convertHexToByte("feedbabe"));  
 dynAppend(data, fwCcpc_convertHexToByte("feedbabe"));  
 dynAppend(mask,fwCcpc_convertHexToByte("ffff0000"));  //just feed is written
 //dynAppend(mask,makeDynChar());    // this line would lead to undefined behaviour
 dynAppend(mask,fwCcpc_convertHexToByte("ffffffff")); // if one mask is applied -  
                                                       // all register masks have to be applied                                      

 if (fwCcpc_write(registers, data, mask, status, true))    
     for(i = 1; i <= dynlen(status); i++)  
        DebugTN("Status: " + status[i]);  
  else  
     DebugTN("Error found!");  
  (...)



bool fwCcpc_writeChkOnSrvr ( dyn_string  pRegistersList,
dyn_dyn_anytype  pDataList,
dyn_dyn_anytype  pMaskList,
dyn_int &  pStatusList,
bool  pWaitFlag = true 
)

Write data into the specified register(s). On the server the data is read back from hardware and compared with the sent data. In case of mismatch of the size of register 1 is written as status. In case the data differs 2 is found as status for the register. Zero is written if everything was ok and '-1' for any other error. This function increases the performance when applying recipes. Note: the data mismatch is not part of the errorcode of the return value but has to be checked from the status array.

Parameters:
[in] pRegistersList list containing the name of the register(s) where to get the settings and to write the specified data.
[in] pDataList list containing the data to be written in the specified register(s).
[in] pMaskList list containing the masks that are going to be used for the writings. Note: if the mask is empty, then no masking operation will be performed.
[out] pStatusList list with the returned value(s) of the writing(s). The return value can be: equal to 0 (no error found); greater than 0 (error found and related with CCPC Server - 1 & 2 if mismatch occurs); equal to -1 (error found and related with PVSS).
[in] pWaitFlag if true, the function will wait for the return value, otherwise (false) the function will not wait for the return value. Note: this parameter is optional (if not specified, the default will be true).
Returns:
true no error found.

false error found.

Example:

  (...)
 dyn_dyn_char data;  
 dyn_dyn_char mask;  
 dyn_string   registers;  
 dyn_int      status;  
 int          i;  
    
 dynAppend(registers, "myBoard.I2Creg");  
 dynAppend(registers, "myBoard.LBUSreg");  
 dynAppend(data,fwCcpc_convertHexToByte("feedbabe"));  
 dynAppend(data, fwCcpc_convertHexToByte("feedbabe"));  
 dynAppend(mask,fwCcpc_convertHexToByte("ffff0000"));  //just feed is written
 //dynAppend(mask,makeDynChar());    // this line would lead to undefined behaviour
 dynAppend(mask,fwCcpc_convertHexToByte("ffffffff")); // if one mask is applied -  
                                                       // all register masks have to be applied                                      

 if (fwCcpc_writeChkOnSrvr(registers, data, mask, status, true))    
     for(i = 1; i <= dynlen(status); i++)  
        DebugTN("Status: " + status[i]);  
  else  
     DebugTN("Error found!");  
  (...)



bool fwCcpc_writeRead ( dyn_string  pRegistersList,
dyn_dyn_anytype  pDataWriteList,
dyn_dyn_anytype  pMaskList,
dyn_dyn_anytype &  pDataReadList,
dyn_int &  pStatusList 
)

Write and, then, read data from the specified register(s), using the settings stored in that/those register(s). This function should be used whenever possible, since it will optimize speed. Note: if the write operation fails, then the read operation will not be performed.

Parameters:
[in] pRegistersList list containing the name of the register(s) where to get the parameters (settings) and to store the data read.
[in] pDataWriteList list containing the data to be written in the specified register(s).
[in] pMaskList list containing the masks that are going to be used for the writings. Note: if the mask is empty, then no masking operation will be performed.
[out] pDataReadList list with the data read from the specified register(s).
[out] pStatusList list with the returned value(s) of the reading(s). The return value can be: equal to 0 (no error found); greater than 0 (error found and related with CCPC Server); equal to -1 (error found and related with PVSS).
Returns:
true no error found.

false error found.

Example:

  (...)
 dyn_dyn_char data;  
 dyn_dyn_char rdata;  
 dyn_dyn_char mask;  
 dyn_string   registers;  
 dyn_int      status;  
 int          i;  
    
 dynAppend(registers, "myBoard.I2Creg");  
 dynAppend(registers, "myBoard.LBUSreg");  
 dynAppend(data,fwCcpc_convertHexToByte("feedbabe"));  
 dynAppend(data, fwCcpc_convertHexToByte("feedbabe"));  
 dynAppend(mask,fwCcpc_convertHexToByte("ffff0000"));  //just feed is written
 //dynAppend(mask,makeDynChar());    // this line would lead to undefined behaviour
 dynAppend(mask,fwCcpc_convertHexToByte("ffffffff")); // if one mask is applied -  
                                                      // all register masks have to be applied                                      

 if (fwCcpc_writeRead(registers, data, mask, rdata, status))    
     for(i = 1; i <= dynlen(status); i++){  
        DebugTN("Status: " + status[i]);  
        DebugTN("Data: " + fwCcpc_convertByteToHex(rdata[i])); 
     }  
  else  
     DebugTN("Error found!");  
  (...)




Generated on Fri Mar 28 13:15:39 2008 for FwCcpc by  doxygen 1.4.7