ASoC: Remove duplicate ADC/DAC widgets from wm_hubs.c
[linux/fpc-iii.git] / drivers / staging / winbond / mlmetxrx.c
blob643ceb060d562d4abc01bdd2ebcb97d25c2d555e
1 //============================================================================
2 // Module Name:
3 // MLMETxRx.C
4 //
5 // Description:
6 // The interface between MDS (MAC Data Service) and MLME.
7 //
8 // Revision History:
9 // --------------------------------------------------------------------------
10 // 200209 UN20 Jennifer Xu
11 // Initial Release
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 "sysdef.h"
20 #include "mds_f.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++;
29 return false;
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
44 Mds_Tx(adapter);
45 return true;
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)
61 int i;
63 // Reclaim the data buffer
64 for (i = 0; i < MAX_NUM_TX_MMPDU; i++) {
65 if (pData == (s8 *)&(adapter->sMlmeFrame.TxMMPDU[i]))
66 break;
68 if (adapter->sMlmeFrame.TxMMPDUInUse[i])
69 adapter->sMlmeFrame.TxMMPDUInUse[i] = false;
70 else {
71 // Something wrong
72 // PD43 Add debug code here???
76 void
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;
88 // Return resource
89 adapter->sMlmeFrame.IsInUsed = PACKET_FREE_TO_USE;