Main Page | Directories | File List | Globals

rtc.c File Reference

#include <agnix/agnix.h>
#include <agnix/adi/adi.h>
#include <agnix/ioport.h>
#include <agnix/memory.h>
#include <agnix/timer.h>

Include dependency graph for rtc.c:

Go to the source code of this file.

Functions

int rtc_timer_gettimeofday_lock (struct timeval_s *tv)
int rtc_gettime (struct chip_s *chip, struct timeval_s *tv)
int rtc_settime (struct chip_s *chip, struct timeval_s *tv)
int rtc_chip_init (struct chip_s *chip)
int rtc_chip_release (struct chip_s *chip)
int __init rtc_init (void)

Variables

chip_rtc_ops_s rtc_int_ops
chip_ops_s rtc_chip_ops
chip_s rtc_chip


Function Documentation

int rtc_chip_init struct chip_s *  chip  ) 
 

Definition at line 63 of file rtc.c.

00064 {
00065     CHIP_LOCK;
00066     CHIP_UNLOCK;
00067 
00068     return 0;
00069 }

int rtc_chip_release struct chip_s *  chip  ) 
 

Definition at line 71 of file rtc.c.

00072 {
00073     CHIP_LOCK;
00074     CHIP_UNLOCK;
00075 
00076     return 0;
00077 }

int rtc_gettime struct chip_s *  chip,
struct timeval_s *  tv
 

Definition at line 39 of file rtc.c.

References rtc_timer_gettimeofday_lock().

00040 {
00041     int ret;
00042 
00043     CHIP_LOCK;
00044 
00045     ret = rtc_timer_gettimeofday_lock(tv);
00046 
00047     CHIP_UNLOCK;
00048     
00049     return ret;
00050 }

Here is the call graph for this function:

int __init rtc_init void   ) 
 

Definition at line 95 of file rtc.c.

References adi_register_chip(), and rtc_chip.

Referenced by adi_chips_init().

00096 {
00097     adi_register_chip(&rtc_chip);
00098 
00099     return 0;    
00100 }

Here is the call graph for this function:

int rtc_settime struct chip_s *  chip,
struct timeval_s *  tv
 

Definition at line 52 of file rtc.c.

00053 {
00054     return 0;
00055 }

int rtc_timer_gettimeofday_lock struct timeval_s *  tv  ) 
 

Definition at line 20 of file rtc.c.

Referenced by rtc_gettime().

00021 {
00022     int i;
00023 
00024     for(i = 0; i < 1000000; i++)
00025         if (IS_RTC_UIP) break;
00026 
00027     for(i = 0; i < 1000000; i++)
00028         if (!IS_RTC_UIP) break;
00029 
00030     tv->tv_sec  = BCD_TO_BIN(RTC_READ(RTC_REG_SECONDS))
00031                 + BCD_TO_BIN(RTC_READ(RTC_REG_MINUTES)) * 60
00032                 + BCD_TO_BIN(RTC_READ(RTC_REG_HOURS)) * 60 * 60;
00033                 
00034     tv->tv_usec = 0;
00035 
00036     return 0;
00037 }


Variable Documentation

struct chip_s rtc_chip
 

Initial value:

 {
    .chip_name          = "rtc",
    .chip_class         = CHIP_CLASS_RTC,
    .chip_vendor        = 0x8086,
    .chip_priority      = 90,
    .chip_ops           = &rtc_chip_ops,
    .chip_pm_ops        = NULL,
    .internal_ops       = (void *)&rtc_int_ops,
    .internal_parm      = (void *)0
}

Definition at line 84 of file rtc.c.

Referenced by rtc_init(), and timer_init().

struct chip_ops_s rtc_chip_ops
 

Initial value:

 {
    .init               = rtc_chip_init,
    .release            = rtc_chip_release
}

Definition at line 79 of file rtc.c.

struct chip_rtc_ops_s rtc_int_ops
 

Initial value:

Definition at line 57 of file rtc.c.

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix