/*
 * $Header: /smsa/bsd:include/dev/cmos.h:bsd  1.13  $
 * $Source: /smsa/bsd:include/dev/cmos.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 *
 */

#ifndef	__dev_cmos_h
#define	__dev_cmos_h

#define CMOS_RAM_SIZE (256-16)

#define CMOS_RAM_CLOCKINFO	0x80
#define CMOS_RAM_YEAR		0x80
#define CMOS_RAM_CENTURY	0x81
#define CMOS_RAM_MONTH		0x82
#define CMOS_RAM_LEAPFLAG	0x83

#define CMOS_RAM_VDU_INFO	0x85
#define		 VDU_CSYNC_FLAG		(1 << 0)
#define		 VDU_TYPE__OFFSET	2	/* bits 2,3 in byte */
#define		 VDU_TYPE__BITS		4
#define		 VDU_TYPE__COUNT (1 << VDU_TYPE__BITS)
#define		 VDU_TYPE__MASK	((1 << VDU_TYPE__BITS)-1)
#define VDU_TYPE(vbyte) (((vbyte) >> VDU_TYPE__OFFSET) & VDU_TYPE__MASK)
/*
 * Historical accident: vdu types were defined both here 
 * and in <dev/vcioctl.h>, so we use an include file to
 * maintain consistency.
 */
#ifndef	__dev_vdu_type_h
#include "vdu_type.h"
#endif


#define CMOS_UNIX_AREA_BASE	0x50
#define CMOS_UNIX_AREA_SIZE	0x20

#define CMOS_RAM_BASE_VTE	CMOS_UNIX_AREA_BASE + 0
#define CMOS_RAM_VTE_BYTES	5		/* bytes/emulator */
#define CMOS_RAM_SIZE_VTE	(2+(1+4)*CMOS_RAM_VTE_BYTES) /* console+4*vterm */
#define CMOS_RAM_PANIC_ADDR	0x6C		/* Address of panic string */
#define CMOS_RAM_PANIC_BYTES	4

#define CMOS_SOUND_FLAGS	0x94		/* RISC OS sound control byte */
#define CMOS_SOUND_SPEAKER	0x80		/* 1-bit: speaker on=1,off=0 */

#define CMOS_BOOT_FLAGS		0xE0 /* Bootstrap flags */
#define CMOS_BOOT_AUTOBOOT	0x80 /* Autoboot bit in bootstrap flags */

#define CMOS_CHECKSUM           0xEF /* Simple additive checksum of all the bytes 00..EE */

#ifdef _KERNEL
/* CMOS RAM access functions */
extern int CMOS_read_RAM ();
extern int CMOS_write_RAM ();
/* clock functions */
extern void CLK_set_clock ();
extern unsigned long CLK_get_clock ();
#endif/*_KERNEL*/

#endif/*__dev_cmos_h*/

/* EOF cmos.h */
