[fpc-pascal]RTC with Free Pascal
Christophe Espern
cespern at free.fr
Wed Apr 16 15:52:43 CEST 2003
Le mer 16/04/2003 à 14:38, Jonas Maebe a écrit :
> Yes, they are simply reading from a device (which is done exactly the
> same as reading from a file, also in Pascal) and using some ioctl's
> (which is available in the linux unit).
Yes but the rtc.h has some constants which seems not available under
FPC. For example :
#define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on
#define RTC_UIE_OFF _IO('p', 0x04) /* ... off
I don't know what means the _IO functions and the "p" param. h2pas can
convert this h file.
As I like danger I try with only the hexa values (ie:$03) for and it
fails
Here is the ugly code :)
program testrtc;
uses Sysutils,Linux;
var
retval:boolean;
i, irqcount:integer;
tmp, data :longint;
fd:integer;
begin
fd:=fileopen ('/dev/rtc', fmOpenRead);
if (fd=-1) then begin
writeln(stderr,'/dev/rtc');
exit;
end;
retval:= ioctl(fd,$03, 0);
if (retval = false) then begin
writeln('error open');
exit;
end;
retval:= ioctl(fd,$04, 0);
if (retval=false) then begin
writeln('error close');
exit;
end;
fileclose(fd);
end.
--
Moreover what about sched_set_scheduler under FPC ? Does someone try to
use it ?
Cheers,
Christophe
More information about the fpc-pascal
mailing list