epicsMMIO.h macrized ioread causes multiple accesses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
High
|
mdavidsaver | ||
3.15 |
Fix Released
|
High
|
mdavidsaver | ||
3.16 |
Fix Released
|
High
|
mdavidsaver |
Bug Description
Andrew Johnson and Shifu Xu of ANL report a nasty bug with epicsMMIO.h effecting all targets except RTEMS/powerpc. This is known to cause incorrect behavior with mrfioc2 on vxWorks, though this particular issue won't manifest on other targets.
On 07/01/2016 05:51 PM, Andrew Johnson wrote:
> ...
> Register reads from the MRF230 are done by calling READ32.
>
> In mrfCommonIO.h:
>
> #define READ32(base,offset) NAT_READ32(
> #define NAT_READ32(
> nat_ioread32 ((epicsUInt8 *)(base) + U32_ ## offset)
>
> In epicsMMIO.h:
>
> #define nat_ioread32(
>
> For a PowerPC:
>
> #define bswap32(value) ( \
> (((epicsUInt32)
> (((epicsUInt32)
> (((epicsUInt32)
> (((epicsUInt32)
>
> Expanding out the bswap32() macro in nat_ioread32 results in
>
> #define nat_ioread32(
> (((epicsUInt32)
> 24) | \
> (((epicsUInt32)
> (((epicsUInt32)
> (((epicsUInt32)
>
> i.e. four actual reads for every call to READ32. If the register is a
> FIFO, that's probably going to throw away entries.
> ...
This is also https:/ /github. com/epics- modules/ devlib2/ issues/ 1