1 /**
2  ******************************************************************************
3  * @file    mbox_def.h
4  * @author  MCD Application Team
5  * @brief   Mailbox definition
6  ******************************************************************************
7  * @attention
8  *
9  * Copyright (c) 2018-2021 STMicroelectronics.
10  * All rights reserved.
11  *
12  * This software is licensed under terms that can be found in the LICENSE file
13  * in the root directory of this software component.
14  * If no LICENSE file comes with this software, it is provided AS-IS.
15  *
16  ******************************************************************************
17  */
18 
19 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __MBOX_H
22 #define __MBOX_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "stm32_wpan_common.h"
29 
30   /**
31    * This file shall be identical between the CPU1 and the CPU2
32    */
33 
34   /**
35    *********************************************************************************
36    * TABLES
37    *********************************************************************************
38    */
39 
40   /**
41    * Version
42    * [0:3]   = Build - 0: Untracked - 15:Released - x: Tracked version
43    * [4:7]   = branch - 0: Mass Market - x: ...
44    * [8:15]  = Subversion
45    * [16:23] = Version minor
46    * [24:31] = Version major
47    *
48    * Memory Size
49    * [0:7]   = Flash ( Number of 4k sector)
50    * [8:15]  = Reserved ( Shall be set to 0 - may be used as flash extension )
51    * [16:23] = SRAM2b ( Number of 1k sector)
52    * [24:31] = SRAM2a ( Number of 1k sector)
53    */
54   typedef PACKED_STRUCT
55   {
56     uint32_t    Version;
57   } MB_SafeBootInfoTable_t;
58 
59   typedef PACKED_STRUCT
60   {
61     uint32_t    Version;
62     uint32_t    MemorySize;
63     uint32_t    FusInfo;
64   } MB_FusInfoTable_t;
65 
66   typedef PACKED_STRUCT
67   {
68     uint32_t    Version;
69     uint32_t    MemorySize;
70     uint32_t    InfoStack;
71     uint32_t    Reserved;
72   } MB_WirelessFwInfoTable_t;
73 
74   typedef struct
75   {
76     MB_SafeBootInfoTable_t      SafeBootInfoTable;
77     MB_FusInfoTable_t           FusInfoTable;
78     MB_WirelessFwInfoTable_t    WirelessFwInfoTable;
79   } MB_DeviceInfoTable_t;
80 
81   typedef struct
82   {
83     uint8_t     *pcmd_buffer;
84     uint8_t     *pcs_buffer;
85     uint8_t     *pevt_queue;
86     uint8_t     *phci_acl_data_buffer;
87   } MB_BleTable_t;
88 
89   typedef struct
90   {
91     uint8_t   *notack_buffer;
92     uint8_t   *clicmdrsp_buffer;
93     uint8_t   *otcmdrsp_buffer;
94     uint8_t   *clinot_buffer;
95   } MB_ThreadTable_t;
96 
97   typedef struct
98   {
99     uint8_t   *clicmdrsp_buffer;
100     uint8_t   *m0cmd_buffer;
101   } MB_LldTestsTable_t;
102 
103   typedef struct
104   {
105     uint8_t   *cmdrsp_buffer;
106     uint8_t   *m0cmd_buffer;
107   } MB_BleLldTable_t;
108 
109   typedef struct
110   {
111     uint8_t   *notifM0toM4_buffer;
112     uint8_t   *appliCmdM4toM0_buffer;
113     uint8_t   *requestM0toM4_buffer;
114   } MB_ZigbeeTable_t;
115   /**
116    * msg
117    * [0:7]   = cmd/evt
118    * [8:31] = Reserved
119    */
120   typedef struct
121   {
122     uint8_t   *pcmd_buffer;
123     uint8_t   *sys_queue;
124   } MB_SysTable_t;
125 
126   typedef struct
127   {
128     uint8_t     *spare_ble_buffer;
129     uint8_t     *spare_sys_buffer;
130     uint8_t     *blepool;
131     uint32_t    blepoolsize;
132     uint8_t     *pevt_free_buffer_queue;
133     uint8_t     *traces_evt_pool;
134     uint32_t    tracespoolsize;
135   } MB_MemManagerTable_t;
136 
137   typedef struct
138   {
139     uint8_t   *traces_queue;
140   } MB_TracesTable_t;
141 
142   typedef struct
143   {
144     uint8_t   *p_cmdrsp_buffer;
145     uint8_t   *p_notack_buffer;
146     uint8_t   *evt_queue;
147   } MB_Mac_802_15_4_t;
148 
149   typedef struct
150   {
151     MB_DeviceInfoTable_t    *p_device_info_table;
152     MB_BleTable_t           *p_ble_table;
153     MB_ThreadTable_t        *p_thread_table;
154     MB_SysTable_t           *p_sys_table;
155     MB_MemManagerTable_t    *p_mem_manager_table;
156     MB_TracesTable_t        *p_traces_table;
157     MB_Mac_802_15_4_t       *p_mac_802_15_4_table;
158     MB_ZigbeeTable_t        *p_zigbee_table;
159     MB_LldTestsTable_t      *p_lld_tests_table;
160     MB_BleLldTable_t        *p_ble_lld_table;
161 } MB_RefTable_t;
162 
163 /**
164  * This table shall be used only in the case the CPU2 runs the FUS.
165  * It is used by the command SHCI_GetWirelessFwInfo()
166  */
167 typedef struct
168 {
169   uint32_t  DeviceInfoTableState;
170   uint8_t   Reserved1;
171   uint8_t   LastFusActiveState;
172   uint8_t   LastWirelessStackState;
173   uint8_t   CurrentWirelessStackType;
174   uint32_t  SafeBootVersion;
175   uint32_t  FusVersion;
176   uint32_t  FusMemorySize;
177   uint32_t  WirelessStackVersion;
178   uint32_t  WirelessStackMemorySize;
179   uint32_t  WirelessFirmwareBleInfo;
180   uint32_t  WirelessFirmwareThreadInfo;
181   uint32_t  Reserved2;
182   uint64_t  UID64;
183   uint16_t  DeviceId;
184 } MB_FUS_DeviceInfoTable_t ;
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 /**
191  *********************************************************************************
192  * IPCC CHANNELS
193  *********************************************************************************
194  */
195 
196 /*  CPU1                                             CPU2
197  *   |             (SYSTEM)                            |
198  *   |----HW_IPCC_SYSTEM_CMD_RSP_CHANNEL-------------->|
199  *   |                                                 |
200  *   |<---HW_IPCC_SYSTEM_EVENT_CHANNEL-----------------|
201  *   |                                                 |
202  *   |            (ZIGBEE)                             |
203  *   |----HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL------------>|
204  *   |                                                 |
205  *   |----HW_IPCC_ZIGBEE_CMD_CLI_CHANNEL-------------->|
206  *   |                                                 |
207  *   |<---HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL-------|
208  *   |                                                 |
209  *   |<---HW_IPCC_ZIGBEE_CLI_NOTIF_ACK_CHANNEL---------|
210  *   |                                                 |
211  *   |             (THREAD)                            |
212  *   |----HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL----------->|
213  *   |                                                 |
214  *   |----HW_IPCC_THREAD_CLI_CMD_CHANNEL-------------->|
215  *   |                                                 |
216  *   |<---HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL------|
217  *   |                                                 |
218  *   |<---HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL--|
219  *   |                                                 |
220  *   |             (BLE)                               |
221  *   |----HW_IPCC_BLE_CMD_CHANNEL--------------------->|
222  *   |                                                 |
223  *   |----HW_IPCC_HCI_ACL_DATA_CHANNEL---------------->|
224  *   |                                                 |
225  *   |<---HW_IPCC_BLE_EVENT_CHANNEL--------------------|
226  *   |                                                 |
227  *   |             (BLE LLD)                           |
228  *   |----HW_IPCC_BLE_LLD_CMD_CHANNEL----------------->|
229  *   |                                                 |
230  *   |<---HW_IPCC_BLE_LLD_RSP_CHANNEL------------------|
231  *   |                                                 |
232  *   |<---HW_IPCC_BLE_LLD_M0_CMD_CHANNEL---------------|
233  *   |                                                 |
234  *   |             (MAC)                               |
235  *   |----HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL-------->|
236  *   |                                                 |
237  *   |<---HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL|
238  *   |                                                 |
239  *   |             (BUFFER)                            |
240  *   |----HW_IPCC_MM_RELEASE_BUFFER_CHANNE------------>|
241  *   |                                                 |
242  *   |             (TRACE)                             |
243  *   |<----HW_IPCC_TRACES_CHANNEL----------------------|
244  *   |                                                 |
245  *
246  *
247  *
248  */
249 
250 
251 
252 /** CPU1 */
253 #define HW_IPCC_BLE_CMD_CHANNEL                         LL_IPCC_CHANNEL_1
254 #define HW_IPCC_SYSTEM_CMD_RSP_CHANNEL                  LL_IPCC_CHANNEL_2
255 #define HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL               LL_IPCC_CHANNEL_3
256 #define HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL                LL_IPCC_CHANNEL_3
257 #define HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL            LL_IPCC_CHANNEL_3
258 #define HW_IPCC_MM_RELEASE_BUFFER_CHANNEL               LL_IPCC_CHANNEL_4
259 #define HW_IPCC_THREAD_CLI_CMD_CHANNEL                  LL_IPCC_CHANNEL_5
260 #define HW_IPCC_LLDTESTS_CLI_CMD_CHANNEL                LL_IPCC_CHANNEL_5
261 #define HW_IPCC_BLE_LLD_CLI_CMD_CHANNEL                 LL_IPCC_CHANNEL_5
262 #define HW_IPCC_BLE_LLD_CMD_CHANNEL                     LL_IPCC_CHANNEL_5
263 #define HW_IPCC_HCI_ACL_DATA_CHANNEL                    LL_IPCC_CHANNEL_6
264 
265 /** CPU2 */
266 #define HW_IPCC_BLE_EVENT_CHANNEL                       LL_IPCC_CHANNEL_1
267 #define HW_IPCC_SYSTEM_EVENT_CHANNEL                    LL_IPCC_CHANNEL_2
268 #define HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL         LL_IPCC_CHANNEL_3
269 #define HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL          LL_IPCC_CHANNEL_3
270 #define HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL   LL_IPCC_CHANNEL_3
271 #define HW_IPCC_LLDTESTS_M0_CMD_CHANNEL                 LL_IPCC_CHANNEL_3
272 #define HW_IPCC_BLE_LLD_M0_CMD_CHANNEL                  LL_IPCC_CHANNEL_3
273 #define HW_IPCC_TRACES_CHANNEL                          LL_IPCC_CHANNEL_4
274 #define HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL     LL_IPCC_CHANNEL_5
275 #define HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL                LL_IPCC_CHANNEL_5
276 #define HW_IPCC_BLE_LLD_CLI_RSP_CHANNEL                 LL_IPCC_CHANNEL_5
277 #define HW_IPCC_BLE_LLD_RSP_CHANNEL                     LL_IPCC_CHANNEL_5
278 #define HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL               LL_IPCC_CHANNEL_5
279 #endif /*__MBOX_H */
280 
281