Bochs/bochs/iodev/display/ddc.cc

72 lines
2.0 KiB
C++
Raw Normal View History

/////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 The Bochs Project
//
// 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// DDC stub (when ready, this code should return the VESA EDID for the
// Bochs plug&play monitor)
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
// is used to know when we are exporting symbols and when we are importing.
#define BX_PLUGGABLE
#include "bochs.h"
#include "ddc.h"
#define LOG_THIS
bx_ddc_c::bx_ddc_c(void)
{
put("DDC");
s.DCKhost = 1;
s.DDAhost = 1;
s.DCKmon = 1;
s.DDAmon = 1;
s.retval = 0x0f;
}
bx_ddc_c::~bx_ddc_c(void)
{
}
Bit8u bx_ddc_c::read()
{
return s.retval;
}
void bx_ddc_c::write(bx_bool dck, bx_bool dda)
{
if (dck != s.DCKhost) {
BX_INFO(("DCK now %s", dck ? "inactive":"active low"));
s.DCKhost = dck;
}
if (dda != s.DDAhost) {
BX_INFO(("DDA now %s", dda ? "inactive":"active low"));
s.DDAhost = dda;
}
combine_signals();
}
void bx_ddc_c::combine_signals()
{
s.retval = (s.DCKhost & s.DCKmon) << 2;
s.retval |= ((s.DDAhost & s.DDAmon) << 3);
s.retval |= ((s.DDAhost << 1) | s.DCKhost);
}