1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0"" |
4 // under the terms of "Eclipse Public License v1.0"" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1034 the header of the last destination descriptor to complete. |
1034 the header of the last destination descriptor to complete. |
1035 */ |
1035 */ |
1036 virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aSrcCompletedHdr, |
1036 virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aSrcCompletedHdr, |
1037 SDmaDesHdr*& aDstCompletedHdr); |
1037 SDmaDesHdr*& aDstCompletedHdr); |
1038 |
1038 |
1039 virtual ~TDmaChannel(); |
1039 /** This function allows the Platform Specific Layer (PSL) to control the |
|
1040 power management of the channel or its controller by overriding the |
|
1041 PIL's default implementation (which does nothing) and making |
|
1042 appropriate use of the Power Resource Manager (PRM). |
|
1043 |
|
1044 The function gets called by the PIL whenever the channel's queued |
|
1045 requests count has changed in a significant way, either before the |
|
1046 channel's Transfer() method is invoked for a request on a previously |
|
1047 empty request queue, or immediately after the request count has become |
|
1048 zero because of request cancellation or completion. |
|
1049 |
|
1050 Depending on the current value of iQueuedRequests, the PSL may power |
|
1051 down or power up the channel. Note that iQueuedRequests gets accessed |
|
1052 and changed by different threads, so the PSL needs to take the usual |
|
1053 precautions when evaluating the variable's value. |
|
1054 |
|
1055 None of the internal DMA framework mutexes is being held by the PIL |
|
1056 when calling this function. |
|
1057 |
|
1058 @see iQueuedRequests |
|
1059 */ |
|
1060 virtual void QueuedRequestCountChanged(); |
|
1061 |
|
1062 #if defined(__CPU_ARM) && !defined(__EABI__) |
|
1063 inline virtual ~TDmaChannel() {} // kill really annoying warning |
|
1064 #endif |
1040 |
1065 |
1041 private: |
1066 private: |
1042 static void Dfc(TAny*); |
1067 static void Dfc(TAny*); |
1043 void DoDfc(); |
1068 void DoDfc(); |
1044 inline void Wait(); |
1069 inline void Wait(); |
1045 inline void Signal(); |
1070 inline void Signal(); |
1046 inline void Flash(); |
1071 inline TBool Flash(); |
1047 void ResetStateMachine(); |
1072 void ResetStateMachine(); |
1048 |
1073 |
1049 protected: |
1074 protected: |
1050 TDmac* iController; // DMAC this channel belongs to (NULL when closed) |
1075 TDmac* iController; // DMAC this channel belongs to (NULL when closed) |
1051 const SDmacCaps* iDmacCaps; // what is supported by DMAC on this channel |
1076 const SDmacCaps* iDmacCaps; // what is supported by DMAC on this channel |
1052 TUint32 iPslId; // unique identifier provided by PSL |
1077 TUint32 iPslId; // unique identifier provided by PSL |
1053 TBool iDynChannel; // this is a dynamically allocated channel |
1078 TBool iDynChannel; // this is a dynamically allocated channel |
1054 TUint iPriority; // hardware priority of this channel |
1079 TUint iPriority; // hardware priority of this channel |
1055 DMutex* iMutex; // for data accessed in both client & DFC context |
1080 NFastMutex iLock; // for data accessed in both client & DFC context |
1056 SDmaDesHdr* iCurHdr; // fragment being transferred or NULL |
1081 SDmaDesHdr* iCurHdr; // fragment being transferred or NULL |
1057 SDmaDesHdr** iNullPtr; // Pointer to NULL pointer following last fragment |
1082 SDmaDesHdr** iNullPtr; // Pointer to NULL pointer following last fragment |
1058 TDfc iDfc; // transfer completion/failure DFC |
1083 TDfc iDfc; // transfer completion/failure DFC |
1059 TInt iMaxDesCount; // maximum number of allocable descriptors |
1084 TInt iMaxDesCount; // maximum number of allocable descriptors |
1060 TInt iAvailDesCount; // available number of descriptors |
1085 TInt iAvailDesCount; // available number of descriptors |
1062 enum {KErrorFlagMask = 0x80000000}; // bit 31 - error flag |
1087 enum {KErrorFlagMask = 0x80000000}; // bit 31 - error flag |
1063 enum {KCancelFlagMask = 0x40000000}; // bit 30 - cancel flag |
1088 enum {KCancelFlagMask = 0x40000000}; // bit 30 - cancel flag |
1064 enum {KDfcCountMask = 0x3FFFFFFF}; // bits 0-29 - number of queued DFCs |
1089 enum {KDfcCountMask = 0x3FFFFFFF}; // bits 0-29 - number of queued DFCs |
1065 SDblQue iReqQ; // being/about to be transferred request queue |
1090 SDblQue iReqQ; // being/about to be transferred request queue |
1066 TInt iReqCount; // number of requests attached to this channel |
1091 TInt iReqCount; // number of requests attached to this channel |
|
1092 TInt iQueuedRequests; // number of requests currently queued on this channel |
1067 private: |
1093 private: |
1068 TDmaCancelInfo* iCancelInfo; // ... |
1094 TDmaCancelInfo* iCancelInfo; // ... |
1069 TBool iRedoRequest; // client ISR callback wants a redo of request |
1095 TBool iRedoRequest; // client ISR callback wants a redo of request |
1070 TBool iIsrCbRequest; // request on queue using ISR callback |
1096 TBool iIsrCbRequest; // request on queue using ISR callback |
1071 |
1097 |