diff options
| -rw-r--r-- | dev/modules/MBCI/MBCI.h | 100 | ||||
| -rw-r--r-- | docs/drawio/MBCI_DESIGN.drawio | 70 |
2 files changed, 170 insertions, 0 deletions
diff --git a/dev/modules/MBCI/MBCI.h b/dev/modules/MBCI/MBCI.h new file mode 100644 index 00000000..ab9b7e6a --- /dev/null +++ b/dev/modules/MBCI/MBCI.h @@ -0,0 +1,100 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifndef _INC_MODULE_MBCI_H_ +#define _INC_MODULE_MBCI_H_ + +#include <NewKit/Defines.h> +#include <Mod/ACPI/ACPI.h> + +/** +- 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 kMBCIZeroSz (8) + +namespace NeOS +{ + struct IMBCIHost; + + enum + { + kMBCISpeedDeviceInvalid, + kMBCILowSpeedDevice, + kMBCIHighSpeedDevice, + kMBCISpeedDeviceCount, + }; + + /// @brief MBCI Host header. + struct PACKED IMBCIHost final + { + UInt32 Magic; + UInt32 HostId; + UInt16 VendorId; + UInt16 DeviceId; + UInt8 MemoryType; + UInt16 HostType; + UInt16 HostFlags; + UInt8 Error; + UInt32 MMIOTest; + UInt16 State; + UInt8 Status; + UInt8 InterruptEnable; + UInt64 BaseAddressRegister; + UInt64 BaseAddressRegisterSize; + UInt32 CommandIssue; + Char Zero[kMBCIZeroSz]; + }; + + /// @brief MBCI host flags. + enum MBCIHostFlags + { + kMBCIHostFlagsSupportsNothing, // Invalid MBCI device. + kMBCIHostFlagsSupportsAPM, // Advanced Power Management. + kMBCIHostFlagsSupportsDaisyChain, // Is daisy chained. + kMBCIHostFlagsSupportsHWInterrupts, // Has HW interrupts. + kMBCIHostFlagsSupportsDMA, // Has DMA. + kMBCIHostFlagsExtended, // Extended flags table. + }; + + /// @brief MBCI host kind. + enum MBCIHostKind + { + kMBCIHostKindHardDisk, + kMBCIHostKindOpticalDisk, + kMBCIHostKindKeyboardLow, + kMBCIHostKindMouseLow, + kMBCIHostKindMouseHigh, + kMBCIHostKindKeyboardHigh, + kMBCIHostKindNetworkInterface, + kMBCIHostKindDaisyChain, + kMBCIHostKindStartExtended, // Extended vendor table limit. + }; + + enum MBCIHostState + { + kMBCIHostStateInvalid, + kMBCIHostStateReset, + kMBCIHostStateSuccess, + kMBCIHostStateReady, + kMBCIHostStateDmaStart, + kMBCIHostStateDmaEnd, + kMBCIHostStateFail, + kMBCIHostStateCount, + }; + + /// @brief An AuthKey is a context used to decrpy data from an MBCI packet. + typedef UInt64 MBCIAuthKeyType; +} // namespace NeOS + +#endif // ifndef _INC_MODULE_MBCI_H_
\ No newline at end of file diff --git a/docs/drawio/MBCI_DESIGN.drawio b/docs/drawio/MBCI_DESIGN.drawio new file mode 100644 index 00000000..38aa8b92 --- /dev/null +++ b/docs/drawio/MBCI_DESIGN.drawio @@ -0,0 +1,70 @@ +<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" version="26.0.14"> + <diagram name="Page-1" id="hkk8yLV24Qf0g4vqRryx"> + <mxGraphModel dx="1368" dy="751" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> + <root> + <mxCell id="0" /> + <mxCell id="1" parent="0" /> + <mxCell id="lO14xRhUFe0yug9pa5VE-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-1" target="lO14xRhUFe0yug9pa5VE-2"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-1" value="Reset" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="120" y="700" width="140" height="60" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-2" target="lO14xRhUFe0yug9pa5VE-4"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-2" target="lO14xRhUFe0yug9pa5VE-6"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-2" value="Start" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="420" y="700" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-4" target="lO14xRhUFe0yug9pa5VE-1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-4" value="Failed" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="420" y="880" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-6" target="lO14xRhUFe0yug9pa5VE-9"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-6" value="Success, Wait" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="650" y="700" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-9" target="lO14xRhUFe0yug9pa5VE-4"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-9" target="lO14xRhUFe0yug9pa5VE-13"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-9" value="Transfer CMD" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="840" y="700" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-13" target="lO14xRhUFe0yug9pa5VE-15"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-13" value="Read CMD" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="1070" y="700" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-15" target="lO14xRhUFe0yug9pa5VE-4"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-15" target="lO14xRhUFe0yug9pa5VE-18"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-15" value="Do Op" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="1070" y="980" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="lO14xRhUFe0yug9pa5VE-18"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="910" y="1150" as="sourcePoint" /> + <mxPoint x="710" y="760" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="lO14xRhUFe0yug9pa5VE-18" value="Send back and ready" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="1070" y="1120" width="120" height="60" as="geometry" /> + </mxCell> + </root> + </mxGraphModel> + </diagram> +</mxfile>
\ No newline at end of file |
