Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
rtc.h File Reference
#include <linux/types.h>
#include <linux/interrupt.h>
#include <uapi/linux/rtc.h>
#include <linux/device.h>
#include <linux/seq_file.h>
#include <linux/cdev.h>
#include <linux/poll.h>
#include <linux/mutex.h>
#include <linux/timerqueue.h>
#include <linux/workqueue.h>

Go to the source code of this file.

Data Structures

struct  rtc_class_ops
 
struct  rtc_task
 
struct  rtc_timer
 
struct  rtc_device
 

Macros

#define RTC_DEVICE_NAME_SIZE   20
 
#define RTC_DEV_BUSY   0
 
#define to_rtc_device(d)   container_of(d, struct rtc_device, dev)
 
#define rtc_hctosys_ret   -ENODEV
 

Typedefs

typedef struct rtc_task rtc_task_t
 

Functions

int rtc_month_days (unsigned int month, unsigned int year)
 
int rtc_year_days (unsigned int day, unsigned int month, unsigned int year)
 
int rtc_valid_tm (struct rtc_time *tm)
 
int rtc_tm_to_time (struct rtc_time *tm, unsigned long *time)
 
void rtc_time_to_tm (unsigned long time, struct rtc_time *tm)
 
ktime_t rtc_tm_to_ktime (struct rtc_time tm)
 
struct rtc_time rtc_ktime_to_tm (ktime_t kt)
 
struct rtc_devicertc_device_register (const char *name, struct device *dev, const struct rtc_class_ops *ops, struct module *owner)
 
void rtc_device_unregister (struct rtc_device *rtc)
 
int rtc_read_time (struct rtc_device *rtc, struct rtc_time *tm)
 
int rtc_set_time (struct rtc_device *rtc, struct rtc_time *tm)
 
int rtc_set_mmss (struct rtc_device *rtc, unsigned long secs)
 
int __rtc_read_alarm (struct rtc_device *rtc, struct rtc_wkalrm *alarm)
 
int rtc_read_alarm (struct rtc_device *rtc, struct rtc_wkalrm *alrm)
 
int rtc_set_alarm (struct rtc_device *rtc, struct rtc_wkalrm *alrm)
 
int rtc_initialize_alarm (struct rtc_device *rtc, struct rtc_wkalrm *alrm)
 
void rtc_update_irq (struct rtc_device *rtc, unsigned long num, unsigned long events)
 
struct rtc_devicertc_class_open (char *name)
 
void rtc_class_close (struct rtc_device *rtc)
 
int rtc_irq_register (struct rtc_device *rtc, struct rtc_task *task)
 
void rtc_irq_unregister (struct rtc_device *rtc, struct rtc_task *task)
 
int rtc_irq_set_state (struct rtc_device *rtc, struct rtc_task *task, int enabled)
 
int rtc_irq_set_freq (struct rtc_device *rtc, struct rtc_task *task, int freq)
 
int rtc_update_irq_enable (struct rtc_device *rtc, unsigned int enabled)
 
int rtc_alarm_irq_enable (struct rtc_device *rtc, unsigned int enabled)
 
int rtc_dev_update_irq_enable_emul (struct rtc_device *rtc, unsigned int enabled)
 
void rtc_handle_legacy_irq (struct rtc_device *rtc, int num, int mode)
 
void rtc_aie_update_irq (void *private)
 
void rtc_uie_update_irq (void *private)
 
enum hrtimer_restart rtc_pie_update_irq (struct hrtimer *timer)
 
int rtc_register (rtc_task_t *task)
 
int rtc_unregister (rtc_task_t *task)
 
int rtc_control (rtc_task_t *t, unsigned int cmd, unsigned long arg)
 
void rtc_timer_init (struct rtc_timer *timer, void(*f)(void *p), void *data)
 
int rtc_timer_start (struct rtc_device *rtc, struct rtc_timer *timer, ktime_t expires, ktime_t period)
 
int rtc_timer_cancel (struct rtc_device *rtc, struct rtc_timer *timer)
 
void rtc_timer_do_work (struct work_struct *work)
 

Variables

struct classrtc_class
 

Macro Definition Documentation

#define RTC_DEV_BUSY   0

Definition at line 84 of file rtc.h.

#define RTC_DEVICE_NAME_SIZE   20

Definition at line 68 of file rtc.h.

#define rtc_hctosys_ret   -ENODEV

Definition at line 190 of file rtc.h.

#define to_rtc_device (   d)    container_of(d, struct rtc_device, dev)

Definition at line 130 of file rtc.h.

Typedef Documentation

Function Documentation

int __rtc_read_alarm ( struct rtc_device rtc,
struct rtc_wkalrm alarm 
)

Definition at line 145 of file interface.c.

void rtc_aie_update_irq ( void private)

rtc_aie_update_irq - AIE mode rtctimer hook : pointer to the rtc_device

This functions is called when the aie_timer expires.

Definition at line 532 of file interface.c.

int rtc_alarm_irq_enable ( struct rtc_device rtc,
unsigned int  enabled 
)

Definition at line 418 of file interface.c.

void rtc_class_close ( struct rtc_device rtc)

Definition at line 619 of file interface.c.

struct rtc_device* rtc_class_open ( char name)
read

Definition at line 599 of file interface.c.

int rtc_control ( rtc_task_t t,
unsigned int  cmd,
unsigned long  arg 
)

Definition at line 876 of file rtc.c.

int rtc_dev_update_irq_enable_emul ( struct rtc_device rtc,
unsigned int  enabled 
)
struct rtc_device* rtc_device_register ( const char name,
struct device dev,
const struct rtc_class_ops ops,
struct module owner 
)
read

