]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/staging/otus/wrap_mis.c
Staging: add otus Atheros wireless network driver
[linux-2.6-omap-h63xx.git] / drivers / staging / otus / wrap_mis.c
1 /*
2  * Copyright (c) 2007-2008 Atheros Communications Inc.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 /*                                                                      */
17 /*  Module Name : wrap_mis.c                                            */
18 /*                                                                      */
19 /*  Abstract                                                            */
20 /*     This module contains wrapper functions for misc functions        */
21 /*                                                                      */
22 /*  NOTES                                                               */
23 /*     Platform dependent.                                              */
24 /*                                                                      */
25 /************************************************************************/
26
27 #include "oal_dt.h"
28 #include "usbdrv.h"
29
30 #include <linux/netlink.h>
31
32 #if WIRELESS_EXT > 12
33 #include <net/iw_handler.h>
34 #endif
35
36 //extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER];
37 extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
38 extern u16_t zfLnxGetVapId(zdev_t* dev);
39
40 /* Simply return 0xffff if VAP function is not supported */
41 u16_t zfwGetVapId(zdev_t* dev)
42 {
43     return zfLnxGetVapId(dev);
44 }
45
46 void zfwSleep(zdev_t* dev, u32_t ms)
47 {
48     if (in_interrupt() == 0)
49     {
50         mdelay(ms);
51     }
52     else
53     {
54         int ii;
55         int iter = 100000 * ms;
56
57         for (ii = 0; ii < iter; ii++)
58         {
59
60         }
61     }
62 }
63
64 #ifdef ZM_HALPLUS_LOCK
65 asmlinkage struct zsWlanDev *zfwGetWlanDev(zdev_t* dev)
66 {
67     return ((struct zsWlanDev*)(((struct usbdrv_private*)dev->priv)->wd));
68 }
69
70 asmlinkage void zfwEnterCriticalSection(zdev_t* dev)
71 {
72     spin_lock_irqsave(&(((struct usbdrv_private *)(dev->priv))->cs_lock),
73             (((struct usbdrv_private *)(dev->priv))->hal_irqFlag));
74 }
75
76 asmlinkage void zfwLeaveCriticalSection(zdev_t* dev)
77 {
78     spin_unlock_irqrestore(&(((struct usbdrv_private *)(dev->priv))->cs_lock),
79             (((struct usbdrv_private *)(dev->priv))->hal_irqFlag));
80 }
81
82 asmlinkage u8_t zfwBufReadByte(zdev_t* dev, zbuf_t* buf, u16_t offset)
83 {
84     return *(u8_t*)((u8_t*)buf->data+offset);
85 }
86
87 asmlinkage u16_t zfwBufReadHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset)
88 {
89     return zmw_cpu_to_le16(*(u16_t*)((u8_t*)buf->data+offset));
90 }
91
92 asmlinkage void zfwBufWriteByte(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t value)
93 {
94     *(u8_t*)((u8_t*)buf->data+offset) = value;
95 }
96
97 asmlinkage void zfwBufWriteHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t value)
98 {
99     *(u16_t*)((u8_t*)buf->data+offset) = zmw_cpu_to_le16(value);
100 }
101
102 asmlinkage u8_t *zfwGetBuffer(zdev_t* dev, zbuf_t* buf)
103 {
104     return (u8_t*)(buf->data);
105 }
106 #endif
107
108 /* Leave an empty line below to remove warning message on some compiler */