1 /**
2  ******************************************************************************
3  * @file    mbox_def.h
4  * @author  MCD Application Team
5  * @brief   Mailbox definition
6  ******************************************************************************
7   * @attention
8   *
9   * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10   * All rights reserved.</center></h2>
11   *
12   * This software component is licensed by ST under BSD 3-Clause license,
13   * the "License"; You may not use this file except in compliance with the
14   * License. You may obtain a copy of the License at:
15   *                        opensource.org/licenses/BSD-3-Clause
16   *
17   ******************************************************************************
18  */
19 
20 
21 /* Define to prevent recursive inclusion -------------------------------------*/
22 #ifndef __MBOX_H
23 #define __MBOX_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "stm32_wpan_common.h"
30 
31   /**
32    * This file shall be identical between the CPU1 and the CPU2
33    */
34 
35   /**
36    *********************************************************************************
37    * TABLES
38    *********************************************************************************
39    */
40 
41   /**
42    * Version
43    * [0:3]   = Build - 0: Untracked - 15:Released - x: Tracked version
44    * [4:7]   = branch - 0: Mass Market - x: ...
45    * [8:15]  = Subversion
46    * [16:23] = Version minor
47    * [24:31] = Version major
48    *
49    * Memory Size
50    * [0:7]   = Flash ( Number of 4k sector)
51    * [8:15]  = Reserved ( Shall be set to 0 - may be used as flash extension )
52    * [16:23] = SRAM2b ( Number of 1k sector)
53    * [24:31] = SRAM2a ( Number of 1k sector)
54    */
55   typedef PACKED_STRUCT
56   {
57     uint32_t    Version;
58   } MB_SafeBootInfoTable_t;
59 
60   typedef PACKED_STRUCT
61   {
62     uint32_t    Version;
63     uint32_t    MemorySize;
64     uint32_t    FusInfo;
65   } MB_FusInfoTable_t;
66 
67   typedef PACKED_STRUCT
68   {
69     uint32_t    Version;
70     uint32_t    MemorySize;
71     uint32_t    InfoStack;
72     uint32_t    Reserved;
73   } MB_WirelessFwInfoTable_t;
74 
75   typedef struct
76   {
77     MB_SafeBootInfoTable_t      SafeBootInfoTable;
78     MB_FusInfoTable_t           FusInfoTable;
79     MB_WirelessFwInfoTable_t    WirelessFwInfoTable;
80   } MB_DeviceInfoTable_t;
81 
82   typedef struct
83   {
84     uint8_t     *pcmd_buffer;
85     uint8_t     *pcs_buffer;
86     uint8_t     *pevt_queue;
87     uint8_t     *phci_acl_data_buffer;
88   } MB_BleTable_t;
89 
90   typedef struct
91   {
92     uint8_t   *notack_buffer;
93     uint8_t   *clicmdrsp_buffer;
94     uint8_t   *otcmdrsp_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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
282