Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Gliffy Diagram
macroId5b09a810-5454-4cc7-a7e3-a4a5ee61db4e
displayNameProcessor.cc
nameProcessor.cc
pagePin89

TBD

Introduction

This contains a list of the capabilities of the module/package i detail. The reader should be able to understand the basic functionalities of this package/module by reading this text.

...

Gliffy Diagram
macroId9c052d24-d800-4055-a84e-d242bf1f5e66
displayNamebsaDriver class
namebsaDriver class
pagePin11

Detailing of the static functions available in the file
Anchor
BLD_STATIC_FUNCTIONS
BLD_STATIC_FUNCTIONS

Gliffy Diagram
macroId34bcb7f3-77d2-4c82-a82a-e08f9ff9a095
nameinit_drvList
pagePin1
Gliffy Diagram
displayNamefind_drvByNamedRoot
namefind_drvByNamedRoot
pagePin4

...

BSA asyn driver also contains a global static pointer that points to a linkedList of all drivers instantiated, and contains the same set of linkedList functions that were described above. The node structure is as follows

(TODO: convert code into diagram, adding bsaAsynDriver, pBsaEllList, and pBsaBridge)

Code Block
languagecpp
themeRDark
titleBSA ELLList node structure
typedef struct {
    ELLNODE       node;
    char          *named_root;
    char          *port;
    bsaAsynDriver *pBsaDrv;
    ELLLIST       *pBsaEllList;
    void          *_pBsaBridge;
} pDrvList_t;

The functions operating on the linked list are as follows:

...

  • Returns an allocated global linked list pointer. This does not necessarily mean that the linked l has elements.
  • Flow: If the global pointer is not NULL, a new linked list (type ELLLIST) is allocated, otherwise do nothing. 

...

  • Returns an allocated but empty driver pointer that needs to be initialized
  • Calls init_drvList, then allocates memory for a new item in the linked list, initializes it, then adds it to the end of the linked list and returns linked list count.

...

  • Same as prep_drvAnonimous; create new driver item of linked list but with a specific port name string

...

  • Same as prep_drvAnonimous; create new driver item of linked list but with a specific named root string

...

  • Returns the last driver found. If not driver is found in the linked list, NULL is returned
  • Calls init_drvList, then counts the number of elements in the linked list. If they are not 0, it returns the last element, otherwise returns NULL

...

  • Returns a driver that matches the same port name. If not found, returns NULL
  • Calls init_drvList, then iterates on the linked list one element at a time starting from the first element. Once an element with a portName that is not NULL, and a string length of not zero, and a string identical to the argument port_name is found, it is returned, otherwise the next item is examined. If none is found, NULL is returned

bsaAsynDriver is a class defined in bsaAsynDriver.h: class bsaAsynDriver:asynPortDriver.

The linked list pBsaEllList contains elements of the struct bsaList_t. This struct represents one BSA channel.

Code Block
languagecpp
themeRDark
titlebsaList_t
typedef struct {
    ELLNODE  node;
    ELLLIST  *pSlaveEllList;  // slave node
    char     bsa_name[64];    // bsa name
    char     bsa_type[32];    // bsa datatype

    int      firstParam;
    int      p_num[MAX_BSA_ARRAY];           // asyn parameter for number of average, asynFloat64Array, RO
    int      p_mean[MAX_BSA_ARRAY];          // asyn parameter for average value,     asynFloat64Array, RO
    int      p_rms2[MAX_BSA_ARRAY];          // asyn parameter for rms2 value,        asynFloat64Array, RO
    int      p_slope;                        // asyn parameter for linear conversion, asynFloat64, RW
    int      p_offset;                       // asyn parameter for linear conversion, asynFloat64, RW
    int      lastParam;

    double   slope;
    double   offset;

    bsaDataType_t type;

    devBsaPvt_t ppvt_num[MAX_BSA_ARRAY];
    devBsaPvt_t ppvt_mean[MAX_BSA_ARRAY];
    devBsaPvt_t ppvt_rms2[MAX_BSA_ARRAY];

    char     pname_num[MAX_BSA_ARRAY][64];
    char     pname_mean[MAX_BSA_ARRAY][64];
    char     pname_rms2[MAX_BSA_ARRAY][64];

    char     pname_slope[64];
    char     pname_offset[64];
    bool     doNotTouch;

} bsaList_t;

