mirror of
https://github.com/amazingfate/rtl8723ds.git
synced 2026-04-30 18:29:47 +01:00
rtl8723ds: Remove code for FREEBSD, OS_XP and OS_CE
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
@@ -84,9 +84,6 @@ inline u8 *_rtw_vmalloc(u32 sz)
|
||||
#ifdef PLATFORM_LINUX
|
||||
pbuf = vmalloc(sz);
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
pbuf = malloc(sz, M_DEVBUF, M_NOWAIT);
|
||||
#endif
|
||||
|
||||
#ifdef DBG_MEMORY_LEAK
|
||||
#ifdef PLATFORM_LINUX
|
||||
@@ -107,9 +104,6 @@ inline u8 *_rtw_zvmalloc(u32 sz)
|
||||
pbuf = _rtw_vmalloc(sz);
|
||||
if (pbuf != NULL)
|
||||
memset(pbuf, 0, sz);
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
pbuf = malloc(sz, M_DEVBUF, M_ZERO | M_NOWAIT);
|
||||
#endif
|
||||
return pbuf;
|
||||
}
|
||||
@@ -119,9 +113,6 @@ inline void _rtw_vmfree(u8 *pbuf, u32 sz)
|
||||
#ifdef PLATFORM_LINUX
|
||||
vfree(pbuf);
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
free(pbuf, M_DEVBUF);
|
||||
#endif
|
||||
#ifdef DBG_MEMORY_LEAK
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_dec(&_malloc_cnt);
|
||||
@@ -144,9 +135,6 @@ u8 *_rtw_malloc(u32 sz)
|
||||
pbuf = kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
pbuf = malloc(sz, M_DEVBUF, M_NOWAIT);
|
||||
#endif
|
||||
#ifdef DBG_MEMORY_LEAK
|
||||
#ifdef PLATFORM_LINUX
|
||||
if (pbuf != NULL) {
|
||||
@@ -163,9 +151,6 @@ u8 *_rtw_malloc(u32 sz)
|
||||
|
||||
u8 *_rtw_zmalloc(u32 sz)
|
||||
{
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return malloc(sz, M_DEVBUF, M_ZERO | M_NOWAIT);
|
||||
#else /* PLATFORM_FREEBSD */
|
||||
u8 *pbuf = _rtw_malloc(sz);
|
||||
|
||||
if (pbuf != NULL) {
|
||||
@@ -176,7 +161,6 @@ u8 *_rtw_zmalloc(u32 sz)
|
||||
}
|
||||
|
||||
return pbuf;
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
|
||||
void _rtw_mfree(u8 *pbuf, u32 sz)
|
||||
@@ -191,9 +175,6 @@ void _rtw_mfree(u8 *pbuf, u32 sz)
|
||||
kfree(pbuf);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
free(pbuf, M_DEVBUF);
|
||||
#endif
|
||||
#ifdef DBG_MEMORY_LEAK
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_dec(&_malloc_cnt);
|
||||
@@ -203,62 +184,11 @@ void _rtw_mfree(u8 *pbuf, u32 sz)
|
||||
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
/* review again */
|
||||
struct sk_buff *dev_alloc_skb(unsigned int size)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
u8 *data = NULL;
|
||||
|
||||
/* skb = (struct sk_buff *)_rtw_zmalloc(sizeof(struct sk_buff)); */ /* for skb->len, etc. */
|
||||
skb = (struct sk_buff *)_rtw_malloc(sizeof(struct sk_buff));
|
||||
if (!skb)
|
||||
goto out;
|
||||
data = _rtw_malloc(size);
|
||||
if (!data)
|
||||
goto nodata;
|
||||
|
||||
skb->head = (unsigned char *)data;
|
||||
skb->data = (unsigned char *)data;
|
||||
skb->tail = (unsigned char *)data;
|
||||
skb->end = (unsigned char *)data + size;
|
||||
skb->len = 0;
|
||||
/* printf("%s()-%d: skb=%p, skb->head = %p\n", __FUNCTION__, __LINE__, skb, skb->head); */
|
||||
|
||||
out:
|
||||
return skb;
|
||||
nodata:
|
||||
_rtw_mfree((u8 *)skb, sizeof(struct sk_buff));
|
||||
skb = NULL;
|
||||
goto out;
|
||||
|
||||
}
|
||||
|
||||
void dev_kfree_skb_any(struct sk_buff *skb)
|
||||
{
|
||||
/* printf("%s()-%d: skb->head = %p\n", __FUNCTION__, __LINE__, skb->head); */
|
||||
if (skb->head)
|
||||
_rtw_mfree(skb->head, 0);
|
||||
/* printf("%s()-%d: skb = %p\n", __FUNCTION__, __LINE__, skb); */
|
||||
if (skb)
|
||||
_rtw_mfree((u8 *)skb, 0);
|
||||
}
|
||||
struct sk_buff *skb_clone(const struct sk_buff *skb)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
inline struct sk_buff *_rtw_skb_alloc(u32 sz)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return __dev_alloc_skb(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return dev_alloc_skb(sz);
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
|
||||
inline void _rtw_skb_free(struct sk_buff *skb)
|
||||
@@ -271,10 +201,6 @@ inline struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb)
|
||||
#ifdef PLATFORM_LINUX
|
||||
return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return NULL;
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
|
||||
inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb)
|
||||
@@ -282,10 +208,6 @@ inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb)
|
||||
#ifdef PLATFORM_LINUX
|
||||
return skb_clone(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return skb_clone(skb);
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
inline struct sk_buff *_rtw_pskb_copy(struct sk_buff *skb)
|
||||
{
|
||||
@@ -296,10 +218,6 @@ inline struct sk_buff *_rtw_pskb_copy(struct sk_buff *skb)
|
||||
return skb_clone(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
#endif
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return NULL;
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
|
||||
inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
|
||||
@@ -307,11 +225,6 @@ inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
|
||||
#if defined(PLATFORM_LINUX)
|
||||
skb->dev = ndev;
|
||||
return netif_rx(skb);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
return (*ndev->if_input)(ndev, skb);
|
||||
#else
|
||||
rtw_warn_on(1);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -359,10 +272,6 @@ inline void *_rtw_usb_buffer_alloc(struct usb_device *dev, size_t size, dma_addr
|
||||
#endif
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return malloc(size, M_USBDEV, M_NOWAIT | M_ZERO);
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
@@ -372,10 +281,6 @@ inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr
|
||||
usb_buffer_free(dev, size, addr, dma);
|
||||
#endif
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
free(addr, M_USBDEV);
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
#endif /* CONFIG_USB_HCI */
|
||||
|
||||
@@ -856,7 +761,7 @@ void rtw_mfree2d(void *pbuf, int h, int w, int size)
|
||||
void _rtw_memcpy(void *dst, const void *src, u32 sz)
|
||||
{
|
||||
|
||||
#if defined(PLATFORM_LINUX) || defined (PLATFORM_FREEBSD)
|
||||
#if defined(PLATFORM_LINUX)
|
||||
|
||||
memcpy(dst, src, sz);
|
||||
|
||||
@@ -875,7 +780,7 @@ inline void _rtw_memmove(void *dst, const void *src, u32 sz)
|
||||
int _rtw_memcmp(const void *dst, const void *src, u32 sz)
|
||||
{
|
||||
|
||||
#if defined(PLATFORM_LINUX) || defined (PLATFORM_FREEBSD)
|
||||
#if defined(PLATFORM_LINUX)
|
||||
/* under Linux/GNU/GLibc, the return value of memcmp for two same mem. chunk is 0 */
|
||||
|
||||
if (!(memcmp(dst, src, sz)))
|
||||
@@ -888,24 +793,13 @@ int _rtw_memcmp(const void *dst, const void *src, u32 sz)
|
||||
void _rtw_memset(void *pbuf, int c, u32 sz)
|
||||
{
|
||||
|
||||
#if defined(PLATFORM_LINUX) || defined (PLATFORM_FREEBSD)
|
||||
#if defined(PLATFORM_LINUX)
|
||||
|
||||
memset(pbuf, c, sz);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
static inline void __list_add(_list *pnew, _list *pprev, _list *pnext)
|
||||
{
|
||||
pnext->prev = pnew;
|
||||
pnew->next = pnext;
|
||||
pnew->prev = pprev;
|
||||
pprev->next = pnew;
|
||||
}
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
|
||||
void _rtw_init_listhead(_list *list)
|
||||
{
|
||||
|
||||
@@ -914,14 +808,8 @@ void _rtw_init_listhead(_list *list)
|
||||
INIT_LIST_HEAD(list);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
For the following list_xxx operations,
|
||||
caller must guarantee the atomic context.
|
||||
@@ -937,14 +825,6 @@ u32 rtw_is_list_empty(_list *phead)
|
||||
else
|
||||
return _FALSE;
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
|
||||
if (phead->next == phead)
|
||||
return _TRUE;
|
||||
else
|
||||
return _FALSE;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -954,10 +834,6 @@ void rtw_list_insert_head(_list *plist, _list *phead)
|
||||
#ifdef PLATFORM_LINUX
|
||||
list_add(plist, phead);
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
__list_add(plist, phead, phead->next);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtw_list_insert_tail(_list *plist, _list *phead)
|
||||
@@ -967,11 +843,6 @@ void rtw_list_insert_tail(_list *plist, _list *phead)
|
||||
|
||||
list_add_tail(plist, phead);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
|
||||
__list_add(plist, phead->prev, phead);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -982,9 +853,6 @@ void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc)
|
||||
#ifdef PLATFORM_LINUX
|
||||
_init_timer(ptimer, adapter->pnetdev, pfunc, adapter);
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
_init_timer(ptimer, adapter->pifp, pfunc, adapter->mlmepriv.nic_hdl);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1002,31 +870,10 @@ void _rtw_init_sema(_sema *sema, int init_val)
|
||||
sema_init(sema, init_val);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
sema_init(sema, init_val, "rtw_drv");
|
||||
#endif
|
||||
#ifdef PLATFORM_OS_XP
|
||||
|
||||
KeInitializeSemaphore(sema, init_val, SEMA_UPBND); /* count=0; */
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_OS_CE
|
||||
if (*sema == NULL)
|
||||
*sema = CreateSemaphore(NULL, init_val, SEMA_UPBND, NULL);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void _rtw_free_sema(_sema *sema)
|
||||
{
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
sema_destroy(sema);
|
||||
#endif
|
||||
#ifdef PLATFORM_OS_CE
|
||||
CloseHandle(*sema);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void _rtw_up_sema(_sema *sema)
|
||||
@@ -1037,18 +884,6 @@ void _rtw_up_sema(_sema *sema)
|
||||
up(sema);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
sema_post(sema);
|
||||
#endif
|
||||
#ifdef PLATFORM_OS_XP
|
||||
|
||||
KeReleaseSemaphore(sema, IO_NETWORK_INCREMENT, 1, FALSE);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_OS_CE
|
||||
ReleaseSemaphore(*sema, 1, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
u32 _rtw_down_sema(_sema *sema)
|
||||
@@ -1062,24 +897,6 @@ u32 _rtw_down_sema(_sema *sema)
|
||||
return _SUCCESS;
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
sema_wait(sema);
|
||||
return _SUCCESS;
|
||||
#endif
|
||||
#ifdef PLATFORM_OS_XP
|
||||
|
||||
if (STATUS_SUCCESS == KeWaitForSingleObject(sema, Executive, KernelMode, TRUE, NULL))
|
||||
return _SUCCESS;
|
||||
else
|
||||
return _FAIL;
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_OS_CE
|
||||
if (WAIT_OBJECT_0 == WaitForSingleObject(*sema, INFINITE))
|
||||
return _SUCCESS;
|
||||
else
|
||||
return _FAIL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1094,18 +911,6 @@ void _rtw_mutex_init(_mutex *pmutex)
|
||||
init_MUTEX(pmutex);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_init(pmutex, "", NULL, MTX_DEF | MTX_RECURSE);
|
||||
#endif
|
||||
#ifdef PLATFORM_OS_XP
|
||||
|
||||
KeInitializeMutex(pmutex, 0);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_OS_CE
|
||||
*pmutex = CreateMutex(NULL, _FALSE, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1116,21 +921,8 @@ void _rtw_mutex_free(_mutex *pmutex)
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
|
||||
mutex_destroy(pmutex);
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
sema_destroy(pmutex);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_OS_XP
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_OS_CE
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1142,37 +934,11 @@ void _rtw_spinlock_init(_lock *plock)
|
||||
spin_lock_init(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_init(plock, "", NULL, MTX_DEF | MTX_RECURSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void _rtw_spinlock_free(_lock *plock)
|
||||
{
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_destroy(plock);
|
||||
#endif
|
||||
}
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
extern PADAPTER prtw_lock;
|
||||
|
||||
void rtw_mtx_lock(_lock *plock)
|
||||
{
|
||||
if (prtw_lock)
|
||||
mtx_lock(&prtw_lock->glock);
|
||||
else
|
||||
printf("%s prtw_lock==NULL", __FUNCTION__);
|
||||
}
|
||||
void rtw_mtx_unlock(_lock *plock)
|
||||
{
|
||||
if (prtw_lock)
|
||||
mtx_unlock(&prtw_lock->glock);
|
||||
else
|
||||
printf("%s prtw_lock==NULL", __FUNCTION__);
|
||||
|
||||
}
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
|
||||
void _rtw_spinlock(_lock *plock)
|
||||
{
|
||||
@@ -1182,9 +948,6 @@ void _rtw_spinlock(_lock *plock)
|
||||
spin_lock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_lock(plock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void _rtw_spinunlock(_lock *plock)
|
||||
@@ -1195,12 +958,8 @@ void _rtw_spinunlock(_lock *plock)
|
||||
spin_unlock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_unlock(plock);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void _rtw_spinlock_ex(_lock *plock)
|
||||
{
|
||||
|
||||
@@ -1209,9 +968,6 @@ void _rtw_spinlock_ex(_lock *plock)
|
||||
spin_lock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_lock(plock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void _rtw_spinunlock_ex(_lock *plock)
|
||||
@@ -1222,9 +978,6 @@ void _rtw_spinunlock_ex(_lock *plock)
|
||||
spin_unlock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_unlock(plock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void _rtw_init_queue(_queue *pqueue)
|
||||
@@ -1259,11 +1012,6 @@ u32 rtw_get_current_time(void)
|
||||
#ifdef PLATFORM_LINUX
|
||||
return jiffies;
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
struct timeval tvp;
|
||||
getmicrotime(&tvp);
|
||||
return tvp.tv_sec;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u32 rtw_systime_to_ms(u32 systime)
|
||||
@@ -1271,9 +1019,6 @@ inline u32 rtw_systime_to_ms(u32 systime)
|
||||
#ifdef PLATFORM_LINUX
|
||||
return systime * 1000 / HZ;
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return systime * 1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u32 rtw_ms_to_systime(u32 ms)
|
||||
@@ -1281,9 +1026,6 @@ inline u32 rtw_ms_to_systime(u32 ms)
|
||||
#ifdef PLATFORM_LINUX
|
||||
return ms * HZ / 1000;
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return ms / 1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* the input parameter start use the same unit as returned by rtw_get_current_time */
|
||||
@@ -1292,9 +1034,6 @@ inline s32 rtw_get_passing_time_ms(u32 start)
|
||||
#ifdef PLATFORM_LINUX
|
||||
return rtw_systime_to_ms(jiffies - start);
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return rtw_systime_to_ms(rtw_get_current_time());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline s32 rtw_get_time_interval_ms(u32 start, u32 end)
|
||||
@@ -1302,9 +1041,6 @@ inline s32 rtw_get_time_interval_ms(u32 start, u32 end)
|
||||
#ifdef PLATFORM_LINUX
|
||||
return rtw_systime_to_ms(end - start);
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return rtw_systime_to_ms(rtw_get_current_time());
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtw_sleep_schedulable(int ms)
|
||||
@@ -1324,10 +1060,6 @@ void rtw_sleep_schedulable(int ms)
|
||||
return;
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
DELAY(ms * 1000);
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1344,11 +1076,6 @@ void rtw_msleep_os(int ms)
|
||||
msleep((unsigned int)ms);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
/* Delay for delay microseconds */
|
||||
DELAY(ms * 1000);
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
void rtw_usleep_os(int us)
|
||||
{
|
||||
@@ -1364,13 +1091,6 @@ void rtw_usleep_os(int us)
|
||||
msleep((us / 1000) + 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
/* Delay for delay microseconds */
|
||||
DELAY(us);
|
||||
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DBG_DELAY_OS
|
||||
@@ -1417,10 +1137,6 @@ void rtw_mdelay_os(int ms)
|
||||
mdelay((unsigned long)ms);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
DELAY(ms * 1000);
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
void rtw_udelay_os(int us)
|
||||
{
|
||||
@@ -1430,11 +1146,6 @@ void rtw_udelay_os(int us)
|
||||
udelay((unsigned long)us);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
/* Delay for delay microseconds */
|
||||
DELAY(us);
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1443,9 +1154,6 @@ void rtw_yield_os(void)
|
||||
#ifdef PLATFORM_LINUX
|
||||
yield();
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
yield();
|
||||
#endif
|
||||
}
|
||||
|
||||
#define RTW_SUSPEND_LOCK_NAME "rtw_wifi"
|
||||
@@ -1626,8 +1334,6 @@ inline void ATOMIC_SET(ATOMIC_T *v, int i)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_set(v, i);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_set_int(v, i);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1635,8 +1341,6 @@ inline int ATOMIC_READ(ATOMIC_T *v)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return atomic_read(v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
return atomic_load_acq_32(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1644,16 +1348,12 @@ inline void ATOMIC_ADD(ATOMIC_T *v, int i)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_add(i, v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_add_int(v, i);
|
||||
#endif
|
||||
}
|
||||
inline void ATOMIC_SUB(ATOMIC_T *v, int i)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_sub(i, v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_subtract_int(v, i);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1661,8 +1361,6 @@ inline void ATOMIC_INC(ATOMIC_T *v)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_inc(v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_add_int(v, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1670,8 +1368,6 @@ inline void ATOMIC_DEC(ATOMIC_T *v)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_dec(v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_subtract_int(v, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1679,9 +1375,6 @@ inline int ATOMIC_ADD_RETURN(ATOMIC_T *v, int i)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return atomic_add_return(i, v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_add_int(v, i);
|
||||
return atomic_load_acq_32(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1689,9 +1382,6 @@ inline int ATOMIC_SUB_RETURN(ATOMIC_T *v, int i)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return atomic_sub_return(i, v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_subtract_int(v, i);
|
||||
return atomic_load_acq_32(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1699,9 +1389,6 @@ inline int ATOMIC_INC_RETURN(ATOMIC_T *v)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return atomic_inc_return(v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_add_int(v, 1);
|
||||
return atomic_load_acq_32(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1709,9 +1396,6 @@ inline int ATOMIC_DEC_RETURN(ATOMIC_T *v)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return atomic_dec_return(v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_subtract_int(v, 1);
|
||||
return atomic_load_acq_32(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2114,76 +1798,6 @@ error:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
/*
|
||||
* Copy a buffer from userspace and write into kernel address
|
||||
* space.
|
||||
*
|
||||
* This emulation just calls the FreeBSD copyin function (to
|
||||
* copy data from user space buffer into a kernel space buffer)
|
||||
* and is designed to be used with the above io_write_wrapper.
|
||||
*
|
||||
* This function should return the number of bytes not copied.
|
||||
* I.e. success results in a zero value.
|
||||
* Negative error values are not returned.
|
||||
*/
|
||||
unsigned long
|
||||
copy_from_user(void *to, const void *from, unsigned long n)
|
||||
{
|
||||
if (copyin(from, to, n) != 0) {
|
||||
/* Any errors will be treated as a failure
|
||||
to copy any of the requested bytes */
|
||||
return n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
copy_to_user(void *to, const void *from, unsigned long n)
|
||||
{
|
||||
if (copyout(from, to, n) != 0) {
|
||||
/* Any errors will be treated as a failure
|
||||
to copy any of the requested bytes */
|
||||
return n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The usb_register and usb_deregister functions are used to register
|
||||
* usb drivers with the usb subsystem. In this compatibility layer
|
||||
* emulation a list of drivers (struct usb_driver) is maintained
|
||||
* and is used for probing/attaching etc.
|
||||
*
|
||||
* usb_register and usb_deregister simply call these functions.
|
||||
*/
|
||||
int
|
||||
usb_register(struct usb_driver *driver)
|
||||
{
|
||||
rtw_usb_linux_register(driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
usb_deregister(struct usb_driver *driver)
|
||||
{
|
||||
rtw_usb_linux_deregister(driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void module_init_exit_wrapper(void *arg)
|
||||
{
|
||||
int (*func)(void) = arg;
|
||||
func();
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
#ifdef CONFIG_PLATFORM_SPRD
|
||||
#ifdef do_div
|
||||
#undef do_div
|
||||
@@ -2195,8 +1809,6 @@ u64 rtw_modular64(u64 x, u64 y)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return do_div(x, y);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
return x % y;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2205,8 +1817,6 @@ u64 rtw_division64(u64 x, u64 y)
|
||||
#ifdef PLATFORM_LINUX
|
||||
do_div(x, y);
|
||||
return x;
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
return x / y;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2222,8 +1832,6 @@ inline u32 rtw_random32(void)
|
||||
#else
|
||||
return random32();
|
||||
#endif
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
#error "to be implemented\n"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user