2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2008-11-10 01:04:14 +03:00
|
|
|
// $Id: pit_wrap.h,v 1.29 2008-11-09 22:04:14 vruppert Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2001-06-11 07:09:40 +04:00
|
|
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
|
|
|
//
|
|
|
|
// MandrakeSoft S.A.
|
|
|
|
// 43, rue d'Aboukir
|
|
|
|
// 75002 Paris - France
|
|
|
|
// http://www.linux-mandrake.com/
|
|
|
|
// http://www.mandrakesoft.com/
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
#ifndef _BX_PIT_WRAP_H
|
|
|
|
#define _BX_PIT_WRAP_H
|
|
|
|
|
2001-07-02 00:49:46 +04:00
|
|
|
#include "bochs.h"
|
|
|
|
#include "pit82c54.h"
|
2001-06-11 07:09:40 +04:00
|
|
|
|
|
|
|
#if BX_USE_PIT_SMF
|
|
|
|
# define BX_PIT_SMF static
|
2001-07-02 00:49:46 +04:00
|
|
|
# define BX_PIT_THIS bx_pit.
|
2001-06-11 07:09:40 +04:00
|
|
|
#else
|
|
|
|
# define BX_PIT_SMF
|
2001-07-02 00:49:46 +04:00
|
|
|
# define BX_PIT_THIS this->
|
2001-06-11 07:09:40 +04:00
|
|
|
#endif
|
|
|
|
|
2001-07-02 00:49:46 +04:00
|
|
|
class bx_pit_c : public logfunctions {
|
2001-06-11 07:09:40 +04:00
|
|
|
public:
|
2006-03-08 00:11:20 +03:00
|
|
|
bx_pit_c();
|
|
|
|
virtual ~bx_pit_c() {}
|
|
|
|
BX_PIT_SMF int init(void);
|
2006-09-17 23:19:15 +04:00
|
|
|
BX_PIT_SMF void exit(void);
|
2006-03-08 00:11:20 +03:00
|
|
|
BX_PIT_SMF void reset(unsigned type);
|
|
|
|
BX_PIT_SMF bx_bool periodic(Bit32u usec_delta);
|
2006-05-27 19:54:49 +04:00
|
|
|
BX_PIT_SMF void register_state(void);
|
2001-06-11 07:09:40 +04:00
|
|
|
|
2004-01-16 19:30:46 +03:00
|
|
|
Bit16u get_timer(int Timer) {
|
|
|
|
return s.timer.get_inlatch(Timer);
|
|
|
|
}
|
2001-06-11 07:09:40 +04:00
|
|
|
|
2007-09-28 23:52:08 +04:00
|
|
|
private:
|
2001-06-11 07:09:40 +04:00
|
|
|
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
|
|
|
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
|
|
|
#if !BX_USE_PIT_SMF
|
2006-03-08 00:11:20 +03:00
|
|
|
Bit32u read(Bit32u addr, unsigned len);
|
|
|
|
void write(Bit32u addr, Bit32u Value, unsigned len);
|
2001-06-11 07:09:40 +04:00
|
|
|
#endif
|
|
|
|
|
2001-08-30 06:04:42 +04:00
|
|
|
struct s_type {
|
2001-06-11 07:09:40 +04:00
|
|
|
pit_82C54 timer;
|
|
|
|
Bit8u speaker_data_on;
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool refresh_clock_div2;
|
2001-08-18 07:28:23 +04:00
|
|
|
Bit64u last_usec;
|
|
|
|
Bit32u last_next_event_time;
|
2002-01-31 19:52:00 +03:00
|
|
|
Bit64u total_ticks;
|
2002-02-08 00:22:55 +03:00
|
|
|
Bit64u total_usec;
|
2006-05-01 22:24:47 +04:00
|
|
|
int timer_handle[3];
|
2006-03-08 00:11:20 +03:00
|
|
|
} s;
|
2001-06-11 07:09:40 +04:00
|
|
|
|
2001-08-18 07:28:23 +04:00
|
|
|
static void timer_handler(void *this_ptr);
|
|
|
|
BX_PIT_SMF void handle_timer();
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
BX_PIT_SMF void write_count_reg(Bit8u value, unsigned timerid);
|
|
|
|
BX_PIT_SMF Bit8u read_counter(unsigned timerid);
|
|
|
|
BX_PIT_SMF void latch(unsigned timerid);
|
2001-06-11 07:09:40 +04:00
|
|
|
BX_PIT_SMF void set_GATE(unsigned pit_id, unsigned value);
|
|
|
|
BX_PIT_SMF void start(unsigned timerid);
|
2002-02-08 00:22:55 +03:00
|
|
|
|
2006-01-08 23:39:08 +03:00
|
|
|
BX_PIT_SMF void irq_handler(bx_bool value);
|
2001-06-11 07:09:40 +04:00
|
|
|
};
|
|
|
|
|
2001-07-02 00:49:46 +04:00
|
|
|
extern bx_pit_c bx_pit;
|
2001-06-11 07:09:40 +04:00
|
|
|
|
|
|
|
#endif // #ifndef _BX_PIT_WRAP_H
|