1
0
mirror of https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git synced 2025-10-19 17:11:09 +02:00
This commit is contained in:
Chen Minqiang
2016-10-10 02:54:43 +08:00
committed by Harshavardhana
parent c962f7a88d
commit 00aedbde5c
408 changed files with 192446 additions and 81116 deletions

View File

@@ -1,7 +1,7 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
@@ -20,86 +20,99 @@
#ifndef __OSDEP_LINUX_SERVICE_H_
#define __OSDEP_LINUX_SERVICE_H_
#include <linux/version.h>
#include <linux/spinlock.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/spinlock.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,5))
#include <linux/kref.h>
#include <linux/kref.h>
#endif
//#include <linux/smp_lock.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/circ_buf.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
#include <asm/atomic.h>
#include <asm/io.h>
//#include <linux/smp_lock.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/circ_buf.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
#include <asm/atomic.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
#include <asm/semaphore.h>
#include <asm/semaphore.h>
#else
#include <linux/semaphore.h>
#include <linux/semaphore.h>
#endif
#include <linux/sem.h>
#include <linux/sched.h>
#include <linux/etherdevice.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>
#include <linux/if_arp.h>
#include <linux/rtnetlink.h>
#include <linux/delay.h>
#include <linux/proc_fs.h> // Necessary because we use the proc fs
#include <linux/interrupt.h> // for struct tasklet_struct
#include <linux/ip.h>
#include <linux/kthread.h>
#include <linux/list.h>
#include <linux/vmalloc.h>
#include <linux/sem.h>
#include <linux/sched.h>
#include <linux/etherdevice.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>
#include <linux/if_arp.h>
#include <linux/rtnetlink.h>
#include <linux/delay.h>
#include <linux/interrupt.h> // for struct tasklet_struct
#include <linux/ip.h>
#include <linux/kthread.h>
#include <linux/list.h>
#include <linux/vmalloc.h>
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,41))
#include <linux/tqueue.h>
#include <linux/tqueue.h>
#endif
#ifdef RTK_DMP_PLATFORM
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12))
#include <linux/pageremap.h>
#include <linux/pageremap.h>
#endif
#include <asm/io.h>
#include <asm/io.h>
#endif
#ifdef CONFIG_IOCTL_CFG80211
// #include <linux/ieee80211.h>
#include <net/ieee80211_radiotap.h>
#include <net/cfg80211.h>
#ifdef CONFIG_NET_RADIO
#define CONFIG_WIRELESS_EXT
#endif
/* Monitor mode */
#include <net/ieee80211_radiotap.h>
#ifdef CONFIG_IOCTL_CFG80211
/* #include <linux/ieee80211.h> */
#include <net/cfg80211.h>
#endif //CONFIG_IOCTL_CFG80211
#ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
#include <linux/in.h>
#include <linux/udp.h>
#include <linux/in.h>
#include <linux/udp.h>
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#include <linux/earlysuspend.h>
#endif //CONFIG_HAS_EARLYSUSPEND
#ifdef CONFIG_EFUSE_CONFIG_FILE
#include <linux/fs.h>
#include <linux/fs.h>
#endif //CONFIG_EFUSE_CONFIG_FILE
#ifdef CONFIG_USB_HCI
#include <linux/usb.h>
#include <linux/usb.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
#include <linux/usb_ch9.h>
#include <linux/usb_ch9.h>
#else
#include <linux/usb/ch9.h>
#include <linux/usb/ch9.h>
#endif
#endif
#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
#include <net/sock.h>
#include <net/tcp.h>
#include <linux/udp.h>
#include <linux/in.h>
#include <linux/netlink.h>
#endif //CONFIG_BT_COEXIST_SOCKET_TRX
#ifdef CONFIG_USB_HCI
typedef struct urb * PURB;
typedef struct urb * PURB;
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22))
#ifdef CONFIG_USB_SUSPEND
#define CONFIG_AUTOSUSPEND 1
@@ -107,47 +120,47 @@
#endif
#endif
typedef struct semaphore _sema;
typedef spinlock_t _lock;
typedef struct semaphore _sema;
typedef spinlock_t _lock;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
typedef struct mutex _mutex;
typedef struct mutex _mutex;
#else
typedef struct semaphore _mutex;
typedef struct semaphore _mutex;
#endif
typedef struct timer_list _timer;
typedef struct timer_list _timer;
struct __queue {
struct list_head queue;
_lock lock;
};
struct __queue {
struct list_head queue;
_lock lock;
};
typedef struct sk_buff _pkt;
typedef unsigned char _buffer;
typedef struct __queue _queue;
typedef struct list_head _list;
typedef int _OS_STATUS;
//typedef u32 _irqL;
typedef unsigned long _irqL;
typedef struct net_device * _nic_hdl;
typedef void* _thread_hdl_;
typedef int thread_return;
typedef void* thread_context;
typedef struct sk_buff _pkt;
typedef unsigned char _buffer;
#define thread_exit() complete_and_exit(NULL, 0)
typedef struct __queue _queue;
typedef struct list_head _list;
typedef int _OS_STATUS;
//typedef u32 _irqL;
typedef unsigned long _irqL;
typedef struct net_device * _nic_hdl;
typedef void timer_hdl_return;
typedef void* timer_hdl_context;
typedef void* _thread_hdl_;
typedef int thread_return;
typedef void* thread_context;
#define thread_exit() complete_and_exit(NULL, 0)
typedef void timer_hdl_return;
typedef void* timer_hdl_context;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41))
typedef struct work_struct _workitem;
typedef struct work_struct _workitem;
#else
typedef struct tq_struct _workitem;
typedef struct tq_struct _workitem;
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
@@ -176,18 +189,18 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
__inline static _list *get_next(_list *list)
{
return list->next;
}
}
__inline static _list *get_list_head(_queue *queue)
{
return (&(queue->queue));
}
#define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
#define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
{
spin_lock_irqsave(plock, *pirqL);
@@ -234,9 +247,9 @@ __inline static int _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
__inline static void _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
mutex_unlock(pmutex);
mutex_unlock(pmutex);
#else
up(pmutex);
up(pmutex);
#endif
}
@@ -249,20 +262,20 @@ __inline static void rtw_list_delete(_list *plist)
__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx)
{
//setup_timer(ptimer, pfunc,(u32)cntx);
//setup_timer(ptimer, pfunc,(u32)cntx);
ptimer->function = pfunc;
ptimer->data = (unsigned long)cntx;
init_timer(ptimer);
}
__inline static void _set_timer(_timer *ptimer,u32 delay_time)
{
mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
{
mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
}
__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
{
del_timer_sync(ptimer);
del_timer_sync(ptimer);
*bcancelled= _TRUE;//TRUE ==1; FALSE==0
}
@@ -319,9 +332,9 @@ static inline int rtw_netif_queue_stopped(struct net_device *pnetdev)
{
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
return (netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) &&
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 1)) &&
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 2)) &&
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)) );
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 1)) &&
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 2)) &&
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3)) );
#else
return netif_queue_stopped(pnetdev);
#endif
@@ -354,6 +367,13 @@ static inline void rtw_netif_stop_queue(struct net_device *pnetdev)
#endif
}
static inline void rtw_merge_string(char *dst, int dst_len, char *src1, char *src2)
{
int len = 0;
len += snprintf(dst+len, dst_len - len, "%s", src1);
len += snprintf(dst+len, dst_len - len, "%s", src2);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
#define rtw_signal_process(pid, sig) kill_pid(find_vpid((pid)),(sig), 1)
#else //(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))