Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
rtc-ls1x.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/rtc.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/types.h>
#include <linux/io.h>
#include <asm/mach-loongson1/loongson1.h>

Go to the source code of this file.

Macros

#define LS1X_RTC_REG_OFFSET   (LS1X_RTC_BASE + 0x20)
 
#define LS1X_RTC_REGS(x)   ((void __iomem *)KSEG1ADDR(LS1X_RTC_REG_OFFSET + (x)))
 
#define SYS_COUNTER_CNTRL   (LS1X_RTC_REGS(0x20))
 
#define SYS_CNTRL_ERS   (1 << 23)
 
#define SYS_CNTRL_RTS   (1 << 20)
 
#define SYS_CNTRL_RM2   (1 << 19)
 
#define SYS_CNTRL_RM1   (1 << 18)
 
#define SYS_CNTRL_RM0   (1 << 17)
 
#define SYS_CNTRL_RS   (1 << 16)
 
#define SYS_CNTRL_BP   (1 << 14)
 
#define SYS_CNTRL_REN   (1 << 13)
 
#define SYS_CNTRL_BRT   (1 << 12)
 
#define SYS_CNTRL_TEN   (1 << 11)
 
#define SYS_CNTRL_BTT   (1 << 10)
 
#define SYS_CNTRL_E0   (1 << 8)
 
#define SYS_CNTRL_ETS   (1 << 7)
 
#define SYS_CNTRL_32S   (1 << 5)
 
#define SYS_CNTRL_TTS   (1 << 4)
 
#define SYS_CNTRL_TM2   (1 << 3)
 
#define SYS_CNTRL_TM1   (1 << 2)
 
#define SYS_CNTRL_TM0   (1 << 1)
 
#define SYS_CNTRL_TS   (1 << 0)
 
#define SYS_TOYTRIM   (LS1X_RTC_REGS(0))
 
#define SYS_TOYWRITE0   (LS1X_RTC_REGS(4))
 
#define SYS_TOYWRITE1   (LS1X_RTC_REGS(8))
 
#define SYS_TOYREAD0   (LS1X_RTC_REGS(0xC))
 
#define SYS_TOYREAD1   (LS1X_RTC_REGS(0x10))
 
#define SYS_TOYMATCH0   (LS1X_RTC_REGS(0x14))
 
#define SYS_TOYMATCH1   (LS1X_RTC_REGS(0x18))
 
#define SYS_TOYMATCH2   (LS1X_RTC_REGS(0x1C))
 
#define SYS_RTCTRIM   (LS1X_RTC_REGS(0x40))
 
#define SYS_RTCWRITE0   (LS1X_RTC_REGS(0x44))
 
#define SYS_RTCREAD0   (LS1X_RTC_REGS(0x48))
 
#define SYS_RTCMATCH0   (LS1X_RTC_REGS(0x4C))
 
#define SYS_RTCMATCH1   (LS1X_RTC_REGS(0x50))
 
#define SYS_RTCMATCH2   (LS1X_RTC_REGS(0x54))
 
#define LS1X_SEC_OFFSET   (4)
 
#define LS1X_MIN_OFFSET   (10)
 
#define LS1X_HOUR_OFFSET   (16)
 
#define LS1X_DAY_OFFSET   (21)
 
#define LS1X_MONTH_OFFSET   (26)
 
#define LS1X_SEC_MASK   (0x3f)
 
#define LS1X_MIN_MASK   (0x3f)
 
#define LS1X_HOUR_MASK   (0x1f)
 
#define LS1X_DAY_MASK   (0x1f)
 
#define LS1X_MONTH_MASK   (0x3f)
 
#define LS1X_YEAR_MASK   (0xffffffff)
 
#define ls1x_get_sec(t)   (((t) >> LS1X_SEC_OFFSET) & LS1X_SEC_MASK)
 
#define ls1x_get_min(t)   (((t) >> LS1X_MIN_OFFSET) & LS1X_MIN_MASK)
 
#define ls1x_get_hour(t)   (((t) >> LS1X_HOUR_OFFSET) & LS1X_HOUR_MASK)
 
#define ls1x_get_day(t)   (((t) >> LS1X_DAY_OFFSET) & LS1X_DAY_MASK)
 
#define ls1x_get_month(t)   (((t) >> LS1X_MONTH_OFFSET) & LS1X_MONTH_MASK)
 
#define RTC_CNTR_OK   (SYS_CNTRL_E0 | SYS_CNTRL_32S)
 

Functions

 module_platform_driver (ls1x_rtc_driver)
 
 MODULE_AUTHOR ("zhao zhang <[email protected]>")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define LS1X_DAY_MASK   (0x1f)

Definition at line 76 of file rtc-ls1x.c.

#define LS1X_DAY_OFFSET   (21)

Definition at line 69 of file rtc-ls1x.c.

#define ls1x_get_day (   t)    (((t) >> LS1X_DAY_OFFSET) & LS1X_DAY_MASK)

Definition at line 83 of file rtc-ls1x.c.

#define ls1x_get_hour (   t)    (((t) >> LS1X_HOUR_OFFSET) & LS1X_HOUR_MASK)

Definition at line 82 of file rtc-ls1x.c.

#define ls1x_get_min (   t)    (((t) >> LS1X_MIN_OFFSET) & LS1X_MIN_MASK)

Definition at line 81 of file rtc-ls1x.c.

#define ls1x_get_month (   t)    (((t) >> LS1X_MONTH_OFFSET) & LS1X_MONTH_MASK)

Definition at line 84 of file rtc-ls1x.c.

#define ls1x_get_sec (   t)    (((t) >> LS1X_SEC_OFFSET) & LS1X_SEC_MASK)

Definition at line 80 of file rtc-ls1x.c.

