[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] 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
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/