aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/winbond/mlmetxrx.c
blob: 7425a23f12e83c0c093ce37790dde4c3edf8325e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* ============================================================================
  Module Name:
    MLMETxRx.C

  Description:
    The interface between MDS (MAC Data Service) and MLME.

  Revision History:
  --------------------------------------------------------------------------
		200209      UN20 Jennifer Xu
		Initial Release
		20021108    PD43 Austin Liu
		20030117    PD43 Austin Liu
		Deleted MLMEReturnPacket and MLMEProcThread()

  Copyright (c) 1996-2002 Winbond Electronics Corp. All Rights Reserved.
============================================================================ */
#include "sysdef.h"

#include "mds_f.h"

void MLME_GetNextPacket(struct wbsoft_priv *adapter, struct wb35_descriptor *desc)
{
	desc->InternalUsed = desc->buffer_start_index + desc->buffer_number;
	desc->InternalUsed %= MAX_DESCRIPTOR_BUFFER_INDEX;
	desc->buffer_address[desc->InternalUsed] = adapter->sMlmeFrame.pMMPDU;
	desc->buffer_size[desc->InternalUsed] = adapter->sMlmeFrame.len;
	desc->buffer_total_size += adapter->sMlmeFrame.len;
	desc->buffer_number++;
	desc->Type = adapter->sMlmeFrame.DataType;
}

static void MLMEfreeMMPDUBuffer(struct wbsoft_priv *adapter, s8 *pData)
{
	int i;

	/* Reclaim the data buffer */
	for (i = 0; i < MAX_NUM_TX_MMPDU; i++) {
		if (pData == (s8 *)&(adapter->sMlmeFrame.TxMMPDU[i]))
			break;
	}
	if (adapter->sMlmeFrame.TxMMPDUInUse[i])
		adapter->sMlmeFrame.TxMMPDUInUse[i] = false;
	else  {
		/* Something wrong
		 PD43 Add debug code here??? */
	}
}

void
MLME_SendComplete(struct wbsoft_priv *adapter, u8 PacketID, unsigned char SendOK)
{
    /* Reclaim the data buffer */
	adapter->sMlmeFrame.len = 0;
	MLMEfreeMMPDUBuffer(adapter, adapter->sMlmeFrame.pMMPDU);

	/* Return resource */
	adapter->sMlmeFrame.IsInUsed = PACKET_FREE_TO_USE;
}