xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/phl/pltfm_ops_none.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2019 - 2020 Realtek Corporation.
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  *****************************************************************************/
15 #ifndef _PLTFM_OPS_NONE_H_
16 #define _PLTFM_OPS_NONE_H_
17 #include "phl_types.h"
18 
_os_strpbrk(const char * cs,const char * ct)19 static char *_os_strpbrk(const char *cs, const char *ct)
20 {
21 	const char *sc1, *sc2;
22 
23 	for (sc1 = cs; *sc1 != '\0'; ++sc1) {
24 		for (sc2 = ct; *sc2 != '\0'; ++sc2) {
25 			if (*sc1 == *sc2)
26 				return (char *)sc1;
27 		}
28 	}
29 	return NULL;
30 }
_os_strsep(char ** s,const char * ct)31 static __inline char *_os_strsep(char **s, const char *ct)
32 {
33 	char *sbegin = *s;
34 	char *end;
35 
36 	if (sbegin == NULL)
37 		return NULL;
38 
39 	end = _os_strpbrk(sbegin, ct);
40 	if (end)
41 		*end++ = '\0';
42 	*s = end;
43 	return sbegin;
44 }
_os_sscanf(const char * buf,const char * fmt,...)45 static __inline int _os_sscanf(const char *buf, const char *fmt, ...)
46 {
47 	return 0;
48 }
_os_strcmp(const char * s1,const char * s2)49 static __inline int _os_strcmp(const char *s1, const char *s2)
50 {
51 	while (*s1 == *s2) {
52 		if (*s1 == '\0')
53 			break;
54 		s1++;
55 		s2++;
56 	}
57 	return *s1 - *s2;
58 }
_os_strncmp(const char * s1,const char * s2,size_t n)59 static __inline int _os_strncmp(const char *s1, const char *s2, size_t n)
60 {
61 	if (n == 0)
62 		return 0;
63 	while (*s1 == *s2) {
64 		if (*s1 == '\0')
65 			break;
66 		s1++;
67 		s2++;
68 		n--;
69 		if (n == 0)
70 			return 0;
71 		}
72 	return *s1 - *s2;
73 }
_os_strcpy(char * dest,const char * src)74 static __inline char *_os_strcpy(char *dest, const char *src)
75 {
76 	return NULL;
77 }
_os_strncpy(char * dest,const char * src,size_t n)78 static inline char *_os_strncpy(char *dest, const char *src, size_t n)
79 {
80 	return NULL;
81 }
_os_strchr(const char * s,int c)82 static __inline char *_os_strchr(const char *s, int c)
83 {
84 	while (*s != (char)c)
85 		if (*s++ == '\0')
86 			return NULL;
87 	return (char *)s;
88 }
_os_snprintf(char * str,size_t size,const char * format,...)89 static __inline int _os_snprintf(char *str, size_t size, const char *format, ...)
90 {
91 	return 0;
92 }
93 
_os_strncat(char * dest,char * src,size_t n)94 static __inline int _os_strncat(char *dest, char *src, size_t n)
95 {
96 	return 0;
97 }
98 
_os_strlen(u8 * buf)99 static __inline u32 _os_strlen(u8 *buf)
100 {
101 	return 0;
102 }
_os_delay_ms(void * h,u32 ms)103 static __inline void _os_delay_ms(void *h, u32 ms)
104 {
105 }
_os_delay_us(void * h,u32 us)106 static __inline void _os_delay_us(void *h, u32 us)
107 {
108 }
_os_sleep_ms(void * h,u32 ms)109 static __inline void _os_sleep_ms(void *h, u32 ms)
110 {
111 }
_os_sleep_us(void * h,u32 us)112 static __inline void _os_sleep_us(void *h, u32 us)
113 {
114 }
_os_get_cur_time_us(void)115 static inline u32 _os_get_cur_time_us(void)
116 {
117 	return 0;
118 }
_os_get_cur_time_ms(void)119 static inline u32 _os_get_cur_time_ms(void)
120 {
121 	return (_os_get_cur_time_us() / 1000);
122 }
123 
_os_modular64(u64 x,u64 y)124 static inline u64 _os_modular64(u64 x, u64 y)
125 {
126 	return x % y;
127 }
_os_division64(u64 x,u64 y)128 static inline u64 _os_division64(u64 x, u64 y)
129 {
130 	u32 low, low2, high, rem, result;
131 
132 	low = x & 0xFFFFFFFF;
133 	high = x >> 32;
134 	rem = high % (u32)y;
135 	high=  high / (u32)y;
136 	low2 = low >> 16;
137 	low2 += rem << 16;
138 	rem = low2 % (u32)y;
139 	low2 = low2 / (u32)y;
140 	low = low & 0xFFFFFFFF;
141 	low += rem << 16;
142 	rem = low % (u32)y;
143 	low = low / (u32)y;
144 	result = low + ((u64)low2 << 16) + ((u64)high << 32);
145 
146 	return result;
147 }
148 
_os_minus64(u64 x,u64 y)149 static inline u64 _os_minus64(u64 x, u64 y)
150 
151 {
152 	return x - y;
153 }
154 
_os_add64(u64 x,u64 y)155 static inline u64 _os_add64(u64 x, u64 y)
156 
157 {
158 	return x + y;
159 }
160 
_os_div_round_up(u32 x,u32 y)161 static inline u32 _os_div_round_up(u32 x, u32 y)
162 {
163         return (x + y - 1) / y;
164 }
165 
166 #ifdef CONFIG_PCI_HCI
_os_cache_inv(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 direction)167 static inline void _os_cache_inv(void *d, _dma *bus_addr_l, _dma *bus_addr_h,
168 					u32 buf_sz, u8 direction)
169 {
170 }
_os_cache_wback(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 direction)171 static inline void _os_cache_wback(void *d, _dma *bus_addr_l,
172 			_dma *bus_addr_h, u32 buf_sz, u8 direction)
173 {
174 }
175 
176 /* txbd, rxbd, wd */
_os_shmem_alloc(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 cache,u8 direction,void ** os_rsvd)177 static inline void *_os_shmem_alloc(void *d, _dma *bus_addr_l,
178 				    _dma *bus_addr_h, u32 buf_sz,
179 				    u8 cache, u8 direction, void **os_rsvd)
180 {
181 	return NULL;
182 }
_os_shmem_free(void * d,u8 * vir_addr,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 cache,u8 direction,void * os_rsvd)183 static inline void _os_shmem_free(void *d, u8 *vir_addr, _dma *bus_addr_l,
184 				  _dma *bus_addr_h, u32 buf_sz,
185 				  u8 cache, u8 direction, void *os_rsvd)
186 {
187 }
188 #endif /*CONFIG_PCI_HCI*/
189 
_os_pkt_buf_unmap_rx(void * d,_dma bus_addr_l,_dma bus_addr_h,u32 buf_sz)190 static inline void *_os_pkt_buf_unmap_rx(void *d, _dma bus_addr_l, _dma bus_addr_h, u32 buf_sz)
191 {
192 	return NULL;
193 }
194 
_os_pkt_buf_map_rx(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,void * os_priv)195 static inline void *_os_pkt_buf_map_rx(void *d, _dma *bus_addr_l, _dma *bus_addr_h,
196 					u32 buf_sz, void *os_priv)
197 {
198 	return NULL;
199 }
200 
_os_pkt_buf_alloc_rx(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,void ** os_priv)201 static inline void *_os_pkt_buf_alloc_rx(void *d, _dma *bus_addr_l,
202 			_dma *bus_addr_h, u32 buf_sz, void **os_priv)
203 {
204 	return NULL;
205 }
_os_pkt_buf_free_rx(void * d,u8 * vir_addr,_dma bus_addr_l,_dma bus_addr_h,u32 buf_sz,void * os_priv)206 static inline u8 *_os_pkt_buf_free_rx(void *d, u8 *vir_addr, _dma bus_addr_l,
207 			_dma bus_addr_h, u32 buf_sz, void *os_priv)
208 {
209 	return NULL;
210 }
211 
212 /* phl pre-alloc network layer buffer */
_os_alloc_netbuf(void * d,u32 buf_sz,void ** os_priv)213 static inline void * _os_alloc_netbuf(void *d, u32 buf_sz, void **os_priv)
214 {
215 	return NULL; // windows never do this.
216 }
217 
218 /* Free netbuf for error case. (ex. drop rx-reorder packet) */
_os_free_netbuf(void * d,u8 * vir_addr,u32 buf_sz,void * os_priv)219 static inline void _os_free_netbuf(void *d, u8 *vir_addr, u32 buf_sz, void *os_priv)
220 {
221 }
_os_mem_alloc(void * h,u32 buf_sz)222 static __inline void *_os_mem_alloc(void *h, u32 buf_sz)
223 {
224 	return NULL;
225 }
226 
_os_mem_free(void * h,void * buf,u32 buf_sz)227 static __inline void _os_mem_free(void *h, void *buf, u32 buf_sz)
228 {
229 }
230 /*physically contiguous memory if the buffer will be accessed by a DMA device*/
_os_kmem_alloc(void * h,u32 buf_sz)231 static __inline void *_os_kmem_alloc(void *h, u32 buf_sz)
232 {
233 	return NULL;
234 }
235 
236 /*physically contiguous memory if the buffer will be accessed by a DMA device*/
_os_kmem_free(void * h,void * buf,u32 buf_sz)237 static __inline void _os_kmem_free(void *h, void *buf, u32 buf_sz)
238 {
239 }
_os_mem_set(void * h,void * buf,s8 value,u32 size)240 static __inline void _os_mem_set(void *h, void *buf, s8 value, u32 size)
241 {
242 }
_os_mem_cpy(void * h,void * dest,void * src,u32 size)243 static __inline void _os_mem_cpy(void *h, void *dest, void *src, u32 size)
244 {
245 }
_os_mem_cmp(void * h,void * ptr1,void * ptr2,u32 size)246 static __inline int _os_mem_cmp(void *h, void *ptr1, void *ptr2, u32 size)
247 {
248 	return 0;
249 }
_os_init_timer(void * h,_os_timer * timer,void (* call_back_func)(void * context),void * context,const char * sz_id)250 static __inline void _os_init_timer(void *h, _os_timer *timer,
251 		void (*call_back_func)(void *context), void *context,
252 		const char *sz_id)
253 {
254 }
255 
_os_set_timer(void * h,_os_timer * timer,u32 ms_delay)256 static __inline void _os_set_timer(void *h, _os_timer *timer, u32 ms_delay)
257 {
258 }
259 
_os_cancel_timer(void * h,_os_timer * timer)260 static __inline void _os_cancel_timer(void *h, _os_timer *timer)
261 {
262 }
263 
_os_cancel_timer_async(void * d,_os_timer * timer)264 static inline void _os_cancel_timer_async(void *d, _os_timer *timer)
265 {
266 }
267 
_os_release_timer(void * h,_os_timer * timer)268 static __inline void _os_release_timer(void *h, _os_timer *timer)
269 {
270 
271 }
_os_mutex_init(void * h,_os_mutex * mutex)272 static __inline void _os_mutex_init(void *h, _os_mutex *mutex)
273 {
274 }
275 
_os_mutex_deinit(void * h,_os_mutex * mutex)276 static __inline void _os_mutex_deinit(void *h, _os_mutex *mutex)
277 {
278 }
279 
_os_mutex_lock(void * h,_os_mutex * mutex)280 static __inline void _os_mutex_lock(void *h, _os_mutex *mutex)
281 {
282 }
283 
_os_mutex_unlock(void * h,_os_mutex * mutex)284 static __inline void _os_mutex_unlock(void *h, _os_mutex *mutex)
285 {
286 }
287 
_os_sema_init(void * d,_os_sema * sema,int int_cnt)288 static inline void _os_sema_init(void *d, _os_sema *sema, int int_cnt)
289 {
290 }
291 
_os_sema_free(void * d,_os_sema * sema)292 static inline void _os_sema_free(void *d, _os_sema *sema)
293 {
294 }
295 
_os_sema_up(void * d,_os_sema * sema)296 static inline void _os_sema_up(void *d, _os_sema *sema)
297 {
298 }
299 
_os_sema_down(void * d,_os_sema * sema)300 static inline u8 _os_sema_down(void *d, _os_sema *sema)
301 {
302 	return 0;	//success
303 }
304 
305 /* event */
_os_event_init(void * h,_os_event * event)306 static __inline void _os_event_init(void *h, _os_event *event)
307 {
308 }
_os_event_free(void * h,_os_event * event)309 static __inline void _os_event_free(void *h, _os_event *event)
310 {
311 }
_os_event_reset(void * h,_os_event * event)312 static __inline void _os_event_reset(void *h, _os_event *event)
313 {
314 }
315 
_os_event_set(void * h,_os_event * event)316 static __inline void _os_event_set(void *h, _os_event *event)
317 {
318 }
319 
320 /*
321  * m_sec
322  * 	== 0 : wait for completion
323  * 	>  0 : wait for timeout or completion
324  * return value
325  * 	0:timeout
326  * 	otherwise:success
327  */
_os_event_wait(void * h,_os_event * event,u32 m_sec)328 static __inline int _os_event_wait(void *h, _os_event *event, u32 m_sec)
329 {
330 	return 0;
331 }
332 
333 /* spinlock */
_os_spinlock_init(void * d,_os_lock * plock)334 static __inline void _os_spinlock_init(void *d, _os_lock *plock)
335 {
336 }
_os_spinlock_free(void * d,_os_lock * plock)337 static __inline void _os_spinlock_free(void *d, _os_lock *plock)
338 {
339 }
340 
_os_spinlock(void * d,_os_lock * plock,enum lock_type type,_os_spinlockfg * flags)341 static inline void _os_spinlock(void *d, _os_lock *plock,
342 					enum lock_type type, _os_spinlockfg *flags)
343 {
344 }
_os_spinunlock(void * d,_os_lock * plock,enum lock_type type,_os_spinlockfg * flags)345 static inline void _os_spinunlock(void *d, _os_lock *plock,
346 					enum lock_type type, _os_spinlockfg *flags)
347 {
348 }
_os_test_and_clear_bit(int nr,unsigned long * addr)349 static inline int _os_test_and_clear_bit(int nr, unsigned long *addr)
350 {
351 	/*UNDO*/
352 	return 0;
353 }
_os_test_and_set_bit(int nr,unsigned long * addr)354 static inline int _os_test_and_set_bit(int nr, unsigned long *addr)
355 {
356 	/*UNDO*/
357 	return 1;
358 }
359 /* Atomic integer operations */
_os_atomic_set(void * d,_os_atomic * v,int i)360 static __inline void _os_atomic_set(void *d, _os_atomic *v, int i)
361 {
362 }
363 
_os_atomic_read(void * d,_os_atomic * v)364 static __inline int _os_atomic_read(void *d, _os_atomic *v)
365 {
366 	return 0;
367 }
368 
_os_atomic_add(void * d,_os_atomic * v,int i)369 static __inline void _os_atomic_add(void *d, _os_atomic *v, int i)
370 {
371 }
_os_atomic_sub(void * d,_os_atomic * v,int i)372 static __inline void _os_atomic_sub(void *d, _os_atomic *v, int i)
373 {
374 }
375 
_os_atomic_inc(void * d,_os_atomic * v)376 static __inline void _os_atomic_inc(void *d, _os_atomic *v)
377 {
378 }
379 
_os_atomic_dec(void * d,_os_atomic * v)380 static __inline void _os_atomic_dec(void *d, _os_atomic *v)
381 {
382 }
383 
_os_atomic_add_return(void * d,_os_atomic * v,int i)384 static __inline int _os_atomic_add_return(void *d, _os_atomic *v, int i)
385 {
386 	return 0;
387 }
388 
_os_atomic_sub_return(void * d,_os_atomic * v,int i)389 static __inline int _os_atomic_sub_return(void *d, _os_atomic *v, int i)
390 {
391 	return 0;
392 }
393 
_os_atomic_inc_return(void * d,_os_atomic * v)394 static __inline int _os_atomic_inc_return(void *d, _os_atomic *v)
395 {
396 	return 0;
397 }
398 
_os_atomic_dec_return(void * d,_os_atomic * v)399 static __inline int _os_atomic_dec_return(void *d, _os_atomic *v)
400 {
401 	return 0;
402 }
403 /*
404 static __inline bool _os_atomic_inc_unless(void *d, _os_atomic *v, int u)
405 {
406 	return 0;
407 }
408 */
409 
_os_tasklet_init(void * drv_priv,_os_tasklet * task,void (* call_back_func)(void * context),void * context)410 static inline enum rtw_phl_status _os_tasklet_init(void *drv_priv, _os_tasklet *task,
411 	void (*call_back_func)(void* context), void *context)
412 {
413 	return RTW_PHL_STATUS_SUCCESS;
414 }
415 
_os_tasklet_deinit(void * drv_priv,_os_tasklet * task)416 static inline enum rtw_phl_status _os_tasklet_deinit(void *drv_priv, _os_tasklet *task)
417 {
418 	return RTW_PHL_STATUS_SUCCESS;
419 }
420 
_os_tasklet_schedule(void * drv_priv,_os_tasklet * task)421 static inline enum rtw_phl_status _os_tasklet_schedule(void *drv_priv, _os_tasklet *task)
422 {
423 	return RTW_PHL_STATUS_SUCCESS;
424 }
425 
_os_thread_init(void * drv_priv,_os_thread * thread,int (* call_back_func)(void * context),void * context,const char namefmt[])426 static __inline u8 _os_thread_init(	void *drv_priv, _os_thread *thread,
427 					int (*call_back_func)(void * context),
428 					void *context,
429 					const char namefmt[])
430 {
431 	return RTW_PHL_STATUS_FAILURE;
432 }
_os_thread_deinit(void * drv_priv,_os_thread * thread)433 static __inline u8 _os_thread_deinit(void *drv_priv, _os_thread *thread)
434 {
435 	return RTW_PHL_STATUS_FAILURE;
436 }
_os_thread_schedule(void * drv_priv,_os_thread * thread)437 static __inline enum rtw_phl_status _os_thread_schedule(void *drv_priv, _os_thread *thread)
438 {
439 	return RTW_PHL_STATUS_FAILURE;
440 }
_os_thread_stop(void * drv_priv,_os_thread * thread)441 static inline void _os_thread_stop(void *drv_priv, _os_thread *thread)
442 {
443 }
_os_thread_check_stop(void * drv_priv,_os_thread * thread)444 static __inline int _os_thread_check_stop(void *drv_priv, _os_thread *thread)
445 {
446 	return 1;
447 }
_os_thread_wait_stop(void * drv_priv,_os_thread * thread)448 static inline int _os_thread_wait_stop(void *drv_priv, _os_thread *thread)
449 {
450 	return RTW_PHL_STATUS_SUCCESS;
451 }
452 
453 #if 0
454 static inline _os_thread _os_thread_start(int (*threadfn)(void *data),
455 	void *data, const char namefmt[])
456 {
457 	return 0;
458 }
459 static inline bool _os_thread_stop(_os_thread th)
460 {
461 	return 0;
462 }
463 static inline void _os_thread_wait_stop(void)
464 {
465 }
466 static inline int _os_thread_should_stop(void)
467 {
468 	return 0;
469 }
470 #endif
471 
_os_workitem_init(void * drv_priv,_os_workitem * workitem,void (* call_back_func)(void * context),void * context)472 static inline enum rtw_phl_status _os_workitem_init(void *drv_priv, _os_workitem *workitem,
473 			void (*call_back_func)(void* context), void *context)
474 {
475 	return RTW_PHL_STATUS_SUCCESS;
476 }
477 
_os_workitem_schedule(void * drv_priv,_os_workitem * workitem)478 static inline enum rtw_phl_status _os_workitem_schedule(void *drv_priv, _os_workitem *workitem)
479 {
480 	return RTW_PHL_STATUS_SUCCESS;
481 }
482 
_os_workitem_deinit(void * drv_priv,_os_workitem * workitem)483 static inline enum rtw_phl_status _os_workitem_deinit(void *drv_priv, _os_workitem *workitem)
484 {
485 	return RTW_PHL_STATUS_SUCCESS;
486 }
487 
488 /*
489  * _os_read_file - phl read file api
490  * @path: path of the file to open and read
491  * @buf: the address of allocated buffer to store the file content
492  * @sz: the bytes to read at most
493  *
494  * returns bytes read
495  */
_os_read_file(const char * path,u8 * buf,u32 sz)496 static inline u32 _os_read_file(const char *path, u8 *buf, u32 sz)
497 {
498 	/* OS Dependent API */
499 	return 0;
500 }
501 
502 #ifdef CONFIG_PCI_HCI
_os_read8_pcie(void * h,u32 addr)503 static __inline u8 _os_read8_pcie(void *h, u32 addr)
504 {
505 	return 0;
506 }
_os_read16_pcie(void * h,u32 addr)507 static __inline u16 _os_read16_pcie(void *h, u32 addr)
508 {
509 	return 0;
510 
511 }
_os_read32_pcie(void * h,u32 addr)512 static __inline u32 _os_read32_pcie(void *h, u32 addr)
513 {
514 	return 0;
515 }
516 
_os_write8_pcie(void * h,u32 addr,u8 val)517 static __inline u32 _os_write8_pcie(void *h, u32 addr, u8 val)
518 {
519 	return 0;
520 }
_os_write16_pcie(void * h,u32 addr,u16 val)521 static __inline u32 _os_write16_pcie(void *h, u32 addr, u16 val)
522 {
523 	return 0;
524 }
_os_write32_pcie(void * h,u32 addr,u32 val)525 static __inline u32 _os_write32_pcie(void *h, u32 addr, u32 val)
526 {
527 	return 0;
528 }
529 #endif/*#ifdef CONFIG_PCI_HCI*/
530 
531 #ifdef CONFIG_USB_HCI
_os_usbctrl_vendorreq(void * h,u8 request,u16 value,u16 index,void * pdata,u16 len,u8 requesttype)532 static __inline u32 _os_usbctrl_vendorreq(void *h, u8 request, u16 value,
533 			u16 index, void *pdata, u16 len, u8 requesttype)
534 {
535 	return 0;
536 }
537 
os_usb_tx(void * h,u8 * tx_buf_ptr,u8 bulk_id,u32 len,u8 * pkt_data_buf)538 static inline int os_usb_tx(void *h, u8 *tx_buf_ptr,
539 			u8 bulk_id, u32 len, u8 *pkt_data_buf)
540 {
541 	return 1;
542 }
543 
os_enable_usb_out_pipes(void * drv_priv)544 static __inline void os_enable_usb_out_pipes(void *drv_priv)
545 {
546 }
547 
os_disable_usb_out_pipes(void * drv_priv)548 static __inline void os_disable_usb_out_pipes(void *drv_priv)
549 {
550 	/* Free bulkout urb */
551 }
552 
os_out_token_alloc(void * drv_priv)553 static __inline u8 os_out_token_alloc(void *drv_priv)
554 {
555 	return 0; // RTW_PHL_STATUS_SUCCESS
556 }
557 
os_out_token_free(void * drv_priv)558 static __inline void os_out_token_free(void *drv_priv)
559 {
560 }
561 
562 
os_in_token_alloc(void * drv_priv)563 static __inline u8 os_in_token_alloc(void *drv_priv)
564 {
565 	// Allocate in token (pUrb) list
566 	return 0;
567 }
568 
os_in_token_free(void * drv_priv)569 static __inline void os_in_token_free(void *drv_priv)
570 {
571 	// Free in token (pUrb) list
572 }
573 
574 
os_send_usb_in_token(void * drv_priv,void * rxobj,u8 * inbuf,u32 inbuf_len,u8 pipe_idx,u8 minLen)575 static __inline u8 os_send_usb_in_token(void *drv_priv, void *rxobj, u8 *inbuf, u32 inbuf_len, u8 pipe_idx, u8 minLen)
576 {
577 	// send rtw_rx_buf to os
578 	return 0;
579 }
580 
os_enable_usb_in_pipes(void * drv_priv)581 static __inline void os_enable_usb_in_pipes(void *drv_priv)
582 {
583 }
584 
os_disable_usb_in_pipes(void * drv_priv)585 static __inline void os_disable_usb_in_pipes(void *drv_priv)
586 {
587 }
588 
589 #endif /*CONFIG_USB_HCI*/
590 
591 #ifdef CONFIG_SDIO_HCI
_os_sdio_cmd52_r8(void * d,u32 offset)592 static inline u8 _os_sdio_cmd52_r8(void *d, u32 offset)
593 {
594 	return 0;
595 }
596 
_os_sdio_cmd53_r8(void * d,u32 offset)597 static inline u8 _os_sdio_cmd53_r8(void *d, u32 offset)
598 {
599 	return 0;
600 }
601 
_os_sdio_cmd53_r16(void * d,u32 offset)602 static inline u16 _os_sdio_cmd53_r16(void *d, u32 offset)
603 {
604 	return 0;
605 }
606 
_os_sdio_cmd53_r32(void * d,u32 offset)607 static inline u32 _os_sdio_cmd53_r32(void *d, u32 offset)
608 {
609 	return 0;
610 }
611 
_os_sdio_cmd53_rn(void * d,u32 offset,u32 size,u8 * data)612 static inline u8 _os_sdio_cmd53_rn(void *d, u32 offset, u32 size, u8 *data)
613 {
614 	return 0;
615 }
616 
_os_sdio_cmd53_r(void * d,u32 offset,u32 size,u8 * data)617 static inline u8 _os_sdio_cmd53_r(void *d, u32 offset, u32 size, u8 *data)
618 {
619 	return 0;
620 }
621 
_os_sdio_cmd52_w8(void * d,u32 offset,u8 val)622 static inline void _os_sdio_cmd52_w8(void *d, u32 offset, u8 val)
623 {
624 }
625 
_os_sdio_cmd53_w8(void * d,u32 offset,u8 val)626 static inline void _os_sdio_cmd53_w8(void *d, u32 offset, u8 val)
627 {
628 }
629 
_os_sdio_cmd53_w16(void * d,u32 offset,u16 val)630 static inline void _os_sdio_cmd53_w16(void *d, u32 offset, u16 val)
631 {
632 }
633 
_os_sdio_cmd53_w32(void * d,u32 offset,u32 val)634 static inline void _os_sdio_cmd53_w32(void *d, u32 offset, u32 val)
635 {
636 }
637 
_os_sdio_cmd53_wn(void * d,u32 offset,u32 size,u8 * data)638 static inline void _os_sdio_cmd53_wn(void *d, u32 offset, u32 size, u8 *data)
639 {
640 }
641 
_os_sdio_cmd53_w(void * d,u32 offset,u32 size,u8 * data)642 static inline void _os_sdio_cmd53_w(void *d, u32 offset, u32 size, u8 *data)
643 {
644 }
645 
_os_sdio_f0_read(void * d,u32 addr,void * buf,size_t len)646 static inline u8 _os_sdio_f0_read(void *d, u32 addr, void *buf, size_t len)
647 {
648 	return 0;
649 }
650 
_os_sdio_read_cia_r8(void * d,u32 addr)651 static inline u8 _os_sdio_read_cia_r8(void *d, u32 addr)
652 {
653 	return 0;
654 }
655 #endif /*CONFIG_SDIO_HCI*/
656 
657 
658 /*
659 * Continuous bits starting from least significant bit
660 * Example:
661 * BIT_LEN_MASK_32(0) => 0x00000000
662 * BIT_LEN_MASK_32(1) => 0x00000001
663 * BIT_LEN_MASK_32(2) => 0x00000003
664 * BIT_LEN_MASK_32(32) => 0xFFFFFFFF
665 */
666 #define BIT_LEN_MASK_32(__BitLen) ((u32)(0xFFFFFFFF >> (32 - (__BitLen))))
667 #define BIT_LEN_MASK_16(__BitLen) ((u16)(0xFFFF >> (16 - (__BitLen))))
668 #define BIT_LEN_MASK_8(__BitLen) ((u8)(0xFF >> (8 - (__BitLen))))
669 
670 /*
671 * Continuous bits starting from least significant bit
672 * Example:
673 * BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
674 * BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
675 */
676 #define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) ((u32)(BIT_LEN_MASK_32(__BitLen) << (__BitOffset)))
677 #define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) ((u16)(BIT_LEN_MASK_16(__BitLen) << (__BitOffset)))
678 #define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) ((u8)(BIT_LEN_MASK_8(__BitLen) << (__BitOffset)))
679 
680 /*
681 * Convert LE data to host byte order
682 */
683 #define EF1Byte (u8)
684 #define EF2Byte le16_to_cpu
685 #define EF4Byte le32_to_cpu
686 
687 /*
688 * Read LE data from memory to host byte order
689 */
690 #define ReadLE4Byte(_ptr)	le32_to_cpu(*((u32 *)(_ptr)))
691 #define ReadLE2Byte(_ptr)	le16_to_cpu(*((u16 *)(_ptr)))
692 #define ReadLE1Byte(_ptr)	(*((u8 *)(_ptr)))
693 
694 /*
695 * Read BE data from memory to host byte order
696 */
697 #define ReadBEE4Byte(_ptr)	be32_to_cpu(*((u32 *)(_ptr)))
698 #define ReadBE2Byte(_ptr)	be16_to_cpu(*((u16 *)(_ptr)))
699 #define ReadBE1Byte(_ptr)	(*((u8 *)(_ptr)))
700 
701 /*
702 * Write host byte order data to memory in LE order
703 */
704 #define WriteLE4Byte(_ptr, _val)	((*((u32 *)(_ptr))) = cpu_to_le32(_val))
705 #define WriteLE2Byte(_ptr, _val)	((*((u16 *)(_ptr))) = cpu_to_le16(_val))
706 #define WriteLE1Byte(_ptr, _val)	((*((u8 *)(_ptr))) = ((u8)(_val)))
707 
708 /*
709 * Write host byte order data to memory in BE order
710 */
711 #define WriteBE4Byte(_ptr, _val)	((*((u32 *)(_ptr))) = cpu_to_be32(_val))
712 #define WriteBE2Byte(_ptr, _val)	((*((u16 *)(_ptr))) = cpu_to_be16(_val))
713 #define WriteBE1Byte(_ptr, _val)	((*((u8 *)(_ptr))) = ((u8)(_val)))
714 
715 /*
716 * Return 4-byte value in host byte ordering from 4-byte pointer in litten-endian system.
717 */
718 #define LE_P4BYTE_TO_HOST_4BYTE(__pStart) (le32_to_cpu(*((u32 *)(__pStart))))
719 #define LE_P2BYTE_TO_HOST_2BYTE(__pStart) (le16_to_cpu(*((u16 *)(__pStart))))
720 #define LE_P1BYTE_TO_HOST_1BYTE(__pStart) ((*((u8 *)(__pStart))))
721 
722 /*
723 * Return 4-byte value in host byte ordering from 4-byte pointer in big-endian system.
724 */
725 #define BE_P4BYTE_TO_HOST_4BYTE(__pStart) (be32_to_cpu(*((u32 *)(__pStart))))
726 #define BE_P2BYTE_TO_HOST_2BYTE(__pStart) (be16_to_cpu(*((u16 *)(__pStart))))
727 #define BE_P1BYTE_TO_HOST_1BYTE(__pStart) ((*((u8 *)(__pStart))))
728 
729 /*
730 * Translate subfield (continuous bits in little-endian) of 4-byte value in LE byte to
731 * 4-byte value in host byte ordering.
732 */
733 #define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
734 	((LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset)) & BIT_LEN_MASK_32(__BitLen))
735 
736 #define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
737 	((LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset)) & BIT_LEN_MASK_16(__BitLen))
738 
739 #define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
740 	((LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset)) & BIT_LEN_MASK_8(__BitLen))
741 
742 /*
743 * Translate subfield (continuous bits in big-endian) of 4-byte value in BE byte to
744 * 4-byte value in host byte ordering.
745 */
746 #define BE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
747 	((BE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset)) & BIT_LEN_MASK_32(__BitLen))
748 
749 #define BE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
750 	((BE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset)) & BIT_LEN_MASK_16(__BitLen))
751 
752 #define BE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
753 	((BE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset)) & BIT_LEN_MASK_8(__BitLen))
754 
755 /*
756 * Mask subfield (continuous bits in little-endian) of 4-byte value in LE byte oredering
757 * and return the result in 4-byte value in host byte ordering.
758 */
759 #define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
760 	(LE_P4BYTE_TO_HOST_4BYTE(__pStart) & (~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen)))
761 
762 #define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
763 	(LE_P2BYTE_TO_HOST_2BYTE(__pStart) & (~BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen)))
764 
765 #define LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
766 	(LE_P1BYTE_TO_HOST_1BYTE(__pStart) & ((u8)(~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen))))
767 
768 /*
769 * Mask subfield (continuous bits in big-endian) of 4-byte value in BE byte oredering
770 * and return the result in 4-byte value in host byte ordering.
771 */
772 #define BE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
773 	(BE_P4BYTE_TO_HOST_4BYTE(__pStart) & (~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen)))
774 
775 #define BE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
776 	(BE_P2BYTE_TO_HOST_2BYTE(__pStart) & (~BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen)))
777 
778 #define BE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
779 	(BE_P1BYTE_TO_HOST_1BYTE(__pStart) & (~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen)))
780 
781 /*
782 * Set subfield of little-endian 4-byte value to specified value.
783 */
784 #define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \
785 	do { \
786 		u8 __offset = __BitOffset, __len = __BitLen; \
787 		if (__offset == 0 && __len == 32) \
788 			WriteLE4Byte(__pStart, __Value); \
789 		else { \
790 			WriteLE4Byte(__pStart, \
791 				LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
792 				| \
793 				((((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset)) \
794 			); \
795 		} \
796 	} while (0)
797 
798 #define SET_BITS_TO_LE_2BYTE(__pStart, __BitOffset, __BitLen, __Value) \
799 	do { \
800 		WriteLE2Byte(__pStart, \
801 			LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
802 			| \
803 			((((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset)) \
804 		); \
805 	} while (0)
806 
807 #define SET_BITS_TO_LE_1BYTE(__pStart, __BitOffset, __BitLen, __Value) \
808 	do { \
809 		u8 __offset = __BitOffset; u8 __len = __BitLen; \
810 		if (__offset == 0 && __len == 8) \
811 			WriteLE1Byte(__pStart, __Value); \
812 		else { \
813 			WriteLE1Byte(__pStart, \
814 				LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __len) \
815 				| \
816 				((((u8)__Value) & BIT_LEN_MASK_8(__len)) << (__BitOffset)) \
817 			); \
818 		} \
819 	} while (0)
820 
821 /*
822 * Set subfield of big-endian 4-byte value to specified value.
823 */
824 #define SET_BITS_TO_BE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \
825 	do { \
826 		if (__BitOffset == 0 && __BitLen == 32) \
827 			WriteBE4Byte(__pStart, __Value); \
828 		else { \
829 			WriteBE4Byte(__pStart, \
830 				BE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
831 				| \
832 				((((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset)) \
833 			); \
834 		} \
835 	} while (0)
836 
837 #define SET_BITS_TO_BE_2BYTE(__pStart, __BitOffset, __BitLen, __Value) \
838 	do { \
839 		if (__BitOffset == 0 && __BitLen == 16) \
840 			WriteBE2Byte(__pStart, __Value); \
841 		else { \
842 			WriteBE2Byte(__pStart, \
843 				BE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
844 				| \
845 				((((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset)) \
846 			); \
847 		} \
848 	} while (0)
849 
850 #define SET_BITS_TO_BE_1BYTE(__pStart, __BitOffset, __BitLen, __Value) \
851 	do { \
852 		if (__BitOffset == 0 && __BitLen == 8) \
853 			WriteBE1Byte(__pStart, __Value); \
854 		else { \
855 			WriteBE1Byte(__pStart, \
856 				BE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
857 				| \
858 				((((u8)__Value) & BIT_LEN_MASK_8(__BitLen)) << (__BitOffset)) \
859 			); \
860 		} \
861 	} while (0)
862 
863 #endif /*_PLTFM_OPS_NONE_H_*/
864