fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
at master 82 lines 3.1 kB view raw
1/***************************************************************************** 2 * pce * 3 *****************************************************************************/ 4 5/***************************************************************************** 6 * File name: src/arch/simarm/timer.h * 7 * Created: 2004-11-14 by Hampa Hug <hampa@hampa.ch> * 8 * Copyright: (C) 2004-2013 Hampa Hug <hampa@hampa.ch> * 9 * Copyright: (C) 2004-2006 Lukas Ruf <ruf@lpr.ch> * 10 *****************************************************************************/ 11 12/***************************************************************************** 13 * This program is free software. You can redistribute it and / or modify it * 14 * under the terms of the GNU General Public License version 2 as published * 15 * by the Free Software Foundation. * 16 * * 17 * This program is distributed in the hope that it will be useful, but * 18 * WITHOUT ANY WARRANTY, without even the implied warranty of * 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 20 * Public License for more details. * 21 *****************************************************************************/ 22 23/***************************************************************************** 24 * This software was developed at the Computer Engineering and Networks * 25 * Laboratory (TIK), Swiss Federal Institute of Technology (ETH) Zurich. * 26 *****************************************************************************/ 27 28 29#ifndef PCE_SIMARM_TIMER_H 30#define PCE_SIMARM_TIMER_H 1 31 32 33#include <devices/memory.h> 34 35 36typedef struct ixp_timer_counter_s { 37 unsigned long ctrl; 38 unsigned long load; 39 unsigned long status; 40 unsigned long clear; 41 42 /* clock divisor, remaining clocks */ 43 unsigned long clkdiv; 44 45 /* set to the clocking function if the counter is active */ 46 void (*clock) (struct ixp_timer_counter_s *cntr, unsigned long n); 47 48 void (*irq) (void *ext, unsigned char val); 49 void *irq_ext; 50 unsigned char irq_val; 51} ixp_timer_counter_t; 52 53 54/*!*************************************************************************** 55 * @short The IXP timer context 56 *****************************************************************************/ 57typedef struct ixp_timer_s { 58 mem_blk_t io; 59 60 unsigned long base; 61 62 ixp_timer_counter_t cntr[4]; 63 64 unsigned long twde; 65} ixp_timer_t; 66 67 68void tmr_init (ixp_timer_t *tmr, unsigned long base); 69ixp_timer_t *tmr_new (unsigned long base); 70void tmr_free (ixp_timer_t *tmr); 71void tmr_del (ixp_timer_t *tmr); 72 73mem_blk_t *tmr_get_io (ixp_timer_t *tmr, unsigned i); 74 75int tmr_get_active (ixp_timer_t *tmr, unsigned i); 76 77void tmr_set_irq_f (ixp_timer_t *tmr, unsigned i, void *f, void *ext); 78 79void tmr_clock (ixp_timer_t *tmr, unsigned long n); 80 81 82#endif