Re: [PATCH 24/56] microblaze_v2: time support

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

 



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-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux