/*1* linux/arch/unicore32/lib/delay.S2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/11#include <linux/linkage.h>12#include <asm/assembler.h>13#include <asm/param.h>14.text1516.LC0: .word loops_per_jiffy17.LC1: .word (2199023*HZ)>>111819/*20* r0 <= 200021* lpj <= 0x01ffffff (max. 3355 bogomips)22* HZ <= 100023*/2425ENTRY(__udelay)26ldw r2, .LC127mul r0, r2, r028ENTRY(__const_udelay) @ 0 <= r0 <= 0x7fffff0629ldw r2, .LC030ldw r2, [r2] @ max = 0x01ffffff31mov r0, r0 >> #14 @ max = 0x0001ffff32mov r2, r2 >> #10 @ max = 0x00007fff33mul r0, r2, r0 @ max = 2^32-134mov.a r0, r0 >> #635cmoveq pc, lr3637/*38* loops = r0 * HZ * loops_per_jiffy / 100000039*40* Oh, if only we had a cycle counter...41*/4243@ Delay routine44ENTRY(__delay)45sub.a r0, r0, #246bua __delay47mov pc, lr48ENDPROC(__udelay)49ENDPROC(__const_udelay)50ENDPROC(__delay)515253