Main Page   Compound List   File List   Compound Members   File Members  

iomacros.h File Reference

#include <inttypes.h>

Go to the source code of this file.

Defines

#define BV(x)   (1 << (x))
#define __mmio(port)   (*((volatile uint8_t *)((uint8_t)(port) + 0x20)))
#define __inb(port)
#define __outb(val, port)
#define __outb_zero(port)
#define inp(port)   (__builtin_constant_p((port)) ? __inb((port)) : __mmio((port)))
#define outp(val, port)
#define __inw(port)
#define __inw_atomic(port)
#define __outw(val, port)
#define __outw_atomic(val, port)
#define __cbi(port, bit)
#define __sbi(port, bit)
#define __port_and(port, val)
#define __port_or(port, val)
#define __cbi_const_port(port, bit)
#define __sbi_const_port(port, bit)
#define cbi(port, bit)
#define sbi(port, bit)
#define bit_is_set(port, bit)   (__inb(port) & (1<<(bit)))
#define bit_is_clear(port, bit)   (!bit_is_set(port, bit))
#define loop_until_bit_is_set(port, bit)
#define loop_until_bit_is_clear(port, bit)
#define parity_even_bit(val)


Define Documentation

#define BV( x )   (1 << (x))
 

Definition at line 24 of file iomacros.h.

#define __cbi( port, bit )
 

Value:

        __asm__ __volatile__ (                          \
                "cbi %0,%1"                             \
                :                       \
                : "I" ((uint8_t)(port)),                \
                  "I" ((uint8_t)(bit))                  \
        )

Definition at line 133 of file iomacros.h.

#define __cbi_const_port( port, bit )
 

Value:

        do {            \
        if (((port) < 0x20) && __builtin_constant_p((bit))) \
                __cbi((port), (bit));                   \
        else                                            \
                __port_and((port), ~BV((bit)));         \
 } while (0)

Definition at line 175 of file iomacros.h.

#define __inb( port )
 

Value:

        ({                              \
        uint8_t __t;                            \
        __asm__ __volatile__ (                  \
                "in %0,%1"                      \
                : "=r" (__t)                    \
                : "I" ((uint8_t)(port))         \
        );                                      \
        __t;                                    \
 })

Definition at line 33 of file iomacros.h.

#define __inw( port )
 

Value:

        ({                                      \
        uint16_t __t;                                   \
        __asm__ __volatile__ (                          \
                "in %A0,%1" "\n\t"                      \
                "in %B0,(%1)+1"                         \
                : "=r" (__t)                            \
                : "I" ((uint8_t)(port))                 \
        );                                              \
        __t;                                            \
 })

Definition at line 83 of file iomacros.h.

#define __inw_atomic( port )
 

Value:

        ({                              \
        uint16_t __t;                                   \
        __asm__ __volatile__ (                          \
                "in __tmp_reg__,__SREG__" "\n\t"        \
                "cli" "\n\t"                            \
                "in %A0,%1" "\n\t"                      \
                "out __SREG__,__tmp_reg__" "\n\t"       \
                "in %B0,(%1)+1"                         \
                : "=r" (__t)                            \
                : "I" ((uint8_t)(port))                 \
                : "r0"                                  \
        );                                              \
        __t;                                            \
 })

Definition at line 94 of file iomacros.h.

#define __mmio( port )   (*((volatile uint8_t *)((uint8_t)(port) + 0x20)))
 

Definition at line 29 of file iomacros.h.

#define __outb( val, port )
 

Value:

        __asm__ __volatile__ (                  \
                "out %1,%0"                     \
                :               \
                : "r" ((uint8_t)(val)),         \
                  "I" ((uint8_t)(port))         \
        )

Definition at line 47 of file iomacros.h.

#define __outb_zero( port )
 

Value:

        __asm__ __volatile__ (                  \
                "out %0,__zero_reg__"           \
                :               \
                : "I" ((uint8_t)(port))         \
        )

Definition at line 55 of file iomacros.h.

#define __outw( val, port )
 

Value:

        __asm__ __volatile__ (                          \
                "out (%1)+1,%B0" "\n\t"                 \
                "out %1,%A0"                            \
                :                       \
                : "r" ((uint16_t)(val)),                \
                  "I" ((uint8_t)(port))                 \
        )

Definition at line 109 of file iomacros.h.

#define __outw_atomic( val, port )
 

Value:

        __asm__ __volatile__ (                          \
                "in __tmp_reg__,__SREG__" "\n\t"        \
                "cli" "\n\t"                            \
                "out (%1)+1,%B0" "\n\t"                 \
                "out __SREG__,__tmp_reg__" "\n\t"       \
                "out %1,%A0"                            \
                :                       \
                : "r" ((uint16_t)(val)),                \
                  "I" ((uint8_t)(port))                 \
                : "r0"                                  \
        )

