gonzui


Format: Advanced Search

tkernel_2/lib/libtk/src/sysdepend/tef_em1d/waitnsec.cbare sourcepermlink (0.02 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      @(#)waitnsec.c (libtk/EM1-D512)
   17:  *
   18:  *      Busy loop wait time in nanoseconds
   19:  */
   20: 
   21: #include <basic.h>
   22: #include <sys/sysinfo.h>
   23: 
   24: EXPORT void WaitNsec( UINT nsec )
   25: {
   26:         UW     count = nsec * SCInfo.loop64us / 64000U;
   27: 
   28:         Asm("  loop:    subs       %0, %0, #1    \n"
   29:         "              bhi loop            "
   30:                 : "=r"(count)
   31:                 : "0"(count + 1)
   32:         );
   33: }