diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-B6F0C909-6E58-584E-9270-8066337FCE0F.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-B6F0C909-6E58-584E-9270-8066337FCE0F.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,74 @@ + + + + + +Client +TutorialExplains how to use the MMC Controller interfaces to use MMC hardware. +
Client interfaces

The +following diagram shows the relationship between the Controller and its clients, +and also shows aspects of the relationship between the constituent parts. +In this case, the client is the MultiMediaCard driver, although in general +this could be some other device driver.

+ +

The session is used to pass commands either to the entire stack, +i.e. a broadcast command, or to individual cards in the stack.

The +session provides access to the stack of cards, via a pointer to a stack object, +the iStackP private member. The session is used to pass commands +either to the entire stack, i.e. a broadcast command, or to individual cards +in the stack. An individual card can be accessed via a pointer to the card +object, the iCardP private member. The card objects, TMMCCard types, +are data members of the card array object, TMMCardArray, +which, in turn is a data member of the stack object.

+
Using the MultiMediaCard +stack

Clients of the MMC Controller such as the MMC Media Driver +uses the MMC Controller as follows:

    +
  • requests a pointer to +the stack object, through which the client can obtain pointers to the individual +card objects and interrogate the cards, finding out their media type, capacity, +and capability (via the card’s TCSD object), and whether +the card is present or ready.

  • +
  • creates a session object, +an instance of the DMMCSession class, providing a callback +function for its constructor. The callback is encapsulated as a TMMCCallBack object.

  • +
  • initiates the session +with the pointer to the stack object: DMMCSession::SetStack() .

  • +

The client interacts with the stack in the following manner:

    +
  1. it sets the session +up with the pointer to the card object, by calling DMMCSession::SetCard().

  2. +
  3. it sets the session +up to do a specific job, such as a MultiMediaCard macro command, or a lower +level card command, using the API provided by DMMCSession.

  4. +
  5. it presents the session +to the stack for execution, by calling DMMCSession::Engage().

  6. +
  7. On completion, the stack +calls the client’s callback function. The client then can repeat the cycle +from step 1 or 2.

  8. +

The client can override the default bus configuration settings, i.e. +change the bus clock, enable retries, change time-out values, restore defaults +etc., using the session's stack configuration object, TMmCStackConfig, +although in practice, there is rarely a need to do this.

+
Locking the +MultiMediaCard stack

The DMMCSession API includes +general lower level functions to issue any single command or series of commands +including those currently unknown to the controller. This allows application +specific commands to be supported. It also allows the controller to support +new commands introduced in later versions of the specification (e.g. commands +to support I/O cards).

When issuing a series of application specific +commands, the client will want to lock the stack, preventing any other client +from generating bus activity during this period. This is accomplished by calling DMMCSession::SetupCIMLockStack() and +then engaging that session. If successful, the stack will be locked until DMMCSession::UnlockStack() is +called.

As it may take time for the controller to lock the stack for +that session, the mechanism for locking the stack involves submitting a session +even though no bus activity results. If this session completes successfully +then the stack is locked. The client can then go ahead and invoke its series +of commands - configuring that same session object as necessary each time +and submitting it.

+
See also

Concepts

+
\ No newline at end of file