/*
    IOHal.h, Copyright  (c) by George Fankhauser,
    Swiss Federal Institute of Technology,
    Computer Engineering and Networks Laboratory.
 
    TOPSY -- A Teachable Operating System.
             Implementation of a tiny and simple
             micro kernel for teaching purposes.
 
    For further information, please visit http://www.tik.ee.ethz.ch/~topsy
 
    This software is provided under the terms of the GNU General Public Licence.
 
    A full copy of the GNU GPL is provided in the file COPYING found in the 
    development root of Topsy.
*/
/*
	
	File:                  $Source: /home/ruf/cvs_Topsy/cvs/Topsy/IO/mips/IOHal.h,v $
 	Author(s):             George Fankhauser
 	Affiliation:           ETH Zuerich, TIK
 	Version:               $Revision: 2922 $
 	Creation Date:         
 	Last Date of Change:   $Date: 2007-03-19 17:48:52 +0100 (Mon, 19 Mär 2007) $      by: $Author: baderma $
 
*/
#ifndef _IOHAL_H_
#define _IOHAL_H_

#include "Configuration.h"

#ifndef SIMOS

#define MODE_REGISTER 0x0	/* SCN2681 register layout */
#define STATUS_REGISTER 0x4
#define COMMAND_REGISTER 0x8
#define INTERRUPT_REGISTER 0x14
#define TX_REGISTER 0x0c

#define READY_TO_SEND 0x04	/* ready to send status */

#ifdef TOPSY_BIG_ENDIAN
#define UART_A_BASE 0xbfe00003	/* kernel uncached address */
#define UART_B_BASE 0xbfe00023	/* kernel uncached address */
#else /* TOPSY_BIG_ENDIAN */
#define UART_A_BASE 0xbfe00000	/* kernel uncached address */
#define UART_B_BASE 0xbfe00020	/* kernel uncached address */
#endif /* TOPSY_BIG_ENDIAN */

#define CONSOLE_BASE UART_B_BASE
#define MAXPUTSTRINGLEN 320

#else /* SIMOS */

/* A structure describing the SimOS console registers. */
typedef struct
{
  int intr_status, data;
}
SimOSConsole;


/* ... and a shortcut ``pointer'' to these registers in memory. */
#define _SIMOS_CONSOLE ((SimOSConsole *)0xa0e01000)

#define MAXPUTSTRINGLEN 0xffff /* this is more or less arbitrary, but 2^16

should be large enough ;
) */

#endif /* SIMOS */

/* those two contain hardware driver code */
void ioConsoleInit(void);
void ioConsolePutChar(char c);

#endif
