SLS version of aai and aao. Main difference: record allocates buffer for array

This commit is contained in:
zimoch
2005-08-16 10:01:59 +00:00
committed by Dirk Zimoch
parent 72fdd8bc2e
commit cdbeac4c8c
2 changed files with 101 additions and 20 deletions

View File

@@ -1,10 +1,3 @@
/*************************************************************************\
* Copyright (c) 2002 Southeastern Universities Research Association, as
* Operator of Thomas Jefferson National Accelerator Facility.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* recAai.c */
/* recAai.c - Record Support Routines for Array Analog In records */
@@ -13,6 +6,36 @@
* Current Author: Dave Barker
* Date: 10/24/93
*
* C E B A F
*
* Continuous Electron Beam Accelerator Facility
* Newport News, Virginia, USA.
*
* Copyright SURA CEBAF 1993.
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
*/
#include <vxWorks.h>
@@ -83,6 +106,7 @@ struct aaidset { /* aai dset */
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_aai; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN special_linconv;
};
/*sizes of field types*/
@@ -102,6 +126,17 @@ static long init_record(paai,pass)
if (pass==0){
if(paai->nelm<=0) paai->nelm=1;
if(paai->ftvl == 0) {
paai->bptr = (char *)calloc(paai->nelm,MAX_STRING_SIZE);
} else {
if(paai->ftvl>DBF_ENUM) paai->ftvl=2;
paai->bptr = (char *)calloc(paai->nelm,sizeofTypes[paai->ftvl]);
}
if(paai->nelm==1) {
paai->nord = 1;
} else {
paai->nord = 0;
}
return(0);
}
recGblInitConstantLink(&paai->siml,DBF_USHORT,&paai->simm);
@@ -184,8 +219,10 @@ static long get_array_info(paddr,no_elements,offset)
long *offset;
{
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
/*
*no_elements = paai->nelm;
*/
*no_elements = paai ->nord;
*offset = 0;
return(0);
}
@@ -196,7 +233,11 @@ static long put_array_info(paddr,nNew)
{
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
/*
paai->nelm = nNew;
*/
paai->nord = nNew;
if(paai->nord > paai->nelm) paai->nord = paai->nelm;
return(0);
}

View File

@@ -1,14 +1,3 @@
/*************************************************************************\
* Copyright (c) 2002 Southeastern Universities Research Association, as
* Operator of Thomas Jefferson National Accelerator Facility.
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* recAao.c */
/* recAao.c - Record Support Routines for Array Analog Out records */
@@ -16,6 +5,37 @@
* Original Author: Dave Barker
* Current Author: Dave Barker
* Date: 10/28/93
*
* C E B A F
*
* Continuous Electron Beam Accelerator Facility
* Newport News, Virginia, USA.
*
* Copyright SURA CEBAF 1993.
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
*/
#include <vxWorks.h>
@@ -84,6 +104,7 @@ struct aaodset { /* aao dset */
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN write_aao; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN special_linconv;
};
/*sizes of field types*/
@@ -103,6 +124,17 @@ static long init_record(paao,pass)
if (pass==0){
if(paao->nelm<=0) paao->nelm=1;
if(paao->ftvl == 0) {
paao->bptr = (char *)calloc(paao->nelm,MAX_STRING_SIZE);
} else {
if(paao->ftvl>DBF_ENUM) paao->ftvl=2;
paao->bptr = (char *)calloc(paao->nelm,sizeofTypes[paao->ftvl]);
}
if(paao->nelm==1) {
paao->nord = 1;
} else {
paao->nord = 0;
}
return(0);
}
recGblInitConstantLink(&paao->siml,DBF_USHORT,&paao->simm);
@@ -182,8 +214,11 @@ static long get_array_info(paddr,no_elements,offset)
long *offset;
{
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
/*
*no_elements = paao->nelm;
*/
*no_elements = paao ->nord;
*offset = 0;
return(0);
}
@@ -194,7 +229,12 @@ static long put_array_info(paddr,nNew)
{
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
/*
paao->nelm = nNew;
*/
paao->nord = nNew;
if(paao->nord > paao->nelm) paao->nord = paao->nelm;
return(0);
}