EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  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  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: VME Bus Error handling on MVME3100 and MVME6100 boards
From: "Thompson, David H." <[email protected]>
To: Andrew Johnson <[email protected]>, Kate Feng <[email protected]>
Cc: [email protected]
Date: Tue, 29 Aug 2006 11:29:45 -0400
> Kate Feng wrote:
> > Andrew Johnson wrote about mvme6100:
> >
> >>The only sure-fire way around this problem is to check
> >>the Tempe chip's VMEbus Exception Attributes Register after every
> >>write operation and every read that returns an all-1s bit pattern
> >
> > This can be implemented at the level of the Tsi148 driver
> > instead of the EPICS driver, right ?
> 
> All the EPICS VME drivers that I know assume that they have memory
> mapped I/O to the VME card and thus do not make an OS or BSP call to
> perform read or write cycles on the VME bus.  If they *did* call an OS
> or BSP routine then it would be possible for a Tsi148 driver to
> intercept all such I/O operations and perform the necessary checks
> afterwards.  However since they don't (most EPICS drivers create a
> struct that directly maps to the board registers and use a pointer to
> that struct to calculate the register address) the above requirement
> would need major changes to every driver to properly handle the issue
of
> getting a bus error.
> 
One 'trick' that is available to c++ users is to define c++ class
objects for the device's registers.  That way you can insert handlers in
to do the I/O and still define the device as a struct.

So:
struct myDeviceRegisters
{
	unsigned short status;
	unsigned short intVector;
...
};

Becomes:

class myDeviceShortType
{
      // No virtual functions allowed.
public:
	operator unsigned short();
	unsigned short operator = (unsigned short);
      // constructors and destructors not needed.
  
};
// The above functions can be implemented inline if desired.

struct myDeviceRegisters
{
	myDeviceShortType status;
	myDeviceShortType intVector;
...
};

This way you get control of what happens when the register is accessed
and if you need to do byte swapping or exception handling you can do it
without a total rewrite of the driver.  I have used this trick a few
times already to hide byte swapping details from the rest of the driver.
It also helps when the compiler refuses to access the register with a
data size and alignment that the card will accept. Obviously if you have
a PCI vs VME implementation you just link/include/ifdef a different
implementation of myDeviceXXXType depending on which it is you need.
The same would be true if you just need to check an error status
register if the read value is all 1s on some hosts.

This still amounts to a major change but if the first step is changing
.c to .cc that might not be that bad.


References:
Re: VME Bus Error handling on MVME3100 and MVME6100 boards Andrew Johnson

Navigate by Date:
Prev: Re: VME Bus Error handling on MVME3100 and MVME6100 boards Andrew Johnson
Next: Re: VME Bus Error handling on MVME3100 and MVME6100 boards Kate Feng
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: VME Bus Error handling on MVME3100 and MVME6100 boards Kate Feng
Next: writes from windows Geoff Savage
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·