[ECOS] Broken macro definitions in hal_io.h
Gary Thomas
gthomas@redhat.com
Mon May 20 05:54:00 GMT 2002
On Sun, 2002-05-19 at 13:03, Thomas Koeller wrote:
> Hi,
>
> the definitions for HAL_READ_UINT32_STRING and HAL_WRITE_UINT32_STRING
> in hal/arm/arch/current/include/hal_io.h are broken. Here's a patch to fix this:
>
Thanks for pointing this out!
Actually, there was more wrong than just this. We [obviously] took the
time to develop and define these macros, but they've never found much
use, thus they were broken from day 1.
The real change I've just committed is:
Index: hal/arm/arch/current/ChangeLog
===================================================================
RCS file: /home/cvs/ecc/ecc/hal/arm/arch/current/ChangeLog,v
retrieving revision 1.250
diff -u -5 -p -r1.250 ChangeLog
--- hal/arm/arch/current/ChangeLog 18 May 2002 23:02:35 -0000 1.250
+++ hal/arm/arch/current/ChangeLog 20 May 2002 12:48:11 -0000
@@ -1,5 +1,10 @@
+2002-05-20 Gary Thomas <gthomas@redhat.com>
+
+ * include/hal_io.h: Fix ...STRING macros - not using index.
+ Pointed out by Thomas Koeller <thomas@koeller.dyndns.org>.
+
2002-05-09 Nick Garnett <nickg@redhat.com>
* src/vectors.S (handle_IRQ_or_FIQ): Save SVC mode LR in interrupt
handling as well as exceptions.
Index: hal/arm/arch/current/include/hal_io.h
===================================================================
RCS file: /home/cvs/ecc/ecc/hal/arm/arch/current/include/hal_io.h,v
retrieving revision 1.21
diff -u -5 -p -r1.21 hal_io.h
--- hal/arm/arch/current/include/hal_io.h 18 May 2002 23:02:36 -0000 1.21
+++ hal/arm/arch/current/include/hal_io.h 20 May 2002 12:51:16 -0000
@@ -109,11 +109,11 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
#define HAL_READ_UINT8_STRING( _register_, _buf_, _count_ ) \
CYG_MACRO_START \
cyg_count32 _i_; \
for( _i_ = 0; _i_ < (_count_); _i_++) \
- (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_)); \
+ (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_i_]; \
CYG_MACRO_END
#define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_ ) \
CYG_MACRO_START \
cyg_count32 _i_; \
@@ -148,19 +148,19 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
#define HAL_READ_UINT8_STRING( _register_, _buf_, _count_ ) \
CYG_MACRO_START \
cyg_count32 _i_; \
volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)^3); \
for( _i_ = 0; _i_ < (_count_); _i_++; \
- (_buf_)[_i_] = _r_; \
+ (_buf_)[_i_] = _r_[_i_]; \
CYG_MACRO_END
#define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_ ) \
CYG_MACRO_START \
cyg_count32 _i_; \
volatile CYG_BYTE* _r_ = ((CYG_ADDRWORD)(_register_)^3); \
for( _i_ = 0; _i_ < (_count_); _i_++) \
- _r_ = (_buf_)[_i_]; \
+ _r_[_i_] = (_buf_)[_i_]; \
CYG_MACRO_END
#endif // Big-endian
//-----------------------------------------------------------------------------
@@ -192,18 +192,18 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
#define HAL_READ_UINT16_STRING( _register_, _buf_, _count_) \
CYG_MACRO_START \
cyg_count32 _i_; \
for( _i_ = 0; _i_ < (_count_); _i_++) \
- (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_)); \
+ (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_i_]; \
CYG_MACRO_END
#define HAL_WRITE_UINT16_STRING( _register_, _buf_, _count_) \
CYG_MACRO_START \
cyg_count32 _i_; \
for( _i_ = 0; _i_ < (_count_); _i_++) \
- ((volatile CYG_WORD16 *)(_register_)) = (_buf_)[_i_]; \
+ ((volatile CYG_WORD16 *)(_register_))[_i_] = (_buf_)[_i_]; \
CYG_MACRO_END
#else // Big-endian version
@@ -232,19 +232,19 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
#define HAL_READ_UINT16_STRING( _register_, _buf_, _count_) \
CYG_MACRO_START \
cyg_count32 _i_; \
volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)^3); \
for( _i_ = 0 = 0; _i_ < (_count_); _i_++) \
- (_buf_)[_i_] = _r_; \
+ (_buf_)[_i_] = _r_[_i_]; \
CYG_MACRO_END
#define HAL_WRITE_UINT16_STRING( _register_, _buf_, _count_) \
CYG_MACRO_START \
cyg_count32 _i_; \
volatile CYG_WORD16* _r_ = ((CYG_ADDRWORD)(_register_)^3); \
for( _i_ = 0 = 0; _i_ < (_count_); _i_++) \
- _r_ = (_buf_)[_i_]; \
+ _r_[_i_] = (_buf_)[_i_]; \
CYG_MACRO_END
#endif // Big-endian
@@ -276,18 +276,18 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
#define HAL_READ_UINT32_STRING( _register_, _buf_, _count_) \
CYG_MACRO_START \
cyg_count32 _i_; \
for( _i_ = 0; _i_ < (_count_); _i_++) \
- (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_)); \
+ (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_i_]; \
CYG_MACRO_END
#define HAL_WRITE_UINT32_STRING( _register_, _buf_, _count_) \
CYG_MACRO_START \
cyg_count32 _i_; \
for( _i_ = 0; _i_ < (_count_); _i_++) \
- ((volatile CYG_WORD32 *)(_register_)) = (_buf_)[_i_]; \
+ ((volatile CYG_WORD32 *)(_register_))[_i_] = (_buf_)[_i_]; \
CYG_MACRO_END
// Enforce a flow "barrier" to prevent optimizing compiler from reordering
// operations.
#define HAL_IO_BARRIER()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20020520/e698065d/attachment.sig>
More information about the Ecos-discuss
mailing list