USB-BDI
M:/USB-BDI/USB-BDI/Firmware/MPC555-USB-BDI/lib/delay.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2003 Free Software Foundation, Inc.
00003  * 
00004  * This file is part of GNU Radio
00005  * 
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  * 
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00033 static void udelay1(void) __naked {
00034         __asm           ; lcall that got us here took 4 bus cycles
00035         ret                     ; 4 bus cycles
00036         __endasm;
00037 }
00038 
00044 void udelay(unsigned char usecs) {
00045         do {
00046                 udelay1 ();
00047         } while(--usecs != 0);
00048 }
00049 
00060 static void mdelay1(void) __naked {
00061         __asm
00062         mov     dptr,#(-1200 & 0xffff)
00063 
00064 002$:   
00065         inc     dptr            ; 3 bus cycles
00066         mov     a, dpl          ; 2 bus cycles
00067         orl     a, dph          ; 2 bus cycles
00068         jnz     002$            ; 3 bus cycles
00069 
00070         ret
00071         __endasm;
00072 }
00073 
00079 void mdelay(unsigned short msecs) {
00080         do {
00081                 mdelay1 ();
00082         } while(--msecs != 0);
00083 }
00084 
00085         
 All Files Functions Variables Defines