/*
 *  linux/atari/config.c
 *
 *  Copyright (C) 1994 Bj”rn Brauel
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file README.legal in the main directory of this archive
 * for more details.
 */

/*
 * Miscellaneous atari stuff
 */

#include <linux/config.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/mktime.h>
#include <linux/bootinfo.h>

#include <linux/atarihw.h>
#include <linux/atariints.h>

#include <asm/system.h>


void atari_sched_init (isrfunc timer_routine)
{
    unsigned short ticks;
    
    ticks=INT_TICKS + 1;       
    
    /* Automatic EOI-Mode */
    mfp.vec_adr = 0x40;
    /* turn off MFP-Ints */
	  mfp.int_en_a=0x00;
	  mfp.int_en_b=0x00;
	  /* no Masking */
	  mfp.int_mk_a=0xff;
	  mfp.int_mk_b=0xff;
	  /* set Timer A data Register */
	  mfp.tim_dt_a=ticks;

    /* install interrupt service routine for MFP Timer A */
    add_isr (IRQ_MFP_TIMA, timer_routine, 0, NULL); 
    /* start timer A */
	  mfp.tim_ct_a=0x06; 
	  /* enable timer A Interrupt */   
	  mfp.int_en_a=0x20;
	  /* enable ACIA Interrupts */ 
	  mfp.int_en_b=0x40;
}

unsigned long atari_gettimeoffset (void)
{
    unsigned short tim;
    unsigned long ticks, flags;

    save_flags(flags);
    cli();

    ticks = (unsigned long)mfp.tim_dt_a;
    restore_flags(flags);
    
    ticks = (INT_TICKS-1) - ticks;
    ticks = ticks * 10000L / INT_TICKS;
    
    return ticks;

}

void atari_gettod (struct mktime *timep)
{
}

void waitbut (void)
{
}

void ata_serial_print (const char *str)
{
}
