summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/eswin/sdio/ecrnx_sdio.h
blob: d2b210bf0bdebc737f64bd0cb84627bf4a45524c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
 /**
 ******************************************************************************
 *
 * @file ecrnx_sdio.h
 *
 * @brief ecrnx sdio header file
 *
 * Copyright (C) ESWIN 2015-2020
 *
 ******************************************************************************
 */
 
#ifndef _ECRNX_SDIO_H_
#define _ECRNX_SDIO_H_

#include "ecrnx_rx.h"
#include "eswin_utils.h"
#include "ecrnx_defs.h"
/*
 * Number of Host buffers available for Data Rx handling
 */
#define SDIO_RXBUF_CNT       32
#define SDIO_RXBUF_SIZE      12288

enum{
    SDIO_FRM_TYPE_RXDESC =1,
    SDIO_FRM_TYPE_MSG,
    SDIO_FRM_TYPE_DBG,
    SDIO_FRM_TYPE_UNSUP_RX_VEC,
    SDIO_FRM_TYPE_RADAR,
    SDIO_FRM_TYPE_TBTT_SEC,
    SDIO_FRM_TYPE_TBTT_PRIM,
    SDIO_FRM_TYPE_MSG_ACK,
    SDIO_FRM_TYPE_TXCFM,
    SDIO_FRM_TYPE_IWPRIV,
    SDIO_FRM_TYPE_UPDATE
};


#define SKB_DATA_COM_HD_OFFSET      sizeof(dispatch_hdr_t)
//#define SKB_DATA_TAG_OFFSET         offsetof(struct rxu_stat_mm, phy_info) //two byte msdu flag
//#define SKB_DATA_HD_OFFSET          sizeof(struct rxu_stat_mm) + sizeof(struct rx_hd)


struct sdio_rx_skb{
    bool flag;
    u16 data_len;
    struct sk_buff *skb;
};

typedef struct{
    atomic_t suspend;
    uint8_t sdio_host_rx_buff_used;
    struct  sdio_rx_skb ecrnx_sdio_rx_skb[SDIO_RXBUF_CNT];
}sdio_rx_buf_t;

/// Structure containing the information about the PHY channel that is used
// typedef uint32_t u32_l;
struct phy_channel_info_sdio
{
    /// PHY channel information 1
    uint32_t info1;
    /// PHY channel information 2
    uint32_t info2;
};

/*调整phy info、 pattern,因为这些信息必须要放到另外一个buff中传输*/
/// Element in the pool of RX header descriptor.
struct rx_hd
{
    /// Total length of the received MPDU
    uint16_t            frmlen;
    /// AMPDU status information
    uint16_t            ampdu_stat_info;
    /// TSF Low
    uint32_t            tsflo;
    /// TSF High
    uint32_t            tsfhi;
    /// Rx Vector 1
    struct rx_vector_1  rx_vec_1;
    /// Rx Vector 2
    struct rx_vector_2  rx_vec_2;
    /// MPDU status information
    uint32_t            statinfo;
};

/*调整phy info、 pattern,因为这些信息必须要放到另外一个buff中传输*/
struct rxu_stat_mm
{
	/*type of msg/dbg/frm etc.*/
	dispatch_hdr_t  frm_type;
    uint32_t fragment_flag     : 1;
    uint32_t is_qos            : 1;
    uint32_t need_reord        : 1;
    uint32_t need_pn_check     : 1;
    uint32_t is_ga             : 1;
    uint32_t flags_rsvd0       : 3;
    uint32_t tid               : 8;
    uint16_t sn;
    /// Length
    uint16_t frame_len;
    /// Status (@ref rx_status_bits)
    uint16_t status;
    uint16_t real_offset; /* dma address align 4, real data - real_offset  */
};


extern sdio_rx_buf_t sdio_rx_buff;

/**
 * @brief: ecrnx_sdio_init  Initialize sdio interface.
 * @param {ecrnx_hw} Main driver data
 * @return: u8
 */
u8 ecrnx_sdio_init(struct ecrnx_hw *ecrnx_hw);

/**
 * @brief: ecrnx_sdio_deinit  DeInitialize sdio interface.
 * @param {ecrnx_hw} Main driver data
 * @return: none
 */
void ecrnx_sdio_deinit(struct ecrnx_hw *ecrnx_hw);

/**
 * @brief: sdio_rx_buf_push: push a skb element to sdio rx buffer
 * @param {skb}  skb data need to push
 * @param {recv_len}  skb data length
 * @return: sk_buff
 */
struct sk_buff * sdio_rx_buf_push(struct sk_buff *skb, uint16_t recv_len);


/**
 * @brief: sdio_rx_buf_pop: pop a skb element from sdio rx buffer
 * @param {void} 
 * @return: sk_buff
 */
struct sk_buff* sdio_rx_buf_pop(void);

#ifdef CONFIG_ECRNX_WIFO_CAIL
/**
 * @brief: sdio_host_rx_handler  Handle the reception of rx frame
 * @param {frm_type} received frame type
 * @param {skb} received skb data
 * @return: none
 */
void sdio_host_amt_rx_handler(uint32_t frm_type, struct sk_buff *skb);
#endif

/**
 * @brief: sdio_host_rx_handler  Handle the reception of rx frame
 * @param {frm_type} received frame type
 * @param {env} pointer to the sdio Host environment
 * @param {skb} received skb data
 * @return: none
 */
void sdio_host_rx_handler(uint32_t frm_type, struct ipc_host_env_tag *env, struct sk_buff *skb);

/**
 * @brief: rcv_skb_convert  convert the sdio received skb to the ecrnx handled skb.
 * @param {src_rxu_state} received rxu state in skb
 * @param {src_rxu_state} received rx header in skb
 * @param {src_rxu_state} handled hw rxhdr in skb
 * @param {src_rxu_state} handled rx desc tag  in skb
 * @return: u8
 */
u8 rcv_skb_convert(struct rxu_stat_mm* src_rxu_state, \
                struct rx_hd* src_rx_hd, \
                struct sk_buff *skb, \
                struct hw_rxhdr* dst_hw_rxhdr,\
                struct rxdesc_tag* dst_rxdesc_tag);

#endif /* __ECRNX_SDIO_H */