// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // TBool WlanOsa::Initialize( TBool aUseCachedMemory, TInt aAllocationUnit, void* aDfcQueue ) { TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::Initialize()")); TBool status( ETrue ); iDfcQueue = aDfcQueue; if ( iPimpl ) { status = Pimpl().Initialize( aUseCachedMemory, aAllocationUnit ); } else { status = EFalse; } TraceDump(INFO_LEVEL, (("[WLAN] WlanOsa::Initialize(): status (bool): %d"), status)); return status; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // TBool WlanOsaImpl::Initialize( TBool aUseCachedMemory, TInt aAllocationUnit ) { TBool status( ETrue ); #ifdef __WLAN_ENABLE_DMA iMemoryPool = new WlanMemoryPool( aUseCachedMemory, aAllocationUnit ); if ( iMemoryPool ) { if ( !iMemoryPool->IsValid() ) { TraceDump(ERROR_LEVEL, ("[WLAN] WlanOsaImpl::Initialize: ERROR: WLAN mem pool invalid")); status = EFalse; // memory pool will be freed in the destructor } } else { TraceDump(ERROR_LEVEL, ("[WLAN] WlanOsaImpl::Initialize: ERROR: WLAN mem pool alloc failed")); status = EFalse; } #endif // __WLAN_ENABLE_DMA return status; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // WlanChunk::~WlanChunk() { TraceDump(INFO_LEVEL | MEMCHUNK, (("[WLAN] WlanChunk dtor +: 0x%08x"), this)); TraceDump(INFO_LEVEL | MEMCHUNK, (("[WLAN] WlanChunk dtor -: 0x%08x"), this)); }
// --------------------------------------------------------------------------- // From class MWlanOsaExt. // --------------------------------------------------------------------------- // void WlanOsa::MutexRelease() { TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexRelease() +")); TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), (Kern::CurrentThread()).iId)); // release mutex Kern::MutexSignal( *(Pimpl().iMutex) ); TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexRelease() -")); TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), (Kern::CurrentThread()).iId)); }
// --------------------------------------------------------------------------- // From class MWlanOsaExt. // --------------------------------------------------------------------------- // void WlanOsa::MutexAcquire() { TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexAcquire() +")); TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), (Kern::CurrentThread()).iId)); // acquire mutex Kern::MutexWait( *(Pimpl().iMutex) ); TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa::MutexAcquire() -")); TraceDump(MUTEX_LEVEL, (("[WLAN] current thread id: %d"), (Kern::CurrentThread()).iId)); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TBool RFrameXferBlockProtocolStack::TxPossible( const TWhaTxQueueState& aWhaTxQueueState, TQueueId& aQueueId ) { TBool txPossible ( ETrue ); // In queue priority order, try to locate a Tx packet which is for a // non-full WHA Tx queue if ( aWhaTxQueueState[EVoice] == ETxQueueNotFull && !iVoiceTxQueue.IsEmpty() ) { aQueueId = EVoice; TraceDump( NWSA_TX_DETAILS, ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from VO queue")); } else if ( aWhaTxQueueState[EVideo] == ETxQueueNotFull && !iVideoTxQueue.IsEmpty() ) { aQueueId = EVideo; TraceDump( NWSA_TX_DETAILS, ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from VI queue")); } else if ( aWhaTxQueueState[ELegacy] == ETxQueueNotFull && !iBestEffortTxQueue.IsEmpty() ) { aQueueId = ELegacy; TraceDump( NWSA_TX_DETAILS, ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from BE queue")); } else if ( aWhaTxQueueState[EBackGround] == ETxQueueNotFull && !iBackgroundTxQueue.IsEmpty() ) { aQueueId = EBackGround; TraceDump( NWSA_TX_DETAILS, ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: from BG queue")); } else { txPossible = EFalse; TraceDump( NWSA_TX_DETAILS, ("WLANLDD: RFrameXferBlockProtocolStack::TxPossible: no packet for a non-full wha queue")); } return txPossible; }
// --------------------------------------------------------- // TInt CLanSettings::GetLanSettings( TUint32 aId,SLanSettings &aSettings) // returns KErrNone on success, LAN settings in aSettings // --------------------------------------------------------- // EXPORT_C TInt CLanSettings::GetLanSettings( TUint32 aId,SLanSettings &aSettings) { TraceDump(WARNING_LEVEL,_L("CLanSettings::GetLanSettings()")); if( iLANServiceRecord) { delete iLANServiceRecord; iLANServiceRecord = NULL; } TRAPD( err, iLANServiceRecord = static_cast<CCDLANServiceRecord*>( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord))); if( !err) { iLANServiceRecord->SetRecordId( aId); TRAP( err, iLANServiceRecord->LoadL( *iDBSession)); if( !err) { aSettings.Name = iLANServiceRecord->iRecordName; aSettings.Id = iLANServiceRecord->RecordId(); aSettings.AddrFromServer = iLANServiceRecord->iIpAddrFromServer; aSettings.Addr = iLANServiceRecord->iIpAddr; } } return err; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // TBool WlanChunk::IsInUse() const { TraceDump(INFO_LEVEL | MEMCHUNK , (("[WLAN] WlanChunk::IsInUse +- this: 0x%08x"), this)); return ETrue; }
// --------------------------------------------------------- // TInt CLanSettings::Connect() // returns KErrNone on success // --------------------------------------------------------- // EXPORT_C TInt CLanSettings::Connect() { TraceDump(WARNING_LEVEL,_L("CLanSettings::Connect()")); TRAPD(err,DoConnectL()); return err; }
EXPORT_C CWlanHwInit::~CWlanHwInit() { TraceDump( INFO_LEVEL, ( _L( "CWlanHwInit::~CWlanHwInit()" ) ) ); OstTrace0( TRACE_BORDER, DUP1_CWLANHWINIT_CWLANHWINIT, "CWlanHwInit::~CWlanHwInit()" ); OstTrace0( TRACE_NORMAL, DUP2_CWLANHWINIT_CWLANHWINIT, "CWlanHwInit::~CWlanHwInit()" ); delete iMain; iMain = NULL; }
// ----------------------------------------------------------------------------- // CWlanHwInit::GetMacAddress // ----------------------------------------------------------------------------- // EXPORT_C TInt CWlanHwInit::GetMacAddress( TMacAddr& aMacAddress ) { TraceDump( INFO_LEVEL, ( _L( "CWlanHwInit::GetMacAddress()" ) ) ); OstTrace0( TRACE_BORDER, CWLANHWINIT_GETMACADDRESS, "CWlanHwInit::GetMacAddress()" ); OstTrace0( TRACE_NORMAL, DUP1_CWLANHWINIT_GETMACADDRESS, "CWlanHwInit::GetMacAddress()" ); return iMain->GetMacAddress( aMacAddress ); }
int main() { TRACE("First line"); TRACE("This is a float: %5.2f", 3.5); int n = 15; TRACE("%%Starting loop of %ld repetitions", (long) n); TraceDump(); for (int i = 0; i < n; ++i) { // TRACE("dual"); TRACE("Iteration %d", i); } TRACE("Short string: \"%s\"", "Hello"); TRACE("Long string: \"%s\"", "The quick brown fox jumped over the lazy dog"); TRACE("100%% done"); TraceDump(); }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // TInt WlanChunk::MaxFreeLinkSize() const { TraceDump(INFO_LEVEL | MEMCHUNK , (("[WLAN] WlanChunk::MaxFreeLinkSize +- this: 0x%08x"), this)); TInt available; iHeap->Available( available ); return available; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void* WlanChunk::Alloc( TInt aSize, TBool aZeroStamp ) { TraceDump(INFO_LEVEL | MEMCHUNK | MEMCHUNK_ALLOC, (("[WLAN] WlanChunk::Alloc + this: 0x%08x"), this)); TraceDump(MEMCHUNK_ALLOC, (("[WLAN] allocation request size in bytes: %d"), aSize)); TAny* ptr = iHeap->Alloc( aSize ); if ( ptr && aZeroStamp ) { memset( ptr, 0, aSize ); } TraceDump(INFO_LEVEL | MEMCHUNK | MEMCHUNK_ALLOC, (("[WLAN] WlanChunk::Alloc - this: 0x%08x"), this)); return ptr; }
// ----------------------------------------------------------------------------- // CWlanHwInit::SetHwTestData // ----------------------------------------------------------------------------- // EXPORT_C TInt CWlanHwInit::SetHwTestData( TUint aId, TDesC8& aData ) { TraceDump( INFO_LEVEL, ( _L( "CWlanHwInit::SetHwTestData()" ) ) ); OstTrace0( TRACE_BORDER, DUP1_CWLANHWINIT_SETHWTESTDATA, "CWlanHwInit::SetHwTestData()" ); OstTrace0( TRACE_NORMAL, CWLANHWINIT_SETHWTESTDATA, "CWlanHwInit::SetHwTestData()" ); return iMain->SetHwTestData( aId, aData ); }
// --------------------------------------------------------- // TInt CLanSettings::Disconnect() // --------------------------------------------------------- // EXPORT_C void CLanSettings::Disconnect() { TraceDump(WARNING_LEVEL,_L("CLanSettings::Disconnect()")); delete iDBSession; iDBSession = NULL; delete iLANServiceRecord; iLANServiceRecord = NULL; }
// --------------------------------------------------------- // void CLanSettings::DoConnectL() // Connects to the CommsDat storage server // --------------------------------------------------------- // void CLanSettings::DoConnectL() { TraceDump(ERROR_LEVEL,_L("CLanSettings::DoConnectL()")); if( !iDBSession) { iDBSession = CMDBSession::NewL( KCDCurrentVersion); } }
// --------------------------------------------------------------------------- // From class MWlanOsa. // // --------------------------------------------------------------------------- // MWlanDfc* WlanOsa::DfcCreate() { TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::DfcCreate()")); WlanDfc* dfc( new WlanDfc( *this, iDfcQueue ) ); if ( dfc ) { if ( !(dfc->IsValid()) ) { // construct failure -> destroy delete dfc; dfc = NULL; } } TraceDump(INFO_LEVEL, (("dfc addr: 0x%08x"), dfc)); return dfc; }
// --------------------------------------------------------- // TInt CLanSettings::WriteLanSettings( SLanSettings &aSettings) // returns KErrNone on success, writes LAN settings from aSettings // --------------------------------------------------------- // EXPORT_C TInt CLanSettings::WriteLanSettings( SLanSettings &aSettings) { TraceDump(WARNING_LEVEL,_L("CLanSettings::WriteLanSettings()")); if( iLANServiceRecord) { delete iLANServiceRecord; iLANServiceRecord = NULL; } TRAPD( err, iLANServiceRecord = static_cast<CCDLANServiceRecord*>( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord))); if( !err) { if( aSettings.Id) // updating existing { iLANServiceRecord->SetRecordId( aSettings.Id); TRAP( err, iLANServiceRecord->LoadL( *iDBSession)); if( err) { return err; } } TRAP( err, iLANServiceRecord->iRecordName.SetL( aSettings.Name)); if( err) { return err; } TRAP( err, iLANServiceRecord->iIpAddrFromServer.SetL( aSettings.AddrFromServer)); if( err) { return err; } TRAP( err, iLANServiceRecord->iIpAddr.SetL( aSettings.Addr)); if( err) { return err; } if( aSettings.Id == 0) // create new { iLANServiceRecord->SetRecordId( KCDNewRecordRequest); TRAP( err, iLANServiceRecord->StoreL( *iDBSession)); aSettings.Id = iLANServiceRecord->RecordId(); // return new id to caller } else { TRAP( err, iLANServiceRecord->ModifyL( *iDBSession)); } } return err; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // WlanOsa::WlanOsa() : iPimpl( NULL ), iDfcQueue( NULL ) { TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa ctor")); iPimpl = new WlanOsaImpl(); if ( iPimpl ) { if ( iPimpl->IsValid() ) { // allocation success & object valid -> proceed Validate(); const TUint mutex_order( KMutexOrdGeneral7 ); TraceDump(MUTEX_LEVEL, (("[WLAN] WlanOsa mutex create: order: %d"), mutex_order)); const TInt ret( Kern::MutexCreate( Pimpl().iMutex, KNullDesC, mutex_order) ); if ( ret != KErrNone ) { delete iPimpl; // and invalidate InValidate(); } } else { // osa impl is invalid. Deallocate it delete iPimpl; // we are invalid, too InValidate(); } } else { // allocation failed invalidate object InValidate(); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // TDataBuffer* RFrameXferBlockProtocolStack::GetTxFrame( const TWhaTxQueueState& aWhaTxQueueState, TBool& aMore ) { TraceDump( NWSA_TX_DETAILS, ("WLANLDD: RFrameXferBlockProtocolStack::GetTxFrame")); TraceDump( NWSA_TX_DETAILS, (("WLANLDD: VO: %d packets"), iVoiceTxQueue.GetLength())); TraceDump( NWSA_TX_DETAILS, (("WLANLDD: VI: %d packets"), iVideoTxQueue.GetLength())); TraceDump( NWSA_TX_DETAILS, (("WLANLDD: BE: %d packets"), iBestEffortTxQueue.GetLength())); TraceDump( NWSA_TX_DETAILS, (("WLANLDD: BG: %d packets"), iBackgroundTxQueue.GetLength())); TDataBuffer* packet = NULL; TQueueId queueId ( EQueueIdMax ); if ( TxPossible( aWhaTxQueueState, queueId ) ) { switch ( queueId ) { case EVoice: packet = iVoiceTxQueue.GetPacket(); break; case EVideo: packet = iVideoTxQueue.GetPacket(); break; case ELegacy: packet = iBestEffortTxQueue.GetPacket(); break; case EBackGround: packet = iBackgroundTxQueue.GetPacket(); break; #ifndef NDEBUG default: TraceDump(ERROR_LEVEL, (("WLANLDD: queueId: %d"), queueId)); os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); #endif } aMore = TxPossible( aWhaTxQueueState, queueId ); } else { aMore = EFalse; } TraceDump( NWSA_TX_DETAILS, (("WLANLDD: krn meta hdr: 0x%08x"), reinterpret_cast<TUint32>(packet))); return packet; }
// --------------------------------------------------------------------------- // From class MWlanOsa. // // --------------------------------------------------------------------------- // MWlanTimer* WlanOsa::TimerCreate() { TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::TimerCreate()")); WlanTimer* timer( new WlanTimer( *this, iDfcQueue ) ); if ( timer ) { if ( !(timer->IsValid()) ) { // construct failure -> destroy delete timer; timer = NULL; } } else { TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::TimerCreate() no memory")); } return timer; }
// ----------------------------------------------------------------------------- // Note! This method is executed in the context of the user mode client // thread, but in supervisor mode // ----------------------------------------------------------------------------- // TDataBuffer* RFrameXferBlockProtocolStack::AllocTxBuffer( const TUint8* aTxBuf, TUint16 aBufLength ) { TDataBuffer* packet( NULL ); if ( aTxBuf ) { // Get Packet from Free Queue packet = iFreeQueue.GetPacket(); TraceDump( NWSA_TX_DETAILS, (("WLANLDD: RFrameXferBlockProtocolStack::AllocTxBuffer: krn metahdr addr: 0x%08x"), packet) ); if ( packet ) { packet->KeSetBufferOffset( aTxBuf - reinterpret_cast<TUint8*>(packet) ); packet->SetBufLength( aBufLength ); // reserve appropriate amount of empty space before the Ethernet // frame so that there is space for all the necessary headers, including // the 802.11 MAC header packet->KeSetOffsetToFrameBeginning( iTxOffset[TDataBuffer::KEthernetFrame] ); // return the user space address packet = reinterpret_cast<TDataBuffer*>( reinterpret_cast<TUint8*>(packet) - iUserToKernAddrOffset); } } TraceDump( NWSA_TX_DETAILS, (("WLANLDD: RFrameXferBlockProtocolStack::AllocTxBuffer: user metahdr addr: 0x%08x"), packet) ); return packet; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // WlanChunk::WlanChunk( TUint8* aStartOfBuf, TUint8* aEndOfBuf, TInt aAllocationUnit ) { iHeap = RWlanHeap::FixedHeap( aStartOfBuf, aEndOfBuf - aStartOfBuf, aAllocationUnit ); TraceDump(INFO_LEVEL | MEMCHUNK, (("[WLAN] WlanChunk ctor -: 0x%08x"), this)); }
// ----------------------------------------------------------------------------- // CWlanHwInit::GetHwInitData // ----------------------------------------------------------------------------- // EXPORT_C void CWlanHwInit::GetHwInitData( const TUint8** aInitData, TUint& aInitLength, const TUint8** aFwData, TUint& aFwLength ) { TraceDump( INFO_LEVEL, ( _L( "CWlanHwInit::GetHwInitData()" ) ) ); OstTrace0( TRACE_BORDER, DUP1_CWLANHWINIT_GETHWINITDATA, "CWlanHwInit::GetHwInitData()" ); OstTrace0( TRACE_NORMAL, CWLANHWINIT_GETHWINITDATA, "CWlanHwInit::GetHwInitData()" ); //BOB10d initialization data block is in one piece (NVS + FW) //InitData is not needed *aInitData = NULL; aInitLength = 0; iMain->GetHwInitData( aInitData, aInitLength, aFwData, aFwLength ); TraceDump( INFO_LEVEL, ( _L( "CWlanHwInit::GetHwInitData() aInitData: 0x%x, aInitLength: %d, aFwData: 0x%x, aFwLength: %d " ),aInitData, aInitLength, aFwData, aFwLength ) ); OstTrace1( TRACE_NORMAL, DUP2_CWLANHWINIT_GETHWINITDATA, "CWlanHwInit::GetHwInitData() aInitData: 0x%x", aInitData ); OstTrace1( TRACE_NORMAL, DUP3_CWLANHWINIT_GETHWINITDATA, "CWlanHwInit::GetHwInitData() aInitLength: %d", aInitLength ); OstTrace1( TRACE_NORMAL, DUP4_CWLANHWINIT_GETHWINITDATA, "CWlanHwInit::GetHwInitData() aFwData 0x%x", aFwData ); OstTrace1( TRACE_NORMAL, DUP5_CWLANHWINIT_GETHWINITDATA, "CWlanHwInit::GetHwInitData() aFwLength: %d", aFwLength ); }
// --------------------------------------------------------------------------- // From class MWlanOsa. // // --------------------------------------------------------------------------- // void WlanOsa::TimerDestroy( MWlanTimer* aWlanTimer ) { TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa::TimerDestroy()")); WlanTimer* timer = static_cast< WlanTimer* >( aWlanTimer ); // dequeue just in case timer->Dequeue(); // remove the final reference to the timer instance - this will // cause the object to destroy itself when it is ready to go // (the timer DFC been completed.) timer->RefDel(); }
// ----------------------------------------------------------------------------- // Note! This method is executed in the context of the user mode client // thread, but in supervisor mode // ----------------------------------------------------------------------------- // TDataBuffer* RFrameXferBlock::GetRxFrame() { TDataBuffer* aPacketInKernSpace( NULL ); if ( iRxQueueFront ) { aPacketInKernSpace = iRxQueueFront; TraceDump( RX_FRAME, (("WLANLDD: RFrameXferBlock::GetRxFrame: " "krn metahdr addr: 0x%08x"), reinterpret_cast<TUint32>(aPacketInKernSpace))); iRxQueueFront = iRxQueueFront->iNext; if ( !iRxQueueFront ) { // the queue became empty iRxQueueRear = NULL; } return reinterpret_cast<TDataBuffer*>( reinterpret_cast<TUint8*>(aPacketInKernSpace) - iUserToKernAddrOffset); } else { // the Rx queue is empty TraceDump( RX_FRAME, (("WLANLDD: RFrameXferBlock::GetRxFrame: " "no frames available"))); // return NULL return aPacketInKernSpace; } }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // WlanOsa::~WlanOsa() { TraceDump(INFO_LEVEL, ("[WLAN] WlanOsa dtor")); iDfcQueue = NULL; if ( IsValid() ) { // we are valid -> proceed // close the mutex TraceDump(MUTEX_LEVEL, ("[WLAN] WlanOsa close mutex")); if ( Pimpl().iMutex ) { Pimpl().iMutex->Close( NULL ); } if ( iPimpl ) { delete iPimpl; iPimpl = NULL; } } }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void RFrameXferBlockBase::KeSetTxOffsets( TUint32 aEthernetFrameTxOffset, TUint32 aDot11FrameTxOffset, TUint32 aSnapFrameTxOffset ) { iTxOffset[TDataBuffer::KEthernetFrame] = aEthernetFrameTxOffset; iTxOffset[TDataBuffer::KDot11Frame] = aDot11FrameTxOffset; iTxOffset[TDataBuffer::KSnapFrame] = aSnapFrameTxOffset; iTxOffset[TDataBuffer::KEthernetTestFrame] = aEthernetFrameTxOffset; for ( TUint i = 0; i < TDataBuffer::KFrameTypeMax ; ++i ) { TraceDump( RX_FRAME, (("WLANLDD: RFrameXferBlockBase::KeSetTxOffsets: offset: %d"), iTxOffset[i]) ); } }
// --------------------------------------------------------- // TInt CLanSettings::DeleteLanSettings( TUint32 aId) // returns KErrNone on success, deletes LANService record with ID aId // --------------------------------------------------------- // EXPORT_C TInt CLanSettings::DeleteLanSettings( TUint32 aId) { TraceDump(WARNING_LEVEL,_L("CLanSettings::DeleteLanSettings()")); if( iLANServiceRecord) { delete iLANServiceRecord; iLANServiceRecord = NULL; } TRAPD( err, iLANServiceRecord = static_cast<CCDLANServiceRecord*>( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord))); if( !err) { iLANServiceRecord->SetRecordId( aId); TRAP( err, iLANServiceRecord->DeleteL( *iDBSession)); } return err; }