1 /** @file mlan_init.h
2  *
3  *  @brief This file defines the FW initialization data
4  *  structures.
5  *
6  *  Copyright 2008-2024 NXP
7  *
8  *  SPDX-License-Identifier: BSD-3-Clause
9  *
10  */
11 
12 /******************************************************
13 Change log:
14     10/13/2008: initial version
15 ******************************************************/
16 
17 #ifndef _MLAN_INIT_H_
18 #define _MLAN_INIT_H_
19 
20 /** Tx buffer size for firmware download*/
21 #define FW_DNLD_TX_BUF_SIZE 620
22 /** Rx buffer size for firmware download*/
23 #define FW_DNLD_RX_BUF_SIZE 2048
24 /** Max firmware retry */
25 #define MAX_FW_RETRY 3
26 
27 /** Firmware has last block */
28 #define FW_HAS_LAST_BLOCK 0x00000004
29 
30 /** Firmware data transmit size */
31 #define FW_DATA_XMIT_SIZE sizeof(FWHeader) + DataLength + sizeof(t_u32)
32 
33 /** FWHeader */
34 typedef struct _FWHeader
35 {
36     /** FW download command */
37     t_u32 dnld_cmd;
38     /** FW base address */
39     t_u32 base_addr;
40     /** FW data length */
41     t_u32 data_length;
42     /** FW CRC */
43     t_u32 crc;
44 } FWHeader;
45 
46 /** FWData */
47 typedef struct _FWData
48 {
49     /** FW data header */
50     FWHeader fw_header;
51     /** FW data sequence number */
52     t_u32 seq_num;
53     /** FW data buffer */
54     t_u8 data[1];
55 } FWData;
56 
57 /** FWSyncHeader */
58 typedef struct _FWSyncHeader
59 {
60     /** FW sync header command */
61     t_u32 cmd;
62     /** FW sync header sequence number */
63     t_u32 seq_num;
64 } FWSyncHeader;
65 
66 #ifdef BIG_ENDIAN_SUPPORT
67 /** Convert sequence number and command fields of fwheader to correct endian format */
68 #define endian_convert_syncfwheader(x)                 \
69     {                                                  \
70         (x)->cmd     = wlan_le32_to_cpu((x)->cmd);     \
71         (x)->seq_num = wlan_le32_to_cpu((x)->seq_num); \
72     }
73 #else
74 /** Convert sequence number and command fields of fwheader to correct endian format */
75 #define endian_convert_syncfwheader(x)
76 #endif /* BIG_ENDIAN_SUPPORT */
77 
78 #endif /* _MLAN_INIT_H_ */
79