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 * 14 ******************************************************************************/ 15#ifndef __OSDEP_SERVICE_H_ 16#define __OSDEP_SERVICE_H_ 17 18#define _FAIL 0 19#define _SUCCESS 1 20#define RTW_RX_HANDLED 2 21 22#include <linux/spinlock.h> 23#include <linux/compiler.h> 24#include <linux/kernel.h> 25#include <linux/errno.h> 26#include <linux/init.h> 27#include <linux/slab.h> 28#include <linux/module.h> 29#include <linux/kref.h> 30#include <linux/netdevice.h> 31#include <linux/skbuff.h> 32#include <asm/uaccess.h> 33#include <asm/byteorder.h> 34#include <asm/atomic.h> 35#include <asm/io.h> 36#include <linux/semaphore.h> 37#include <linux/sem.h> 38#include <linux/sched.h> 39#include <linux/etherdevice.h> 40#include <linux/wireless.h> 41#include <linux/if_arp.h> 42#include <linux/rtnetlink.h> 43#include <linux/delay.h> 44#include <linux/interrupt.h> /* for struct tasklet_struct */ 45#include <linux/ip.h> 46 47#include <net/ieee80211_radiotap.h> 48#include <net/cfg80211.h> 49 50struct rtw_queue { 51 struct list_head queue; 52 spinlock_t lock; 53}; 54 55static inline struct list_head *get_list_head(struct rtw_queue *queue) 56{ 57 return &queue->queue; 58} 59 60static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) 61{ 62 return (netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) && 63 netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 1)) && 64 netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 2)) && 65 netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3))); 66} 67 68static inline u32 CHKBIT(u32 x) 69{ 70 WARN_ON(x >= 32); 71 if (x >= 32) 72 return 0; 73 return BIT(x); 74} 75 76extern unsigned char MCS_rate_2R23A[16]; 77 78extern unsigned char MCS_rate_2R23A[16]; 79extern unsigned char MCS_rate_1R23A[16]; 80 81void _rtw_init_queue23a(struct rtw_queue *pqueue); 82 83/* Macros for handling unaligned memory accesses */ 84 85#define RTW_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \ 86 ((u32) (a)[2])) 87 88#endif 89