rtc_device_register - register w/ RTC class : the device to register

rtc_device_unregister() must be called when the class device is no longer needed.

Returns the pointer to the new struct class device.

Definition at line 144 of file class.c.

void rtc_device_unregister ( struct rtc_device rtc)

rtc_device_unregister - removes the previously registered RTC class device

: the RTC class device to destroy

Definition at line 235 of file class.c.

void rtc_handle_legacy_irq ( struct rtc_device rtc,
int  num,
int  mode 
)

rtc_handle_legacy_irq - AIE, UIE and PIE event hook : pointer to the rtc device

This function is called when an AIE, UIE or PIE mode interrupt has occurred (or been emulated).

Triggers the registered irq_task function callback.

Definition at line 506 of file interface.c.

int rtc_initialize_alarm ( struct rtc_device rtc,
struct rtc_wkalrm alrm 
)

Definition at line 384 of file interface.c.

int rtc_irq_register ( struct rtc_device rtc,
struct rtc_task task 
)

Definition at line 626 of file interface.c.

int rtc_irq_set_freq ( struct rtc_device rtc,
struct rtc_task task,
int  freq 
)

rtc_irq_set_freq - set 2^N Hz periodic IRQ frequency for IRQ : the rtc device : currently registered with rtc_irq_register() : positive frequency with which task->func() will be called Context: any

Note that rtc_irq_set_state() is used to enable or disable the periodic IRQs.

Definition at line 726 of file interface.c.

int rtc_irq_set_state ( struct rtc_device rtc,
struct rtc_task task,
int  enabled 
)

rtc_irq_set_state - enable/disable 2^N Hz periodic IRQs : the rtc device : currently registered with rtc_irq_register() : true to enable periodic IRQs Context: any

Note that rtc_irq_set_freq() should previously have been used to specify the desired frequency of periodic IRQ task->func() callbacks.

Definition at line 692 of file interface.c.

void rtc_irq_unregister ( struct rtc_device rtc,
struct rtc_task task 
)

Definition at line 650 of file interface.c.

struct rtc_time rtc_ktime_to_tm ( ktime_t  kt)
read

Definition at line 136 of file rtc-lib.c.

int rtc_month_days ( unsigned int  month,
unsigned int  year 
)

Definition at line 33 of file rtc-lib.c.

enum hrtimer_restart rtc_pie_update_irq ( struct hrtimer timer)

rtc_pie_update_irq - PIE mode hrtimer hook : pointer to the pie mode hrtimer

This function is used to emulate PIE mode interrupts using an hrtimer. This function is called when the periodic hrtimer expires.

Definition at line 560 of file interface.c.

int rtc_read_alarm ( struct rtc_device rtc,
struct rtc_wkalrm alrm 
)

Definition at line 304 of file interface.c.

int rtc_read_time ( struct rtc_device rtc,
struct rtc_time tm 
)

Definition at line 37 of file interface.c.

int rtc_register ( rtc_task_t task)

Definition at line 812 of file rtc.c.

int rtc_set_alarm ( struct rtc_device rtc,
struct rtc_wkalrm alrm 
)

Definition at line 359 of file interface.c.

int rtc_set_mmss ( struct rtc_device rtc,
unsigned long  secs 
)

Definition at line 82 of file interface.c.

int rtc_set_time ( struct rtc_device rtc,
struct rtc_time tm 
)

Definition at line 51 of file interface.c.

void rtc_time_to_tm ( unsigned long  time,
struct rtc_time tm 
)

Definition at line 51 of file rtc-lib.c.

int rtc_timer_cancel ( struct rtc_device rtc,
struct rtc_timer timer 
)

Definition at line 933 of file interface.c.

void rtc_timer_do_work ( struct work_struct work)

rtc_timer_do_work - Expires rtc timers rtc device timer being removed.

Expires rtc timers. Reprograms next alarm event if needed. Called via worktask.

Serializes access to timerqueue via ops_lock mutex

Definition at line 836 of file interface.c.

void rtc_timer_init ( struct rtc_timer timer,
void(*)(void *p f,
void data 
)

Definition at line 894 of file interface.c.

int rtc_timer_start ( struct rtc_device rtc,
struct rtc_timer timer,
ktime_t  expires,
ktime_t  period 
)

Definition at line 910 of file interface.c.

ktime_t rtc_tm_to_ktime ( struct rtc_time  tm)

Definition at line 125 of file rtc-lib.c.

int rtc_tm_to_time ( struct rtc_time tm,
unsigned long time 
)

Definition at line 114 of file rtc-lib.c.

void rtc_uie_update_irq ( void private)

rtc_uie_update_irq - UIE mode rtctimer hook : pointer to the rtc_device

This functions is called when the uie_timer expires.

Definition at line 545 of file interface.c.

int rtc_unregister ( rtc_task_t task)

Definition at line 839 of file rtc.c.

void rtc_update_irq ( struct rtc_device rtc,
unsigned long  num,
unsigned long  events 
)

rtc_update_irq - Triggered when a RTC interrupt occurs. : the rtc device : how many irqs are being reported (usually one) : mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF Context: any

Definition at line 582 of file interface.c.

int rtc_update_irq_enable ( struct rtc_device rtc,
unsigned int  enabled 
)

Definition at line 445 of file interface.c.

int rtc_valid_tm ( struct rtc_time tm)

Definition at line 96 of file rtc-lib.c.

int rtc_year_days ( unsigned int  day,
unsigned int  month,
unsigned int  year 
)

Definition at line 42 of file rtc-lib.c.

Variable Documentation

struct class* rtc_class

Definition at line 25 of file class.c.