How do you call delay/udelay/mdelay timer in userspace?
I am trying to write a program which calls either udelay, mdelay or delay. I am getting the following errors trying to compile the program:
---
psullivan@linux:~> gcc delays.c
/tmp/ccmvwQPo.o(.text+0xf): In function `main':
delays.c: undefined reference to `delay'
/tmp/ccmvwQPo.o(.text+0x2d):delays.c: undefined reference to `mdelay'
/tmp/ccmvwQPo.o(.text+0x41):delays.c: undefined reference to `__bad_udelay'
collect2: ld returned 1 exit status
psullivan@linux:~>
---
I am trying to write using main() (does this mean I am writing in userspace?)? I am confused about this. Can I call exec() or fork() from my user space programs in my home directory simply using gcc (filename.c). Do I have to link in the kernel, or can the calls be made already since I am running in Konsole and compiling the program using gcc (as above)?
My program looks as follows:
---
psullivan@linux:~> cat delays.c
#include <stdio.h>
#include <string.h>
#include <asm/delay.h>
int main ()
{
delay(30);
printf ("Seeing Delay before Printing!!\n");
mdelay(4000);
printf("Next Print after delay!!\n");
udelay(5000000);
printf("Print last message after udelay!!!\n");
return 0;
}
psullivan@linux:~>
---
What am I doing wrong? Does anyone know?
Thanks,
Pat//
|