xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/phl/pltfm_ops_macos.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_MACOS_H_
16 #define _PLTFM_OPS_MACOS_H_
17 
_os_strsep(char ** s,const char * ct)18 static __inline char *_os_strsep(char **s, const char *ct)
19 {
20 	return NULL;
21 }
_os_sscanf(const char * buf,const char * fmt,...)22 static __inline int _os_sscanf(const char *buf, const char *fmt, ...)
23 {
24 	return 0;
25 }
_os_strcmp(const char * s1,const char * s2)26 static __inline int _os_strcmp(const char *s1, const char *s2)
27 {
28 	return 0;
29 }
_os_strncmp(const char * s1,const char * s2,size_t n)30 static __inline int _os_strncmp(const char *s1, const char *s2, size_t n)
31 {
32 	return 0;
33 }
_os_strcpy(char * dest,const char * src)34 static __inline char *_os_strcpy(char *dest, const char *src)
35 {
36 	return NULL;
37 }
_os_strncpy(char * dest,const char * src,size_t n)38 static inline char *_os_strncpy(char *dest, const char *src, size_t n)
39 {
40 	return NULL;
41 }
_os_strchr(const char * s,int c)42 static __inline char *_os_strchr(const char *s, int c)
43 {
44 	while (*s != (char)c)
45 		if (*s++ == '\0')
46 			return NULL;
47 	return (char *)s;
48 }
_os_snprintf(char * str,size_t size,const char * format,...)49 static __inline int _os_snprintf(char *str, size_t size, const char *format, ...)
50 {
51 	return 0;
52 }
53 
_os_strlen(u8 * buf)54 static __inline u32 _os_strlen(u8 *buf)
55 {
56 	return 0;
57 }
_os_delay_ms(void * h,u32 ms)58 static __inline void _os_delay_ms(void *h, u32 ms)
59 {
60 }
_os_delay_us(void * h,u32 us)61 static __inline void _os_delay_us(void *h, u32 us)
62 {
63 }
_os_sleep_ms(void * h,u32 ms)64 static __inline void _os_sleep_ms(void *h, u32 ms)
65 {
66 }
_os_sleep_us(void * h,u32 us)67 static __inline void _os_sleep_us(void *h, u32 us)
68 {
69 }
_os_get_cur_time_us(void)70 static inline u32 _os_get_cur_time_us(void)
71 {
72 	return 0;
73 }
_os_get_cur_time_ms(void)74 static inline u32 _os_get_cur_time_ms(void)
75 {
76 	return 0;
77 }
78 
_os_modular64(u64 x,u64 y)79 static inline u64 _os_modular64(u64 x, u64 y)
80 {
81 	return x % y;
82 }
_os_division64(u64 x,u64 y)83 static inline u64 _os_division64(u64 x, u64 y)
84 {
85 	return x / y;
86 }
87 
88 #ifdef CONFIG_PCI_HCI
_os_cache_inv(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 direction)89 static inline void _os_cache_inv(void *d, _dma *bus_addr_l, _dma *bus_addr_h,
90 					u32 buf_sz, u8 direction)
91 {
92 }
_os_cache_wback(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 direction)93 static inline void _os_cache_wback(void *d, _dma *bus_addr_l,
94 			_dma *bus_addr_h, u32 buf_sz, u8 direction)
95 {
96 }
97 
_os_dma_pool_create(void * d,char * name,u32 wd_page_sz)98 static inline void *_os_dma_pool_create(void *d, char *name, u32 wd_page_sz)
99 {
100 	return NULL;
101 }
102 
_os_dma_pool_destory(void * d,void * pool)103 static inline void _os_dma_pool_destory(void *d, void *pool)
104 {
105 }
106 
107 /* txbd, rxbd, wd */
_os_shmem_alloc(void * d,void * pool,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 cache,u8 direction,void ** os_rsvd)108 static inline void *_os_shmem_alloc(void *d, void *pool, _dma *bus_addr_l,
109 				    _dma *bus_addr_h, u32 buf_sz,
110 				    u8 cache, u8 direction, void **os_rsvd)
111 {
112 	return NULL;
113 }
_os_shmem_free(void * d,void * pool,u8 * vir_addr,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 cache,u8 direction,void * os_rsvd)114 static inline void _os_shmem_free(void *d, void *pool, u8 *vir_addr, _dma *bus_addr_l,
115 				  _dma *bus_addr_h, u32 buf_sz,
116 				  u8 cache, u8 direction, void *os_rsvd)
117 {
118 	return NULL;
119 }
120 #endif
121 
_os_pkt_buf_unmap_rx(void * d,_dma bus_addr_l,_dma bus_addr_h,u32 buf_sz)122 static inline void *_os_pkt_buf_unmap_rx(void *d, _dma bus_addr_l, _dma bus_addr_h, u32 buf_sz)
123 {
124 	return NULL;
125 }
126 
_os_pkt_buf_map_rx(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,void * os_priv)127 static inline void *_os_pkt_buf_map_rx(void *d, _dma *bus_addr_l, _dma *bus_addr_h,
128 					u32 buf_sz, void *os_priv)
129 {
130 	return NULL;
131 }
132 
_os_pkt_buf_alloc_rx(void * d,_dma * bus_addr_l,_dma * bus_addr_h,u32 buf_sz,u8 cache,void ** os_priv)133 static inline void *_os_pkt_buf_alloc_rx(void *d, _dma *bus_addr_l, _dma *bus_addr_h,
134 					u32 buf_sz, u8 cache, void **os_priv)
135 {
136 	return NULL;
137 }
_os_pkt_buf_free_rx(void * d,u8 * vir_addr,_dma bus_addr_l,_dma bus_addr_h,u32 buf_sz,u8 cache,void * os_priv)138 static inline u8 *_os_pkt_buf_free_rx(void *d, u8 *vir_addr, _dma bus_addr_l,
139 				_dma bus_addr_h, u32 buf_sz, u8 cache, void *os_priv)
140 {
141 	return NULL;
142 }
143 
144 /* phl pre-alloc network layer buffer */
_os_alloc_netbuf(void * d,u32 buf_sz,void ** os_priv)145 static inline void * _os_alloc_netbuf(void *d, u32 buf_sz, void **os_priv)
146 {
147 	return NULL; // windows never do this.
148 }
149 
150 /* Free netbuf for error case. (ex. drop rx-reorder packet) */
_os_free_netbuf(void * d,u8 * vir_addr,u32 buf_sz,void * os_priv)151 static inline void _os_free_netbuf(void *d, u8 *vir_addr, u32 buf_sz, void *os_priv)
152 {
153 }
154 
_os_mem_alloc(void * h,u32 buf_sz)155 static __inline void *_os_mem_alloc(void *h, u32 buf_sz)
156 {
157 	return NULL;
158 }
159 
_os_mem_free(void * h,void * buf,u32 buf_sz)160 static __inline void _os_mem_free(void *h, void *buf, u32 buf_sz)
161 {
162 }
163 /*physically contiguous memory if the buffer will be accessed by a DMA device*/
_os_kmem_alloc(void * h,u32 buf_sz)164 static inline void *_os_kmem_alloc(void *h, u32 buf_sz)
165 {
166 	return NULL;
167 }
168 
169 /*physically contiguous memory if the buffer will be accessed by a DMA device*/
_os_kmem_free(void * h,void * buf,u32 buf_sz)170 static inline void _os_kmem_free(void *h, void *buf, u32 buf_sz)
171 {
172 }
_os_mem_set(void * h,void * buf,s8 value,u32 size)173 static __inline void _os_mem_set(void *h, void *buf, s8 value, u32 size)
174 {
175 }
_os_mem_cpy(void * h,void * dest,void * src,u32 size)176 static __inline void _os_mem_cpy(void *h, void *dest, void *src, u32 size)
177 {
178 }
_os_mem_cmp(void * h,void * ptr1,void * ptr2,u32 size)179 static __inline int _os_mem_cmp(void *h, void *ptr1, void *ptr2, u32 size)
180 {
181 	return 0;
182 }
_os_init_timer(void * h,_os_timer * timer,void (* call_back_func)(void * context),void * context,const char * sz_id)183 static __inline void _os_init_timer(void *h, _os_timer *timer,
184 		void (*call_back_func)(void *context), void *context,
185 		const char *sz_id)
186 {
187 }
188 
_os_set_timer(void * h,_os_timer * timer,u32 ms_delay)189 static __inline void _os_set_timer(void *h, _os_timer *timer, u32 ms_delay)
190 {
191 }
192 
_os_cancel_timer(void * h,_os_timer * timer)193 static __inline void _os_cancel_timer(void *h, _os_timer *timer)
194 {
195 }
_os_cancel_timer_async(void * d,_os_timer * timer)196 static inline void _os_cancel_timer_async(void *d, _os_timer *timer)
197 {
198 }
199 
_os_release_timer(void * h,_os_timer * timer)200 static __inline void _os_release_timer(void *h, _os_timer *timer)
201 {
202 
203 }
_os_mutex_init(void * h,_os_mutex * mutex)204 static __inline void _os_mutex_init(void *h, _os_mutex *mutex)
205 {
206 }
207 
_os_mutex_deinit(void * h,_os_mutex * mutex)208 static __inline void _os_mutex_deinit(void *h, _os_mutex *mutex)
209 {
210 }
211 
_os_mutex_lock(void * h,_os_mutex * mutex)212 static __inline void _os_mutex_lock(void *h, _os_mutex *mutex)
213 {
214 }
215 
_os_mutex_unlock(void * h,_os_mutex * mutex)216 static __inline void _os_mutex_unlock(void *h, _os_mutex *mutex)
217 {
218 }
219 
_os_sema_init(void * h,_os_sema * sema,int int_cnt)220 static inline void _os_sema_init(void *h, _os_sema *sema, int int_cnt)
221 {
222 }
223 
_os_sema_free(void * h,_os_sema * sema)224 static inline void _os_sema_free(void *h, _os_sema *sema)
225 {
226 }
227 
_os_sema_up(void * h,_os_sema * sema)228 static inline void _os_sema_up(void *h, _os_sema *sema)
229 {
230 }
231 
_os_sema_down(void * h,_os_sema * sema)232 static inline u8 _os_sema_down(void *h, _os_sema *sema)
233 {
234 	return 0; //success
235 }
236 
_os_spinlock_init(void * d,_os_lock * plock)237 static __inline void _os_spinlock_init(void *d, _os_lock *plock)
238 {
239 }
_os_spinlock_free(void * d,_os_lock * plock)240 static __inline void _os_spinlock_free(void *d, _os_lock *plock)
241 {
242 }
_os_spinlock(void * d,_os_lock * plock,enum lock_type type,_os_spinlockfg * flags)243 static inline void _os_spinlock(void *d, _os_lock *plock,
244 					enum lock_type type, _os_spinlockfg *flags)
245 {
246 }
247 
_os_spinunlock(void * d,_os_lock * plock,enum lock_type type,_os_spinlockfg * flags)248 static inline void _os_spinunlock(void *d, _os_lock *plock,
249 					enum lock_type type, _os_spinlockfg *flags)
250 {
251 }
252 
253 /* event */
_os_event_init(void * h,_os_event * event)254 static __inline void _os_event_init(void *h, _os_event *event)
255 {
256 }
_os_event_free(void * h,_os_event * event)257 static __inline void _os_event_free(void *h, _os_event *event)
258 {
259 }
_os_event_reset(void * h,_os_event * event)260 static __inline void _os_event_reset(void *h, _os_event *event)
261 {
262 }
_os_event_set(void * h,_os_event * event)263 static __inline void _os_event_set(void *h, _os_event *event)
264 {
265 }
266 
267 /*
268  * m_sec
269  *	== 0 : wait for completion
270  *	>  0 : wait for timeout or completion
271  * return value
272  *	0:timeout
273  *	otherwise:success
274  */
_os_event_wait(void * h,_os_event * event,u32 m_sec)275 static __inline int _os_event_wait(void *h, _os_event *event, u32 m_sec)
276 {
277 	return 0;
278 }
279 
_os_test_and_clear_bit(int nr,unsigned long * addr)280 static inline int _os_test_and_clear_bit(int nr, unsigned long *addr)
281 {
282 	/*UNDO*/
283 	return 0;
284 }
_os_test_and_set_bit(int nr,unsigned long * addr)285 static inline int _os_test_and_set_bit(int nr, unsigned long *addr)
286 {
287 	/*UNDO*/
288 	return 1;
289 }
290 /* Atomic integer operations */
_os_atomic_set(void * d,_os_atomic * v,int i)291 static __inline void _os_atomic_set(void *d, _os_atomic *v, int i)
292 {
293 }
294 
_os_atomic_read(void * d,_os_atomic * v)295 static __inline int _os_atomic_read(void *d, _os_atomic *v)
296 {
297 	return 0;
298 }
299 
_os_atomic_add(void * d,_os_atomic * v,int i)300 static __inline void _os_atomic_add(void *d, _os_atomic *v, int i)
301 {
302 }
_os_atomic_sub(void * d,_os_atomic * v,int i)303 static __inline void _os_atomic_sub(void *d, _os_atomic *v, int i)
304 {
305 }
306 
_os_atomic_inc(void * d,_os_atomic * v)307 static __inline void _os_atomic_inc(void *d, _os_atomic *v)
308 {
309 }
310 
_os_atomic_dec(void * d,_os_atomic * v)311 static __inline void _os_atomic_dec(void *d, _os_atomic *v)
312 {
313 }
314 
_os_atomic_add_return(void * d,_os_atomic * v,int i)315 static __inline int _os_atomic_add_return(void *d, _os_atomic *v, int i)
316 {
317 	return 0;
318 }
319 
_os_atomic_sub_return(void * d,_os_atomic * v,int i)320 static __inline int _os_atomic_sub_return(void *d, _os_atomic *v, int i)
321 {
322 	return 0;
323 }
324 
_os_atomic_inc_return(void * d,_os_atomic * v)325 static __inline int _os_atomic_inc_return(void *d, _os_atomic *v)
326 {
327 	return 0;
328 }
329 
_os_atomic_dec_return(void * d,_os_atomic * v)330 static __inline int _os_atomic_dec_return(void *d, _os_atomic *v)
331 {
332 	return 0;
333 }
334 /*
335 static __inline bool _os_atomic_inc_unless(void *d, _os_atomic *v, int u)
336 {
337 	return 0;
338 }
339 */
_os_tasklet_init(void * drv_priv,_os_tasklet * task,void (* call_back_func)(void * context),void * context)340 static inline u8 _os_tasklet_init(void *drv_priv, _os_tasklet *task,
341 	void (*call_back_func)(void* context), void *context)
342 {
343 	return 0;
344 }
_os_tasklet_deinit(void * drv_priv,_os_tasklet * task)345 static inline u8 _os_tasklet_deinit(void *drv_priv, _os_tasklet *task)
346 {
347 	return 0;
348 }
_os_tasklet_schedule(void * drv_priv,_os_tasklet * task)349 static inline u8 _os_tasklet_schedule(void *drv_priv, _os_tasklet *task)
350 {
351 	return 0;
352 }
353 
_os_thread_init(void * drv_priv,_os_thread * thread,int (* call_back_func)(void * context),void * context,const char namefmt[])354 static __inline u8 _os_thread_init(	void *drv_priv, _os_thread *thread,
355 					int (*call_back_func)(void * context),
356 					void *context,
357 					const char namefmt[])
358 {
359 	return RTW_PHL_STATUS_FAILURE;
360 }
_os_thread_deinit(void * drv_priv,_os_thread * thread)361 static __inline u8 _os_thread_deinit(void *drv_priv, _os_thread *thread)
362 {
363 	return RTW_PHL_STATUS_FAILURE;
364 }
_os_thread_schedule(void * drv_priv,_os_thread * thread)365 static __inline enum rtw_phl_status _os_thread_schedule(void *drv_priv, _os_thread *thread)
366 {
367 	return RTW_PHL_STATUS_FAILURE;
368 }
_os_thread_stop(void * drv_priv,_os_thread * thread)369 static inline void _os_thread_stop(void *drv_priv, _os_thread *thread)
370 {
371 }
_os_thread_check_stop(void * drv_priv,_os_thread * thread)372 static inline int _os_thread_check_stop(void *drv_priv, _os_thread *thread)
373 {
374 	return 1;
375 }
_os_thread_wait_stop(void * drv_priv,_os_thread * thread)376 static inline int _os_thread_wait_stop(void *drv_priv, _os_thread *thread)
377 {
378 	return RTW_PHL_STATUS_SUCCESS;
379 }
380 
381 #if 0 /* TODO */
382 static inline _os_thread _os_thread_start(int (*threadfn)(void *data),
383 	void *data, const char namefmt[])
384 {
385 	return 0;
386 }
387 static inline bool _os_thread_stop(_os_thread th)
388 {
389 	return 0;
390 }
391 static inline void _os_thread_wait_stop(void)
392 {
393 }
394 static inline int _os_thread_check_stop(void)
395 {
396 	return 0;
397 }
398 #endif
399 
_os_workitem_init(void * drv_priv,_os_workitem * workitem,void (* call_back_func)(void * context),void * context)400 static inline u8 _os_workitem_init(void *drv_priv, _os_workitem *workitem,
401 			void (*call_back_func)(void* context), void *context)
402 {
403 	return 0;
404 }
_os_workitem_schedule(void * drv_priv,_os_workitem * workitem)405 static inline u8 _os_workitem_schedule(void *drv_priv, _os_workitem *workitem)
406 {
407 	return 0;
408 }
_os_workitem_deinit(void * drv_priv,_os_workitem * workitem)409 static inline u8 _os_workitem_deinit(void *drv_priv, _os_workitem *workitem)
410 {
411 	return 0;
412 }
413 
414 /* File Operation */
_os_read_file(const char * path,u8 * buf,u32 sz)415 static inline u32 _os_read_file(const char *path, u8 *buf, u32 sz)
416 {
417 	/* OS Dependent API */
418 	return 0;
419 }
420 
421 #ifdef CONFIG_PCI_HCI
_os_read8_pcie(void * h,u32 addr)422 static __inline u8 _os_read8_pcie(void *h, u32 addr)
423 {
424 	return 0;
425 }
_os_read16_pcie(void * h,u32 addr)426 static __inline u16 _os_read16_pcie(void *h, u32 addr)
427 {
428 	return 0;
429 
430 }
_os_read32_pcie(void * h,u32 addr)431 static __inline u32 _os_read32_pcie(void *h, u32 addr)
432 {
433 	return 0;
434 }
435 
_os_write8_pcie(void * h,u32 addr,u8 val)436 static __inline u32 _os_write8_pcie(void *h, u32 addr, u8 val)
437 {
438 	return 0;
439 }
_os_write16_pcie(void * h,u32 addr,u16 val)440 static __inline u32 _os_write16_pcie(void *h, u32 addr, u16 val)
441 {
442 	return 0;
443 }
_os_write32_pcie(void * h,u32 addr,u32 val)444 static __inline u32 _os_write32_pcie(void *h, u32 addr, u32 val)
445 {
446 	return 0;
447 }
448 #endif/*#ifdef CONFIG_PCI_HCI*/
449 
450 #ifdef CONFIG_USB_HCI
_os_usbctrl_vendorreq(void * h,u8 request,u16 value,u16 index,void * pdata,u16 len,u8 requesttype)451 static __inline u32 _os_usbctrl_vendorreq(void *h, u8 request, u16 value,
452 			u16 index, void *pdata, u16 len, u8 requesttype)
453 {
454 	return 0;
455 }
456 
os_usb_tx(void * h,u8 * tx_buf_ptr,u8 bulk_id,u32 len,u8 * pkt_data_buf)457 static inline int os_usb_tx(void *h, u8 *tx_buf_ptr,
458 			u8 bulk_id, u32 len, u8 *pkt_data_buf)
459 {
460 	return 1;
461 }
462 
463 #endif /*CONFIG_USB_HCI*/
464 
465 #ifdef CONFIG_SDIO_HCI
_os_sdio_cmd52_r8(void * d,u32 offset)466 static __inline u8 _os_sdio_cmd52_r8(void *d, u32 offset)
467 {
468 	return 0;
469 }
470 
_os_sdio_cmd53_r8(void * d,u32 offset)471 static __inline u8 _os_sdio_cmd53_r8(void *d, u32 offset)
472 {
473 	return 0;
474 }
475 
_os_sdio_cmd53_r16(void * d,u32 offset)476 static __inline u16 _os_sdio_cmd53_r16(void *d, u32 offset)
477 {
478 	return 0;
479 }
480 
_os_sdio_cmd53_r32(void * d,u32 offset)481 static __inline u32 _os_sdio_cmd53_r32(void *d, u32 offset)
482 {
483 	return 0;
484 }
485 
_os_sdio_cmd53_rn(void * d,u32 offset,u32 size,u8 * data)486 static __inline u8 _os_sdio_cmd53_rn(void *d, u32 offset, u32 size, u8 *data)
487 {
488 	return 0;
489 }
490 
_os_sdio_cmd53_r(void * d,u32 offset,u32 size,u8 * data)491 static __inline u8 _os_sdio_cmd53_r(void *d, u32 offset, u32 size, u8 *data)
492 {
493 	/* TODO: implement read RX FIFO */
494 	return 0;
495 }
496 
_os_sdio_cmd52_w8(void * d,u32 offset,u8 val)497 static __inline void _os_sdio_cmd52_w8(void *d, u32 offset, u8 val)
498 {
499 }
500 
_os_sdio_cmd53_w8(void * d,u32 offset,u8 val)501 static __inline void _os_sdio_cmd53_w8(void *d, u32 offset, u8 val)
502 {
503 }
504 
_os_sdio_cmd53_w16(void * d,u32 offset,u16 val)505 static __inline void _os_sdio_cmd53_w16(void *d, u32 offset, u16 val)
506 {
507 }
508 
_os_sdio_cmd53_w32(void * d,u32 offset,u32 val)509 static __inline void _os_sdio_cmd53_w32(void *d, u32 offset, u32 val)
510 {
511 }
512 
_os_sdio_cmd53_wn(void * d,u32 offset,u32 size,u8 * data)513 static __inline void _os_sdio_cmd53_wn(void *d, u32 offset, u32 size, u8 *data)
514 {
515 }
516 
_os_sdio_cmd53_w(void * d,u32 offset,u32 size,u8 * data)517 static __inline void _os_sdio_cmd53_w(void *d, u32 offset, u32 size, u8 *data)
518 {
519 }
520 
_os_sdio_f0_read(void * d,u32 addr,void * buf,size_t len)521 static __inline u8 _os_sdio_f0_read(void *d, u32 addr, void *buf, size_t len)
522 {
523 	return 0;
524 }
525 
_os_sdio_read_cia_r8(void * d,u32 addr)526 static __inline u8 _os_sdio_read_cia_r8(void *d, u32 addr)
527 {
528 	return 0;
529 }
530 #endif /*CONFIG_SDIO_HCI*/
531 
532 /* temp os dependency */
533 
534 /* can delete if osdep ready */
535 
536 
537 #endif /*_PLTFM_OPS_MACOS_H_*/
538