• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef _RWNX_DEFS_H_
16 #define _RWNX_DEFS_H_
17 
18 #include "wifi_ipc_host.h"
19 #include "wifi_nx_cmds.h"
20 #include "rwnx_utils.h"
21 
22 //#define ipc_host_env_tag ipc_fhost_host_env_tag;
23 /**
24  * struct rwnx_hw - Main driver data
25  *
26  * @dev: device structure
27  * @plat: Platform info
28  * @task: Tasklet used to IRQ bottom half
29  * @class: Class used to create device
30  * @major: Major number for the driver
31  * @term: Term device structure
32  * @trace: Trace device structure
33  * @cb_lock: Lock used to run message callback
34  * @ipc_env: Pointer to IPC shared struture
35  * @e2amsgs_pool: Pool of DMA buffer for messages push by FW
36  * @dbgmsgs_pool: Pool of DMA buffer for dbg messages push by FW
37  * @dbgdump_elem: DMA buffer for FW to upload debug dump (TODO)
38  * @cmd_mgr: Command (aka fw message) structure
39  * @mod_params: Module parameters used to initialize configuration buffer
40  * @config: Configuration buffer passed to FW before start
41  * @tv: Time at which we started the firmware
42  * @debugfs: debugfs entries configuration
43  */
44 struct rwnx_hw {
45 
46     struct ipc_host_env_tag *ipc_env;
47     struct rwnx_ipc_elem_pool e2amsgs_pool;
48     //struct rwnx_ipc_elem_pool dbgmsgs_pool;
49     //struct rwnx_ipc_dbgdump_elem dbgdump_elem;
50     //struct rwnx_ipc_elem_pool e2arxdesc_pool;
51     struct rwnx_cmd_mgr cmd_mgr;
52     //struct rwnx_mod_params *mod_params;
53     //uint32_t config[IPC_CFG_SIZE];
54 };
55 
56 struct rwnx_term_stream
57 {
58     //struct list_head list;
59     //struct rwnx_term *term;
60     //char buf[2 * TERM_BUFFER_SIZE];
61     char *read, *write;
62     int avail, last_idx;
63 };
64 
65 extern struct rwnx_hw hw_env;
66 
67 int rwnx_ipc_init(struct rwnx_hw *rwnx_hw, void *shared_ram);
68 void rwnx_ipc_start(struct rwnx_hw *rwnx_hw);
69 void rwnx_ipc_msg_push(struct rwnx_hw *rwnx_hw, void *msg_buf, uint16_t len);
70 int rwnx_host_send_msg(struct rwnx_hw *rwnx_hw, const void *msg_params,
71                          int reqcfm, lmac_msg_id_t reqid, void *cfm);
72 int rwnx_ipc_txdesc_push(struct rwnx_hw *rwnx_hw, void *tx_desc,
73                           void *hostid, int hw_queue);
74 int rwnx_ipc_rxbuf_elem_alloc(struct rwnx_hw *rwnx_hw);
75 void wifi_patch_prepare(void);
76 
77 #endif
78