net: wireless: rockchip_wlan: add rtl8188fu support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8188fu / include / osdep_service_xp.h
diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188fu/include/osdep_service_xp.h b/drivers/net/wireless/rockchip_wlan/rtl8188fu/include/osdep_service_xp.h
new file mode 100644 (file)
index 0000000..45d54af
--- /dev/null
@@ -0,0 +1,202 @@
+/******************************************************************************\r
+ *\r
+ * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.\r
+ *                                        \r
+ * This program is free software; you can redistribute it and/or modify it\r
+ * under the terms of version 2 of the GNU General Public License as\r
+ * published by the Free Software Foundation.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but WITHOUT\r
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ * more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along with\r
+ * this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA\r
+ *\r
+ *\r
+ ******************************************************************************/\r
+#ifndef __OSDEP_LINUX_SERVICE_H_\r
+#define __OSDEP_LINUX_SERVICE_H_\r
+\r
+       #include <ndis.h>\r
+       #include <ntddk.h>\r
+       #include <ntddndis.h>\r
+       #include <ntdef.h>\r
+\r
+#ifdef CONFIG_USB_HCI\r
+       #include <usb.h>\r
+       #include <usbioctl.h>\r
+       #include <usbdlib.h>\r
+#endif\r
+\r
+       typedef KSEMAPHORE      _sema;\r
+       typedef LIST_ENTRY      _list;\r
+       typedef NDIS_STATUS _OS_STATUS;\r
+       \r
+\r
+       typedef NDIS_SPIN_LOCK  _lock;\r
+\r
+       typedef KMUTEX                  _mutex;\r
+\r
+       typedef KIRQL   _irqL;\r
+\r
+       // USB_PIPE for WINCE , but handle can be use just integer under windows\r
+       typedef NDIS_HANDLE  _nic_hdl;\r
+\r
+\r
+       typedef NDIS_MINIPORT_TIMER    _timer;\r
+\r
+       struct  __queue {\r
+               LIST_ENTRY      queue;  \r
+               _lock   lock;\r
+       };\r
+\r
+       typedef NDIS_PACKET     _pkt;\r
+       typedef NDIS_BUFFER     _buffer;\r
+       typedef struct  __queue _queue;\r
+       \r
+       typedef PKTHREAD _thread_hdl_;\r
+       typedef void    thread_return;\r
+       typedef void* thread_context;\r
+\r
+       typedef NDIS_WORK_ITEM _workitem;\r
+\r
+       #define thread_exit() PsTerminateSystemThread(STATUS_SUCCESS);\r
+\r
+       #define HZ                      10000000\r
+       #define SEMA_UPBND      (0x7FFFFFFF)   //8192\r
+       \r
+__inline static _list *get_next(_list  *list)\r
+{\r
+       return list->Flink;\r
+}      \r
+\r
+__inline static _list  *get_list_head(_queue   *queue)\r
+{\r
+       return (&(queue->queue));\r
+}\r
+       \r
+\r
+#define LIST_CONTAINOR(ptr, type, member) CONTAINING_RECORD(ptr, type, member)\r
+     \r
+\r
+__inline static _enter_critical(_lock *plock, _irqL *pirqL)\r
+{\r
+       NdisAcquireSpinLock(plock);     \r
+}\r
+\r
+__inline static _exit_critical(_lock *plock, _irqL *pirqL)\r
+{\r
+       NdisReleaseSpinLock(plock);     \r
+}\r
+\r
+\r
+__inline static _enter_critical_ex(_lock *plock, _irqL *pirqL)\r
+{\r
+       NdisDprAcquireSpinLock(plock);  \r
+}\r
+\r
+__inline static _exit_critical_ex(_lock *plock, _irqL *pirqL)\r
+{\r
+       NdisDprReleaseSpinLock(plock);  \r
+}\r
+\r
+__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)\r
+{\r
+       NdisDprAcquireSpinLock(plock);\r
+}\r
+\r
+__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)\r
+{\r
+       NdisDprReleaseSpinLock(plock);\r
+}\r
+\r
+__inline static _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)\r
+{\r
+       KeWaitForSingleObject(pmutex, Executive, KernelMode, FALSE, NULL);\r
+}\r
+\r
+\r
+__inline static _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL)\r
+{\r
+       KeReleaseMutex(pmutex, FALSE);\r
+}\r
+\r
+\r
+__inline static void rtw_list_delete(_list *plist)\r
+{\r
+       RemoveEntryList(plist);\r
+       InitializeListHead(plist);      \r
+}\r
+\r
+#define RTW_TIMER_HDL_ARGS IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3\r
+\r
+__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,PVOID cntx)\r
+{\r
+       NdisMInitializeTimer(ptimer, nic_hdl, pfunc, cntx);\r
+}\r
+\r
+__inline static void _set_timer(_timer *ptimer,u32 delay_time)\r
+{      \r
+       NdisMSetTimer(ptimer,delay_time);       \r
+}\r
+\r
+__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)\r
+{\r
+       NdisMCancelTimer(ptimer,bcancelled);\r
+}\r
+\r
+__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)\r
+{\r
+\r
+       NdisInitializeWorkItem(pwork, pfunc, cntx);\r
+}\r
+\r
+__inline static void _set_workitem(_workitem *pwork)\r
+{\r
+       NdisScheduleWorkItem(pwork);\r
+}\r
+\r
+\r
+#define ATOMIC_INIT(i)  { (i) }\r
+\r
+//\r
+// Global Mutex: can only be used at PASSIVE level.\r
+//\r
+\r
+#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter)                              \\r
+{                                                               \\r
+    while (NdisInterlockedIncrement((PULONG)&(_MutexCounter)) != 1)\\r
+    {                                                           \\r
+        NdisInterlockedDecrement((PULONG)&(_MutexCounter));        \\r
+        NdisMSleep(10000);                          \\r
+    }                                                           \\r
+}\r
+\r
+#define RELEASE_GLOBAL_MUTEX(_MutexCounter)                              \\r
+{                                                               \\r
+    NdisInterlockedDecrement((PULONG)&(_MutexCounter));              \\r
+}\r
+\r
+// limitation of path length\r
+#define PATH_LENGTH_MAX MAX_PATH\r
+\r
+//Atomic integer operations\r
+#define ATOMIC_T LONG\r
+\r
+\r
+#define NDEV_FMT "%s"\r
+#define NDEV_ARG(ndev) ""\r
+#define ADPT_FMT "%s"\r
+#define ADPT_ARG(adapter) ""\r
+#define FUNC_NDEV_FMT "%s"\r
+#define FUNC_NDEV_ARG(ndev) __func__\r
+#define FUNC_ADPT_FMT "%s"\r
+#define FUNC_ADPT_ARG(adapter) __func__\r
+\r
+#define STRUCT_PACKED\r
+\r
+#endif\r
+\r