Recipe Functions


Functions

int fwHw_createRecipeType (string recipeType, string dpType, dyn_string regs)
int fwHw_deleteRecipeType (string recipeType)
dyn_string fwHw_getRecipeTypes (string dpType, string sys="")
int fwHw_getRecipeTypeInfo (string recipeType, string dpType, dyn_string &regs, string sys="")
dyn_string fwHw_getRecipes (string hw)
int fwHw_saveRecipe (string hw, string recipeType, string recipe, dyn_string regs=makeDynString(), dyn_int types=makeDynInt(), dyn_dyn_anytype data=makeDynAnytype(), int combineWithHw=1)
int fwHw_saveRecipeMulti (dyn_string hws, string recipeType, string recipe, dyn_string regs=makeDynString(), dyn_int types=makeDynInt(), dyn_dyn_anytype data=makeDynAnytype(), int combineWithHw=1)
int fwHw_getRecipe (string hw, string recipe, dyn_string &regs, dyn_dyn_anytype &data)
int fwHw_applyRecipe (string hw, dyn_string regs, dyn_dyn_anytype data, int compare=0)
int fwHw_getApplyRecipe (string hw, string recipe, int compare=0, string domain="")
int fwHw_getApplyRecipeStatus (string hw, dyn_string &regs, dyn_int &status)
int fwHw_getApplyRecipeFastTell1 (string hw, string recipe, int compare=0, string domain="")
int fwHw_deleteRecipe (string hw, string recipe)

Detailed Description

List of common functions to operate with Recipe Types and Recipies. Note: A recipe is a kind of precscription of how the content (do not confuse with specific settings) of a set of registers is stored in a database. At runtime this data can be retrieved and be written to the registers on the hardware.

Function Documentation

int fwHw_applyRecipe ( string  hw,
dyn_string  regs,
dyn_dyn_anytype  data,
int  compare = 0 
)

This function can be used to apply to a hardware device the settings retrieved with fwHw_getRecipe(...).

Parameters:
[in] hw name of the hardware device.
[in] regs the list of registers in the recipe.
[in] data the list of data items corresponding to the registers.
[in] compare flag (optional), default = 0. If set data written is compared with data read back.
Returns:
1 if all went ok.

0 if Apply recipe failed

-1 if comparison failed (if comparison requested).

Example:

  (...)

  dyn_string      regs;
  dyn_dyn_anytype data;

  fwHw_getRecipe("MyBoard1","PHYSICS/Configure", regs, data);
  fwHw_applyRecipe("MyBoard1", regs, data);

  (...)



int fwHw_createRecipeType ( string  recipeType,
string  dpType,
dyn_string  regs 
)

This function creates a Recipe Type specifying which registers should be part of a recipe of this type. Note: the register names must include the nested hardware structure e.g. '.GBE.PORT0.TxFifo'

Parameters:
[in] recipeType name of the recipe type.
[in] dpType name of the datapoint type corresponding to this hwType.
[in] regs the list of registers (in the form .xxx.yyy.regA).
Returns:
1 if all went ok.

-1 if error occurs in fwConfigurationDB functions. Note: see LogViewer for exception info

Example:

  (...)

  dyn_string      myRegisters;

  myRegisters = makeDynString(
        ".mezza.CtrlReg",
        ".mezza.BusSelRegReg",
        ".mezza.DefIntVetcReg",
        ".mezza.ChanBDelayReg");

  fwHw_createRecipeType("MyBoardType_","HwTypeSPECSMyBoardType", myRegisters);

  (...)



int fwHw_deleteRecipe ( string  hw,
string  recipe 
)

This function can be used to delete a recipe for a certain hw device.

Parameters:
[in] hw name of the hardware device.
[in] recipe the name of the recipe.
Returns:
1 no error found.

0 error found.

Example:

  (...)

  fwHw_deleteRecipe("MyBoard1","PHYSICS/Configure");

  (...)



int fwHw_deleteRecipeType ( string  recipeType  ) 

This function deletes a Recipe Type. Note: For safety reasons the recipes of this type have to be removed by hand from the cache.

Parameters:
[in] recipeType name of the recipe type.
Returns:
1 if all went ok.

-1 if error occurs in fwConfigurationDB functions. Note: see LogViewer for exception info

Example:

  (...)


  fwHw_deleteRecipeType("MyBoardType_");

  (...)



int fwHw_getApplyRecipe ( string  hw,
string  recipe,
int  compare = 0,
string  domain = "" 
)