#define LS1X_HOUR_MASK   (0x1f)

Definition at line 75 of file rtc-ls1x.c.

#define LS1X_HOUR_OFFSET   (16)

Definition at line 68 of file rtc-ls1x.c.

#define LS1X_MIN_MASK   (0x3f)

Definition at line 74 of file rtc-ls1x.c.

#define LS1X_MIN_OFFSET   (10)

Definition at line 67 of file rtc-ls1x.c.

#define LS1X_MONTH_MASK   (0x3f)

Definition at line 77 of file rtc-ls1x.c.

#define LS1X_MONTH_OFFSET   (26)

Definition at line 70 of file rtc-ls1x.c.

#define LS1X_RTC_REG_OFFSET   (LS1X_RTC_BASE + 0x20)

Definition at line 22 of file rtc-ls1x.c.

#define LS1X_RTC_REGS (   x)    ((void __iomem *)KSEG1ADDR(LS1X_RTC_REG_OFFSET + (x)))

Definition at line 23 of file rtc-ls1x.c.

#define LS1X_SEC_MASK   (0x3f)

Definition at line 73 of file rtc-ls1x.c.

#define LS1X_SEC_OFFSET   (4)

Definition at line 66 of file rtc-ls1x.c.

#define LS1X_YEAR_MASK   (0xffffffff)

Definition at line 78 of file rtc-ls1x.c.

#define RTC_CNTR_OK   (SYS_CNTRL_E0 | SYS_CNTRL_32S)

Definition at line 86 of file rtc-ls1x.c.

#define SYS_CNTRL_32S   (1 << 5)

Definition at line 41 of file rtc-ls1x.c.

#define SYS_CNTRL_BP   (1 << 14)

Definition at line 34 of file rtc-ls1x.c.

#define SYS_CNTRL_BRT   (1 << 12)

Definition at line 36 of file rtc-ls1x.c.

#define SYS_CNTRL_BTT   (1 << 10)

Definition at line 38 of file rtc-ls1x.c.

#define SYS_CNTRL_E0   (1 << 8)

Definition at line 39 of file rtc-ls1x.c.

#define SYS_CNTRL_ERS   (1 << 23)

Definition at line 28 of file rtc-ls1x.c.

#define SYS_CNTRL_ETS   (1 << 7)

Definition at line 40 of file rtc-ls1x.c.

#define SYS_CNTRL_REN   (1 << 13)

Definition at line 35 of file rtc-ls1x.c.

#define SYS_CNTRL_RM0   (1 << 17)

Definition at line 32 of file rtc-ls1x.c.

#define SYS_CNTRL_RM1   (1 << 18)

Definition at line 31 of file rtc-ls1x.c.

#define SYS_CNTRL_RM2   (1 << 19)

Definition at line 30 of file rtc-ls1x.c.

#define SYS_CNTRL_RS   (1 << 16)

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

#define SYS_CNTRL_RTS   (1 << 20)

Definition at line 29 of file rtc-ls1x.c.

#define SYS_CNTRL_TEN   (1 << 11)

Definition at line 37 of file rtc-ls1x.c.

#define SYS_CNTRL_TM0   (1 << 1)

Definition at line 45 of file rtc-ls1x.c.

#define SYS_CNTRL_TM1   (1 << 2)

Definition at line 44 of file rtc-ls1x.c.

#define SYS_CNTRL_TM2   (1 << 3)

Definition at line 43 of file rtc-ls1x.c.

#define SYS_CNTRL_TS   (1 << 0)

Definition at line 46 of file rtc-ls1x.c.

#define SYS_CNTRL_TTS   (1 << 4)

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

#define SYS_COUNTER_CNTRL   (LS1X_RTC_REGS(0x20))

Definition at line 27 of file rtc-ls1x.c.

#define SYS_RTCMATCH0   (LS1X_RTC_REGS(0x4C))

Definition at line 62 of file rtc-ls1x.c.

#define SYS_RTCMATCH1   (LS1X_RTC_REGS(0x50))

Definition at line 63 of file rtc-ls1x.c.

#define SYS_RTCMATCH2   (LS1X_RTC_REGS(0x54))

Definition at line 64 of file rtc-ls1x.c.

#define SYS_RTCREAD0   (LS1X_RTC_REGS(0x48))

Definition at line 61 of file rtc-ls1x.c.

#define SYS_RTCTRIM   (LS1X_RTC_REGS(0x40))

Definition at line 59 of file rtc-ls1x.c.

#define SYS_RTCWRITE0   (LS1X_RTC_REGS(0x44))

Definition at line 60 of file rtc-ls1x.c.

#define SYS_TOYMATCH0   (LS1X_RTC_REGS(0x14))

Definition at line 54 of file rtc-ls1x.c.

#define SYS_TOYMATCH1   (LS1X_RTC_REGS(0x18))

Definition at line 55 of file rtc-ls1x.c.

#define SYS_TOYMATCH2   (LS1X_RTC_REGS(0x1C))

Definition at line 56 of file rtc-ls1x.c.

#define SYS_TOYREAD0   (LS1X_RTC_REGS(0xC))

Definition at line 52 of file rtc-ls1x.c.

#define SYS_TOYREAD1   (LS1X_RTC_REGS(0x10))

Definition at line 53 of file rtc-ls1x.c.

#define SYS_TOYTRIM   (LS1X_RTC_REGS(0))

Definition at line 49 of file rtc-ls1x.c.

#define SYS_TOYWRITE0   (LS1X_RTC_REGS(4))

Definition at line 50 of file rtc-ls1x.c.

#define SYS_TOYWRITE1   (LS1X_RTC_REGS(8))

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

Function Documentation

MODULE_AUTHOR ( "zhao zhang <[email protected]>"  )
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( ls1x_rtc_driver  )