1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     os_SpinWait.cpp
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 12449 $
14  *---------------------------------------------------------------------------*/
15 
16 #include <nn/os.h>
17 
18 namespace nn {
19 namespace os {
20 namespace ARM {
21 
22 #include    <nn/hw/ARM/code32.h>
SpinWaitCpuCycles(s32 cycle NN_IS_UNUSED_VAR)23     asm void  SpinWaitCpuCycles( s32 cycle NN_IS_UNUSED_VAR )
24     {
25 #if     defined(NN_PROCESSOR_ARM11MPCORE)
26 NN_LSYM(1)
27         subs   r0, r0, #2       // 1 ループ 2 サイクル
28         nop                     // nop をなくすと 5 サイクルになる
29         bgt    NN_BSYM(1)
30         bx     lr
31 #elif   defined(NN_PROCESSOR_ARM946ES)
32 NN_LSYM(1)
33         subs   r0, r0, #4   // 1 cycle
34         bgt    NN_BSYM(1)   // 3 cycle
35         bx     lr
36 #else
37     #error no cpu selected
38 #endif
39     }
40 #include    <nn/hw/ARM/codereset.h>
41 
42 }
43 }
44 }
45