1 //============================================================================
6 // The interface between MDS (MAC Data Service) and MLME.
9 // --------------------------------------------------------------------------
10 // 200209 UN20 Jennifer Xu
12 // 20021108 PD43 Austin Liu
13 // 20030117 PD43 Austin Liu
14 // Deleted MLMEReturnPacket and MLMEProcThread()
16 // Copyright (c) 1996-2002 Winbond Electronics Corp. All Rights Reserved.
17 //============================================================================
18 #include "os_common.h"
22 //=============================================================================
23 u8 MLMESendFrame(struct wbsoft_priv * adapter, u8 *pMMPDU, u16 len, u8 DataType)
24 /* DataType : FRAME_TYPE_802_11_MANAGEMENT, FRAME_TYPE_802_11_MANAGEMENT_CHALLENGE,
25 FRAME_TYPE_802_11_DATA */
27 if (adapter->sMlmeFrame.IsInUsed != PACKET_FREE_TO_USE) {
28 adapter->sMlmeFrame.wNumTxMMPDUDiscarded++;
31 adapter->sMlmeFrame.IsInUsed = PACKET_COME_FROM_MLME;
33 // Keep information for sending
34 adapter->sMlmeFrame.pMMPDU = pMMPDU;
35 adapter->sMlmeFrame.DataType = DataType;
36 // len must be the last setting due to QUERY_SIZE_SECOND of Mds
37 adapter->sMlmeFrame.len = len;
38 adapter->sMlmeFrame.wNumTxMMPDU++;
40 // H/W will enter power save by set the register. S/W don't send null frame
41 //with PWRMgt bit enbled to enter power save now.
43 // Transmit NDIS packet
48 void MLME_GetNextPacket(struct wbsoft_priv *adapter, PDESCRIPTOR desc)
50 desc->InternalUsed = desc->buffer_start_index + desc->buffer_number;
51 desc->InternalUsed %= MAX_DESCRIPTOR_BUFFER_INDEX;
52 desc->buffer_address[desc->InternalUsed] = adapter->sMlmeFrame.pMMPDU;
53 desc->buffer_size[desc->InternalUsed] = adapter->sMlmeFrame.len;
54 desc->buffer_total_size += adapter->sMlmeFrame.len;
55 desc->buffer_number++;
56 desc->Type = adapter->sMlmeFrame.DataType;
59 static void MLMEfreeMMPDUBuffer(struct wbsoft_priv *adapter, s8 *pData)
63 // Reclaim the data buffer
64 for (i = 0; i < MAX_NUM_TX_MMPDU; i++) {
65 if (pData == (s8 *)&(adapter->sMlmeFrame.TxMMPDU[i]))
68 if (adapter->sMlmeFrame.TxMMPDUInUse[i])
69 adapter->sMlmeFrame.TxMMPDUInUse[i] = false;
72 // PD43 Add debug code here???
77 MLME_SendComplete(struct wbsoft_priv * adapter, u8 PacketID, unsigned char SendOK)
79 MLME_TXCALLBACK TxCallback;
81 // Reclaim the data buffer
82 adapter->sMlmeFrame.len = 0;
83 MLMEfreeMMPDUBuffer( adapter, adapter->sMlmeFrame.pMMPDU );
86 TxCallback.bResult = MLME_SUCCESS;
89 adapter->sMlmeFrame.IsInUsed = PACKET_FREE_TO_USE;