23 <p>Each session object has its own individual state machine stack because |
23 <p>Each session object has its own individual state machine stack because |
24 each session runs its own sequence of bus operations, with the controller |
24 each session runs its own sequence of bus operations, with the controller |
25 managing these multiple sequences. This means that each session object has |
25 managing these multiple sequences. This means that each session object has |
26 a state machine object, an instance of the <xref href="GUID-022AC0FE-86EE-3908-A9F8-4A33D04A68A5.dita"><apiname>TMMCStateMachine</apiname></xref> class. </p> |
26 a state machine object, an instance of the <xref href="GUID-022AC0FE-86EE-3908-A9F8-4A33D04A68A5.dita"><apiname>TMMCStateMachine</apiname></xref> class. </p> |
27 <fig id="GUID-3CD3F1EF-FB6A-5D5D-B806-75536F8DF533"> |
27 <fig id="GUID-3CD3F1EF-FB6A-5D5D-B806-75536F8DF533"> |
28 <image href="GUID-4592D493-A47C-5622-8C03-F24FABB4381C_d0e383692_href.png" placement="inline"/> |
28 <image href="GUID-4592D493-A47C-5622-8C03-F24FABB4381C_d0e405416_href.png" placement="inline"/> |
29 </fig> |
29 </fig> |
30 <p>The state machine remembers the next state and child function name, and |
30 <p>The state machine remembers the next state and child function name, and |
31 moves to that state as soon as control returns to the session. </p> |
31 moves to that state as soon as control returns to the session. </p> |
32 <p>The stack chooses the next session to be handled and manages the state |
32 <p>The stack chooses the next session to be handled and manages the state |
33 machine through the state machine dispatcher. </p> |
33 machine through the state machine dispatcher. </p> |
55 it gets the chance to trap those errors if the child state machine function |
55 it gets the chance to trap those errors if the child state machine function |
56 returns those errors. Errors are propagated up the stack, and any error conditions |
56 returns those errors. Errors are propagated up the stack, and any error conditions |
57 not trapped at any level in the state machine hierarchy leads to the state |
57 not trapped at any level in the state machine hierarchy leads to the state |
58 machine terminating with that error value. </p> </li> |
58 machine terminating with that error value. </p> </li> |
59 </ul> <fig id="GUID-064C53DB-6A96-5C6D-B3CD-B40A0251EF66"> |
59 </ul> <fig id="GUID-064C53DB-6A96-5C6D-B3CD-B40A0251EF66"> |
60 <image href="GUID-D8911BE6-100D-588A-8E5C-A429A72AFCDA_d0e383777_href.png" placement="inline"/> |
60 <image href="GUID-D8911BE6-100D-588A-8E5C-A429A72AFCDA_d0e405501_href.png" placement="inline"/> |
61 </fig> <p>In general, the overall state of the state machine reflects the |
61 </fig> <p>In general, the overall state of the state machine reflects the |
62 state of the current state entry; for example, <xref href="GUID-E32D6BC3-F8D9-3F7E-94F6-56633B645D6A.dita#GUID-E32D6BC3-F8D9-3F7E-94F6-56633B645D6A/GUID-48F37107-2D11-3550-890B-D79844A97DBF"><apiname>TMMCStatemachine::State()</apiname></xref> returns |
62 state of the current state entry; for example, <xref href="GUID-E32D6BC3-F8D9-3F7E-94F6-56633B645D6A.dita#GUID-E32D6BC3-F8D9-3F7E-94F6-56633B645D6A/GUID-48F37107-2D11-3550-890B-D79844A97DBF"><apiname>TMMCStatemachine::State()</apiname></xref> returns |
63 the state held in the current state entry. </p> <p>While the flow of control |
63 the state held in the current state entry. </p> <p>While the flow of control |
64 through a stack can be complex, the following diagram shows a short example |
64 through a stack can be complex, the following diagram shows a short example |
65 snapshot. Here, the current state in the current stack entry is <codeph>Sn</codeph> and |
65 snapshot. Here, the current state in the current stack entry is <codeph>Sn</codeph> and |
66 is handled by the function <codeph>PF()</codeph>. The code decides to pass |
66 is handled by the function <codeph>PF()</codeph>. The code decides to pass |
67 control to the child function <codeph>CF()</codeph>, but ensures that, on |
67 control to the child function <codeph>CF()</codeph>, but ensures that, on |
68 completion, the next state in the current stack entry will be <codeph>Sn+1</codeph>. </p> <fig id="GUID-6ACBC49E-14EE-526B-A1A3-426B64BF8476"> |
68 completion, the next state in the current stack entry will be <codeph>Sn+1</codeph>. </p> <fig id="GUID-6ACBC49E-14EE-526B-A1A3-426B64BF8476"> |
69 <image href="GUID-D2D41326-BA88-5A02-805B-5EAEC29ADB5D_d0e383804_href.png" placement="inline"/> |
69 <image href="GUID-D2D41326-BA88-5A02-805B-5EAEC29ADB5D_d0e405528_href.png" placement="inline"/> |
70 </fig> <p>For example, the <xref href="GUID-B5193656-9819-3E00-A335-EEF1726115A5.dita#GUID-B5193656-9819-3E00-A335-EEF1726115A5/GUID-F71A4421-2F9E-39FD-A352-97ECAAFE822D"><apiname>DMMCStack::CIMUpdateAcqSM()</apiname></xref> function |
70 </fig> <p>For example, the <xref href="GUID-B5193656-9819-3E00-A335-EEF1726115A5.dita#GUID-B5193656-9819-3E00-A335-EEF1726115A5/GUID-F71A4421-2F9E-39FD-A352-97ECAAFE822D"><apiname>DMMCStack::CIMUpdateAcqSM()</apiname></xref> function |
71 implements the CIM_UPDATE_ACQ macro as defined by the <i>MultiMediaCard System |
71 implements the CIM_UPDATE_ACQ macro as defined by the <i>MultiMediaCard System |
72 Specification</i>, and is a typical state machine function. </p> <p>Most commands |
72 Specification</i>, and is a typical state machine function. </p> <p>Most commands |
73 and macros involve one or more asynchronous operations and while such operations |
73 and macros involve one or more asynchronous operations and while such operations |
74 are outstanding, a session is blocked. While a session is blocked, its state |
74 are outstanding, a session is blocked. While a session is blocked, its state |
229 a state machine calling sequence</title> <p>This shows the state machine calling |
229 a state machine calling sequence</title> <p>This shows the state machine calling |
230 sequence that implements the reading of a single block on a MultiMediaCard, |
230 sequence that implements the reading of a single block on a MultiMediaCard, |
231 where the card is not yet selected. Note that the lowest level state machine |
231 where the card is not yet selected. Note that the lowest level state machine |
232 function called is <codeph>IssueMMCCommandSM()</codeph>, which is implemented |
232 function called is <codeph>IssueMMCCommandSM()</codeph>, which is implemented |
233 by the base port. </p> <fig id="GUID-A67E1B8E-322A-5AC8-9EEA-AC24C8868E81"> |
233 by the base port. </p> <fig id="GUID-A67E1B8E-322A-5AC8-9EEA-AC24C8868E81"> |
234 <image href="GUID-A51C3E48-3ED0-519B-A128-C5175D7E175B_d0e384203_href.png" placement="inline"/> |
234 <image href="GUID-A51C3E48-3ED0-519B-A128-C5175D7E175B_d0e405927_href.png" placement="inline"/> |
235 </fig> </section> |
235 </fig> </section> |
236 </conbody></concept> |
236 </conbody></concept> |