[Top][All Lists]

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

Re: [avr-libc-dev] [RFC] Sleeping BOD API

From: Joerg Wunsch
Subject: Re: [avr-libc-dev] [RFC] Sleeping BOD API
Date: Fri, 6 Feb 2009 23:27:22 +0100
User-agent: Mutt/1.5.11

As Weddington, Eric wrote:

> Ok so the above works, but now a question about some theoretical
> aspects of this. In practice, the MCUCR register is in the I/O
> space, therefore it can be accessed with IN/OUT instructions. The
> macro above works, but it *explicitly* specifies the OUT
> instruction. But what if there were an AVR device where MCUCR were
> *not* in the I/O space?

I think you're hosed in that case anyway (depending on how the "within
four clock cycles" restriction is to be interpreted).  Accessing the
memory space takes two cycles per instruction, so IMHO you would want
to have the to respective STS instructions back to back then, just to
be on the safe side.  That means you'll need another temporary
variable then, so you can preset both bit patterns in temp registers,
and then fire the two STS instructions.

The advantage (if you'd like to call it so :) of my suggested code
snippet here is that it will fail assembly in case MCUCR is not in the
OUT-accessible address space, while your code will compile but fail to
work correctly (again, depending on hour the "four clock cycles" are

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

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