From 36b8e46de0e92aff31664470bb3587a91517ab99 Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Thu, 3 Oct 2024 05:32:46 +0200 Subject: IMP: Fixes improvements and new APIs and implementations. - Add more threading API calls. - Moved /dev/zka/modules/ to /dev/modules/. - Add APM API inside /dev/modules. - Add SInt{x} types inside Defines.hxx. - Fix formatting inside PRM. Signed-off-by: Amlal EL Mahrouss --- dev/modules/MBCI/Interface.hxx | 10 +++++ dev/modules/MBCI/MBCI.hxx | 99 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 dev/modules/MBCI/Interface.hxx create mode 100644 dev/modules/MBCI/MBCI.hxx (limited to 'dev/modules/MBCI') diff --git a/dev/modules/MBCI/Interface.hxx b/dev/modules/MBCI/Interface.hxx new file mode 100644 index 00000000..e895b3f2 --- /dev/null +++ b/dev/modules/MBCI/Interface.hxx @@ -0,0 +1,10 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include +#include diff --git a/dev/modules/MBCI/MBCI.hxx b/dev/modules/MBCI/MBCI.hxx new file mode 100644 index 00000000..cc525a77 --- /dev/null +++ b/dev/modules/MBCI/MBCI.hxx @@ -0,0 +1,99 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#ifndef _INC_MODULE_MBCI_HXX_ +#define _INC_MODULE_MBCI_HXX_ + +#include +#include + +/** +- VCC (IN) (OUT for MCU) +- CLK (IN) (OUT for MCU) +- ACK (BI) (Contains an Acknowledge Packet Frame) +- D0- (IN) (Starts with the Host Interface Packet Frame) +- D1- (IN) (Starts with the Host Interface Packet Frame) +- D0+ (OUT) (Starts with the Host Interface Packet Frame) +- D1+ (OUT) (Starts with the Host Interface Packet Frame) +- GND (IN) (OUT for MCU) + */ + +#define cMBCIZeroSz (8) +#define cMBCIMagic "MBCI " + +namespace Kernel +{ + struct IMBCIHost; + struct IMBCIHostPacketFrame; + + /// @brief MBCI Packet frame header + struct PACKED IMBCIHostPacketFrame final + { + UInt32 Magic; + UInt32 HostId; + UInt32 Flags; + UInt32 VendorId; + UInt32 DeviceId; + UInt32 DeviceSpeed; + Bool Acknowledge; + Char Zero[cMBCIZeroSz]; + }; + + enum + { + eMBCISpeedDeviceInvalid, + eMBCILowSpeedDevice, + eMBCIHighSpeedDevice, + eMBCISpeedDeviceCount, + }; + + /// @brief MBCI Host Interface header. + struct PACKED IMBCIHost final + { + UInt32 Magic; + UInt32 HostId; + UInt16 VendorId; + UInt16 DeviceId; + UInt8 MemoryType; + UInt16 HostType; + UInt16 HostFlags; + UInt8 Error; + UInt8 Status; + UInt8 InterruptEnable; + UInt64 BaseAddressRegister; + UInt64 BaseAddressRegisterSize; + Char Zero[cMBCIZeroSz]; + }; + + /// @brief MBCI host flags. + enum MBCIHostFlags + { + eMBCIHostFlagsSupportsNothing, // Invalid MBCI device. + eMBCIHostFlagsSupportsAPM, // Advanced Power Management. + eMBCIHostFlagsSupportsDaisyChain, // Is daisy chained. + eMBCIHostFlagsSupportsHWInterrupts, // Has HW interrupts. + eMBCIHostFlagsSupportsDMA, // Has DMA. + eMBCIHostFlagsExtended = __UINT16_MAX__, // Extended flags table. + }; + + enum MBCIHostKind + { + eMBCIHostKindHardDisk, + eMBCIHostKindOpticalDisk, + eMBCIHostKindKeyboardLow, + eMBCIHostKindMouseLow, + eMBCIHostKindMouseHigh, + eMBCIHostKindKeyboardHigh, + eMBCIHostKindNetworkInterface, + eMBCIHostKindDaisyChain, + eMBCIHostKindStartExtended = __UINT16_MAX__, // Extended vendor table. + }; + + /// @brief An AuthKey is a context used to decrpy data from an MBCI packet. + typedef UInt64 MBCIAuthyKeyType; +} // namespace Kernel + +#endif // ifndef _INC_MODULE_MBCI_HXX_ -- cgit v1.2.3