avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [RFC][PATCH] Deprecate inb / outb.


From: E. Weddington
Subject: [avr-libc-dev] [RFC][PATCH] Deprecate inb / outb.
Date: Mon, 09 Jun 2003 16:02:00 -0600

Per previous discussions, the attached patch should deprecate inb / outb. It 
also removes all usage in the lib headers.

Is anything else needed? Did I miss anything?

Comments?

Eric Weddington

Index: include/avr/ina90.h
===================================================================
RCS file: /cvsroot/avr-libc/avr-libc/include/avr/ina90.h,v
retrieving revision 1.4
diff -u -r1.4 ina90.h
--- include/avr/ina90.h 12 Dec 2002 11:41:01 -0000      1.4
+++ include/avr/ina90.h 9 Jun 2003 21:54:45 -0000
@@ -59,8 +59,8 @@
 /* _EEGET, _EEPUT */
 #include <avr/eeprom.h>
 
-#define input(port) inb(port)
-#define output(port, val) outb(port, val)
+#define input(port) (port)
+#define output(port, val) (port = val)
 
 #define __inp_blk__(port, addr, cnt, op) {     \
        unsigned char __i = (cnt);              \
Index: include/avr/interrupt.h
===================================================================
RCS file: /cvsroot/avr-libc/avr-libc/include/avr/interrupt.h,v
retrieving revision 1.5
diff -u -r1.5 interrupt.h
--- include/avr/interrupt.h     17 Mar 2003 18:39:19 -0000      1.5
+++ include/avr/interrupt.h     9 Jun 2003 21:54:45 -0000
@@ -97,7 +97,7 @@
 
     This function gives access to the \c gimsk register (or \c eimsk register
     if using an AVR Mega device or \c gicr register for others). Although this
-    function is essentially the same as using the outb() function, it does
+    function is essentially the same as assigning to the register, it does
     adapt slightly to the type of device being used. */
 
 extern inline void enable_external_int (unsigned char ints)
@@ -117,13 +117,13 @@
 
     \code#include <avr/interrupt.h>\endcode
 
-       This function modifies the \c timsk register using the outb() function.
+       This function modifies the \c timsk register.
        The value you pass via \c ints is device specific. */
 
 extern inline void timer_enable_int (unsigned char ints)
 {
 #ifdef TIMSK
-  outb(TIMSK, ints);
+    TIMSK = ints;
 #endif
 }
 
Index: include/avr/sfr_defs.h
===================================================================
RCS file: /cvsroot/avr-libc/avr-libc/include/avr/sfr_defs.h,v
retrieving revision 1.7
diff -u -r1.7 sfr_defs.h
--- include/avr/sfr_defs.h      6 Jan 2003 22:01:06 -0000       1.7
+++ include/avr/sfr_defs.h      9 Jun 2003 21:54:45 -0000
@@ -198,14 +198,6 @@
 
 /address@hidden/
 
-/** \def inb
-    \ingroup avr_sfr
-
-    \code #include <avr/io.h>\endcode
-
-    Read a byte from IO register \c sfr. */
-
-#define inb(sfr) _SFR_BYTE(sfr)
 
 /** \def inw
     \ingroup avr_sfr
@@ -216,17 +208,6 @@
 
 #define inw(sfr) _SFR_WORD(sfr)
 
-/** \def outb
-    \ingroup avr_sfr
-
-    \code #include <avr/io.h>\endcode
-
-    Write \c val to IO register \c sfr. 
-
-    \note The order of the arguments was switched in older versions of
-    avr-libc (versions <= 20020203). */
-
-#define outb(sfr, val) (_SFR_BYTE(sfr) = (val))
 
 /** \def outw
     \ingroup avr_sfr
@@ -276,7 +257,7 @@
 
     Test whether bit \c bit in IO register \c sfr is set. */
 
-#define bit_is_set(sfr, bit) (inb(sfr) & _BV(bit))
+#define bit_is_set(sfr, bit) (sfr & _BV(bit))
 
 /** \def bit_is_clear
     \ingroup avr_sfr
@@ -285,7 +266,7 @@
 
     Test whether bit \c bit in IO register \c sfr is clear. */
 
-#define bit_is_clear(sfr, bit) (!(inb(sfr) & _BV(bit)))
+#define bit_is_clear(sfr, bit) (!(sfr & _BV(bit)))
 
 /** \def loop_until_bit_is_set
     \ingroup avr_sfr
@@ -314,13 +295,39 @@
 /** \name Deprecated Macros */
 /address@hidden/
 
+/** \def inb
+    \ingroup avr_sfr
+    \deprecated
+    \code #include <avr/io.h>\endcode
+    For backwards compatibility only. This macro will eventually be removed.
+
+    \par
+    <b>Use direct access in new programs</b>. */
+
+#define inb(sfr) _SFR_BYTE(sfr)
+
+
+
+/** \def outb
+    \ingroup avr_sfr
+    \deprecated
+    \code #include <avr/io.h>\endcode
+
+    For backwards compatibility only. This macro will eventually be removed.
+
+    \par
+    <b>Use direct access in new programs</b>. */
+
+#define outb(sfr, val) (_SFR_BYTE(sfr) = (val))
+
+
 /** \def outp
     \ingroup avr_sfr
     \deprecated
     For backwards compatibility only. This macro will eventually be removed.
 
     \par
-    <b>Use outb() in new programs</b>. */
+    <b>Use direct access in new programs</b>. */
 
 #define outp(val, sfr) outb(sfr, val)
 
@@ -330,7 +337,7 @@
     For backwards compatibility only. This macro will eventually be removed.
 
     \par
-    <b>Use inb() in new programs</b>. */
+    <b>Use direct access in new programs</b>. */
 
 #define inp(sfr) inb(sfr)
 
Index: include/avr/timer.h
===================================================================
RCS file: /cvsroot/avr-libc/avr-libc/include/avr/timer.h,v
retrieving revision 1.3
diff -u -r1.3 timer.h
--- include/avr/timer.h 12 Dec 2002 11:41:01 -0000      1.3
+++ include/avr/timer.h 9 Jun 2003 21:54:45 -0000
@@ -47,17 +47,17 @@
 
 static inline void timer0_source (unsigned int src)
 {
-  outb(TCCR0, src);
+    TCCR0 = src;
 }
 
 static inline void timer0_stop (void)
 {
-  outb(TCNT0, 0);
+    TCNT0 = 0;
 }
 
 static inline void timer0_start (void)
 {
-  outb(TCNT0, 1);
+    TCNT0 = 1;
 }
 
 #ifdef __cplusplus

reply via email to

[Prev in Thread] Current Thread [Next in Thread]