Commit | Line | Data |
---|---|---|
4bd43f50 LR |
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 | #ifndef _PUB_USB_H | |
18 | #define _PUB_USB_H | |
19 | ||
20 | #include "../oal_dt.h" | |
21 | ||
22 | #define ZM_HAL_80211_MODE_AP 0 | |
23 | #define ZM_HAL_80211_MODE_STA 1 | |
24 | #define ZM_HAL_80211_MODE_IBSS_GENERAL 2 | |
25 | #define ZM_HAL_80211_MODE_IBSS_WPA2PSK 3 | |
26 | ||
27 | /* USB module description */ | |
28 | /* Queue Management */ | |
29 | /* 80211core requires OAL to implement a transmission queue in OAL's */ | |
30 | /* USB module. Because there is only limited on-chip memory, so USB */ | |
31 | /* data transfer may be pending until on-chip memory is available. */ | |
32 | /* 80211core also requires OAL's USB module to provide two functions */ | |
33 | /* zfwUsbGetFreeTxQSize() and zfwUsbGetMaxTxQSize() for 80211core to */ | |
34 | /* query the status of this transmission queue. The main purpose of */ | |
35 | /* this queue is for QoS/WMM. Though there are hardware priority */ | |
36 | /* queues on the chip, and also software priority queues in the */ | |
37 | /* 80211core. There is still one and only one USB channel. So */ | |
38 | /* 80211core will use the information that zfwUsbGetFreeTxQSize() */ | |
39 | /* returned to schedule the traffic from the software priority */ | |
40 | /* queues to the hardware priority queues. For example, if 80211core */ | |
41 | /* found that USB transmission queue is going to be full, it will */ | |
42 | /* not allow packets with lower priority to enter the USB channel. */ | |
43 | ||
44 | ||
45 | /* Structure for USB call back functions */ | |
46 | struct zfCbUsbFuncTbl { | |
47 | void (*zfcbUsbRecv)(zdev_t *dev, zbuf_t *buf); | |
48 | void (*zfcbUsbRegIn)(zdev_t* dev, u32_t* rsp, u16_t rspLen); | |
49 | void (*zfcbUsbOutComplete)(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr); | |
50 | void (*zfcbUsbRegOutComplete)(zdev_t* dev); | |
51 | }; | |
52 | ||
53 | /* Call back functions */ | |
54 | /* Below are the functions that should be called by the OAL */ | |
55 | ||
56 | /* When data is available in endpoint 3, OAL shall embed the data in */ | |
57 | /* zbuf_t and supply to 80211core by calling this function */ | |
58 | /* void (*zfcbUsbRecv)(zdev_t *dev, zbuf_t *buf); */ | |
59 | ||
60 | /* When data is available in endpoint 2, OAL shall call this function */ | |
61 | /* void (*zfcbUsbRegIn)(zdev_t* dev, u32_t* rsp, u16_t rspLen); */ | |
62 | ||
63 | /* When USB data transfer completed in endpoint 1, OAL shall call this function */ | |
64 | /* void (*zfcbUsbOutComplete)(zdev_t* dev, zbuf_t *buf, u8_t status, u8_t *hdr); */ | |
65 | ||
66 | ||
67 | /* Call out functions */ | |
68 | /* Below are the functions that supply by the OAL for 80211core to */ | |
69 | /* manipulate the USB */ | |
70 | ||
71 | /* Return OAL's USB TxQ size */ | |
72 | extern u32_t zfwUsbGetMaxTxQSize(zdev_t* dev); | |
73 | ||
74 | /* Return OAL's TxQ available size */ | |
75 | extern u32_t zfwUsbGetFreeTxQSize(zdev_t* dev); | |
76 | ||
77 | /* Register call back function */ | |
78 | extern void zfwUsbRegisterCallBack(zdev_t* dev, struct zfCbUsbFuncTbl *zfUsbFunc); | |
79 | ||
80 | /* Enable USB interrupt endpoint */ | |
81 | extern u32_t zfwUsbEnableIntEpt(zdev_t *dev, u8_t endpt); | |
82 | ||
83 | /* Enable USB Rx endpoint */ | |
84 | extern int zfwUsbEnableRxEpt(zdev_t* dev, u8_t endpt); | |
85 | ||
86 | /* 80211core call this function to send a USB request over endpoint 0 */ | |
87 | extern u32_t zfwUsbSubmitControl(zdev_t* dev, u8_t req, u16_t value, | |
88 | u16_t index, void *data, u32_t size); | |
89 | extern u32_t zfwUsbSubmitControlIo(zdev_t* dev, u8_t req, u8_t reqtype, | |
90 | u16_t value, u16_t index, void *data, u32_t size); | |
91 | ||
92 | /* 80211core call this function to transfer data out over endpoint 1 */ | |
93 | extern void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen); | |
94 | ||
95 | /* 80211core call this function to transfer data out over endpoint 4 */ | |
96 | extern u32_t zfwUsbSend(zdev_t* dev, u8_t endpt, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen, | |
97 | u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset); | |
98 | ||
99 | /* 80211core call this function to set USB configuration */ | |
100 | extern u32_t zfwUsbSetConfiguration(zdev_t *dev, u16_t value); | |
101 | ||
102 | #endif |