0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __RSI_COMMON_H__
0018 #define __RSI_COMMON_H__
0019
0020 #include <linux/kthread.h>
0021
0022 #define EVENT_WAIT_FOREVER 0
0023 #define FIRMWARE_RSI9113 "rs9113_wlan_qspi.rps"
0024 #define QUEUE_NOT_FULL 1
0025 #define QUEUE_FULL 0
0026
0027 static inline int rsi_init_event(struct rsi_event *pevent)
0028 {
0029 atomic_set(&pevent->event_condition, 1);
0030 init_waitqueue_head(&pevent->event_queue);
0031 return 0;
0032 }
0033
0034 static inline int rsi_wait_event(struct rsi_event *event, u32 timeout)
0035 {
0036 int status = 0;
0037
0038 if (!timeout)
0039 status = wait_event_interruptible(event->event_queue,
0040 (atomic_read(&event->event_condition) == 0));
0041 else
0042 status = wait_event_interruptible_timeout(event->event_queue,
0043 (atomic_read(&event->event_condition) == 0),
0044 timeout);
0045 return status;
0046 }
0047
0048 static inline void rsi_set_event(struct rsi_event *event)
0049 {
0050 atomic_set(&event->event_condition, 0);
0051 wake_up_interruptible(&event->event_queue);
0052 }
0053
0054 static inline void rsi_reset_event(struct rsi_event *event)
0055 {
0056 atomic_set(&event->event_condition, 1);
0057 }
0058
0059 static inline int rsi_create_kthread(struct rsi_common *common,
0060 struct rsi_thread *thread,
0061 void *func_ptr,
0062 u8 *name)
0063 {
0064 init_completion(&thread->completion);
0065 atomic_set(&thread->thread_done, 0);
0066 thread->task = kthread_run(func_ptr, common, "%s", name);
0067 if (IS_ERR(thread->task))
0068 return (int)PTR_ERR(thread->task);
0069
0070 return 0;
0071 }
0072
0073 static inline int rsi_kill_thread(struct rsi_thread *handle)
0074 {
0075 atomic_inc(&handle->thread_done);
0076 rsi_set_event(&handle->event);
0077
0078 return kthread_stop(handle->task);
0079 }
0080
0081 void rsi_mac80211_detach(struct rsi_hw *hw);
0082 u16 rsi_get_connected_channel(struct ieee80211_vif *vif);
0083 struct rsi_hw *rsi_91x_init(u16 oper_mode);
0084 void rsi_91x_deinit(struct rsi_hw *adapter);
0085 int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len);
0086 #ifdef CONFIG_PM
0087 int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan);
0088 #endif
0089 struct rsi_sta *rsi_find_sta(struct rsi_common *common, u8 *mac_addr);
0090 struct ieee80211_vif *rsi_get_vif(struct rsi_hw *adapter, u8 *mac);
0091 void rsi_roc_timeout(struct timer_list *t);
0092 #endif