sl@0: // Copyright (c) 2008-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\iic_transaction.cpp sl@0: // IIC Transaction API Implementation sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: EXPORT_C void TIicBusSlaveCallback::DfcFunc(TAny* aPtr) sl@0: { sl@0: TIicBusSlaveCallback* pCb = (TIicBusSlaveCallback*) aPtr; sl@0: // pCb can be NULL if a client corrupt it after the dfc has been queued sl@0: __ASSERT_DEBUG(pCb != NULL, Kern::Fault(KIicPanic,__LINE__)); sl@0: DIicBusChannelSlave* chan = pCb->iChannel; sl@0: __ASSERT_DEBUG(chan != NULL, Kern::Fault(KIicPanic,__LINE__)); sl@0: sl@0: chan->ProcessData(pCb->iTrigger, pCb); // Call PSL to fill in iReturn, iRxWords and/or iTxWords sl@0: // sl@0: // Only invoke the client's callback (and update the state machine) if asynchronous channel capture has sl@0: // completed, or if one of the requested triggers has occurred or if a bus error has been witnessed sl@0: TInt8 callbackTrig = 0; sl@0: TInt callbackRet = 0; sl@0: TInt nextSteps = chan->UpdateReqTrig(callbackTrig, callbackRet); sl@0: if(nextSteps & DIicBusChannelSlave::EStopTimer) sl@0: { sl@0: chan->StopTimer(); sl@0: } sl@0: if(nextSteps & DIicBusChannelSlave::EInvokeCb) sl@0: { sl@0: (pCb->iCallback)(pCb->iChannelId, callbackRet, (TInt)callbackTrig, pCb->iRxWords, pCb->iTxWords, pCb->iParam); sl@0: // Callback now processed, so re-initialise callback object members sl@0: pCb->iTrigger = 0; sl@0: pCb->iReturn = KErrNone; sl@0: pCb->iRxWords = 0; sl@0: pCb->iTxWords = 0; sl@0: } sl@0: if(nextSteps & DIicBusChannelSlave::EStartTimer) sl@0: { sl@0: chan->StartTimerByState(); sl@0: } sl@0: }