sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\drivers\pbus\pccard\epoc\pccd_medchg.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: DPlatPcCardMediaChange::DPlatPcCardMediaChange(TInt aMediaChangeNum) sl@0: // sl@0: // Constructor sl@0: // sl@0: : DPcCardMediaChange(aMediaChangeNum), sl@0: iDelayCallBack(DelayCallBack,this) sl@0: { sl@0: } sl@0: sl@0: TInt DPlatPcCardMediaChange::Create() sl@0: // sl@0: // Initialiser. sl@0: // sl@0: { sl@0: sl@0: TInt r=DPcCardMediaChange::Create(); sl@0: if (r==KErrNone) sl@0: { sl@0: iMedChgIntId=ThePccdCntrlInterface->IntIdMediaChange(iMediaChangeNum); sl@0: r=Interrupt::Bind(iMedChgIntId,Isr,this); sl@0: } sl@0: __KTRACE_OPT(KPBUS1,Kern::Printf("iMedChgIntId); sl@0: ThePccdCntrlInterface->ClearMediaChange(pM->iMediaChangeNum); sl@0: pM->DoorOpenService(); sl@0: } sl@0: sl@0: void DPlatPcCardMediaChange::DelayCallBack(TAny *aPtr) sl@0: // sl@0: // Timer callback after media change sl@0: // sl@0: { sl@0: DPlatPcCardMediaChange* pM=(DPlatPcCardMediaChange*)aPtr; sl@0: pM->DoorClosedService(); sl@0: } sl@0: sl@0: void DPlatPcCardMediaChange::ForceMediaChange() sl@0: { sl@0: Interrupt::Disable(iMedChgIntId); sl@0: ThePccdCntrlInterface->ClearMediaChange(iMediaChangeNum); sl@0: DoorOpenService(); sl@0: } sl@0: sl@0: void DPlatPcCardMediaChange::DoDoorOpen() sl@0: // sl@0: // Called after media change has been recognised sl@0: // sl@0: { sl@0: sl@0: __KTRACE_OPT(KPBUS2,Kern::Printf(">PlatMedCh(%d):DoDoorOpen",iMediaChangeNum)); sl@0: iDelayCallBack.OneShot(NKern::TimerTicks(20),ETrue); sl@0: } sl@0: sl@0: void DPlatPcCardMediaChange::DoDoorClosed() sl@0: // sl@0: // Handle the media door closing (called on tick). sl@0: // sl@0: { sl@0: sl@0: ThePccdCntrlInterface->ClearMediaChange(iMediaChangeNum); sl@0: Interrupt::Enable(iMedChgIntId); sl@0: } sl@0: sl@0: TMediaState DPlatPcCardMediaChange::MediaState() sl@0: // sl@0: // Return status of media changed signal. sl@0: // sl@0: { sl@0: sl@0: return ThePccdCntrlInterface->MediaState(iMediaChangeNum); sl@0: } sl@0: