[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate
From: |
Dmitry K. |
Subject: |
Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.] |
Date: |
Mon, 16 Jun 2003 09:12:46 +1100 |
User-agent: |
KMail/1.5 |
16 Jun 2003 06:18 Joerg Wunsch wrote:
> Basically, it's now no longer (easily) possible to use one
> of the SFRs as the target of an inline asm statement anyway (see bug
> ID #2233, we need to update our inline asm docs accordingly).
Examples of SFRs usage:
//#define _SFR_ASM_COMPAT 1 /* needed for second example only */
#include <avr/io.h>
/* Examples of SFRs as the target of an inline asm statements.
For qualitative realization it is necessary to add check:
if (__builtin_constant_p((port)))
*/
#define cbi_atomic(port,bit) do { \
if (_SFR_IO_ADDR(port) < 0x20) { \
asm volatile ( \
"cbi %0,%1" \
: \
: "I"(_SFR_IO_ADDR(port)), \
"I"((unsigned char)(bit)) ); \
} else { \
unsigned char __tmp; \
asm volatile ( \
"in __tmp_reg__,__SREG__ \n\t" \
"cli \n\t" \
"in %0,%1 \n\t" \
"andi %0,%2 \n\t" \
"out __SREG__,__tmp_reg__ \n\t" \
"out %1,%0 " \
: "=d"(__tmp) \
: "I"(_SFR_IO_ADDR(port)), \
"M"(0377 & ~(1 << (bit))) ); \
} \
} while (0)
/* Next definitions for insertion SFRs to body inline asm */
#define _v(s) _s(s)
#define _s(s) #s
void foo (void)
{
/* Examples of SFRs as the target of an inline asm statements */
cbi_atomic(PORTB, 2);
cbi_atomic(MCUCR, SE);
/* Example of usage SFRs in body of an inline asm - more readeble */
#if _SFR_ASM_COMPAT /* SFRs as simple numbers needed */
asm volatile (
"out "_v(_SFR_IO_ADDR(PORTB))",__zero_reg__"
:: );
#endif
}
- [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], eric, 2003/06/13
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Dmitry K., 2003/06/13
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Joerg Wunsch, 2003/06/14
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Dmitry K., 2003/06/15
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Joerg Wunsch, 2003/06/15
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.],
Dmitry K. <=
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Russell Shaw, 2003/06/15
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Dmitry K., 2003/06/15
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Dmitry K., 2003/06/15
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Russell Shaw, 2003/06/15
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Dmitry K., 2003/06/16
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Joerg Wunsch, 2003/06/18
- Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.], Dmitry K., 2003/06/18