EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: ss_id for seq_pv functions
From: Ned Arnold <[email protected]>
To: [email protected], [email protected]
Date: Thu, 15 Feb 2001 11:42:50 -0600 (CST)
 
> Hello all,
> 
> I'm wanting to use the state code escaped C versions of the pvPut/Get(),
> etc, ie. seq_pvPut/Get(). From the SNL User Guide I've found the first
> parameter to these functions is the state set identifier (SS_ID) of the
> calling state set, please can someone tell me how I may obtain this?
> 
> I'm using vxWorks 5.3, EPICS 3.13.2 and SNC/SEQ Version 1.9.2.Beta12.
> 
> Many thanks,
> Alastair B.


Alastair,

It gets defined for you in the .c file that is generated by the SNC compiler.
Escaped c code will find it. Here is a typical example ...


At the beginning of the file ...


    %%#include        <seq.h>

    %%static long putAndWait(SS_ID ssId, int pvId, chtype type, void *value);

    int     sendStringId;



With the sequence code ...    

    state init
    {
        when ()
        {
            sendStringId = pvIndex(sendString);
        } state wait_for_command
    }



    state wait_for_command
        when (1)
        {

    %%              putAndWait(ssId, sendStringId, DBR_STRING, sendString);
    
    
    
    
In the escaped C-code ...

%{


SEM_ID          waitingSem = NULL;
static void myCallback();

static long putAndWait(SS_ID ssId, int pvId, chtype type, void *value)
{

    unsigned long   count = 1;
    long            result;

    chid            chanId;
  
    SPROG           *pSP;   /* ptr to state program */
    CHAN            *pDB;   /* ptr to channel struct */
   
    /* See if the semaphore has been initialized yet */
    if(!waitingSem) {
        waitingSem = semBCreate(SEM_Q_FIFO,SEM_EMPTY);
    }

    /* find chid from sequencer's structures */
    pSP = ((SSCB *)ssId)->sprog;
    pDB = pSP->pChan + pvId;
    chanId = pDB->chid;

    result = semTake(waitingSem, NO_WAIT); /* clear semaphore */

    ca_array_put_callback(type, count, chanId, value, myCallback, NULL);
    ca_flush_io();

    result = semTake(waitingSem, 600);

    return(result);

}

void myCallback()
{
    semGive(waitingSem);
}


}%



	Ned
	



Navigate by Date:
Prev: ss_id for seq_pv functions Alastair Borrowman
Next: Re: dm2k on alpha Brian McAllister
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: ss_id for seq_pv functions Alastair Borrowman
Next: Support for Allen-Bradley PLCs Rarback, Harvey
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024