[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48202B63.2050101@seznam.cz>
Date: Tue, 06 May 2008 11:56:51 +0200
From: Michal Simek <monstr@...nam.cz>
To: John Williams <john.williams@...alogix.com>
CC: monstr@...nam.cz, linux-kernel@...r.kernel.org, arnd@...db.de,
linux-arch@...r.kernel.org, stephen.neuendorffer@...inx.com,
John.Linn@...inx.com, matthew@....cx, will.newton@...il.com,
drepper@...hat.com, microblaze-uclinux@...e.uq.edu.au,
grant.likely@...retlab.ca
Subject: Re: [PATCH 24/56] microblaze_v2: time support
Hi John,
> Hi Michal,
>
> On Mon, 2008-05-05 at 16:22 +0200, Michal Simek wrote:
>> Hi John,
>>
>> you wrote me you have smarter implementation that xilinx did. Can you find it
>> and send me it?
>
> It's not much (any?) better? One less multiply I think? Attached
> anyway - feel free to discard for now.
>
> We could do a nice asm implementation with the optional mulhi
> instruction, but that can wait.
>
> Cheers,
>
> John
+extern __inline__ void __udelay(unsigned int x)
{
- unsigned long long tmp = usec;
- unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
+ unsigned long long tmp=(unsigned long long)x*(unsigned long
long)loops_per_jiffy*226LL;
+ unsigned loops=tmp>>32;
+
__delay(loops);
}
-#endif /* _ASM_MICROBLAZE_DELAY_H */
+extern __inline__ void __ndelay(unsigned int x)
+{
+ unsigned long long tmp=(unsigned long long)x*(unsigned long
long)loops_per_jiffy*226LL;
+ unsigned loops=tmp>>32;
+
+ __delay(loops);
+}
Why is __ndelay implementation the same with __udelay? This is weird for me.
+
+extern void __bad_udelay(void); /* deliberately undefined */
+extern void __bad_ndelay(void); /* deliberately undefined */
Are these function used anywhere?
+#define udelay(n) (__builtin_constant_p(n)? \
+ ((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \
+ __udelay((n) * (19 * HZ)))
+
+#define ndelay(n) (__builtin_constant_p(n)? \
+ ((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \
+ __ndelay((n) * HZ))
+#define muldiv(a, b, c) (((a)*(b))/(c))
muldiv: Where is this use?
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists