www.pudn.com > CC2420_TRX.rar > hal_wait.c


/******************************************************************************************************* 
 *                                                                                                     * 
 *        **********                                                                                   * 
 *       ************                                                                                  * 
 *      ***        ***                                                                                 * 
 *      ***   +++   ***                                                                                * 
 *      ***   + +   ***                                                                                * 
 *      ***   +                        CHIPCON HARDWARE ABSTRACTION LIBRARY FOR THE CC2420             * 
 *      ***   + +   ***                                   Idle looping                                 * 
 *      ***   +++   ***                                                                                * 
 *      ***        ***                                                                                 * 
 *       ************                                                                                  * 
 *        **********                                                                                   * 
 *                                                                                                     * 
 ******************************************************************************************************* 
 * The Chipcon Hardware Abstraction Library is a collection of functions, macros and constants, which  * 
 * can be used to ease access to the hardware on the CC2420 and the target microcontroller.            * 
 *                                                                                                     * 
 * This function contains a function for idle looping with millisecond resolution.                     * 
 ******************************************************************************************************* 
 * Compiler: AVR-GCC                                                                                   * 
 * Target platform: CC2420DB, CC2420 + any ATMEGA MCU                                                  * 
 ******************************************************************************************************* 
 * Revision history:                                                                                   * 
 * $Log: hal_wait.c,v $ 
 * Revision 1.2  2004/03/30 14:59:50  mbr 
 * Release for web 
 *   
 * 
 * 
 *******************************************************************************************************/ 
#include  
 
 
//------------------------------------------------------------------------------------------------------- 
//	void halWait(UINT16 timeout) 
// 
//	DESCRIPTION: 
//		Runs an idle loop for [timeout] microseconds. 
// 
//  ARGUMENTS: 
//      UINT16 timeout 
//          The timeout in microseconds 
//------------------------------------------------------------------------------------------------------- 
void halWait(UINT16 timeout) { 
 
    // This sequence uses exactly 8 clock cycle for each round 
    do { 
        NOP(); 
        NOP(); 
        NOP(); 
        NOP(); 
    } while (--timeout); 
 
} // halWait