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
|
|
|
|
2013-07-26 16:20:42 +00:00
|
|
|
u1Byte ODM_Read1Byte(struct odm_dm_struct *pDM_Odm, u4Byte RegAddr)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
return rtw_read8(Adapter,RegAddr);
|
|
|
|
}
|
|
|
|
|
2013-07-26 16:20:42 +00:00
|
|
|
u2Byte ODM_Read2Byte(struct odm_dm_struct *pDM_Odm, u4Byte RegAddr)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
return rtw_read16(Adapter,RegAddr);
|
|
|
|
}
|
|
|
|
|
2013-07-26 16:20:42 +00:00
|
|
|
u4Byte ODM_Read4Byte(struct odm_dm_struct *pDM_Odm, u4Byte RegAddr)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
return rtw_read32(Adapter,RegAddr);
|
|
|
|
}
|
|
|
|
|
2013-07-26 16:20:42 +00:00
|
|
|
void ODM_Write1Byte(struct odm_dm_struct *pDM_Odm, u4Byte RegAddr, u1Byte Data)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_write8(Adapter,RegAddr, Data);
|
|
|
|
}
|
|
|
|
|
2013-07-26 16:20:42 +00:00
|
|
|
void ODM_Write2Byte(struct odm_dm_struct *pDM_Odm, u4Byte RegAddr, u2Byte Data)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_write16(Adapter,RegAddr, Data);
|
|
|
|
}
|
|
|
|
|
2013-07-26 16:20:42 +00:00
|
|
|
void ODM_Write4Byte(struct odm_dm_struct *pDM_Odm, u4Byte RegAddr, u4Byte Data)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_write32(Adapter,RegAddr, Data);
|
|
|
|
}
|
|
|
|
|
2013-07-26 16:20:42 +00:00
|
|
|
void ODM_SetMACReg(struct odm_dm_struct *pDM_Odm, u4Byte RegAddr, u4Byte BitMask, u4Byte Data)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
|
|
|
}
|
|
|
|
|
|
|
|
u4Byte
|
|
|
|
ODM_GetMACReg(
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-07-15 04:50:52 +00:00
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_SetBBReg(
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-07-15 04:50:52 +00:00
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask,
|
|
|
|
u4Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
|
|
|
}
|
|
|
|
|
|
|
|
u4Byte
|
|
|
|
ODM_GetBBReg(
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-07-15 04:50:52 +00:00
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_SetRFReg(
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
|
|
|
enum ODM_RF_RADIO_PATH eRFPath,
|
2013-07-15 04:50:52 +00:00
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask,
|
|
|
|
u4Byte Data
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-07-26 18:36:38 +00:00
|
|
|
PHY_SetRFReg(Adapter, (enum rf_radio_path)eRFPath, RegAddr, BitMask, Data);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u4Byte
|
|
|
|
ODM_GetRFReg(
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
|
|
|
enum ODM_RF_RADIO_PATH eRFPath,
|
2013-07-15 04:50:52 +00:00
|
|
|
u4Byte RegAddr,
|
|
|
|
u4Byte BitMask
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
2013-07-15 04:50:52 +00:00
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
2013-07-26 18:36:38 +00:00
|
|
|
return PHY_QueryRFReg(Adapter, (enum rf_radio_path)eRFPath, RegAddr, BitMask);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
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-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-05-25 20:45:50 +00:00
|
|
|
void * *pPtr,
|
2013-07-15 04:50:52 +00:00
|
|
|
u4Byte length
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
*pPtr = rtw_zvmalloc(length);
|
|
|
|
}
|
|
|
|
|
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-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-05-25 20:45:50 +00:00
|
|
|
void * pPtr,
|
2013-07-15 04:50:52 +00:00
|
|
|
u4Byte length
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
rtw_vmfree(pPtr, length);
|
|
|
|
}
|
2013-07-15 04:50:52 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
s4Byte ODM_CompareMemory(
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-05-25 20:45:50 +00:00
|
|
|
void * pBuf1,
|
|
|
|
void * pBuf2,
|
|
|
|
u4Byte length
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
return _rtw_memcmp(pBuf1,pBuf2,length);
|
|
|
|
}
|
|
|
|
|
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-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-07-26 20:25:06 +00:00
|
|
|
enum RT_SPINLOCK_TYPE type
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
}
|
2013-07-15 04:50:52 +00:00
|
|
|
|
2013-05-19 04:37:45 +00:00
|
|
|
void
|
2013-05-19 04:28:07 +00:00
|
|
|
ODM_ReleaseSpinLock(
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *pDM_Odm,
|
2013-07-26 20:25:06 +00:00
|
|
|
enum RT_SPINLOCK_TYPE type
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* Work item relative API. FOr MP driver only~! */
|
|
|
|
/* */
|
2013-07-26 16:20:42 +00:00
|
|
|
void ODM_InitializeWorkItem(struct odm_dm_struct *pDM_Odm, void *pRtWorkItem,
|
2013-07-15 04:50:52 +00:00
|
|
|
RT_WORKITEM_CALL_BACK RtWorkItemCallback,
|
|
|
|
void *pContext, const char*szID)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-24 02:54:38 +00:00
|
|
|
void ODM_StartWorkItem(void *pRtWorkItem)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-24 02:54:38 +00:00
|
|
|
void ODM_StopWorkItem(void *pRtWorkItem)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-24 02:54:38 +00:00
|
|
|
void ODM_FreeWorkItem(void *pRtWorkItem)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-24 02:54:38 +00:00
|
|
|
void ODM_ScheduleWorkItem(void *pRtWorkItem)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-24 02:54:38 +00:00
|
|
|
void ODM_IsWorkItemScheduled(void *pRtWorkItem)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* ODM Timer relative API. */
|
|
|
|
/* */
|
2013-07-15 04:50:52 +00:00
|
|
|
void ODM_StallExecution(u4Byte usDelay)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
rtw_udelay_os(usDelay);
|
|
|
|
}
|
|
|
|
|
2013-07-15 04:50:52 +00:00
|
|
|
void ODM_delay_ms(u4Byte ms)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
rtw_mdelay_os(ms);
|
|
|
|
}
|
|
|
|
|
2013-07-15 04:50:52 +00:00
|
|
|
void ODM_delay_us(u4Byte us)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
rtw_udelay_os(us);
|
|
|
|
}
|
|
|
|
|
2013-07-15 04:50:52 +00:00
|
|
|
void ODM_sleep_ms(u4Byte ms)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
rtw_msleep_os(ms);
|
|
|
|
}
|
|
|
|
|
2013-07-15 04:50:52 +00:00
|
|
|
void ODM_sleep_us(u4Byte us)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
rtw_usleep_os(us);
|
|
|
|
}
|
|
|
|
|
2013-07-26 20:25:06 +00:00
|
|
|
void ODM_SetTimer(struct odm_dm_struct *pDM_Odm, struct timer_list * pTimer, u4Byte msDelay)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-10 18:25:07 +00:00
|
|
|
_set_timer(pTimer,msDelay ); /* ms */
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-26 20:25:06 +00:00
|
|
|
void ODM_InitializeTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer,
|
|
|
|
void *CallBackFunc, void *pContext,
|
2013-07-15 04:50:52 +00:00
|
|
|
const char *szID)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
PADAPTER Adapter = pDM_Odm->Adapter;
|
|
|
|
_init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm);
|
|
|
|
}
|
|
|
|
|
2013-07-26 20:25:06 +00:00
|
|
|
void ODM_CancelTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
_cancel_timer_ex(pTimer);
|
|
|
|
}
|
|
|
|
|
2013-07-26 20:25:06 +00:00
|
|
|
void ODM_ReleaseTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* ODM FW relative API. */
|
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
u4Byte
|
|
|
|
ODM_FillH2CCmd(
|
2013-07-15 04:50:52 +00:00
|
|
|
pu1Byte pH2CBuffer,
|
|
|
|
u4Byte H2CBufferLen,
|
|
|
|
u4Byte CmdNum,
|
|
|
|
pu4Byte pElementID,
|
|
|
|
pu4Byte pCmdLen,
|
2013-05-25 20:45:50 +00:00
|
|
|
pu1Byte* pCmbBuffer,
|
2013-07-15 04:50:52 +00:00
|
|
|
pu1Byte CmdStartSeq
|
2013-05-19 04:28:07 +00:00
|
|
|
)
|
|
|
|
{
|
2013-05-27 22:32:24 +00:00
|
|
|
return true;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|