mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-05-08 14:33:05 +00:00
rtl8188eu: Remove dead code for FREEBSD
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
a68c6cc26e
commit
dd606233f2
22 changed files with 6 additions and 2326 deletions
|
@ -28,10 +28,6 @@
|
|||
#ifdef PLATFORM_LINUX
|
||||
#include <linux/vmalloc.h>
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/time.h>
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
#ifdef RTK_DMP_PLATFORM
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
|
||||
#include <linux/pageremap.h>
|
||||
|
@ -99,10 +95,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
|
||||
if ( pbuf != NULL) {
|
||||
|
@ -122,9 +114,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;
|
||||
}
|
||||
|
@ -134,9 +123,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);
|
||||
|
@ -159,9 +145,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) {
|
||||
|
@ -178,9 +161,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) {
|
||||
|
@ -191,7 +171,6 @@ u8* _rtw_zmalloc(u32 sz)
|
|||
}
|
||||
|
||||
return pbuf;
|
||||
#endif // PLATFORM_FREEBSD
|
||||
}
|
||||
|
||||
void _rtw_mfree(u8 *pbuf, u32 sz)
|
||||
|
@ -206,9 +185,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
|
||||
|
@ -219,62 +195,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)
|
||||
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)
|
||||
|
@ -287,10 +212,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)
|
||||
|
@ -298,10 +219,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 int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
|
||||
|
@ -310,10 +227,6 @@ inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
|
|||
skb->dev = ndev;
|
||||
return netif_rx(skb);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
return (*ndev->if_input)(ndev, skb);
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
|
||||
void _rtw_skb_queue_purge(struct sk_buff_head *list)
|
||||
|
@ -334,11 +247,8 @@ inline void *_rtw_usb_buffer_alloc(struct usb_device *dev, size_t size, dma_addr
|
|||
return usb_buffer_alloc(dev, size, (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), dma);
|
||||
#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
|
||||
|
@ -348,10 +258,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 */
|
||||
|
||||
|
@ -762,51 +668,23 @@ void rtw_mfree2d(void *pbuf, int h, int w, int size)
|
|||
|
||||
void _rtw_memcpy(void* dst, void* src, u32 sz)
|
||||
{
|
||||
|
||||
#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
|
||||
|
||||
memcpy(dst, src, sz);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int _rtw_memcmp(void *dst, void *src, u32 sz)
|
||||
{
|
||||
|
||||
#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
|
||||
//under Linux/GNU/GLibc, the return value of memcmp for two same mem. chunk is 0
|
||||
|
||||
if (!(memcmp(dst, src, sz)))
|
||||
return _TRUE;
|
||||
else
|
||||
return _FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _rtw_memset(void *pbuf, int c, u32 sz)
|
||||
{
|
||||
|
||||
#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
|
@ -815,11 +693,6 @@ void _rtw_init_listhead(_list *list)
|
|||
INIT_LIST_HEAD(list);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -838,14 +711,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
|
||||
}
|
||||
|
||||
|
@ -855,11 +720,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)
|
||||
|
@ -870,11 +730,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
|
||||
}
|
||||
|
||||
|
||||
|
@ -893,31 +748,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)
|
||||
|
@ -928,18 +762,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)
|
||||
|
@ -951,26 +773,7 @@ u32 _rtw_down_sema(_sema *sema)
|
|||
return _FAIL;
|
||||
else
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
@ -985,43 +788,16 @@ 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
|
||||
}
|
||||
|
||||
void _rtw_mutex_free(_mutex *pmutex);
|
||||
void _rtw_mutex_free(_mutex *pmutex)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
|
@ -1033,40 +809,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)
|
||||
{
|
||||
|
@ -1076,23 +823,14 @@ void _rtw_spinlock(_lock *plock)
|
|||
spin_lock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_lock(plock);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void _rtw_spinunlock(_lock *plock)
|
||||
{
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
|
||||
spin_unlock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_unlock(plock);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1104,9 +842,6 @@ void _rtw_spinlock_ex(_lock *plock)
|
|||
spin_lock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_lock(plock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void _rtw_spinunlock_ex(_lock *plock)
|
||||
|
@ -1117,13 +852,8 @@ void _rtw_spinunlock_ex(_lock *plock)
|
|||
spin_unlock(plock);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
mtx_unlock(plock);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _rtw_init_queue(_queue *pqueue)
|
||||
{
|
||||
|
||||
|
@ -1154,11 +884,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)
|
||||
|
@ -1166,9 +891,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)
|
||||
|
@ -1176,9 +898,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
|
||||
|
@ -1187,9 +906,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)
|
||||
|
@ -1197,9 +913,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
|
||||
}
|
||||
|
||||
|
||||
|
@ -1221,10 +934,6 @@ void rtw_sleep_schedulable(int ms)
|
|||
return;
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
DELAY(ms*1000);
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1236,11 +945,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)
|
||||
|
@ -1255,12 +959,6 @@ void rtw_usleep_os(int us)
|
|||
msleep( (us/1000) + 1);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
//Delay for delay microseconds
|
||||
DELAY(us);
|
||||
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1285,11 +983,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)
|
||||
{
|
||||
|
@ -1299,11 +992,6 @@ void rtw_udelay_os(int us)
|
|||
udelay((unsigned long)us);
|
||||
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
//Delay for delay microseconds
|
||||
DELAY(us);
|
||||
return ;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1312,9 +1000,6 @@ void rtw_yield_os()
|
|||
#ifdef PLATFORM_LINUX
|
||||
yield();
|
||||
#endif
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
yield();
|
||||
#endif
|
||||
}
|
||||
|
||||
#define RTW_SUSPEND_LOCK_NAME "rtw_wifi"
|
||||
|
@ -1403,8 +1088,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
|
||||
}
|
||||
|
||||
|
@ -1412,8 +1095,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
|
||||
}
|
||||
|
||||
|
@ -1421,16 +1102,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
|
||||
}
|
||||
|
||||
|
@ -1438,8 +1115,6 @@ inline void ATOMIC_INC(ATOMIC_T *v)
|
|||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_inc(v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_add_int(v,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1447,8 +1122,6 @@ inline void ATOMIC_DEC(ATOMIC_T *v)
|
|||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
atomic_dec(v);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
atomic_subtract_int(v,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1456,9 +1129,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
|
||||
}
|
||||
|
||||
|
@ -1466,9 +1136,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
|
||||
}
|
||||
|
||||
|
@ -1476,9 +1143,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
|
||||
}
|
||||
|
||||
|
@ -1486,9 +1150,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
|
||||
}
|
||||
|
||||
|
@ -1859,76 +1520,6 @@ error:
|
|||
#endif
|
||||
#endif //MEM_ALLOC_REFINE_ADAPTOR
|
||||
|
||||
#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
|
||||
|
@ -1940,8 +1531,6 @@ u64 rtw_modular64(u64 x, u64 y)
|
|||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
return do_div(x, y);
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
return (x %y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1950,8 +1539,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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue