2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-01-26 23:23:13 +03:00
|
|
|
// Copyright (C) 2001-2017 The Bochs Project
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// 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
|
2009-02-08 12:05:52 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
#ifndef BX_IODEV_PARPORT_H
|
|
|
|
#define BX_IODEV_PARPORT_H
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
#if BX_USE_PAR_SMF
|
|
|
|
# define BX_PAR_SMF static
|
2002-10-25 01:07:56 +04:00
|
|
|
# define BX_PAR_THIS theParallelDevice->
|
2001-04-10 05:04:59 +04:00
|
|
|
#else
|
|
|
|
# define BX_PAR_SMF
|
|
|
|
# define BX_PAR_THIS this->
|
|
|
|
#endif
|
|
|
|
|
2004-01-28 00:38:51 +03:00
|
|
|
#define BX_PARPORT_MAXDEV 2
|
|
|
|
|
|
|
|
#define BX_PAR_DATA 0
|
|
|
|
#define BX_PAR_STAT 1
|
|
|
|
#define BX_PAR_CTRL 2
|
|
|
|
|
2001-11-12 04:33:01 +03:00
|
|
|
typedef struct {
|
|
|
|
Bit8u data;
|
|
|
|
struct {
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool error;
|
|
|
|
bx_bool slct;
|
|
|
|
bx_bool pe;
|
|
|
|
bx_bool ack;
|
|
|
|
bx_bool busy;
|
2001-11-12 04:33:01 +03:00
|
|
|
} STATUS;
|
|
|
|
struct {
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool strobe;
|
|
|
|
bx_bool autofeed;
|
|
|
|
bx_bool init;
|
|
|
|
bx_bool slct_in;
|
|
|
|
bx_bool irq;
|
|
|
|
bx_bool input;
|
2001-11-12 04:33:01 +03:00
|
|
|
} CONTROL;
|
2004-01-28 00:38:51 +03:00
|
|
|
Bit8u IRQ;
|
2017-01-27 19:53:59 +03:00
|
|
|
bx_param_string_c *file;
|
2002-08-24 14:20:35 +04:00
|
|
|
FILE *output;
|
2017-01-27 19:53:59 +03:00
|
|
|
bx_bool file_changed;
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool initmode;
|
2001-11-12 04:33:01 +03:00
|
|
|
} bx_par_t;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
class bx_parallel_c : public bx_devmodel_c {
|
2001-04-10 05:04:59 +04:00
|
|
|
public:
|
2006-03-08 00:11:20 +03:00
|
|
|
bx_parallel_c();
|
|
|
|
virtual ~bx_parallel_c();
|
|
|
|
virtual void init(void);
|
|
|
|
virtual void reset(unsigned type);
|
2006-05-27 19:54:49 +04:00
|
|
|
virtual void register_state(void);
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
private:
|
2004-01-28 00:38:51 +03:00
|
|
|
bx_par_t s[BX_PARPORT_MAXDEV];
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2004-01-28 00:38:51 +03:00
|
|
|
static void virtual_printer(Bit8u port);
|
2001-11-12 04:33:01 +03:00
|
|
|
|
2001-04-10 05:04:59 +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_PAR_SMF
|
|
|
|
Bit32u read(Bit32u address, unsigned io_len);
|
|
|
|
void write(Bit32u address, Bit32u value, unsigned io_len);
|
|
|
|
#endif
|
2017-01-27 19:53:59 +03:00
|
|
|
static const char* parport_file_param_handler(bx_param_string_c *param, int set,
|
|
|
|
const char *oldval, const char *val,
|
|
|
|
int maxlen);
|
2006-03-07 21:16:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|