EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: Epics driver using BLT or CBLT to read FIFO wanted
From: Benjamin Franksen <[email protected]>
To: <[email protected]>
Date: Thu, 6 Sep 2012 22:54:50 +0200
Am Donnerstag, 6. September 2012, 21:57:00 schrieb Mark Rivers:
> I would like to renew my plea for an update to the EPICS devLib to support
> VME operations in an OS-independent manner.  This includes not just the
> DMA operations that this thread originally referenced, but also basic
> register write and read operations.
>
> For example, when Kate Feng converted my SIS320 driver from vxWorks to
> RTEMS she made changes like the following:
>
> -        status = sysDmaFromVme(dmaId_, fifoBuffer_, (int)fifo_base_,
> VME_AM_EXT_SUP_D64BLT, (count)*sizeof(int), 8); +#ifdef __rtems__
> +        status= BSP_VMEDmaStart(dmaId_,fifoBuffer_PCIaddr,
> fifo_baseVMEaddr_, (count)*sizeof(int)); +#else
> +        status = sysDmaFromVme(dmaId_, fifoBuffer_, fifo_baseVMEaddr_,
> VME_AM_EXT_SUP_D64BLT, (count)*sizeof(int), 8); +#endif
>
> According to Till's message this might not have been necessary, since he
> said he had an RTEMS implementation of Andrew's API, so perhaps the same
> API call could have been used?
>
> But there were also changes like this:
> -    registers_->irq_control_status_reg = SIS3820_IRQ_SOURCE4_DISABLE;
> +    writeReg32(&registers_->irq_control_status_reg,
> SIS3820_IRQ_SOURCE4_DISABLE);
>
> and this:
> -  firmwareVersion_ = registers_->moduleID_reg & 0x0000FFFF;
> +  firmwareVersion_ = readReg32( &registers_->moduleID_reg) & 0x0000FFFF;
>
> So where I was doing register access directly, on RTEMs this is being
> wrapped in a function or macro.  I understand that this may be needed on
> some architectures to ensure that writes are done immediately, etc.  The
> problem is that Kate's code won't build on vxWorks because the readReg32
> function is defined in a header file only included for RTEMS.  I don't
> know of a vxWorks equivalent.
>
> We really need something standard in EPICS base that we can all use in our
> VME drivers to make them OS and architecture independent.

I agree, wholeheartedly. The more so since the RTEMS way to access registers
strikes me as the better idea anyway: matching a C struct definition with the
register layout (as it is done traditionally in EPICS drivers) is error prone
and non-portable, since the exact memory layout of a struct depends on
architecture and compiler. So, yes, we need a set of access functions (or
macros) like read/writeReg8/16/32 packages as an OSI library; and indeed
devLib is the right place to put them.

--
Ben Franksen
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

> From: [email protected] [[email protected]] on
> behalf of Till Straumann [[email protected]] Sent: Wednesday,
> February 15, 2012 9:21 AM
> To: [email protected]
> Subject: Re: Epics driver using BLT or CBLT to read FIFO wanted
>
> FWIW. We also have a RTEMS implementation of Andrew's DMA API.
> And yes, I'd think integrating this into devLib would be desirable.
>
> Till
>
> On 02/15/2012 08:24 AM, Mark Rivers wrote:
> > Hi,
> >
> > My SIS3820 driver reads out a FIFO using BLT. Here is the code snippet:
> >       if (useDma_ && (count >= MIN_DMA_TRANSFERS)) {
> >
> >         asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
> >
> >                   "%s:%s: doing DMA transfer, fifoBuffer=%p,
> >                   fifo_base=%p, count=%d\n", driverName, functionName,
> >                   fifoBuffer_, fifo_base_, count);
> >
> >         status = sysDmaFromVme(dmaId_, fifoBuffer_, (int)fifo_base_,
> >         VME_AM_EXT_SUP_D64BLT, (count)*sizeof(int), 8); if (status) {
> >
> >           asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
> >
> >                     "%s:%s: doing DMA transfer, error calling
> >                     sysDmaFromVme, status=%d, buff=%p, fifo_base=%p,
> >                     count=%d\n", driverName, functionName, status,
> >                     fifoBuffer_, fifo_base_, count);
> >
> >         }
> >
> > You can get the complete file containing this snippet here:
> >
> > https://subversion.xor.aps.anl.gov/synApps/mca/trunk/mcaApp/SISSrc/drvSIS
> > 3820.cpp
> >
> > This code uses the DMA functions that Andrew Johnson provides in the
> > vxWorks BSPs at the APS.
> >
> > I would like to suggest (again) that these functions or something similar
> > should be added to devLib in EPICS base, so that we can all write
> > portable code that uses DMA!
> >
> > Cheers,
> > Mark
> > ________________________________________
> > From: [email protected] [[email protected]] on
> > behalf of Bai Jiaoni [[email protected]] Sent: Wednesday, February 15,
> > 2012 7:17 AM
> > To: [email protected]
> > Subject: Epics driver using BLT or CBLT to read FIFO wanted
> >
> > I want to wirte a driver for the hardware, which needs to use record to
> > read the data of FIFO(altera FPGA) by BLT or CBLT. Do you know some
> > other dirvers finishing the same function?
> > Version:Epics 3.13 or 3.14; vxWorks 5.4; VME bus
> >
> > I am looking forward to your reply.

________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de


Replies:
RE: Epics driver using BLT or CBLT to read FIFO wanted Davidsaver, Michael
References:
Epics driver using BLT or CBLT to read FIFO wanted Bai Jiaoni
Re: Epics driver using BLT or CBLT to read FIFO wanted Till Straumann
RE: Epics driver using BLT or CBLT to read FIFO wanted Mark Rivers

Navigate by Date:
Prev: mca R7-2 available Mark Rivers
Next: quadEM R3-0 now available Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Epics driver using BLT or CBLT to read FIFO wanted Mark Rivers
Next: RE: Epics driver using BLT or CBLT to read FIFO wanted Davidsaver, Michael
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·