RTC with TQM823L

Wolfgang Denk wd at denx.de
Thu Mar 17 19:34:10 EST 2005


In message <HMECJAKDCPLOGPDHNAHECEKFCAAA.jean.nicollerat at microdev.ch> you wrote:
>
> I need to have an interrup every 10ms in my application running in linux.

This is  an  oxymoron.  Interrups  are  processed  in  kernel  space,
applications  are running in userspace. You cannot process interrupts
in aplication code.

> I try to use the RTC modules but with the code :
> 
> 	fd = open ("/dev/rtc", O_RDONLY);
> 
> 	if (fd ==  -1) {
> 		perror("/dev/rtc");
> 	}
> 	/* Turn on update interrupts (one per second) */

You mentioned you wanted signals (not interrupts) every 10  millisec,
not every second -- what exactly is it that you want?

> 	retval = ioctl(fd, RTC_UIE_ON, 0);
...
>   ioctl : invalide argument # for then line :"retval = ioctl(fd, RTC_UIE_ON,
> 0);"

Which means that the driver does not support this ioctl.

> Can somebody help ? why it is not working or a better way to get function
> called each 10ms

You can use setitimer. But be  warned.  Your  requirement  of  having
signals  every  10 milliseconds means that there is a serious problem
with your software design. You  are  doing  someting  really,  really
wrong.  To  me  it  sounds  as if you try to implement your own timer
based control loop in user space with an insane  smapp  period.  This
will  never  work  reliably (as there is no guarantee that your tasks
will be scheduled in time), and will waste a lot of CPU power.

Never take existing software  designs  from  other  operating  system
environments  and  put them without thinking into a Unix environment.
Often there are much better and more efficient approaches in Unix.


Just in case you really must stick with that 10  millisecond  raster:
in  this  case  you  will  probably have to use RTAI (especially on a
resource-limted CPU like the 823).

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The trouble with our times is that the future is not what it used  to
be.                                                     - Paul Valery



More information about the Linuxppc-embedded mailing list