summaryrefslogtreecommitdiffhomepage
path: root/doc/tex/mini_bus_controller_interface.tex
blob: ba2381b75a4c5f55e9567aef5d656d48d3444727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

\documentclass{article}
\usepackage{geometry}
\usepackage{longtable}
\usepackage{listings}
\usepackage{xcolor}
\geometry{margin=1in}
\title{MBCI: Mini Bus Controller Interface Specification}
\author{Amlal El Mahrouss}
\date{\today}

\begin{document}

\maketitle

\section{Overview}
The Mini Bus Controller Interface (MBCI) is a standardized memory-mapped I/O bus specification designed for use in embedded systems and operating system kernels. It provides an extensible framework for managing hardware devices via a shared bus using memory-mapped registers. It is designed to remain abstract and platform-agnostic, leaving platform-specific interrupt and address logic to the HAL.

\section{Signal Lines}
The MBCI bus interface includes the following signal lines:

\begin{itemize}
  \item \textbf{VCC} (IN) – Power supply (OUT for MCU)
  \item \textbf{CLK} (IN) – Clock line (OUT for MCU)
  \item \textbf{ACK} (BI) – Acknowledge line containing packet frame
  \item \textbf{D0-, D1-} (IN) – Host interface packet input
  \item \textbf{D0+, D1+} (OUT) – Host interface packet output
  \item \textbf{GND} (IN) – Ground line (OUT for MCU)
\end{itemize}

\section{Host Structure}

\subsection*{IMBCIHost Structure}

\begin{lstlisting}[language=C++,basicstyle=\ttfamily\footnotesize]
volatile struct IMBCIHost {
  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;
  UInt8  Esb[64];  // Extended Signature Block
  UInt8  Zero[8];
};
\end{lstlisting}

\section{Enumerations}

\subsection*{Device Speeds}
\begin{itemize}
  \item \texttt{kMBCISpeedDeviceInvalid}
  \item \texttt{kMBCILowSpeedDevice}
  \item \texttt{kMBCIHighSpeedDevice}
\end{itemize}

\subsection*{Host Flags}
\begin{itemize}
  \item \texttt{kMBCIHostFlagsSupportsNothing}
  \item \texttt{kMBCIHostFlagsSupportsAPM}
  \item \texttt{kMBCIHostFlagsSupportsDaisyChain}
  \item \texttt{kMBCIHostFlagsSupportsHWInterrupts}
  \item \texttt{kMBCIHostFlagsSupportsDMA}
  \item \texttt{kMBCIHostFlagsExtended}
\end{itemize}

\subsection*{Host Types}
\begin{itemize}
  \item \texttt{kMBCIHostKindHardDisk}
  \item \texttt{kMBCIHostKindOpticalDisk}
  \item \texttt{kMBCIHostKindKeyboardLow}
  \item \texttt{kMBCIHostKindMouseLow}
  \item \texttt{kMBCIHostKindMouseHigh}
  \item \texttt{kMBCIHostKindKeyboardHigh}
  \item \texttt{kMBCIHostKindNetworkInterface}
  \item \texttt{kMBCIHostKindDaisyChain}
  \item \texttt{kMBCIHostKindStartExtended}
\end{itemize}

\subsection*{Host State}
\begin{itemize}
  \item \texttt{kMBCIHostStateInvalid}
  \item \texttt{kMBCIHostStateReset}
  \item \texttt{kMBCIHostStateSuccess}
  \item \texttt{kMBCIHostStateReady}
  \item \texttt{kMBCIHostStateDmaStart}
  \item \texttt{kMBCIHostStateDmaEnd}
  \item \texttt{kMBCIHostStateFail}
  \item \texttt{kMBCIHostStateCount}
\end{itemize}

\section{Functions}

\subsection*{MMIO Test}
Tests if MMIO is accessible by writing and checking a challenge value. Times out if the bus does not respond.

\begin{lstlisting}[language=C++,basicstyle=\ttfamily\footnotesize]
inline BOOL busi_test_mmio(struct IMBCIHost* host, const UInt32 test);
\end{lstlisting}

\subsection*{Auth Key Reader}
Reads the 24-bit auth key encoded in the last three bytes of the Extended Signature Block after verifying MMIO test success:

\begin{lstlisting}[language=C++,basicstyle=\ttfamily\footnotesize]
inline MBCIAuthKeyType mbci_read_auth_key(struct IMBCIHost* host);
\end{lstlisting}

\end{document}