Atmosphere-libs/libstratosphere/include/stratosphere/i2c/driver/i2c_i_i2c_driver.hpp
2020-12-02 06:52:44 -08:00

54 lines
1.8 KiB
C++

/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vapours.hpp>
#include <stratosphere/i2c/i2c_types.hpp>
#include <stratosphere/ddsf.hpp>
namespace ams::i2c::driver {
class I2cDeviceProperty;
class II2cDriver : public ::ams::ddsf::IDriver {
NON_COPYABLE(II2cDriver);
NON_MOVEABLE(II2cDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::i2c::II2cDriver, ::ams::ddsf::IDriver);
public:
II2cDriver() : IDriver() { /* ... */ }
virtual ~II2cDriver() { /* ... */ }
virtual void InitializeDriver() = 0;
virtual void FinalizeDriver() = 0;
virtual Result Open() = 0;
virtual void Close() = 0;
virtual Result Send(I2cDeviceProperty *device, const void *src, size_t src_size, TransactionOption option) = 0;
virtual Result Receive(void *dst, size_t dst_size, I2cDeviceProperty *device, TransactionOption option) = 0;
virtual os::SdkMutex &GetTransactionOrderMutex() = 0;
virtual void SuspendBus();
virtual void SuspendPowerBus();
virtual void ResumeBus();
virtual void ResumePowerBus();
virtual const DeviceCode &GetDeviceCode() const = 0;
};
}