os/boardsupport/haitest/bspsvs/suite/bsp/mmc/ldd/src/mmclddmediachange.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#include <kernel.h>
sl@0
    20
#include <mmc.h>
sl@0
    21
#include <locmedia.h>
sl@0
    22
sl@0
    23
#include "mmcldd.h"
sl@0
    24
#include "d_mmcsdif.h"
sl@0
    25
sl@0
    26
/**
sl@0
    27
 * Do a kernel side control for DMMCMediChange
sl@0
    28
 *
sl@0
    29
 * @param TInt aFunction - Request Function ID
sl@0
    30
 * @param TAny* a1 - Given parameter
sl@0
    31
 * @param TAny* a2 - Given parameter
sl@0
    32
 *
sl@0
    33
 * @return TInt the error code
sl@0
    34
 *
sl@0
    35
 * @leave N/A
sl@0
    36
 */
sl@0
    37
TInt DLddMmcCntrlInterface::MediaChangeDoControl(TInt aFunction, TAny* a1, TAny* a2)
sl@0
    38
	{
sl@0
    39
	MMCSDLOG("<--MediaChangeDoControl-->");
sl@0
    40
	TInt r = KErrNone;
sl@0
    41
	
sl@0
    42
	if (!iSocket)
sl@0
    43
		{
sl@0
    44
  		MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iSocket is NULL");		
sl@0
    45
		return KErrGeneral;
sl@0
    46
		}
sl@0
    47
	else if (!iClient)
sl@0
    48
		{
sl@0
    49
  		MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iClient is NULL");		
sl@0
    50
		return KErrGeneral;
sl@0
    51
		}
sl@0
    52
sl@0
    53
	switch(TTCFunctionId(aFunction).FunctionId())
sl@0
    54
		{
sl@0
    55
      	case RMMCSDTestControllerInterface::EMediaChange:
sl@0
    56
      		{
sl@0
    57
			r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange, sizeof(iMediaChange));
sl@0
    58
      		}
sl@0
    59
	  		break;
sl@0
    60
sl@0
    61
		case RMMCSDTestControllerInterface::EMediaStateInfo:
sl@0
    62
	     	{
sl@0
    63
			TMediaState doorState;
sl@0
    64
			doorState = iMediaChange->MediaState();
sl@0
    65
			MMCSDLOG2("EMediaStateInfo : %d",doorState);
sl@0
    66
			r = Kern::ThreadRawWrite(iClient, a1, &doorState, sizeof(TMediaState));
sl@0
    67
			break;
sl@0
    68
	       	}
sl@0
    69
		case RMMCSDTestControllerInterface::EForceMediaChange:
sl@0
    70
        	{
sl@0
    71
			iMediaChange->ForceMediaChange();
sl@0
    72
			MMCSDLOG("Force MediaChange");
sl@0
    73
        	break;
sl@0
    74
			}
sl@0
    75
		case RMMCSDTestControllerInterface::EMediaChangeCounter:
sl@0
    76
        	{
sl@0
    77
    		r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange->iReplyCount, sizeof(iMediaChange->iReplyCount));
sl@0
    78
    		MMCSDLOG2("EMediaChangeCounter : %d",&iMediaChange->iReplyCount);
sl@0
    79
        	break;
sl@0
    80
			}
sl@0
    81
		default:
sl@0
    82
			r = KErrNotFound;
sl@0
    83
			break;
sl@0
    84
sl@0
    85
		}
sl@0
    86
	return(r);
sl@0
    87
	}