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
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2021-01-31 13:50:53 +03:00
|
|
|
// Copyright (C) 2001-2021 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
|
|
|
|
|
2023-10-20 22:34:37 +03:00
|
|
|
enum {
|
|
|
|
BX_PAR_DATA = 0,
|
|
|
|
BX_PAR_STAT = 1,
|
|
|
|
BX_PAR_CTRL = 2
|
|
|
|
};
|
2004-01-28 00:38:51 +03:00
|
|
|
|
2001-11-12 04:33:01 +03:00
|
|
|
typedef struct {
|
|
|
|
Bit8u data;
|
|
|
|
struct {
|
2021-01-31 13:50:53 +03:00
|
|
|
bool error;
|
|
|
|
bool slct;
|
|
|
|
bool pe;
|
|
|
|
bool ack;
|
|
|
|
bool busy;
|
2001-11-12 04:33:01 +03:00
|
|
|
} STATUS;
|
|
|
|
struct {
|
2021-01-31 13:50:53 +03:00
|
|
|
bool strobe;
|
|
|
|
bool autofeed;
|
|
|
|
bool init;
|
|
|
|
bool slct_in;
|
|
|
|
bool irq;
|
|
|
|
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;
|
2021-01-31 13:50:53 +03:00
|
|
|
bool file_changed;
|
|
|
|
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
|
2021-02-19 16:13:42 +03:00
|
|
|
static const char* parport_file_param_handler(bx_param_string_c *param, bool set,
|
2017-01-27 19:53:59 +03:00
|
|
|
const char *oldval, const char *val,
|
|
|
|
int maxlen);
|
2006-03-07 21:16:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|