Merge remote-tracking branch 'staging/staging-next'
[deliverable/linux.git] / drivers / staging / rtl8188eu / include / osdep_service.h
CommitLineData
f9f08d70
LF
1/******************************************************************************
2 *
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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 *
f9f08d70
LF
14 ******************************************************************************/
15#ifndef __OSDEP_SERVICE_H_
16#define __OSDEP_SERVICE_H_
17
18#include <basic_types.h>
19
20#define _FAIL 0
21#define _SUCCESS 1
f8d8f6f2 22#define RTW_RX_HANDLED 2
f9f08d70 23
f9f08d70
LF
24#include <linux/spinlock.h>
25#include <linux/compiler.h>
26#include <linux/kernel.h>
27#include <linux/errno.h>
f9f08d70
LF
28#include <linux/slab.h>
29#include <linux/module.h>
30#include <linux/kref.h>
31#include <linux/netdevice.h>
32#include <linux/skbuff.h>
33#include <linux/circ_buf.h>
34#include <linux/uaccess.h>
35#include <asm/byteorder.h>
36#include <linux/atomic.h>
37#include <linux/io.h>
f18c566e 38#include <linux/mutex.h>
f9f08d70
LF
39#include <linux/sem.h>
40#include <linux/sched.h>
41#include <linux/etherdevice.h>
42#include <linux/wireless.h>
43#include <net/iw_handler.h>
44#include <linux/if_arp.h>
45#include <linux/rtnetlink.h>
46#include <linux/delay.h>
f9f08d70
LF
47#include <linux/interrupt.h> /* for struct tasklet_struct */
48#include <linux/ip.h>
49#include <linux/kthread.h>
50
51#include <linux/usb.h>
52#include <linux/usb/ch9.h>
53
54struct __queue {
55 struct list_head queue;
56 spinlock_t lock;
57};
58
f9f08d70
LF
59static inline struct list_head *get_list_head(struct __queue *queue)
60{
282956c6 61 return &(queue->queue);
f9f08d70
LF
62}
63
f9f08d70
LF
64static inline int rtw_netif_queue_stopped(struct net_device *pnetdev)
65{
66 return netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) &&
67 netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 1)) &&
68 netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 2)) &&
69 netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3));
70}
71
ebea63f6 72int RTW_STATUS_CODE(int error_code);
f9f08d70 73
f9f08d70 74#define rtw_update_mem_stat(flag, sz) do {} while (0)
f9f08d70 75u8 *_rtw_malloc(u32 sz);
f9f08d70 76#define rtw_malloc(sz) _rtw_malloc((sz))
f9f08d70
LF
77
78void *rtw_malloc2d(int h, int w, int size);
f9f08d70 79
f9f08d70 80void _rtw_init_queue(struct __queue *pqueue);
f9f08d70 81
f9f08d70
LF
82struct rtw_netdev_priv_indicator {
83 void *priv;
f9f08d70 84};
f8a1a236 85struct net_device *rtw_alloc_etherdev_with_old_priv(void *old_priv);
f9f08d70
LF
86
87#define rtw_netdev_priv(netdev) \
88 (((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv)
89void rtw_free_netdev(struct net_device *netdev);
90
91#define NDEV_FMT "%s"
92#define NDEV_ARG(ndev) ndev->name
93#define ADPT_FMT "%s"
94#define ADPT_ARG(adapter) adapter->pnetdev->name
95#define FUNC_NDEV_FMT "%s(%s)"
96#define FUNC_NDEV_ARG(ndev) __func__, ndev->name
97#define FUNC_ADPT_FMT "%s(%s)"
98#define FUNC_ADPT_ARG(adapter) __func__, adapter->pnetdev->name
99
f9f08d70 100u64 rtw_modular64(u64 x, u64 y);
f9f08d70
LF
101
102/* Macros for handling unaligned memory accesses */
103
7be921a2
JH
104#define RTW_GET_BE24(a) ((((u32)(a)[0]) << 16) | (((u32) (a)[1]) << 8) | \
105 ((u32)(a)[2]))
f9f08d70 106
f9f08d70
LF
107void rtw_buf_free(u8 **buf, u32 *buf_len);
108void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len);
f9f08d70 109#endif
This page took 0.4268 seconds and 5 git commands to generate.