diff packages/hal/arm/arch/current/include/hal_io.h @ 191:678094f34118

Merge from eCos master repository on 2001-10-19-06:43:02-BST
author jlarmour
date Fri, 19 Oct 2001 07:02:26 +0000
parents 289bf90c6a9b
children e0c0827131d1
line wrap: on
line diff
--- a/packages/hal/arm/arch/current/include/hal_io.h
+++ b/packages/hal/arm/arch/current/include/hal_io.h
@@ -26,7 +26,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -34,16 +34,16 @@
 //=============================================================================
 //#####DESCRIPTIONBEGIN####
 //
-// Author(s):   nickg, gthomas
-// Contributors:        nickg, gthomas
-// Date:        1998-09-11
-// Purpose:     Define IO register support
-// Description: The macros defined here provide the HAL APIs for handling
-//              device IO control registers.
+// Author(s):    nickg, gthomas
+// Contributors: Fabrice Gautier
+// Date:         1998-09-11
+// Purpose:      Define IO register support
+// Description:  The macros defined here provide the HAL APIs for handling
+//               device IO control registers.
 //              
 // Usage:
-//              #include <cyg/hal/hal_io.h>
-//              ...
+//               #include <cyg/hal/hal_io.h>
+//               ...
 //              
 //
 //####DESCRIPTIONEND####
@@ -89,6 +89,20 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_];        \
     CYG_MACRO_END
 
+#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_));             \
+    CYG_MACRO_END
+
+#define HAL_WRITE_UINT8_STRING( _register_, _buf_, _count_ )            \
+    CYG_MACRO_START                                                     \
+    cyg_count32 _i_;                                                    \
+    for( _i_ = 0; _i_ < (_count_); _i_++)                               \
+        ((volatile CYG_BYTE *)(_register_)) = (_buf_)[_i_];             \
+    CYG_MACRO_END
+
 #else // Big-endian version
 
 #define HAL_READ_UINT8( _register_, _value_ ) \
@@ -113,6 +127,22 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         _r_[_j_] = (_buf_)[_i_];                                        \
     CYG_MACRO_END
 
+#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_;                                             \
+    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_];                                             \
+    CYG_MACRO_END
+
 #endif // Big-endian
 
 //-----------------------------------------------------------------------------
@@ -142,6 +172,21 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_];      \
     CYG_MACRO_END
 
+#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_));           \
+    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_];           \
+    CYG_MACRO_END
+
+
 #else // Big-endian version
 
 #define HAL_READ_UINT16( _register_, _value_ ) \
@@ -166,6 +211,23 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         _r_[_j_] = (_buf_)[_i_];                                        \
     CYG_MACRO_END
 
+#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_;                                             \
+    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_];                                             \
+    CYG_MACRO_END
+
+
 #endif // Big-endian
 
 //-----------------------------------------------------------------------------
@@ -194,6 +256,20 @@ typedef volatile CYG_ADDRWORD HAL_IO_REG
         ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_];      \
     CYG_MACRO_END
 
+#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_));           \
+    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_];           \
+    CYG_MACRO_END
+
 // Enforce a flow "barrier" to prevent optimizing compiler from reordering 
 // operations.
 #define HAL_IO_BARRIER()