// $Id$
-/* tab:4
+/*
* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
-/* tab:4
+/*
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
* downloading, copying, installing or using the software you agree to
* this license. If you do not agree to this license, do not download,
#include <atm128hardware.h>
#include <avrhardware.h>
+#ifndef MHZ
+/* Clock rate is ~8MHz except if specified by user
+ (this value must be a power of 2, see MicaTimer.h and MeasureClockC.nc) */
+#define MHZ 8
+#endif
+
typedef uint32_t in_flash_addr_t;
typedef uint32_t ex_flash_addr_t;
-void wait( uint16_t t ) {
- for ( ; t; t-- );
+static inline void wait( uint16_t dt ) {
+ /* In most cases (constant arg), the test is elided at compile-time */
+ if (dt)
+ /* loop takes 8 cycles. this is 1uS if running on an internal 8MHz
+ clock, and 1.09uS if running on the external crystal. */
+ asm volatile (
+ "1: sbiw %0,1\n"
+ " adiw %0,1\n"
+ " sbiw %0,1\n"
+ " brne 1b" : "+w" (dt));
}
// LED assignments