1 #include <linux/timer.h>
2 #include "ecrnx_utils.h"
3 #include "ecrnx_defs.h"
4 #include "ecrnx_msg_rx.h"
13 static struct timer_list tm;
14 static int counter = 0;
17 struct sk_buff *skb = NULL;
18 struct ecrnx_hw *g_ecrnx_hw = NULL;
23 struct cfg80211_mgmt_tx_params params;
25 static void test_timer_handler(struct timer_list * lt);
27 void ecrnx_hw_set(void* init_ecrnx_hw)
29 g_ecrnx_hw = (struct ecrnx_hw *)init_ecrnx_hw;
32 static int sdio_rx_param_init(void)
34 struct rxu_stat_mm rxu_state;
39 uint16_t head_len = sizeof(struct ethhdr);
40 ECRNX_DBG("%s entry!!", __func__);
41 memset(&rxu_state, 0, sizeof(struct rxu_stat_mm));
42 memset(&rx_head, 0, sizeof(struct rx_hd));
43 memset(ð_hd, 0, sizeof(struct ethhdr));
45 rxu_state.comm_hd.frm_type = USB_FRM_TYPE_RXDESC;
46 //rxu_state.comm_hd.frm_type = USB_FRM_TYPE_MSG;
47 if(rxu_state.comm_hd.frm_type == USB_FRM_TYPE_RXDESC)
49 head_len += sizeof(struct rxu_stat_mm) + sizeof(struct rx_hd);
53 head_len += sizeof(dispatch_hdr_t);
56 skb = dev_alloc_skb(FRAME_SIZE + head_len);
57 skb_reserve(skb, head_len);
58 ptr = skb_put(skb, FRAME_SIZE); //ptr is skb tail
59 memset(skb->data, 0x0f, FRAME_SIZE); //payload
60 skb_push(skb, sizeof(struct ethhdr));
62 for( index = 0; index < ETH_ALEN; index++)
64 eth_hd.h_dest[index] = index;
65 eth_hd.h_source[index] = index;
68 eth_hd.h_proto = ETH_P_80221; //ETHERTYPE_IP;
69 memcpy(skb->data, ð_hd, sizeof(struct ethhdr));
71 if(rxu_state.comm_hd.frm_type == USB_FRM_TYPE_RXDESC)
73 //data frame, need header, rxu state
75 skb_push(skb, sizeof(struct rx_hd));
76 rx_head.frmlen = FRAME_SIZE + head_len;
77 rx_head.ampdu_stat_info = 0;
79 memcpy(skb->data , &rx_head, sizeof(struct rx_hd));
82 skb_push(skb, sizeof(struct rxu_stat_mm));
83 rxu_state.msdu_mode = 0x01;
84 rxu_state.host_id = 0x0001;
85 rxu_state.frame_len = rx_head.frmlen;
86 rxu_state.status = RX_STAT_MONITOR;
87 //rxu_state.phy_info.info1 = 1 | (1 << 8) | (2450 << 16);
88 //rxu_state.phy_info.info2 = 2450 | (2450 << 16);
89 #ifdef CONFIG_ECRNX_FULLMAC
90 //rxu_state.flags = 0;
92 //rxu_state.pattern = ecrnx_rxbuff_pattern;
93 memcpy(skb->data, &rxu_state, sizeof(struct rxu_stat_mm));
97 //message frame, don't need header
98 skb_push(skb, sizeof(dispatch_hdr_t)); //rxu state
99 memcpy(skb->data, &rxu_state.comm_hd, sizeof(dispatch_hdr_t));
102 for(index = 0; index < head_len; index++)
104 ECRNX_DBG("0x%x ", skb->data[index]);
107 ECRNX_DBG("%s exit, skb_len:%d, type: %d!!", __func__, skb->len, (skb->data[1] << 8) | skb->data[0]);
112 extern int ecrnx_start_mgmt_xmit(struct ecrnx_vif *vif, \
113 struct ecrnx_sta *sta, \
114 struct cfg80211_mgmt_tx_params *params, \
119 struct cfg80211_mgmt_tx_params {
120 struct ieee80211_channel *chan;
126 bool dont_wait_for_ack;
128 const u16 *csa_offsets;
131 static void sdio_tx_param_init(void)
133 u8 send_buf[FRAME_SIZE] = {0x00, 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};
135 params.len = FRAME_SIZE;
136 params.buf = (const u8 *)send_buf;
137 params.n_csa_offsets = 10;
138 params.csa_offsets = (const u16 *)send_buf;
141 vif.ecrnx_hw = g_ecrnx_hw;
144 void sdio_rx_tx_test_schedule(void)
146 ECRNX_DBG("%s entry!!", __func__);
147 tm.function = test_timer_handler;
148 tm.expires = jiffies + HZ * 10;
151 sdio_rx_param_init();
152 sdio_tx_param_init();
153 ECRNX_DBG("%s exit!!", __func__);
156 static void test_timer_handler(struct timer_list * lt)
158 ECRNX_DBG("%s, counter:%d\n", __FUNCTION__, counter);
163 //ecrnx_start_mgmt_xmit(&vif, NULL, ¶ms, false, &cookie);
167 ecrnx_rx_callback(g_ecrnx_hw, skb, 1);
177 //tm.expires = jiffies +1 * HZ / 1000/10; //100us
178 tm.expires = jiffies +1 * HZ;