2010-11-06 22:34:47     20msec interrupt using timer function

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

2010-11-06 22:34:47     20msec interrupt using timer function

shuja ahmed (UNITED KINGDOM)

Message: 95611   

 

I read the following link which is about 10msec interrupt generation using timers.

 

  blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=32393&action=ForumBrowse&forum_id=39

 

I also have gone through the link

 

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:timers

 

I wanted a function to be priodically called after every 20msec in user space. I am getting a very basic error and stuck with this.

 

If I add

 

#include <linux/timer.h>

 

I get the error

 

error: linux/timer.h: No such file or directory

How to give path of this file to my program.

 

Once this header file is visible to my program, then hope so using setup_timer() and mod_timer() function, I will be able to call a function priodically at 20msec rate.

QuoteReplyEditDelete

 

 

2010-11-07 21:50:19     Re: 20msec interrupt using timer function

Aaron Wu (CHINA)

Message: 95616   

 

Did you change your default include file path? if not it should be there. by the way,  the add_timer and mod_timer is for kernel.

QuoteReplyEditDelete

 

 

2010-11-07 22:09:00     Re: 20msec interrupt using timer function

shuja ahmed (UNITED KINGDOM)

Message: 95618   

 

Thanks for reply.

 

Through forum, I got the idea that mod_timer and add_timer functions are only for kernel space. Well, I wanted an ISR to be called periodically at rate of 20msec. And I wanted it in user space. In this Interrupt service routine, I wanted to receive some data from UART. Infact, I wanted to check UART periodically for some data received. And if received, I will process it. Any suggestions about how to use timers then. I have timer0 to timer8 available in /dev folder. But I dont think that I can map an ISR on it. I dont know, if it is possible in user space. But there must be a way of getting a function called periodically in user space.

 

Any suggestion....

QuoteReplyEditDelete

 

 

2010-11-07 22:15:56     Re: 20msec interrupt using timer function

shuja ahmed (UNITED KINGDOM)

Message: 95619   

 

I am using the following makefile in camera_test folder. I simple call "make" on the terminal from camera_test folder. All of my code is in srv1_timer.c file. If I include the file "#include <linux/timer.h>", I get the error that file not found. I did not change any default include path.

 

CC = bfin-uclinux-gcc

EXEC = srv1_timer

OBJS = srv1_timer.o jpeg.o r8x8dct.o

CFLAGS += -I. -O2 -Wall

ASMFLAGS = -x assembler-with-cpp

all: $(EXEC)

$(EXEC): $(OBJS)

    $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBM) $(LDLIBS) $(LIBGCC)

 

%.o: %.asm

    $(CC) $(ASMFLAGS) -c -o $@ $<

 

romfs:

    $(ROMFSINST) /bin/$(EXEC)

 

clean:

    -rm -f $(EXEC) *.elf *.gdb *.o

QuoteReplyEditDelete

 

 

2010-11-08 01:09:44     Re: 20msec interrupt using timer function

Aaron Wu (CHINA)

Message: 95624   

 

Generally, the kernel does not interfere with user space in this way. Instead, kernel provides some mechenism to block or wake up threads running in kernel space on behalf of user space. Have a look at  if  complete and wait_for_completion will help in your case

Attachments

    Outcomes