mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-01 14:41:34 +00:00
35c86ad6bf
Result of running IWYU (https://include-what-you-use.org/) and applying most of the suggestions about unncessary includes and forward declarations. Was motivated by observing that <thread> was being included in ppcopcodes.cpp even though it was unused (found while researching the use of threads), but seems generally good to help with build times and correctness.
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
/*
|
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
|
Copyright (C) 2018-23 divingkatae and maximum
|
|
(theweirdo) spatium
|
|
|
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/** @file Base class for Apple Desktop Bus devices. */
|
|
|
|
#ifndef ADB_DEVICE_H
|
|
#define ADB_DEVICE_H
|
|
|
|
#include <devices/common/hwcomponent.h>
|
|
|
|
#include <string>
|
|
|
|
/** Common ADB device addresses/types. */
|
|
enum {
|
|
ADB_ADDR_KBD = 2, // keyboards
|
|
ADB_ADDR_RELPOS = 3, // relative position devices (mouse)
|
|
ADB_ADDR_ABSPOS = 4, // absolute position devices (graphic tablets)
|
|
};
|
|
|
|
class AdbBus; // forward declaration to prevent compiler errors
|
|
|
|
class AdbDevice : public HWComponent {
|
|
public:
|
|
AdbDevice(std::string name);
|
|
~AdbDevice() = default;
|
|
|
|
int device_postinit() override;
|
|
|
|
virtual void reset() = 0;
|
|
virtual bool talk(const uint8_t dev_addr, const uint8_t reg_num);
|
|
virtual void listen(const uint8_t dev_addr, const uint8_t reg_num);
|
|
virtual uint8_t get_address() { return this->my_addr; };
|
|
|
|
protected:
|
|
uint8_t gen_random_address();
|
|
|
|
virtual bool get_register_0() { return false; };
|
|
virtual bool get_register_1() { return false; };
|
|
virtual bool get_register_2() { return false; };
|
|
virtual bool get_register_3();
|
|
|
|
virtual void set_register_0() {};
|
|
virtual void set_register_1() {};
|
|
virtual void set_register_2() {};
|
|
virtual void set_register_3() {};
|
|
|
|
uint8_t exc_event_flag = 0;
|
|
uint8_t srq_flag = 0;
|
|
uint8_t my_addr = 0;
|
|
uint8_t dev_handler_id = 0;
|
|
bool got_collision = false;
|
|
|
|
AdbBus* host_obj = nullptr;
|
|
};
|
|
|
|
#endif // ADB_DEVICE_H
|