_pBsaBridge receives pProcessor→getHardware(), a class defined in the timing/bsa module.

devBsaPvt_t is defined in the devScBsa.h file:

Code Block
languagecpp
themeRDark
titledevBsaPvt_t
typedef struct {
    void *dpvt;
    epicsTimeStamp ts;
    int  nreq;
    int  entry_sz;
    void *bptr;
} devBsaPvt_t;


The functions operating on the linked list are as follows:

  • init_drvList:
  • prep_drvAnonimous:
    • Returns an allocated but empty driver pointer that needs to be initialized
    • Calls init_drvList, then allocates memory for a new item in the linked list, initializes it, then adds it to the end of the linked list and returns linked list count.
  • prep_drvByPort
    • Same as prep_drvAnonimous; create new driver item of linked list but with a specific port name string
  • prep_drvByNamedRoot: 
    • Same as prep_drvAnonimous; create new driver item of linked list but with a specific named root string
  • find_drvLast. Returns the last driver found. If no driver is found in the linked list, NULL is returned.
    • Starting by calling init_drvList to make sure a linked list is initialized
    • Counts the number of elements in the linked list.
    • If they are not 0, returns the last element, otherwise returns the pointer to the empty list.
  • find_drvByPort:
    • Returns a driver that matches the same port name. If not found, returns NULL
    • Calls init_drvList, then iterates on the linked list one element at a time starting from the first element. Once an element with a portName that is not NULL, and a string length of not zero, and a string identical to the argument port_name is found, it is returned, otherwise the next item is examined. If none is found, NULL is returned
  • find_drvyNamedRoot:
    • Returns a driver that matches the same named root. If not found, returns NULL
    • Calls init_drvList, then iterates on the linked list one element at a time starting from the first element. Once an element with a named_root that is not NULL, and a string length of not zero, and a string identical to the argument name_root is found, it is returned, otherwise the next item is examined. If none is found, NULL is returned

bsaAdd() function

bsaAdd() initializes a bsaList_t structure and stores it in the pBsaEllList ELL linked list. pBsaEllList is stored in the structure pDrvList_t of the bsaAsynDriver.cpp file. There are different structures named as pDrvList_t in other files of the bsaDriver EPICS module, so care must be taken to not get confused. This is a visual pointer structure operated by bsaAdd():

Gliffy Diagram
macroId81444b6f-19c4-4b41-9aad-06a2c41e137b
displayNamebsaAdd pointer structure
namebsaAdd pointer structure
pagePin3

The software assumes that the sequence of commands called in the IOC's st.cmd file is the following:

  1. cpswLoadYamlFile(), from the yamlLoader EPICS module.
  2. One or more bsaAdd().
  3. Zero or more bsaAddSecondary().
  4. bsaAsynDriverConfigure().

If the IOC controls more than one ATCA carrier board, then steps 1 to 4 above are repeated in the same order. If, for example, you called all 4 commands above for board 1, it is not possible to call bsaAdd() expecting it will be applied to board 1 again. After bsaAsynDriverConfigure() the door is closed to add additional BSA channels.

bsaAdd() starts by searching for getting the last element of the pDrvEllList linked list. This is the list that contains the configuration for each ATCA carrier board. One element of this list corresponds to one carrier board. The software assumes that the last element of the list is the one that is still open to receive BSA channels with bsaAdd(). It obtains the last element and check if the pointer to a pBsaDrv is null or if the port is still not defined. These two configurations only happen when bsaAsynDriverConfigure() is called. If the driver was not configured yet, then we are adding BSA channels to the right pDrvList_t. In case the driver is configured, this means that addBsa was called for the first time after cpswLoadYamlFile(). This way, a new pDrvList_t element must be created and appended to the end of the pDrvEllList linked list.

...