2013-05-19 04:28:07 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* include files */
|
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
#include "odm_precomp.h"
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* ODM IO Relative API. */
|
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
|
|
|
u1Byte
|
|
|
|
ODM_Read1Byte(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
prtl8192cd_priv priv = pDM_Odm->priv;
|
|
|
|
return RTL_R8(RegAddr);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return rtw_read8(Adapter,RegAddr);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return PlatformEFIORead1Byte(Adapter, RegAddr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u2Byte
|
|
|
|
ODM_Read2Byte(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
prtl8192cd_priv priv = pDM_Odm->priv;
|
|
|
|
return RTL_R16(RegAddr);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return rtw_read16(Adapter,RegAddr);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return PlatformEFIORead2Byte(Adapter, RegAddr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u4Byte
|
|
|
|
ODM_Read4Byte(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
prtl8192cd_priv priv = pDM_Odm->priv;
|
|
|
|
return RTL_R32(RegAddr);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return rtw_read32(Adapter,RegAddr);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return PlatformEFIORead4Byte(Adapter, RegAddr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_Write1Byte(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u1Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
prtl8192cd_priv priv = pDM_Odm->priv;
|
|
|
|
RTL_W8(RegAddr, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
rtw_write8(Adapter,RegAddr, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformEFIOWrite1Byte(Adapter, RegAddr, Data);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_Write2Byte(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u2Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
prtl8192cd_priv priv = pDM_Odm->priv;
|
|
|
|
RTL_W16(RegAddr, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
rtw_write16(Adapter,RegAddr, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformEFIOWrite2Byte(Adapter, RegAddr, Data);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_Write4Byte(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
prtl8192cd_priv priv = pDM_Odm->priv;
|
|
|
|
RTL_W32(RegAddr, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
rtw_write32(Adapter,RegAddr, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformEFIOWrite4Byte(Adapter, RegAddr, Data);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_SetMACReg(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask,
|
|
|
|
u4Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP))
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u4Byte
|
|
|
|
ODM_GetMACReg(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP))
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_SetBBReg(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask,
|
|
|
|
u4Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP))
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u4Byte
|
|
|
|
ODM_GetBBReg(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP))
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_SetRFReg(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
ODM_RF_RADIO_PATH_E eRFPath,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask,
|
|
|
|
u4Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
PHY_SetRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, Data);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP))
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-06-03 19:52:18 +00:00
|
|
|
PHY_SetRFReg(Adapter, (enum _RF_RADIO_PATH)eRFPath, RegAddr, BitMask, Data);
|
2013-05-19 04:28:07 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u4Byte
|
|
|
|
ODM_GetRFReg(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
ODM_RF_RADIO_PATH_E eRFPath,
|
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
return PHY_QueryRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, 1);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_MP))
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-06-03 19:52:18 +00:00
|
|
|
return PHY_QueryRFReg(Adapter, (enum _RF_RADIO_PATH)eRFPath, RegAddr, BitMask);
|
2013-05-19 04:28:07 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* ODM Memory relative API. */
|
|
|
|
/* */
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_AllocateMemory(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
void * *pPtr,
|
|
|
|
u4Byte length
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
*pPtr = kmalloc(length, GFP_ATOMIC);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
|
|
|
|
*pPtr = rtw_zvmalloc(length);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformAllocateMemory(Adapter, pPtr, length);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* length could be ignored, used to detect memory leakage. */
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_FreeMemory(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
void * pPtr,
|
|
|
|
u4Byte length
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
kfree(pPtr);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
|
|
|
|
rtw_vmfree(pPtr, length);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
2013-07-10 18:25:07 +00:00
|
|
|
/* PADAPTER Adapter = pDM_Odm->Adapter; */
|
2013-05-19 04:28:07 +00:00
|
|
|
PlatformFreeMemory(pPtr, length);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
s4Byte ODM_CompareMemory(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
void * pBuf1,
|
|
|
|
void * pBuf2,
|
|
|
|
u4Byte length
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
return memcmp(pBuf1,pBuf2,length);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
|
|
|
|
return _rtw_memcmp(pBuf1,pBuf2,length);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
return PlatformCompareMemory(pBuf1,pBuf2,length);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* ODM MISC relative API. */
|
|
|
|
/* */
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_AcquireSpinLock(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
RT_SPINLOCK_TYPE type
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformAcquireSpinLock(Adapter, type);
|
|
|
|
#endif
|
|
|
|
}
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_ReleaseSpinLock(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
RT_SPINLOCK_TYPE type
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformReleaseSpinLock(Adapter, type);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* Work item relative API. FOr MP driver only~! */
|
|
|
|
/* */
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_InitializeWorkItem(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
PRT_WORK_ITEM pRtWorkItem,
|
|
|
|
RT_WORKITEM_CALL_BACK RtWorkItemCallback,
|
|
|
|
void * pContext,
|
|
|
|
const char* szID
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformInitializeWorkItem(Adapter, pRtWorkItem, RtWorkItemCallback, pContext, szID);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_StartWorkItem(
|
2013-05-25 20:45:50 +00:00
|
|
|
PRT_WORK_ITEM pRtWorkItem
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PlatformStartWorkItem(pRtWorkItem);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_StopWorkItem(
|
2013-05-25 20:45:50 +00:00
|
|
|
PRT_WORK_ITEM pRtWorkItem
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PlatformStopWorkItem(pRtWorkItem);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_FreeWorkItem(
|
2013-05-25 20:45:50 +00:00
|
|
|
PRT_WORK_ITEM pRtWorkItem
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PlatformFreeWorkItem(pRtWorkItem);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_ScheduleWorkItem(
|
2013-05-25 20:45:50 +00:00
|
|
|
PRT_WORK_ITEM pRtWorkItem
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PlatformScheduleWorkItem(pRtWorkItem);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_IsWorkItemScheduled(
|
2013-05-25 20:45:50 +00:00
|
|
|
PRT_WORK_ITEM pRtWorkItem
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PlatformIsWorkItemScheduled(pRtWorkItem);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* ODM Timer relative API. */
|
|
|
|
/* */
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_StallExecution(
|
2013-05-25 20:45:50 +00:00
|
|
|
u4Byte usDelay
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
rtw_udelay_os(usDelay);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PlatformStallExecution(usDelay);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-27 03:51:56 +00:00
|
|
|
ODM_delay_ms(u4Byte ms)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
delay_ms(ms);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
rtw_mdelay_os(ms);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
delay_ms(ms);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-27 03:51:56 +00:00
|
|
|
ODM_delay_us(u4Byte us)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
delay_us(us);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
rtw_udelay_os(us);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PlatformStallExecution(us);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-27 03:51:56 +00:00
|
|
|
ODM_sleep_ms(u4Byte ms)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
rtw_msleep_os(ms);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-27 03:51:56 +00:00
|
|
|
ODM_sleep_us(u4Byte us)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
rtw_usleep_os(us);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_SetTimer(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
PRT_TIMER pTimer,
|
|
|
|
u4Byte msDelay
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
mod_timer(pTimer, jiffies + (msDelay+9)/10);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
2013-07-10 18:25:07 +00:00
|
|
|
_set_timer(pTimer,msDelay ); /* ms */
|
2013-05-19 04:28:07 +00:00
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformSetTimer(Adapter, pTimer, msDelay);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_InitializeTimer(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
PRT_TIMER pTimer,
|
|
|
|
RT_TIMER_CALL_BACK CallBackFunc,
|
|
|
|
void * pContext,
|
|
|
|
const char* szID
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
pTimer->function = CallBackFunc;
|
|
|
|
pTimer->data = (unsigned long)pDM_Odm;
|
|
|
|
init_timer(pTimer);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
_init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformInitializeTimer(Adapter, pTimer, CallBackFunc,pContext,szID);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_CancelTimer(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
PRT_TIMER pTimer
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
del_timer_sync(pTimer);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
_cancel_timer_ex(pTimer);
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
PlatformCancelTimer(Adapter, pTimer);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_ReleaseTimer(
|
2013-05-25 20:45:50 +00:00
|
|
|
PDM_ODM_T pDM_Odm,
|
|
|
|
PRT_TIMER pTimer
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
|
|
|
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* <20120301, Kordan> If the initilization fails, InitializeAdapterXxx will return regardless of InitHalDm. */
|
|
|
|
/* Hence, uninitialized timers cause BSOD when the driver releases resources since the init fail. */
|
2013-05-19 04:28:07 +00:00
|
|
|
if (pTimer == 0)
|
|
|
|
{
|
|
|
|
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_SERIOUS, ("=====>ODM_ReleaseTimer(), The timer is NULL! Please check it!\n"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlatformReleaseTimer(Adapter, pTimer);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* ODM FW relative API. */
|
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
#if (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_FillH2CCmd(
|
2013-05-25 20:45:50 +00:00
|
|
|
PADAPTER Adapter,
|
|
|
|
u1Byte ElementID,
|
|
|
|
u4Byte CmdLen,
|
|
|
|
pu1Byte pCmdBuffer
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
if (IS_HARDWARE_TYPE_JAGUAR(Adapter))
|
|
|
|
{
|
|
|
|
switch (ElementID)
|
|
|
|
{
|
|
|
|
case ODM_H2C_RSSI_REPORT:
|
|
|
|
FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (IS_HARDWARE_TYPE_8188E(Adapter))
|
|
|
|
{
|
|
|
|
switch (ElementID)
|
|
|
|
{
|
|
|
|
case ODM_H2C_PSD_RESULT:
|
|
|
|
FillH2CCmd88E(Adapter, H2C_88E_PSD_RESULT, CmdLen, pCmdBuffer);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (ElementID)
|
|
|
|
{
|
|
|
|
case ODM_H2C_RSSI_REPORT:
|
|
|
|
FillH2CCmd92C(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);
|
|
|
|
case ODM_H2C_PSD_RESULT:
|
|
|
|
FillH2CCmd92C(Adapter, H2C_92C_PSD_RESULT, CmdLen, pCmdBuffer);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
u4Byte
|
|
|
|
ODM_FillH2CCmd(
|
2013-05-25 20:45:50 +00:00
|
|
|
pu1Byte pH2CBuffer,
|
|
|
|
u4Byte H2CBufferLen,
|
|
|
|
u4Byte CmdNum,
|
|
|
|
pu4Byte pElementID,
|
|
|
|
pu4Byte pCmdLen,
|
|
|
|
pu1Byte* pCmbBuffer,
|
|
|
|
pu1Byte CmdStartSeq
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
|
|
|
|
|
|
|
#elif (DM_ODM_SUPPORT_TYPE & ODM_MP)
|
2013-07-10 18:25:07 +00:00
|
|
|
/* FillH2CCmd(pH2CBuffer, H2CBufferLen, CmdNum, pElementID, pCmdLen, pCmbBuffer, CmdStartSeq); */
|
2013-05-27 22:32:24 +00:00
|
|
|
return false;
|
2013-05-19 04:28:07 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-27 22:32:24 +00:00
|
|
|
return true;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
#endif
|