os/boardsupport/haitest/bspsvs/suite/bsp/mmc/ldd/src/mmclddmediachange.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/bsp/mmc/ldd/src/mmclddmediachange.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <kernel.h>
    1.23 +#include <mmc.h>
    1.24 +#include <locmedia.h>
    1.25 +
    1.26 +#include "mmcldd.h"
    1.27 +#include "d_mmcsdif.h"
    1.28 +
    1.29 +/**
    1.30 + * Do a kernel side control for DMMCMediChange
    1.31 + *
    1.32 + * @param TInt aFunction - Request Function ID
    1.33 + * @param TAny* a1 - Given parameter
    1.34 + * @param TAny* a2 - Given parameter
    1.35 + *
    1.36 + * @return TInt the error code
    1.37 + *
    1.38 + * @leave N/A
    1.39 + */
    1.40 +TInt DLddMmcCntrlInterface::MediaChangeDoControl(TInt aFunction, TAny* a1, TAny* a2)
    1.41 +	{
    1.42 +	MMCSDLOG("<--MediaChangeDoControl-->");
    1.43 +	TInt r = KErrNone;
    1.44 +	
    1.45 +	if (!iSocket)
    1.46 +		{
    1.47 +  		MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iSocket is NULL");		
    1.48 +		return KErrGeneral;
    1.49 +		}
    1.50 +	else if (!iClient)
    1.51 +		{
    1.52 +  		MMCSDLOG("DLddMmcCntrlInterface::MediaChangeDoControl - iClient is NULL");		
    1.53 +		return KErrGeneral;
    1.54 +		}
    1.55 +
    1.56 +	switch(TTCFunctionId(aFunction).FunctionId())
    1.57 +		{
    1.58 +      	case RMMCSDTestControllerInterface::EMediaChange:
    1.59 +      		{
    1.60 +			r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange, sizeof(iMediaChange));
    1.61 +      		}
    1.62 +	  		break;
    1.63 +
    1.64 +		case RMMCSDTestControllerInterface::EMediaStateInfo:
    1.65 +	     	{
    1.66 +			TMediaState doorState;
    1.67 +			doorState = iMediaChange->MediaState();
    1.68 +			MMCSDLOG2("EMediaStateInfo : %d",doorState);
    1.69 +			r = Kern::ThreadRawWrite(iClient, a1, &doorState, sizeof(TMediaState));
    1.70 +			break;
    1.71 +	       	}
    1.72 +		case RMMCSDTestControllerInterface::EForceMediaChange:
    1.73 +        	{
    1.74 +			iMediaChange->ForceMediaChange();
    1.75 +			MMCSDLOG("Force MediaChange");
    1.76 +        	break;
    1.77 +			}
    1.78 +		case RMMCSDTestControllerInterface::EMediaChangeCounter:
    1.79 +        	{
    1.80 +    		r = Kern::ThreadRawWrite(iClient, a1, &iMediaChange->iReplyCount, sizeof(iMediaChange->iReplyCount));
    1.81 +    		MMCSDLOG2("EMediaChangeCounter : %d",&iMediaChange->iReplyCount);
    1.82 +        	break;
    1.83 +			}
    1.84 +		default:
    1.85 +			r = KErrNotFound;
    1.86 +			break;
    1.87 +
    1.88 +		}
    1.89 +	return(r);
    1.90 +	}