打印

mini2440使用rtc的周信息

[复制链接]
1515|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
flyingdon|  楼主 | 2010-4-13 11:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
最近在做mini2440的开发,需要使用rtc提供的时间信息,特别是周信息,使用ret=ioctl(fd, RTC_RD_TIME, (unsigned long)timep);
读取到的时间信息中不含有周信息,
timep->tm_wday+=1;
打印出来后tm_wday始终为零,查询过rtc.c驱动程序
case RTC_RD_TIME: /* Read the time/date from RTC */
{
  memset(&wtime, 0, sizeof(struct rtc_time));
  rtc_get_rtc_time(&wtime);
  break;
}
case RTC_SET_TIME: /* Set the RTC */
{
  struct rtc_time rtc_tm;
  unsigned char mon, day, hrs, min, sec, leap_yr;
  unsigned char save_control, save_freq_select;
  unsigned int yrs;
#ifdef CONFIG_MACH_DECSTATION
  unsigned int real_yrs;
#endif
  if (!capable(CAP_SYS_TIME))
   return -EACCES;
  if (copy_from_user(&rtc_tm, (struct rtc_time __user *)arg,
       sizeof(struct rtc_time)))
   return -EFAULT;
  yrs = rtc_tm.tm_year + 1900;
  mon = rtc_tm.tm_mon + 1;   /* tm_mon starts at zero */
  day = rtc_tm.tm_mday;
  hrs = rtc_tm.tm_hour;
  min = rtc_tm.tm_min;
  sec = rtc_tm.tm_sec;
设置时间的case RTC_SET_TIME中就没有周信息的设置,

同时读取实时时钟的rtc_get_rtc_time(&wtime);中也没有返回周信息。

在开发板的串口上输入命令date或者是hwclock -r都能将时间信息中的周信息打印出来,不知道它们的处理办法是什么?不知道哪位达人能够给点提示,多谢!

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

4

帖子

0

粉丝