Definition at line 118 of file iomacros.h.

#define __port_and( port, val )
 

Value:

        __asm__ __volatile__ (                          \
                "in __tmp_reg__,%0" "\n\t"              \
                "and __tmp_reg__,%1" "\n\t"             \
                "out %0,__tmp_reg__"                    \
                :                       \
                : "I" ((uint8_t)(port)),                \
                  "r" ((uint8_t)(val))                  \
                : "r0"                                  \
        )

Definition at line 151 of file iomacros.h.

#define __port_or( port, val )
 

Value:

        __asm__ __volatile__ (                          \
                "in __tmp_reg__,%0" "\n\t"              \
                "or __tmp_reg__,%1" "\n\t"              \
                "out %0,__tmp_reg__"                    \
                :                       \
                : "I" ((uint8_t)(port)),                \
                  "r" ((uint8_t)(val))                  \
                : "r0"                                  \
        )

Definition at line 162 of file iomacros.h.

#define __sbi( port, bit )
 

Value:

        __asm__ __volatile__ (                          \
                "sbi %0,%1"                             \
                :                       \
                : "I" ((uint8_t)(port)),                \
                  "I" ((uint8_t)(bit))                  \
        )

Definition at line 141 of file iomacros.h.

#define __sbi_const_port( port, bit )
 

Value:

        do {            \
        if (((port) < 0x20) && __builtin_constant_p((bit))) \
                __sbi((port), (bit));                   \
        else                                            \
                __port_or((port), BV((bit)));           \
 } while (0)

Definition at line 182 of file iomacros.h.

#define bit_is_clear( port, bit )   (!bit_is_set(port, bit))
 

Definition at line 209 of file iomacros.h.

#define bit_is_set( port, bit )   (__inb(port) & (1<<(bit)))
 

Definition at line 208 of file iomacros.h.

#define cbi( port, bit )
 

Value:

        do {                            \
        if (__builtin_constant_p((port)))               \
                __cbi_const_port((port), (bit));        \
        else                                            \
                __mmio((port)) &= ~BV((bit));           \
 } while (0)

Definition at line 191 of file iomacros.h.

#define inp( port )   (__builtin_constant_p((port)) ? __inb((port)) : __mmio((port)))
 

Definition at line 64 of file iomacros.h.

#define loop_until_bit_is_clear( port, bit )
 

Value:

        __asm__ __volatile__ (                          \
        "L_%=: " "sbic %0,%1" "\n\t"                    \
                "rjmp L_%="                             \
                :                       \
                : "I" ((uint8_t)(port)),                \
                  "I" ((uint8_t)(bit))                  \
        )

Definition at line 250 of file iomacros.h.

#define loop_until_bit_is_set( port, bit )
 

Value:

        __asm__ __volatile__ (                          \
        "L_%=: " "sbis %0,%1" "\n\t"                    \
                "rjmp L_%="                             \
                :                       \
                : "I" ((uint8_t)(port)),                \
                  "I" ((uint8_t)(bit))                  \
        )

Definition at line 241 of file iomacros.h.

#define outp( val, port )
 

Value:

        do {                            \
        if (__builtin_constant_p((port))) {             \
                if (__builtin_constant_p((val)) && ((val) == 0)) \
                        __outb_zero((port));            \
                else                                    \
                        __outb((val), (port));          \
        } else                                          \
                __mmio((port)) = (val);                 \
 } while (0)

Definition at line 66 of file iomacros.h.

Referenced by enable_external_int(), and timer_enable_int().

#define parity_even_bit( val )
 

Value:

        ({                              \
        uint8_t __t;                                    \
        __asm__ (                                       \
                "mov __tmp_reg__,%0" "\n\t"             \
                "swap %0" "\n\t"                        \
                "eor %0,__tmp_reg__" "\n\t"             \
                "mov __tmp_reg__,%0" "\n\t"             \
                "lsr %0" "\n\t"                         \
                "lsr %0" "\n\t"                         \
                "eor %0,__tmp_reg__" "\n\t"             \
                "mov __tmp_reg__,%0" "\n\t"             \
                "lsr %0" "\n\t"                         \
                "eor %0,__tmp_reg__"                    \
                : "=r" (__t)                            \
                : "0" ((uint8_t)(val))                  \
                : "r0"                                  \
        );                                              \
        (__t & 1);                                      \
 })

Definition at line 259 of file iomacros.h.

#define sbi( port, bit )
 

Value:

        do {                            \
        if (__builtin_constant_p((port)))               \
                __sbi_const_port((port), (bit));        \
        else                                            \
                __mmio((port)) |= BV((bit));            \
 } while (0)

Definition at line 198 of file iomacros.h.


Generated at Fri Jul 19 14:55:46 2002 for avrgcc by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001