diff -r 43365a9b78a3 -r d8d70de2bd36 kernel/eka/include/drivers/dma_v2.h --- a/kernel/eka/include/drivers/dma_v2.h Tue Jul 06 15:50:07 2010 +0300 +++ b/kernel/eka/include/drivers/dma_v2.h Wed Aug 18 11:08:29 2010 +0300 @@ -42,13 +42,24 @@ #ifdef _DEBUG #define __DMA_CANT_HAPPEN() Kern::Fault(KDmaPanicCat, __LINE__) #define __DMA_DECLARE_INVARIANT public: void Invariant(); +#define __DMA_DECLARE_VIRTUAL_INVARIANT public: virtual void Invariant(); #define __DMA_INVARIANT() Invariant() #else #define __DMA_CANT_HAPPEN() #define __DMA_DECLARE_INVARIANT +#define __DMA_DECLARE_VIRTUAL_INVARIANT #define __DMA_INVARIANT() #endif +#ifdef __DMASIM__ +#ifdef __PRETTY_FUNCTION__ +#define __DMA_UNREACHABLE_DEFAULT() DMA_PSL_TRACE1("Calling default virtual: %s", __PRETTY_FUNCTION__) +#else +#define __DMA_UNREACHABLE_DEFAULT() DMA_PSL_TRACE("Calling default virtual function") +#endif +#else +#define __DMA_UNREACHABLE_DEFAULT() __DMA_CANT_HAPPEN() +#endif ////////////////////////////////////////////////////////////////////////////// // INTERFACE EXPOSED TO DEVICE-DRIVERS @@ -637,7 +648,7 @@ private: inline void OnDeque(); TInt CheckTransferConfig(const TDmaTransferConfig& aTarget, TUint aCount) const; - TInt CheckMemFlags(const TDmaTransferConfig& aTarget, TUint aCount) const; + TInt CheckMemFlags(const TDmaTransferConfig& aTarget) const; TInt AdjustFragmentSize(TUint& aFragSize, TUint aElementSize, TUint aFrameSize); TUint GetTransferCount(const TDmaTransferArgs& aTransferArgs) const; TUint GetMaxTransferlength(const TDmaTransferArgs& aTransferArgs, TUint aCount) const; @@ -738,11 +749,6 @@ TInt iDesCount; /** DFC queue used to service DMA interrupts. - The DFC thread priority must be higher than any client thread - priority to avoid a situation where a transfer completes while - being cancelled and another transfer is started before the DFC - thread gets a chance to run. This would lead to a stray DFC. - @released */ TDfcQue* iDfcQ; @@ -1232,15 +1238,16 @@ void TFooDmaChannel::QueuedRequestCountChanged() { Kern::MutexWait(*iDmaMutex); - if ((iQueuedRequests > 0) && (iPrevQueuedRequests == 0)) + const TInt queued_now = __e32_atomic_load_acq32(&iQueuedRequests); + if ((queued_now > 0) && (iPrevQueuedRequests == 0)) { IncreasePowerCount(); // Base port specific } - else if ((iQueuedRequests == 0) && (iPrevQueuedRequests > 0)) + else if ((queued_now == 0) && (iPrevQueuedRequests > 0)) { DecreasePowerCount(); // Base port specific } - iPrevQueuedRequests = iQueuedRequests; + iPrevQueuedRequests = queued_now; Kern::MutexSignal(*iDmaMutex); } @@ -1250,17 +1257,18 @@ */ virtual void QueuedRequestCountChanged(); -#if defined(__CPU_ARM) && !defined(__EABI__) - inline virtual ~TDmaChannel() {} // kill really annoying warning -#endif + virtual void SetNullPtr(const DDmaRequest& aReq); + virtual void ResetNullPtr(); + + inline virtual ~TDmaChannel() {} + + inline void Wait(); + inline void Signal(); + inline TBool Flash(); private: static void Dfc(TAny*); void DoDfc(); - inline void Wait(); - inline void Signal(); - inline TBool Flash(); - void ResetStateMachine(); protected: TDmac* iController; // DMAC this channel belongs to (NULL when closed) @@ -1281,13 +1289,14 @@ SDblQue iReqQ; // being/about to be transferred request queue TInt iReqCount; // number of requests attached to this channel TInt iQueuedRequests; // number of requests currently queued on this channel + TBool iCallQueuedRequestFn; // call QueuedRequestCountChanged? (default: true) private: TDmaCancelInfo* iCancelInfo; // ... TBool iRedoRequest; // client ISR callback wants a redo of request TBool iIsrCbRequest; // request on queue using ISR callback - __DMA_DECLARE_INVARIANT + __DMA_DECLARE_VIRTUAL_INVARIANT };