Update contrib.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\drivers\iic_transaction.cpp
15 // IIC Transaction API Implementation
18 #include <drivers/iic_transaction.h>
19 #include <drivers/iic_channel.h>
21 EXPORT_C void TIicBusSlaveCallback::DfcFunc(TAny* aPtr)
23 TIicBusSlaveCallback* pCb = (TIicBusSlaveCallback*) aPtr;
24 // pCb can be NULL if a client corrupt it after the dfc has been queued
25 __ASSERT_DEBUG(pCb != NULL, Kern::Fault(KIicPanic,__LINE__));
26 DIicBusChannelSlave* chan = pCb->iChannel;
27 __ASSERT_DEBUG(chan != NULL, Kern::Fault(KIicPanic,__LINE__));
29 chan->ProcessData(pCb->iTrigger, pCb); // Call PSL to fill in iReturn, iRxWords and/or iTxWords
31 // Only invoke the client's callback (and update the state machine) if asynchronous channel capture has
32 // completed, or if one of the requested triggers has occurred or if a bus error has been witnessed
33 TInt8 callbackTrig = 0;
35 TInt nextSteps = chan->UpdateReqTrig(callbackTrig, callbackRet);
36 if(nextSteps & DIicBusChannelSlave::EStopTimer)
40 if(nextSteps & DIicBusChannelSlave::EInvokeCb)
42 (pCb->iCallback)(pCb->iChannelId, callbackRet, (TInt)callbackTrig, pCb->iRxWords, pCb->iTxWords, pCb->iParam);
43 // Callback now processed, so re-initialise callback object members
45 pCb->iReturn = KErrNone;
49 if(nextSteps & DIicBusChannelSlave::EStartTimer)
51 chan->StartTimerByState();