This function retrieves and applies the data values stored in a certain recipe to a given hw device. This function should be used in the Device Units "xxx_doCommand()" scripts.

Parameters:
[in] hw name of the hardware device (received in the "device" parameter).
[in] recipe name of the recipe (for example "PHYSICS/Configure") .
[in] compare flag (optional), default = 0. If set data written is compared with data read back.
[in] domain (optional) domain name, if specified the recipe loaded by the "Configurator", if it exists, will be used.
Returns:
1 if all went ok.

0 if Apply recipe failed

-1 if error occurs in fwConfigurationDB functions. (Note: see LogViewer for exception info)

Example:

  HwTypeXXXXMyBoard_doCommand( string domain, string device, string command)
         
  (...)

  else if (command == "Configure")
  {
    string          recipe;
    int             ret;
    dyn_string    regs;
    dyn_int       regStatus;

    recipe = fwHw_makeRecipeName(domain, device, command);
    if((ret = fwHw_getApplyRecipe(device, recipe, 0, domain)) != 1)
    {
      fwHw_getApplyRecipeStatus(device, regs, regStatus);
      DebugN("ERROR", ret, regs, regStatus);
    }

  (...)



int fwHw_getApplyRecipeFastTell1 ( string  hw,
string  recipe,
int  compare = 0,
string  domain = "" 
)

This function retrieves and applies the data values stored in a certain recipe to a given hw device. This function is an optimized version of getApplyRecipe for TELL1's only

Parameters:
[in] hw name of the hardware device (received in the "device" parameter).
[in] recipe name of the recipe (for example "PHYSICS/Configure") .
[in] compare flag (optional), default = 0. If set data written is compared with data read back.
[in] domain (optional) domain name, if specified the recipe loaded by the "Configurator", if it exists, will be used.
Returns:
1 if all went ok.

0 if Apply recipe failed

-1 if error occurs in fwConfigurationDB functions. (Note: see LogViewer for exception info)

Example:

  (...)

  fwHw_getApplyRecipeFastTell1("MyBoard1","PHYSICS/Configure");

  (...)



int fwHw_getApplyRecipeStatus ( string  hw,
dyn_string &  regs,
dyn_int &  status 
)

This function can be used when fwHw_applyRecipe or fwHw_getApplyRecipe fail in order to obtain the list of registers and their individual error return codes.

Parameters:
[in] hw name of the hardware device.
[out] regs the list of registers in the recipe.
[out] status list with the returned value(s) of the registers(s). The return value can be: equal to 0 (no error found); greater than 0 (Server specific error CCPC/Specs); equal to -1 (error related with PVSS); equal to -2 (data comparison mismatch).
Returns:
1 if all went ok.

0 if last recipe status not available

Example:

  (...)

  int       ret;
  dyn_string      regs;
  dyn_int         regStatus;

  if((ret = fwHw_getApplyRecipe("MyBoard1", "MyPhysicsRecipe")) != 1)
  {
    fwHw_getApplyRecipeStatus("MyBoard1", regs, regStatus);
    DebugN("ERROR", ret, regs, regStatus);
  }

  (...)



int fwHw_getRecipe ( string  hw,
string  recipe,
dyn_string &  regs,
dyn_dyn_anytype &  data 
)

This function retrieves the list of registers and data vaues stored in a certain recipe for a given hw device. If you wish to do fwHw_getRecipe() followed by fwHw_applyRecipe() please use fwHw_getApplyRecipe() instead.

Parameters:
[in] hw name of the hardware device.
[in] recipe name of the recipe.
[out] regs the list of registers in the recipe.
[out] data the list of data items corresponding to the registers.
Returns:
1 if all went ok.

-1 if error occurs in fwConfigurationDB functions. Note: see LogViewer for exception info

Example:

  (...)

  dyn_string      regs;
  dyn_dyn_anytype data;

  fwHw_getRecipe("MyBoard1","PHYSICS/Configure", regs, data);
  DebugN(regs, data);
  fwHw_applyRecipe("MyBoard1", regs, data);

  (...)



dyn_string fwHw_getRecipes ( string  hw  ) 

This function retrieves the list of Recipes defined for a certain hardware device.

Parameters:
[in] hw name of the hardware device.
Returns:
list of recipes defined.
Example:

  (...)

  dyn_string      recipes;

  recipes = fwHw_getRecipes("MyBoard1");
  DebugN(recipes);

  (...)



int fwHw_getRecipeTypeInfo ( string  recipeType,
string  dpType,
dyn_string &  regs,
string  sys = "" 
)

This function retrieves the list of registers that are specified for a given Recipe Type.

Parameters:
[in] recipeType name of the recipe type.
[in] dpType name of the datapoint type corresponding to this hwType.
[out] regs the list of registers (in the form .xxx.yyy.regA).
Returns:
1 if all went ok.

-1 if error occurs in fwConfigurationDB functions. Note: see LogViewer for exception info

Example:

  (...)

  dyn_string      myRegisters;

  fwHw_getRecipeTypeInfo("MyBoardType_","HwTypeSPECSMyBoardType", myRegisters);
  DebugN(myRegisters);

  (...)



dyn_string fwHw_getRecipeTypes ( string  dpType,
string  sys = "" 
)

This function retrieves the Recipe Types available for a certain hwType (dpType).

Parameters:
[in] dpType name of the datapoint type corresponding to this hwType.
[in] sys (optional) the system name
Returns:
list of recipe types.
Example:

  (...)

  dyn_string      recipeTypes;

  recipeTypes fwHw_getRecipeTypes("HwTypeSPECSMyBoardType");
  DebugN(recipeTypes);

  (...)



int fwHw_saveRecipe ( string  hw,
string  recipeType,
string  recipe,
dyn_string  regs = makeDynString(),
dyn_int  types = makeDynInt(),
dyn_dyn_anytype  data = makeDynAnytype(),
int  combineWithHw = 1 
)

This function creates and/or saves a Recipe (of a certain Recipe Type) for a given hardware device. If the optional parameters are not used, the values last written to the hardware will be used as recipe data. Otherwise the pairs regs[i], data[i] will overwrite the last written data values (or the last values in the recipe depending on the combineWithHw parameter).

Parameters:
[in] hw name of the hardware device.
[in] recipeType name of the recipe type.
[in] recipe name of this recipe.
[in] regs (optional) a new list of registers to be added or overwritten in the recipe.
[in] types (optional) the list of registers types corresponding to the above registers.
[in] data (optional) a new list of data items to replace the current last written values.
[in] combineWithHw (optional) if 1 above data should replace the last written values (default) or if 0 the last recipe values.
Returns:
1 if all went ok.

-1 if error occurs in fwConfigurationDB functions. Note: see LogViewer for exception info

Example:

  (...)

  dyn_string regs;
  dyn_int types;
  dyn_dyn_anytype data;

  regs[1] = ".mezza1.ConfRegOutMSB";
  regs[2] = ".mezza1.ConfRegOutLSB";
  types[1] = FWHW_REG;
  types[2] = FWHW_REG;
  data[1] = makeDynChar(0xde,0xad);
  data[2] = makeDynChar(0x12,0x34);

  fwHw_saveRecipe("MyBoard1","MyBoardType_", "PHYSICS/Configure", regs, types, data);

  (...)



int fwHw_saveRecipeMulti ( dyn_string  hws,
string  recipeType,
string  recipe,
dyn_string  regs = makeDynString(),
dyn_int  types = makeDynInt(),
dyn_dyn_anytype  data = makeDynAnytype(),
int  combineWithHw = 1 
)

This function creates and/or saves a Recipe (of a certain Recipe Type) for several hardware devices in one go. If the optional parameters are not used, the values last written to the hardware will be used as recipe data. Otherwise the pairs regs[i], data[i] will overwrite the last written data values (or the last values in the recipe depending on the combineWithHw parameter). The list of registers gan be given either as ".part.reg" in wich case the same data will be applied to this register for each hw device or as "hw.part.reg" in which case there can be different data for each device.

Parameters:
[in] hws list of hardware devices (should all be in the same system).
[in] recipeType name of the recipe type.
[in] recipe name of this recipe.
[in] regs (optional) a new list of registers to be added or overwritten in the recipe.
[in] types (optional) the list of registers types corresponding to the above registers.
[in] data (optional) a new list of data items to replace the current last written values.
[in] combineWithHw (optional) if 1 above data should replace the last written values (default) or if 0 the last recipe values.
Returns:
1 if all went ok.

-1 if error occurs in fwConfigurationDB functions. Note: see LogViewer for exception info

Example:

  (...)

  dyn_string      myDevices;

  dynAppend(myDevices, "MyBoard1");
  dynAppend(myDevices, "MyBoard2");
  fwHw_saveRecipeMulti(MyDevices,"MyBoardType_", "PHYSICS/Configure");

  (...)




Generated on Mon Jan 28 10:40:19 2008 for FwHw by  doxygen 1.4.7