2011-06-23 22:51:26     missing delay.h

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-06-23 22:51:26     missing delay.h

Wojtek Skulski (UNITED STATES)

Message: 101632   

 

I want to delay by a few milliseconds. I heard that either msleep or mdelay can be used. Where is it? Corbet on page 196 says <linux/delay.h> declares mdelay. But this file seems to be missing. I found delay.h in the "asm" subdirectory:

 

./linux-2.6.x/arch/blackfin/include/asm/delay.h

 

So I put the following #include in my code:

 

#include <asm/delay.h>

 

The compiler complained:

 

fpga.c:15:23: error: asm/delay.h: No such file or directory

 

 

I am confused. The file is there but cannot be #included? What should I do? Copy it to some other location?

QuoteReplyEditDelete

 

 

2011-06-23 23:05:22     Re: missing delay.h

Mike Frysinger (UNITED STATES)

Message: 101633   

 

you cannot include kernel-only headers in userspace apps

QuoteReplyEditDelete

 

 

2011-06-23 23:17:03     Re: missing delay.h

Wojtek Skulski (UNITED STATES)

Message: 101635   

 

So how can I delay by two milliseconds? sleep(2) waits for 2 seconds, right?

QuoteReplyEditDelete

 

 

2011-06-23 23:49:57     Re: missing delay.h

Mike Frysinger (UNITED STATES)

Message: 101636   

 

`man usleep`

 

`man nanosleep`

QuoteReplyEditDelete

 

 

2011-06-24 00:04:50     Re: missing delay.h

Wojtek Skulski (UNITED STATES)

Message: 101637   

 

$ man usleep

No manual entry for usleep

$ man nanosleep

No manual entry for nanosleep

$ man nsleep

No manual entry for nsleep

QuoteReplyEditDelete

 

 

2011-06-24 00:08:52     Re: missing delay.h

Mike Frysinger (UNITED STATES)

Message: 101638   

 

then install the relevant development related man pages on your system.  they're pretty much a requirement for any doing Linux programming.

QuoteReplyEditDelete

 

 

2011-06-24 00:19:00     Re: missing delay.h

Wojtek Skulski (UNITED STATES)

Message: 101639   

 

Oh, I see. I am using the newest coLinux. I thought it was perfect.

QuoteReplyEditDelete

 

 

2011-06-24 00:39:31     Re: missing delay.h

Mike Frysinger (UNITED STATES)

Message: 101640   

 

you might be using latest coLinux *kernel*, but that doesnt mean you updated your userland install.  i vaguely recall you specifically not doing that.

 

latest coLinux install looks like it install the man pages.  `man usleep` shows the man page.

QuoteReplyEditDelete

 

 

2011-06-24 01:12:08     Re: missing delay.h

Wojtek Skulski (UNITED STATES)

Message: 101641   

 

Mike:

 

I did not update the userland because I want to keep it stable. I was happy enough that after upgrading 0.7.7.1 to 0.7.9 everything stays the same, after fixing the adi/uclinux mismatch of course.

 

The man pages are available on internet. I read about usleep and I already fixed my code. Thank you for the hint that mdelay is not available in userland. I would not have guessed. I was suspecting some PATH misconfiguration.

 

  www.kernel.org/doc/man-pages/online/pages/man3/usleep.3.html

Attachments

    Outcomes