Common Functions


Functions

void fwCcpc_clear ()
void fwCcpc_get (dyn_string &pCCPCList, string systemName="")
bool fwCcpc_add (string pCCPC)
bool fwCcpc_remove (string pCCPC)
bool fwCcpc_getServerVersion (string pCCPC, int &pMajor, int &pMinor, int &pPatch)
int fwCcpc_reset (string pCCPC)
int fwCcpc_setVerbosity (string pCCPC, int pVerb)
int fwCcpc_FPGAProgramPOF (string pCCPC, int pChain, string pFileName)
int fwCcpc_FPGAProgramJAM (string pCCPC, int pChain, string pFileName, string pAction)
int fwCcpc_FPGAInitialize (string pCCPC, string pFileName)
bool fwCcpc_tell1_EPC16ToFPGA (string pCCPC)
bool fwCcpc_executeCommand (string pCCPC, string pCommand, dyn_string &pResultList, int tmout=0)

Detailed Description

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

Although the download of firmware is using the JTAG bus, the functions are grouped together with the download of the configuration file (writing the configuration to registers) and the reprogramming from the EPC16 to the FPGAs.


Function Documentation

bool fwCcpc_add ( string  pCCPC  ) 

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

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

false error found.

Example:

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



void fwCcpc_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. Scripts, registers and CCPCs are removed.

Returns:
void (nothing)
Example:

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



bool fwCcpc_executeCommand ( string  pCCPC,
string  pCommand,
dyn_string &  pResultList,
int  tmout = 0 
)

This function executes a command on the specified CCPC. Each CCPC is running under Linux. Standard command line commands can be launched and the output is parsed back to PVSS. A 10 seconds timer is set to avoid a lock when commands like 'ping' are executed.

Parameters:
[in] pCCPC name of the CCPC (optionaly preceded by the system name).
[in] pCommand command to be executed on the specified CCPC.
[out] pResultList list containing the result (output) of the execution of the command.
[in] tmout (optional) A timeout, default = 20 seconds.
Returns:
true no error found.

false error found.

Example:

  (...)
  dyn_string result;
  int        i;

  if (fwCcpc_executeCommand("pclbcecs03", "ls -la", result))   // execute the command 'ls -la' on CCPC 'pclbcecs03'
     for(i = 1; i <= dynlen(result); i++)
        DebugTN(result[i]);
  else
     DebugTN("Error found!");
  (...)



int fwCcpc_FPGAInitialize ( string  pCCPC,
string  pFileName 
)

This function initializes (configures) the FPGAs located in the specified CCPC. A system call is launched executing a program which is directly linked to the tell1lib maintained by EPFL. As in the tell1 C-library the configuration file (.cfg) file is parsed and the values written to the registers. This usually takes a few seconds.

Parameters:
[in] pCCPC name of the CCPC (optionaly preceded by the system name).
[in] pFileName CFG file name containing the configuration.
Returns:
= 0 no error found.

> 0 error found (related with CCPC Server).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwCcpc_FPGAInitialize("pclbcecs03", "c:\config\config01.cfg") == 0)   // configures the FPGAs located in 'pclbcecs03'
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwCcpc_FPGAProgramJAM ( string  pCCPC,
int  pChain,
string  pFileName,
string  pAction 
)

This function uploads JAM files to the EEPROM located in the specified CCPC. The actions provided by the JAM player can be passed as well.

Parameters:
[in] pCCPC name of the CCPC (optionaly preceded by the system name).
[in] pChain chain number.
[in] pFileName JAM file name containing the firmware.
[in] pAction action to be performed.
Returns:
= 0 no error found.

> 0 error found (related with CCPC Server).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwCcpc_FPGAProgramJAM("pclbcecs03", 1, "c:\firmware\firm01.jam", "program") == 0)   // upload JAM file to EEPROM located in 'pclbcecs03'
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwCcpc_FPGAProgramPOF ( string  pCCPC,
int  pChain,
string  pFileName 
)

This function uploads POF files to the EEPROM located in the specified CCPC. After programming a GPIO line is pulled to trigger the download from the EPC16 to the FPGAs. Although this is the fastest way to program the FPGAs, it takes around 2 minutes.

Parameters:
[in] pCCPC name of the CCPC (optionaly preceded by the system name).
[in] pChain chain number.
[in] pFileName POF file name containing the firmware.
Returns:
= 0 no error found.

> 0 error found (related with CCPC Server).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwCcpc_FPGAProgramPOF("pclbcecs03", 1, "c:\firmware\firm01.pof") == 0)   // upload POF file to EEPROM located in 'pclbcecs03'
     (...)
  else
     DebugTN("Error found!");
  (...)



void fwCcpc_get ( dyn_string &  pCCPCList,
string  systemName = "" 
)

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

Parameters:
[out] pCCPCList list containing the CCPC server running in the moment.
[in] systemName (optional) the PVSS System name.
Returns:
void (nothing)
Example:

  (...)
  dyn_string myList;
  int        i;

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



bool fwCcpc_getServerVersion ( string  pCCPC,
int &  pMajor,
int &  pMinor,
int &  pPatch 
)

This function returns the version number of the server

Parameters:
[in] pCCPC name of the CCPC.
[out] pMajor 
[out] pMinor 
[out] pPatch 
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwCcpc_getServerVersion("pclbcecs03"))   // get server version of the CCPC 'pclbcecs03'
     DebugTN("Server version number: " + pMajor + "-" + pMinor + "-" pPatch);
  else
     DebugTN("Error found!");
  (...)



bool fwCcpc_remove ( string  pCCPC  ) 

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

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

false error found.

Example:

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



int fwCcpc_reset ( string  pCCPC  ) 

This function resets the specified CCPC. Being more detailed it is initialising the gluecard by invoking 'glue_default_init()' at the server side.

Parameters:
[in] pCCPC name of the CCPC to be reset.
Returns:
= 0 no error found.

> 0 error found (related with CCPC Server).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwCcpc_reset("pclbcecs03") == 0)   // reset 'pclbcecs03'
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwCcpc_setVerbosity ( string  pCCPC,
int  pVerb 
)

This function sets the verbosity of the server. (maximum value is 7)

Parameters:
[in] pCCPC name of the CCPC to be reset.
[in] pVerb degree of verbosity.
Returns:
= 0 no error found.

> 0 error found (related with CCPC Server).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwCcpc_setVerbosity("pclbcecs03",7) == 0)   // sets verbosity to 7 
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwCcpc_tell1_EPC16ToFPGA ( string  pCCPC  ) 

This function loads the FPGA from EPC16 (just for TELL1). Once the EPC16 EEPROM is loaded, the FPGAs can be programmed within a fraction of a second from the EPC16.

Parameters:
[in] pCCPC name of the CCPC.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwCcpc_tell1_EPC16ToFPGA("pclbcecs03") == 0)   // load the FPGAs from EPC16
     (...)
  else
     DebugTN("Error found!");
  (...)




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