/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. See the file COPYING * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Copyright (C) 2010 Frank van Maarseveen */ #ifndef _DELAY_H_ #define _DELAY_H_ #include #if MHZ == 4 __attribute__((always_inline)) static inline void udelay(uint8_t us) { if (us) { asm volatile( "1: dec %0" /* 1 */ "\n nop" /* 1 */ "\n brne 1b" /* 2 */ : "=r"(us) : "0"(us) ); } } #else void udelay(uint8_t us); #endif #endif