diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /include/asm-sparc/mostek.h | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'include/asm-sparc/mostek.h')
-rw-r--r-- | include/asm-sparc/mostek.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h index e83d44d3c..c9a10cd86 100644 --- a/include/asm-sparc/mostek.h +++ b/include/asm-sparc/mostek.h @@ -1,4 +1,4 @@ -/* $Id: mostek.h,v 1.10 1998/08/18 15:03:11 davem Exp $ +/* $Id: mostek.h,v 1.12 1999/08/31 18:51:41 davem Exp $ * mostek.h: Describes the various Mostek time of day clock registers. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -38,6 +38,18 @@ * other than the control register are in binary coded decimal. Some * control bits also live outside the control register. */ +#define mostek_read(_addr) (*((volatile u8 *)(_addr))) +#define mostek_write(_addr,_val) ((*((volatile u8 *)(_addr))) = (_val)) +#define MOSTEK_EEPROM 0x0000UL +#define MOSTEK_IDPROM 0x07d8UL +#define MOSTEK_CREG 0x07f8UL +#define MOSTEK_SEC 0x07f9UL +#define MOSTEK_MIN 0x07faUL +#define MOSTEK_HOUR 0x07fbUL +#define MOSTEK_DOW 0x07fcUL +#define MOSTEK_DOM 0x07fdUL +#define MOSTEK_MONTH 0x07feUL +#define MOSTEK_YEAR 0x07ffUL struct mostek48t02 { volatile char eeprom[2008]; /* This is the eeprom, don't touch! */ @@ -52,7 +64,7 @@ struct mostek48t02 { volatile unsigned char year; /* Year (0-99) */ }; -extern struct mostek48t02 *mstk48t02_regs; +extern unsigned long mstk48t02_regs; /* Control register values. */ #define MSTK_CREG_WRITE 0x80 /* Must set this before placing values. */ @@ -81,14 +93,14 @@ extern struct mostek48t02 *mstk48t02_regs; #define MSTK_DECIMAL_TO_REGVAL(x) ((((x) / 0x0A) << 0x04) + ((x) % 0x0A)) /* Generic register set and get macros for internal use. */ -#define MSTK_GET(regs,var,mask) (MSTK_REGVAL_TO_DECIMAL(regs->var & MSTK_ ## mask ## _MASK)) -#define MSTK_SET(regs,var,value,mask) do { regs->var &= ~(MSTK_ ## mask ## _MASK); regs->var |= MSTK_DECIMAL_TO_REGVAL(value) & (MSTK_ ## mask ## _MASK); } while (0) +#define MSTK_GET(regs,var,mask) (MSTK_REGVAL_TO_DECIMAL(((struct mostek48t02 *)regs)->var & MSTK_ ## mask ## _MASK)) +#define MSTK_SET(regs,var,value,mask) do { ((struct mostek48t02 *)regs)->var &= ~(MSTK_ ## mask ## _MASK); ((struct mostek48t02 *)regs)->var |= MSTK_DECIMAL_TO_REGVAL(value) & (MSTK_ ## mask ## _MASK); } while (0) /* Macros to make register access easier on our fingers. These give you * the decimal value of the register requested if applicable. You pass * the a pointer to a 'struct mostek48t02'. */ -#define MSTK_REG_CREG(regs) (regs->creg) +#define MSTK_REG_CREG(regs) (((struct mostek48t02 *)regs)->creg) #define MSTK_REG_SEC(regs) MSTK_GET(regs,sec,SEC) #define MSTK_REG_MIN(regs) MSTK_GET(regs,min,MIN) #define MSTK_REG_HOUR(regs) MSTK_GET(regs,hour,HOUR) |