|  | @@ -0,0 +1,44 @@
 | 
	
		
			
				|  |  | +#ifndef IODEV_H
 | 
	
		
			
				|  |  | +#define IODEV_H
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Address for I/O device d, subregister r */
 | 
	
		
			
				|  |  | +#define IODEVA(d,r) (0xfffffc00+((d) << 6)+((r) << 2))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#ifdef __ASSEMBLY__
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/*
 | 
	
		
			
				|  |  | + * The I/O device range is designed so that it can be addressed via
 | 
	
		
			
				|  |  | + * negative offsets from the zero register, so no explicit base
 | 
	
		
			
				|  |  | + * pointer register is necesary.
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +#define IODEVV(d,r) IODEVA(d,r)(zero)
 | 
	
		
			
				|  |  | +#define IODEVB(d,r) IODEVV(d,r)
 | 
	
		
			
				|  |  | +#define IODEVH(d,r) IODEVV(d,r)
 | 
	
		
			
				|  |  | +#define IODEVL(d,r) IODEVV(d,r)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#else
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include <stdint.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Writable registers */
 | 
	
		
			
				|  |  | +#define IODEVV(d,r) (*(volatile void     *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +#define IODEVB(d,r) (*(volatile uint8_t  *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +#define IODEVH(d,r) (*(volatile uint16_t *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +#define IODEVL(d,r) (*(volatile uint32_t *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Readonly registers */
 | 
	
		
			
				|  |  | +#define IODEVRV(d,r) (*(const volatile void     *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +#define IODEVRB(d,r) (*(const volatile uint8_t  *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +#define IODEVRH(d,r) (*(const volatile uint16_t *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +#define IODEVRL(d,r) (*(const volatile uint32_t *)IODEVA(d,r))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define CPU_CLK_HZ	84000000
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define LED		IODEVB(0,0)
 | 
	
		
			
				|  |  | +#define CONSOLE		IODEVB(1,0)
 | 
	
		
			
				|  |  | +#define CON_BAUDDIV	IODEVL(1,1)
 | 
	
		
			
				|  |  | +#define CON_BAUD_BASE	(48000000U >> 4)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#endif /* IODEV_H */
 |