moel@236: /* moel@236: moel@344: This Source Code Form is subject to the terms of the Mozilla Public moel@344: License, v. 2.0. If a copy of the MPL was not distributed with this moel@344: file, You can obtain one at http://mozilla.org/MPL/2.0/. moel@236: moel@344: Copyright (C) 2010 Michael Möller moel@344: moel@236: */ moel@236: moel@236: using System; moel@236: using System.Runtime.InteropServices; moel@236: moel@236: namespace OpenHardwareMonitor.Hardware { moel@236: moel@236: [StructLayout(LayoutKind.Sequential, Pack = 1)] moel@236: internal struct IOControlCode { moel@236: private uint code; moel@236: moel@236: public IOControlCode(uint deviceType, uint function, Access access) : moel@236: this(deviceType, function, Method.Buffered, access) { } moel@236: moel@236: public IOControlCode(uint deviceType, uint function, Method method, moel@236: Access access) moel@236: { moel@236: code = (deviceType << 16) | moel@236: ((uint)access << 14) | (function << 2) | (uint)method; moel@236: } moel@236: moel@236: public enum Method : uint { moel@236: Buffered = 0, moel@236: InDirect = 1, moel@236: OutDirect = 2, moel@236: Neither = 3 moel@236: } moel@236: moel@236: public enum Access : uint { moel@236: Any = 0, moel@236: Read = 1, moel@236: Write = 2 moel@236: } moel@236: } moel@236: }