Advantech RSB-4210 Evaluation Kit User Manual Page 88

  • Download
  • Add to my manuals
  • Print
  • Page
    / 104
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 87
RSB-4210 User Manual 80
* RTC_IRQP_SET, RTC_IRQP_READ: the irq_set_freq function will be called
to set the frequency while the framework will handle the read for you since the fre-
quency is stored in the irq_freq member of the rtc_device structure. Your driver
needs to initialize the irq_freq member during init. Make sure you check the
requested frequency is in range of your hardware in the irq_set_freq function. If it
isn't, return -EINVAL. If you cannot actually change the frequency, do not define
irq_set_freq.
* RTC_PIE_ON, RTC_PIE_OFF: the irq_set_state function will be called.
If all else fails, check out the rtc-test.c driver!
/****************************************************
/* Real Time Clock Driver Test/Example Program
/* Compile with:*gcc -s -Wall -Wstrict-prototypes rtctest.c -o rtctest
/* Released under the GNU General Public License, version 2,
/* included herein by reference.
/* ****************************************************/
#include <stdio.h>
#include <linux/rtc.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
/*
* This expects the new RTC class driver framework, working
with
* clocks that will often not be clones of what the PC-AT had.
* Use the command line to specify another RTC if you need one.
*/
static const char default_rtc[] = "/dev/rtc0";
int main(int argc, char **argv)
{
int i, fd, retval, irqcount = 0;
unsigned long tmp, data;
struct rtc_time rtc_tm;
const char *rtc = default_rtc;
switch (argc) {
Page view 87
1 2 ... 83 84 85 86 87 88 89 90 91 92 93 ... 103 104

Comments to this Manuals

No comments