e6b3543cfbdc660bf6ab1ee5dd7991ea8ddbeb39
[firefly-linux-kernel-4.4.55.git] / drivers / staging / rtl8188eu / hal / odm_interface.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20
21 #include "odm_precomp.h"
22 /*  ODM IO Relative API. */
23
24 u8 ODM_Read1Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr)
25 {
26         struct adapter *Adapter = pDM_Odm->Adapter;
27         return rtw_read8(Adapter, RegAddr);
28 }
29
30 u16 ODM_Read2Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr)
31 {
32         struct adapter *Adapter = pDM_Odm->Adapter;
33         return rtw_read16(Adapter, RegAddr);
34 }
35
36 u32 ODM_Read4Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr)
37 {
38         struct adapter *Adapter = pDM_Odm->Adapter;
39         return rtw_read32(Adapter, RegAddr);
40 }
41
42 void ODM_Write1Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u8 Data)
43 {
44         struct adapter *Adapter = pDM_Odm->Adapter;
45         rtw_write8(Adapter, RegAddr, Data);
46 }
47
48 void ODM_Write2Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u16 Data)
49 {
50         struct adapter *Adapter = pDM_Odm->Adapter;
51         rtw_write16(Adapter, RegAddr, Data);
52 }
53
54 void ODM_Write4Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u32 Data)
55 {
56         struct adapter *Adapter = pDM_Odm->Adapter;
57         rtw_write32(Adapter, RegAddr, Data);
58 }
59
60 /*  ODM Memory relative API. */
61 void ODM_AllocateMemory(struct odm_dm_struct *pDM_Odm, void **pPtr, u32 length)
62 {
63         *pPtr = rtw_zvmalloc(length);
64 }
65
66 /*  length could be ignored, used to detect memory leakage. */
67 void ODM_FreeMemory(struct odm_dm_struct *pDM_Odm, void *pPtr, u32 length)
68 {
69         rtw_vmfree(pPtr, length);
70 }
71
72 s32 ODM_CompareMemory(struct odm_dm_struct *pDM_Odm, void *pBuf1, void *pBuf2, u32 length)
73 {
74         return _rtw_memcmp(pBuf1, pBuf2, length);
75 }
76
77 /*  ODM MISC relative API. */
78 void ODM_AcquireSpinLock(struct odm_dm_struct *pDM_Odm, enum RT_SPINLOCK_TYPE type)
79 {
80 }
81
82 void ODM_ReleaseSpinLock(struct odm_dm_struct *pDM_Odm, enum RT_SPINLOCK_TYPE type)
83 {
84 }
85
86 /*  Work item relative API. FOr MP driver only~! */
87 void ODM_InitializeWorkItem(struct odm_dm_struct *pDM_Odm, void *pRtWorkItem,
88                             RT_WORKITEM_CALL_BACK RtWorkItemCallback,
89                             void *pContext, const char *szID)
90 {
91 }
92
93 void ODM_StartWorkItem(void *pRtWorkItem)
94 {
95 }
96
97 void ODM_StopWorkItem(void *pRtWorkItem)
98 {
99 }
100
101 void ODM_FreeWorkItem(void *pRtWorkItem)
102 {
103 }
104
105 void ODM_ScheduleWorkItem(void *pRtWorkItem)
106 {
107 }
108
109 void ODM_IsWorkItemScheduled(void *pRtWorkItem)
110 {
111 }
112
113 void ODM_SetTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer, u32 msDelay)
114 {
115         _set_timer(pTimer, msDelay); /* ms */
116 }
117
118 void ODM_InitializeTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer,
119                          void *CallBackFunc, void *pContext,
120                          const char *szID)
121 {
122         struct adapter *Adapter = pDM_Odm->Adapter;
123         _init_timer(pTimer, Adapter->pnetdev, CallBackFunc, pDM_Odm);
124 }
125
126 void ODM_CancelTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer)
127 {
128         _cancel_timer_ex(pTimer);
129 }
130
131 void ODM_ReleaseTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer)
132 {
133 }
134
135 /*  ODM FW relative API. */
136 u32 ODM_FillH2CCmd(u8 *pH2CBuffer, u32 H2CBufferLen, u32 CmdNum,
137                       u32 *pElementID, u32 *pCmdLen,
138                       u8 **pCmbBuffer, u8 *CmdStartSeq)
139 {
140         return  true;
141 }