STM32Cube_FW_WB_V1.4.0 - STM32_WPAN part

pull/12283/head
jeromecoutant 2020-01-17 17:09:53 +01:00
parent 08184d7ac9
commit b4f3b0799d
13 changed files with 1245 additions and 527 deletions

View File

@ -4,7 +4,7 @@
* @author MCD Application Team
* @brief Hardware
******************************************************************************
* @attention
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
@ -15,7 +15,7 @@
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/
@ -27,240 +27,6 @@ extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32wbxx.h"
#include "stm32wbxx_ll_exti.h"
#include "stm32wbxx_ll_system.h"
#include "stm32wbxx_ll_rcc.h"
#include "stm32wbxx_ll_ipcc.h"
#include "stm32wbxx_ll_bus.h"
#include "stm32wbxx_ll_pwr.h"
#include "stm32wbxx_ll_cortex.h"
#include "stm32wbxx_ll_utils.h"
#include "stm32wbxx_ll_hsem.h"
#ifdef USE_STM32WBXX_USB_DONGLE
#include "stm32wbxx_usb_dongle.h"
#endif
#ifdef USE_STM32WBXX_NUCLEO
#include "stm32wbxx_nucleo.h"
#endif
#ifdef USE_X_NUCLEO_EPD
#include "x_nucleo_epd.h"
#endif
/******************************************************************************
* HW LOW POWER
******************************************************************************/
/**
* Stop Mode configuration
* The values of enum shall be kept unchanged
*/
typedef enum
{
hw_lpm_stopmode0,
hw_lpm_stopmode1,
hw_lpm_stopmode2,
} HW_LPM_StopModeConf_t;
/**
* Off Mode configuration
* The values of enum shall be kept unchanged
*/
typedef enum
{
hw_lpm_standby,
hw_lpm_shutdown,
} HW_LPM_OffModeConf_t;
void HW_LPM_SleepMode(void);
void HW_LPM_StopMode(HW_LPM_StopModeConf_t configuration);
void HW_LPM_OffMode(HW_LPM_OffModeConf_t configuration);
/******************************************************************************
* HW UART
******************************************************************************/
typedef enum
{
hw_uart1,
hw_uart2,
hw_lpuart1,
} hw_uart_id_t;
typedef enum
{
hw_uart_ok,
hw_uart_error,
hw_uart_busy,
hw_uart_to,
} hw_status_t;
void HW_UART_Init(hw_uart_id_t hw_uart_id);
void HW_UART_Receive_IT(hw_uart_id_t hw_uart_id, uint8_t *pData, uint16_t Size, void (*Callback)(void));
void HW_UART_Transmit_IT(hw_uart_id_t hw_uart_id, uint8_t *pData, uint16_t Size, void (*Callback)(void));
hw_status_t HW_UART_Transmit(hw_uart_id_t hw_uart_id, uint8_t *p_data, uint16_t size, uint32_t timeout);
hw_status_t HW_UART_Transmit_DMA(hw_uart_id_t hw_uart_id, uint8_t *p_data, uint16_t size, void (*Callback)(void));
void HW_UART_Interrupt_Handler(hw_uart_id_t hw_uart_id);
void HW_UART_DMA_Interrupt_Handler(hw_uart_id_t hw_uart_id);
/******************************************************************************
* HW TimerServer
******************************************************************************/
/* Exported types ------------------------------------------------------------*/
/**
* This setting is used when standby mode is supported.
* hw_ts_InitMode_Limited should be used when the device restarts from Standby Mode. In that case, the Timer Server does
* not re-initialized its context. Only the Hardware register which content has been lost is reconfigured
* Otherwise, hw_ts_InitMode_Full should be requested (Start from Power ON) and everything is re-initialized.
*/
typedef enum
{
hw_ts_InitMode_Full,
hw_ts_InitMode_Limited,
} HW_TS_InitMode_t;
/**
* When a Timer is created as a SingleShot timer, it is not automatically restarted when the timeout occurs. However,
* the timer is kept reserved in the list and could be restarted at anytime with HW_TS_Start()
*
* When a Timer is created as a Repeated timer, it is automatically restarted when the timeout occurs.
*/
typedef enum
{
hw_ts_SingleShot,
hw_ts_Repeated
} HW_TS_Mode_t;
/**
* hw_ts_Successful is returned when a Timer has been successfully created with HW_TS_Create(). Otherwise, hw_ts_Failed
* is returned. When hw_ts_Failed is returned, that means there are not enough free slots in the list to create a
* Timer. In that case, CFG_HW_TS_MAX_NBR_CONCURRENT_TIMER should be increased
*/
typedef enum
{
hw_ts_Successful,
hw_ts_Failed,
}HW_TS_ReturnStatus_t;
typedef void (*HW_TS_pTimerCb_t)(void);
/**
* @brief Initialize the timer server
* This API shall be called by the application before any timer is requested to the timer server. It
* configures the RTC module to be connected to the LSI input clock.
*
* @param TimerInitMode: When the device restarts from Standby, it should request hw_ts_InitMode_Limited so that the
* Timer context is not re-initialized. Otherwise, hw_ts_InitMode_Full should be requested
* @param hrtc: RTC Handle
* @retval None
*/
void HW_TS_Init(HW_TS_InitMode_t TimerInitMode, RTC_HandleTypeDef *hrtc);
/**
* @brief Interface to create a virtual timer
* The user shall call this API to create a timer. Once created, the timer is reserved to the module until it
* has been deleted. When creating a timer, the user shall specify the mode (single shot or repeated), the
* callback to be notified when the timer expires and a module ID to identify in the timer interrupt handler
* which module is concerned. In return, the user gets a timer ID to handle it.
*
* @param TimerProcessID: This is an identifier provided by the user and returned in the callback to allow
* identification of the requester
* @param pTimerId: Timer Id returned to the user to request operation (start, stop, delete)
* @param TimerMode: Mode of the virtual timer (Single shot or repeated)
* @param pTimerCallBack: Callback when the virtual timer expires
* @retval HW_TS_ReturnStatus_t: Return whether the creation is sucessfull or not
*/
HW_TS_ReturnStatus_t HW_TS_Create(uint32_t TimerProcessID, uint8_t *pTimerId, HW_TS_Mode_t TimerMode, HW_TS_pTimerCb_t pTimerCallBack);
/**
* @brief Stop a virtual timer
* This API may be used to stop a running timer. A timer which is stopped is move to the pending state.
* A pending timer may be restarted at any time with a different timeout value but the mode cannot be changed.
* Nothing is done when it is called to stop a timer which has been already stopped
*
* @param TimerID: Id of the timer to stop
* @retval None
*/
void HW_TS_Stop(uint8_t TimerID);
/**
* @brief Start a virtual timer
* This API shall be used to start a timer. The timeout value is specified and may be different each time.
* When the timer is in the single shot mode, it will move to the pending state when it expires. The user may
* restart it at any time with a different timeout value. When the timer is in the repeated mode, it always
* stay in the running state. When the timer expires, it will be restarted with the same timeout value.
* This API shall not be called on a running timer.
*
* @param TimerID: The ID Id of the timer to start
* @param timeout_ticks: Number of ticks of the virtual timer (Maximum value is (0xFFFFFFFF-0xFFFF = 0xFFFF0000)
* @retval None
*/
void HW_TS_Start(uint8_t TimerID, uint32_t timeout_ticks);
/**
* @brief Delete a virtual timer from the list
* This API should be used when a timer is not needed anymore by the user. A deleted timer is removed from
* the timer list managed by the timer server. It cannot be restarted again. The user has to go with the
* creation of a new timer if required and may get a different timer id
*
* @param TimerID: The ID of the timer to remove from the list
* @retval None
*/
void HW_TS_Delete(uint8_t TimerID);
/**
* @brief Schedule the timer list on the timer interrupt handler
* This interrupt handler shall be called by the application in the RTC interrupt handler. This handler takes
* care of clearing all status flag required in the RTC and EXTI peripherals
*
* @param None
* @retval None
*/
void HW_TS_RTC_Wakeup_Handler(void);
/**
* @brief Return the number of ticks to count before the interrupt
* This API returns the number of ticks left to be counted before an interrupt is generated by the
* Timer Server. This API may be used by the application for power management optimization. When the system
* enters low power mode, the mode selection is a tradeoff between the wakeup time where the CPU is running
* and the time while the CPU will be kept in low power mode before next wakeup. The deeper is the
* low power mode used, the longer is the wakeup time. The low power mode management considering wakeup time
* versus time in low power mode is implementation specific
* When the timer is disabled (No timer in the list), it returns 0xFFFF
*
* @param None
* @retval The number of ticks left to count
*/
uint16_t HW_TS_RTC_ReadLeftTicksToCount(void);
/**
* @brief Notify the application that a registered timer has expired
* This API shall be implemented by the user application.
* This API notifies the application that a timer expires. This API is running in the RTC Wakeup interrupt
* context. The application may implement an Operating System to change the context priority where the timer
* callback may be handled. This API provides the module ID to identify which module is concerned and to allow
* sending the information to the correct task
*
* @param TimerProcessID: The TimerProcessId associated with the timer when it has been created
* @param TimerID: The TimerID of the expired timer
* @param pTimerCallBack: The Callback associated with the timer when it has been created
* @retval None
*/
void HW_TS_RTC_Int_AppNot(uint32_t TimerProcessID, uint8_t TimerID, HW_TS_pTimerCb_t pTimerCallBack);
/**
* @brief Notify the application that the wakeupcounter has been updated
* This API should be implemented by the user application
* This API notifies the application that the counter has been updated. This is expected to be used along
* with the HW_TS_RTC_ReadLeftTicksToCount () API. It could be that the counter has been updated since the
* last call of HW_TS_RTC_ReadLeftTicksToCount () and before entering low power mode. This notification
* provides a way to the application to solve that race condition to reevaluate the counter value before
* entering low power mode
*
* @param None
* @retval None
*/
void HW_TS_RTC_CountUpdated_AppNot(void);
/******************************************************************************
* HW IPCC
@ -292,6 +58,13 @@ extern "C" {
void HW_IPCC_THREAD_CliSendAck( void );
void HW_IPCC_THREAD_CliEvtNot( void );
void HW_IPCC_LLDTESTS_Init( void );
void HW_IPCC_LLDTESTS_SendCliCmd( void );
void HW_IPCC_LLDTESTS_ReceiveCliRsp( void );
void HW_IPCC_LLDTESTS_SendCliRspAck( void );
void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void );
void HW_IPCC_LLDTESTS_SendM0CmdAck( void );
void HW_IPCC_TRACES_Init( void );
void HW_IPCC_TRACES_EvtNot( void );
@ -301,6 +74,17 @@ extern "C" {
void HW_IPCC_MAC_802_15_4_CmdEvtNot( void );
void HW_IPCC_MAC_802_15_4_EvtNot( void );
void HW_IPCC_ZIGBEE_Init( void );
void HW_IPCC_ZIGBEE_SendAppliCmd(void);
void HW_IPCC_ZIGBEE_AppliCmdNotification(void);
void HW_IPCC_ZIGBEE_AppliAsyncEvtNotification(void);
void HW_IPCC_ZIGBEE_SendAppliCmdAck(void);
void HW_IPCC_ZIGBEE_AppliAsyncLoggingNotification( void );
void HW_IPCC_ZIGBEE_SendLoggingAck(void);
#ifdef __cplusplus
}
#endif

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
* @file mbox_def.h
* @author MCD Application Team
* @brief Mailbox definition
******************************************************************************
******************************************************************************
* @file mbox_def.h
* @author MCD Application Team
* @brief Mailbox definition
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
@ -15,7 +15,7 @@
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/
@ -61,22 +61,22 @@ extern "C" {
{
uint32_t Version;
uint32_t MemorySize;
uint32_t RssInfo;
} MB_RssInfoTable_t;
uint32_t FusInfo;
} MB_FusInfoTable_t;
typedef PACKED_STRUCT
{
uint32_t Version;
uint32_t MemorySize;
uint32_t ThreadInfo;
uint32_t BleInfo;
uint32_t InfoStack;
uint32_t Reserved;
} MB_WirelessFwInfoTable_t;
typedef struct
{
MB_SafeBootInfoTable_t SafeBootInfoTable;
MB_RssInfoTable_t RssInfoTable;
MB_WirelessFwInfoTable_t WirelessFwIinfoTable;
MB_FusInfoTable_t FusInfoTable;
MB_WirelessFwInfoTable_t WirelessFwInfoTable;
} MB_DeviceInfoTable_t;
typedef struct
@ -94,6 +94,18 @@ extern "C" {
uint8_t *otcmdrsp_buffer;
} MB_ThreadTable_t;
typedef struct
{
uint8_t *clicmdrsp_buffer;
uint8_t *m0cmd_buffer;
} MB_LldTestsTable_t;
typedef struct
{
uint8_t *notifM0toM4_buffer;
uint8_t *appliCmdM4toM0_buffer;
uint8_t *loggingM0toM4_buffer;
} MB_ZigbeeTable_t;
/**
* msg
* [0:7] = cmd/evt
@ -134,10 +146,12 @@ extern "C" {
MB_BleTable_t *p_ble_table;
MB_ThreadTable_t *p_thread_table;
MB_SysTable_t *p_sys_table;
MB_MemManagerTable_t *p_mem_manager_table;
MB_MemManagerTable_t *p_mem_manager_table;
MB_TracesTable_t *p_traces_table;
MB_Mac_802_15_4_t *p_mac_802_15_4_table;
} MB_RefTable_t;
MB_ZigbeeTable_t *p_zigbee_table;
MB_LldTestsTable_t *p_lld_tests_table;
} MB_RefTable_t;
#ifdef __cplusplus
}
@ -149,23 +163,77 @@ extern "C" {
*********************************************************************************
*/
/* CPU1 CPU2
* | (SYSTEM) |
* |----HW_IPCC_SYSTEM_CMD_RSP_CHANNEL-------------->|
* | |
* |<---HW_IPCC_SYSTEM_EVENT_CHANNEL-----------------|
* | |
* | (ZIGBEE) |
* |----HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL------------>|
* | |
* |----HW_IPCC_ZIGBEE_CMD_CLI_CHANNEL-------------->|
* | |
* |<---HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL-------|
* | |
* |<---HW_IPCC_ZIGBEE_CLI_NOTIF_ACK_CHANNEL---------|
* | |
* | (THREAD) |
* |----HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL----------->|
* | |
* |----HW_IPCC_THREAD_CLI_CMD_CHANNEL-------------->|
* | |
* |<---HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL------|
* | |
* |<---HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL--|
* | |
* | (BLE) |
* |----HW_IPCC_BLE_CMD_CHANNEL--------------------->|
* | |
* |----HW_IPCC_HCI_ACL_DATA_CHANNEL---------------->|
* | |
* |<---HW_IPCC_BLE_EVENT_CHANNEL--------------------|
* | |
* | (MAC) |
* |----HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL-------->|
* | |
* |<---HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL|
* | |
* | (BUFFER) |
* |----HW_IPCC_MM_RELEASE_BUFFER_CHANNE------------>|
* | |
* | (TRACE) |
* |<----HW_IPCC_TRACES_CHANNEL----------------------|
* | |
*
*
*
*/
/** CPU1 */
#define HW_IPCC_BLE_CMD_CHANNEL LL_IPCC_CHANNEL_1
#define HW_IPCC_SYSTEM_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_2
#define HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3
#define HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL LL_IPCC_CHANNEL_3
#define HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3
#define HW_IPCC_THREAD_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5
#define HW_IPCC_MM_RELEASE_BUFFER_CHANNEL LL_IPCC_CHANNEL_4
#define HW_IPCC_THREAD_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5
#define HW_IPCC_LLDTESTS_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5
#define HW_IPCC_HCI_ACL_DATA_CHANNEL LL_IPCC_CHANNEL_6
/** CPU2 */
#define HW_IPCC_BLE_EVENT_CHANNEL LL_IPCC_CHANNEL_1
#define HW_IPCC_SYSTEM_EVENT_CHANNEL LL_IPCC_CHANNEL_2
#define HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3
#define HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL LL_IPCC_CHANNEL_3
#define HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3
#define HW_IPCC_LLDTESTS_M0_CMD_CHANNEL LL_IPCC_CHANNEL_3
#define HW_IPCC_TRACES_CHANNEL LL_IPCC_CHANNEL_4
#define HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_5
#define HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5
#define HW_IPCC_ZIGBEE_APPLI_LOGGING_CHANNEL LL_IPCC_CHANNEL_5
#endif /*__MBOX_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -4,18 +4,18 @@
* @author MCD Application Team
* @brief OTP manager
******************************************************************************
* @attention
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Includes ------------------------------------------------------------------*/

View File

@ -4,18 +4,18 @@
* @author MCD Application Team
* @brief OTP manager interface
******************************************************************************
* @attention
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/

View File

@ -1,21 +1,21 @@
/**
******************************************************************************
* @file shci.c
* @author MCD Application Team
* @brief HCI command for the system channel
******************************************************************************
******************************************************************************
* @file shci.c
* @author MCD Application Team
* @brief HCI command for the system channel
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Includes ------------------------------------------------------------------*/
@ -23,6 +23,7 @@
#include "shci_tl.h"
#include "shci.h"
#include "stm32wbxx.h"
/* Private typedef -----------------------------------------------------------*/
/* Private defines -----------------------------------------------------------*/
@ -35,25 +36,210 @@
/**
* C2 COMMAND
* These commands are sent to the CPU2
*/
SHCI_CmdStatus_t SHCI_C2_FUS_Get_State( void )
uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_error_code )
{
/**
* Buffer is large enough to hold either a command with no parameter
* or a command complete without payload
* A command status event + payload has the same size than the expected command complete
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_CmdPacket_t * p_cmd;
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1];
TL_EvtPacket_t * p_rsp;
p_cmd = (TL_CmdPacket_t *)local_buffer;
p_rsp = (TL_EvtPacket_t *)local_buffer;
p_cmd->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_FUS_GET_STATE;
shci_send( SHCI_OPCODE_C2_FUS_GET_STATE,
0,
0,
p_rsp );
p_cmd->cmdserial.cmd.plen = 0 ;
if(p_error_code != 0)
{
*p_error_code = (SHCI_FUS_GetState_ErrorCode_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[1]);
}
shci_send( p_cmd, p_rsp );
return (((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_add )
{
/**
* TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
uint32_t *p_cmd;
uint8_t cmd_length;
p_cmd = (uint32_t*)local_buffer;
cmd_length = 0;
if(fw_src_add != 0)
{
*p_cmd = fw_src_add;
cmd_length += 4;
}
if(fw_dest_add != 0)
{
*(p_cmd+1) = fw_dest_add;
cmd_length += 4;
}
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_FUS_FW_UPGRADE,
cmd_length,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_FUS_FW_DELETE,
0,
0,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t *pParam )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_FUS_UPDATE_AUTH_KEY,
sizeof( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t ),
(uint8_t*)pParam,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_FUS_LOCK_AUTH_KEY,
0,
0,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *pParam, uint8_t *p_key_index )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1];
TL_EvtPacket_t * p_rsp;
uint8_t local_payload_len;
if(pParam->KeyType == KEYTYPE_ENCRYPTED)
{
/**
* When the key is encrypted, the 12 bytes IV Key is included in the payload as well
* The IV key is always 12 bytes
*/
local_payload_len = pParam->KeySize + 2 + 12;
}
else
{
local_payload_len = pParam->KeySize + 2;
}
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_FUS_STORE_USR_KEY,
local_payload_len ,
(uint8_t*)pParam,
p_rsp );
*p_key_index = (((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[1]);
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
local_buffer[0] = key_index;
shci_send( SHCI_OPCODE_C2_FUS_LOAD_USR_KEY,
1,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_FUS_START_WS,
0,
0,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
local_buffer[0] = key_index;
shci_send( SHCI_OPCODE_C2_FUS_LOCK_USR_KEY,
1,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
@ -61,164 +247,304 @@ SHCI_CmdStatus_t SHCI_C2_FUS_Get_State( void )
SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket )
{
/**
* Buffer is large enough to hold a command complete without payload
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
((TL_CmdPacket_t *)pCmdPacket)->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_BLE_INIT;
((TL_CmdPacket_t *)pCmdPacket)->cmdserial.cmd.plen = sizeof( SHCI_C2_Ble_Init_Cmd_Param_t ) ;
shci_send( (TL_CmdPacket_t *)pCmdPacket, p_rsp );
shci_send( SHCI_OPCODE_C2_BLE_INIT,
sizeof( SHCI_C2_Ble_Init_Cmd_Param_t ),
(uint8_t*)&pCmdPacket->Param,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_CmdPacket_t * p_cmd;
TL_EvtPacket_t * p_rsp;
p_cmd = (TL_CmdPacket_t *)local_buffer;
p_rsp = (TL_EvtPacket_t *)local_buffer;
p_cmd->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_THREAD_INIT;
p_cmd->cmdserial.cmd.plen = 0 ;
shci_send( p_cmd, p_rsp );
shci_send( SHCI_OPCODE_C2_THREAD_INIT,
0,
0,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_LLD_TESTS_INIT,
param_size,
p_param,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_ZIGBEE_INIT,
0,
0,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket )
{
/**
* Buffer is large enough to hold a command complete without payload
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
((TL_CmdPacket_t *)pCmdPacket)->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_DEBUG_INIT;
((TL_CmdPacket_t *)pCmdPacket)->cmdserial.cmd.plen = sizeof( SHCI_C2_DEBUG_Init_Cmd_Packet_t ) ;
shci_send( (TL_CmdPacket_t *)pCmdPacket, p_rsp );
shci_send( SHCI_OPCODE_C2_DEBUG_INIT,
sizeof( SHCI_C2_DEBUG_init_Cmd_Param_t ),
(uint8_t*)&pCmdPacket->Param,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FLASH_Erase_Activity( SHCI_C2_FLASH_Erase_Activity_Cmd_Packet_t *pCmdPacket )
SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activity )
{
/**
* Buffer is large enough to hold a command complete without payload
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
((TL_CmdPacket_t *)pCmdPacket)->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_FLASH_ERASE_ACTIVITY;
local_buffer[0] = erase_activity;
((TL_CmdPacket_t *)pCmdPacket)->cmdserial.cmd.plen = sizeof( SHCI_C2_FLASH_Erase_Activity_Cmd_Packet_t ) ;
shci_send( (TL_CmdPacket_t *)pCmdPacket, p_rsp );
shci_send( SHCI_OPCODE_C2_FLASH_ERASE_ACTIVITY,
1,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mode )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_CmdPacket_t * p_cmd;
TL_EvtPacket_t * p_rsp;
p_cmd = (TL_CmdPacket_t *)local_buffer;
p_rsp = (TL_EvtPacket_t *)local_buffer;
p_cmd->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_CONCURRENT_SET_MODE;
p_cmd->cmdserial.cmd.plen = 1;
p_cmd->cmdserial.cmd.payload[0] = Mode;
local_buffer[0] = Mode;
shci_send( p_cmd, p_rsp );
shci_send( SHCI_OPCODE_C2_CONCURRENT_SET_MODE,
1,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_CmdPacket_t * p_cmd;
TL_EvtPacket_t * p_rsp;
p_cmd = (TL_CmdPacket_t *)local_buffer;
p_rsp = (TL_EvtPacket_t *)local_buffer;
p_cmd->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_FLASH_STORE_DATA;
p_cmd->cmdserial.cmd.plen = 1;
p_cmd->cmdserial.cmd.payload[0] = Ip;
local_buffer[0] = Ip;
shci_send( p_cmd, p_rsp );
shci_send( SHCI_OPCODE_C2_FLASH_STORE_DATA,
1,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_CmdPacket_t * p_cmd;
TL_EvtPacket_t * p_rsp;
p_cmd = (TL_CmdPacket_t *)local_buffer;
p_rsp = (TL_EvtPacket_t *)local_buffer;
p_cmd->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_FLASH_ERASE_DATA;
p_cmd->cmdserial.cmd.plen = 1;
p_cmd->cmdserial.cmd.payload[0] = Ip;
local_buffer[0] = Ip;
shci_send( p_cmd, p_rsp );
shci_send( SHCI_OPCODE_C2_FLASH_ERASE_DATA,
1,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t FlagRadioLowPowerOn)
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_CmdPacket_t * p_cmd;
TL_EvtPacket_t * p_rsp;
p_cmd = (TL_CmdPacket_t *)local_buffer;
p_rsp = (TL_EvtPacket_t *)local_buffer;
p_cmd->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER;
p_cmd->cmdserial.cmd.plen = 2;
p_cmd->cmdserial.cmd.payload[0] = Ip;
p_cmd->cmdserial.cmd.payload[1] = FlagRadioLowPowerOn;
shci_send( p_cmd, p_rsp );
local_buffer[0] = Ip;
local_buffer[1] = FlagRadioLowPowerOn;
shci_send( SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER,
2,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_CmdPacket_t * p_cmd;
TL_EvtPacket_t * p_rsp;
p_cmd = (TL_CmdPacket_t *)local_buffer;
p_rsp = (TL_EvtPacket_t *)local_buffer;
p_cmd->cmdserial.cmd.cmdcode = SHCI_OPCODE_C2_MAC_802_15_4_INIT;
p_cmd->cmdserial.cmd.plen = 0 ;
shci_send( p_cmd, p_rsp );
shci_send( SHCI_OPCODE_C2_MAC_802_15_4_INIT,
0,
0,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_Reinit( void )
{
/**
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
shci_send( SHCI_OPCODE_C2_REINIT,
0,
0,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_number, uint8_t gpio_polarity, uint8_t gpio_status)
{
/**
* TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters
* Buffer is large enough to hold command complete without payload
*/
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE];
TL_EvtPacket_t * p_rsp;
p_rsp = (TL_EvtPacket_t *)local_buffer;
((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_port = gpio_port;
((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_pin_number = gpio_pin_number;
((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_polarity = gpio_polarity;
((SHCI_C2_EXTPA_CONFIG_Cmd_Param_t*)local_buffer)->gpio_status = gpio_status;
shci_send( SHCI_OPCODE_C2_EXTPA_CONFIG,
8,
local_buffer,
p_rsp );
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
}
/**
* Local System COMMAND
* These commands are NOT sent to the CPU2
*/
SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
{
uint32_t ipccdba = 0;
MB_RefTable_t * p_RefTable = NULL;
uint32_t version = 0;
uint32_t memorySize = 0;
uint32_t infoStack = 0;
ipccdba = READ_BIT( FLASH->IPCCBR, FLASH_IPCCBR_IPCCDBA );
p_RefTable = (MB_RefTable_t*)((ipccdba<<2) + SRAM2A_BASE);
/**
* Retrieve the WirelessFwInfoTable
* This table is stored in RAM at startup during the TL (transport layer) initialization
*/
version = p_RefTable->p_device_info_table->WirelessFwInfoTable.Version;
pWirelessInfo->VersionMajor = ((version & INFO_VERSION_MAJOR_MASK) >> INFO_VERSION_MAJOR_OFFSET);
pWirelessInfo->VersionMinor = ((version & INFO_VERSION_MINOR_MASK) >> INFO_VERSION_MINOR_OFFSET);
pWirelessInfo->VersionSub = ((version & INFO_VERSION_SUB_MASK) >> INFO_VERSION_SUB_OFFSET);
pWirelessInfo->VersionBranch = ((version & INFO_VERSION_BRANCH_MASK) >> INFO_VERSION_BRANCH_OFFSET);
pWirelessInfo->VersionReleaseType = ((version & INFO_VERSION_TYPE_MASK) >> INFO_VERSION_TYPE_OFFSET);
memorySize = p_RefTable->p_device_info_table->WirelessFwInfoTable.MemorySize;
pWirelessInfo->MemorySizeSram2B = ((memorySize & INFO_SIZE_SRAM2B_MASK) >> INFO_SIZE_SRAM2B_OFFSET);
pWirelessInfo->MemorySizeSram2A = ((memorySize & INFO_SIZE_SRAM2A_MASK) >> INFO_SIZE_SRAM2A_OFFSET);
pWirelessInfo->MemorySizeSram1 = ((memorySize & INFO_SIZE_SRAM1_MASK) >> INFO_SIZE_SRAM1_OFFSET);
pWirelessInfo->MemorySizeFlash = ((memorySize & INFO_SIZE_FLASH_MASK) >> INFO_SIZE_FLASH_OFFSET);
infoStack = p_RefTable->p_device_info_table->WirelessFwInfoTable.InfoStack;
pWirelessInfo->StackType = ((infoStack & INFO_STACK_TYPE_MASK) >> INFO_STACK_TYPE_OFFSET);
/**
* Retrieve the FusInfoTable
* This table is stored in RAM at startup during the TL (transport layer) initialization
*/
version = p_RefTable->p_device_info_table->FusInfoTable.Version;
pWirelessInfo->FusVersionMajor = ((version & INFO_VERSION_MAJOR_MASK) >> INFO_VERSION_MAJOR_OFFSET);
pWirelessInfo->FusVersionMinor = ((version & INFO_VERSION_MINOR_MASK) >> INFO_VERSION_MINOR_OFFSET);
pWirelessInfo->FusVersionSub = ((version & INFO_VERSION_SUB_MASK) >> INFO_VERSION_SUB_OFFSET);
memorySize = p_RefTable->p_device_info_table->FusInfoTable.MemorySize;
pWirelessInfo->FusMemorySizeSram2B = ((memorySize & INFO_SIZE_SRAM2B_MASK) >> INFO_SIZE_SRAM2B_OFFSET);
pWirelessInfo->FusMemorySizeSram2A = ((memorySize & INFO_SIZE_SRAM2A_MASK) >> INFO_SIZE_SRAM2A_OFFSET);
pWirelessInfo->FusMemorySizeFlash = ((memorySize & INFO_SIZE_FLASH_MASK) >> INFO_SIZE_FLASH_OFFSET);
return (SHCI_Success);
}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,21 +1,21 @@
/**
******************************************************************************
* @file shci.h
* @author MCD Application Team
* @brief HCI command for the system channel
******************************************************************************
******************************************************************************
* @file shci.h
* @author MCD Application Team
* @brief HCI command for the system channel
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/
@ -27,6 +27,8 @@ extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "mbox_def.h" /* Requested to expose the MB_WirelessFwInfoTable_t structure */
/* Exported types ------------------------------------------------------------*/
/* SYSTEM EVENT */
@ -36,6 +38,21 @@ extern "C" {
RSS_FW_RUNNING = 0x01,
} SHCI_SysEvt_Ready_Rsp_t;
/* ERROR CODES
*
* These error codes are detected on M0 side and are send back to the M4 via a system
* notification message. It is up to the application running on M4 to manage these errors
*
* These errors can be generated by all layers (low level driver, stack, framework infrastructure, etc..)
*/
typedef enum
{
ERR_BLE_INIT = 0,
ERR_THREAD_LLD_FATAL_ERROR = 125, /* The LLD driver used on 802_15_4 detected a fatal error */
ERR_THREAD_UNKNOWN_CMD = 126, /* The command send by the M4 to control the Thread stack is unknown */
ERR_ZIGBEE_UNKNOWN_CMD = 200, /* The command send by the M4 to control the Zigbee stack is unknown */
} SCHI_SystemErrCode_t;
#define SHCI_EVTCODE ( 0xFF )
#define SHCI_SUB_EVT_CODE_BASE ( 0x9200 )
@ -45,12 +62,17 @@ extern "C" {
typedef enum
{
SHCI_SUB_EVT_CODE_READY = SHCI_SUB_EVT_CODE_BASE,
SHCI_SUB_EVT_ERROR_NOTIF,
} SHCI_SUB_EVT_CODE_t;
typedef PACKED_STRUCT{
SHCI_SysEvt_Ready_Rsp_t sysevt_ready_rsp;
} SHCI_C2_Ready_Evt_t;
typedef PACKED_STRUCT{
SCHI_SystemErrCode_t errorCode;
} SHCI_C2_ErrorNotif_Evt_t;
/* SYSTEM COMMAND */
typedef PACKED_STRUCT
{
@ -60,25 +82,19 @@ extern "C" {
typedef enum
{
SHCI_Success = 0x00,
SHCI_Unknown_Command = 0x01,
SHCI_UNKNOWN_CMD = 0x01,
SHCI_ERR_UNSUPPORTED_FEATURE = 0x11,
SHCI_ERR_INVALID_HCI_CMD_PARAMS = 0x12,
SHCI_FUS_Command_Not_Supported = 0xFF,
SHCI_FUS_CMD_NOT_SUPPORTED = 0xFF,
} SHCI_CmdStatus_t;
typedef enum
{
SHCI_8bits = 0x01,
SHCI_16bits = 0x02,
SHCI_32bits = 0x04,
SHCI_8BITS = 0x01,
SHCI_16BITS = 0x02,
SHCI_32BITS = 0x04,
} SHCI_Busw_t;
typedef enum
{
erase_activity_OFF = 0x00,
erase_activity_ON = 0x01,
} SHCI_Erase_Activity_t;
#define SHCI_OGF ( 0x3F )
#define SHCI_OCF_BASE ( 0x50 )
@ -90,81 +106,111 @@ extern "C" {
SHCI_OCF_C2_RESERVED1 = SHCI_OCF_BASE,
SHCI_OCF_C2_RESERVED2,
SHCI_OCF_C2_FUS_GET_STATE,
SHCI_OCF_C2_FUS_GET_UUID64,
SHCI_OCF_C2_FUS_FIRMWARE_UPGRADE,
SHCI_OCF_C2_FUS_REMOVE_WIRELESS_STACK,
SHCI_OCF_C2_FUS_UPDATE_AUTHENTICATION_KEY,
SHCI_OCF_C2_FUS_LOCK_AUTHENTICATION_KEY,
SHCI_OCF_C2_FUS_WRITE_USER_KEY_IN_MEMORY,
SHCI_OCF_C2_FUS_WRITE_USER_KEY_IN_AES,
SHCI_OCF_C2_FUS_START_WIRELESS_STACK,
SHCI_OCF_C2_FUS_UPGRADE,
SHCI_OCF_C2_FUS_ABORT,
SHCI_OCF_C2_FUS_RESERVED1,
SHCI_OCF_C2_FUS_FW_UPGRADE,
SHCI_OCF_C2_FUS_FW_DELETE,
SHCI_OCF_C2_FUS_UPDATE_AUTH_KEY,
SHCI_OCF_C2_FUS_LOCK_AUTH_KEY,
SHCI_OCF_C2_FUS_STORE_USR_KEY,
SHCI_OCF_C2_FUS_LOAD_USR_KEY,
SHCI_OCF_C2_FUS_START_WS,
SHCI_OCF_C2_FUS_RESERVED2,
SHCI_OCF_C2_FUS_RESERVED3,
SHCI_OCF_C2_FUS_RESERVED4,
SHCI_OCF_C2_FUS_LOCK_USR_KEY,
SHCI_OCF_C2_FUS_RESERVED5,
SHCI_OCF_C2_FUS_RESERVED6,
SHCI_OCF_C2_FUS_RESERVED7,
SHCI_OCF_C2_FUS_RESERVED8,
SHCI_OCF_C2_FUS_RESERVED9,
SHCI_OCF_C2_BLE_init,
SHCI_OCF_C2_Thread_init,
SHCI_OCF_C2_Debug_init,
SHCI_OCF_C2_FLASH_erase_activity,
SHCI_OCF_C2_Concurrent_Set_Mode,
SHCI_OCF_C2_FLASH_store_data,
SHCI_OCF_C2_FLASH_erase_data,
SHCI_OCF_C2_RADIO_Allow_Low_Power,
SHCI_OCF_C2_Mac_802_15_4_init,
SHCI_OCF_C2_FUS_RESERVED10,
SHCI_OCF_C2_FUS_RESERVED11,
SHCI_OCF_C2_FUS_RESERVED12,
SHCI_OCF_C2_BLE_INIT,
SHCI_OCF_C2_THREAD_INIT,
SHCI_OCF_C2_DEBUG_INIT,
SHCI_OCF_C2_FLASH_ERASE_ACTIVITY,
SHCI_OCF_C2_CONCURRENT_SET_MODE,
SHCI_OCF_C2_FLASH_STORE_DATA,
SHCI_OCF_C2_FLASH_ERASE_DATA,
SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER,
SHCI_OCF_C2_MAC_802_15_4_INIT,
SHCI_OCF_C2_REINIT,
SHCI_OCF_C2_ZIGBEE_INIT,
SHCI_OCF_C2_LLD_TESTS_INIT,
SHCI_OCF_C2_EXTPA_CONFIG
} SHCI_OCF_t;
#define SHCI_OPCODE_C2_FUS_GET_STATE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_GET_STATE)
/** No command parameters */
/** No response parameters*/
/** Response parameters*/
typedef enum
{
FUS_STATE_NO_ERROR = 0x00,
FUS_STATE_IMG_NOT_FOUND = 0x01,
FUS_STATE_IMG_CORRUPT = 0x02,
FUS_STATE_IMG_NOT_AUTHENTIC = 0x03,
FUS_STATE_IMG_NOT_ENOUGH_SPACE = 0x04,
FUS_STATE_ERR_UNKNOWN = 0xFF,
} SHCI_FUS_GetState_ErrorCode_t;
#define SHCI_OPCODE_C2_FUS_GET_UUID64 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_GET_UUID64)
#define SHCI_OPCODE_C2_FUS_RESERVED1 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED1)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_FIRMWARE_UPGRADE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_FIRMWARE_UPGRADE)
#define SHCI_OPCODE_C2_FUS_FW_UPGRADE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_FW_UPGRADE)
/** No structure for command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_FW_DELETE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_FW_DELETE)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_REMOVE_WIRELESS_STACK (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_REMOVE_WIRELESS_STACK)
#define SHCI_OPCODE_C2_FUS_UPDATE_AUTH_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_UPDATE_AUTH_KEY)
typedef PACKED_STRUCT{
uint8_t KeySize;
uint8_t KeyData[64];
} SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t;
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_LOCK_AUTH_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_LOCK_AUTH_KEY)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_UPDATE_AUTHENTICATION_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_UPDATE_AUTHENTICATION_KEY)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_STORE_USR_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_STORE_USR_KEY)
/** Command parameters */
/* List of supported key type */
enum
{
KEYTYPE_NONE = 0x00,
KEYTYPE_SIMPLE = 0x01,
KEYTYPE_MASTER = 0x02,
KEYTYPE_ENCRYPTED = 0x03,
};
#define SHCI_OPCODE_C2_FUS_LOCK_AUTHENTICATION_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_LOCK_AUTHENTICATION_KEY)
/** No command parameters */
/** No response parameters*/
/* List of supported key size */
enum
{
KEYSIZE_16 = 16,
KEYSIZE_32 = 32,
};
#define SHCI_OPCODE_C2_FUS_WRITE_USER_KEY_IN_MEMORY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_WRITE_USER_KEY_IN_MEMORY)
/** No command parameters */
/** No response parameters*/
typedef PACKED_STRUCT{
uint8_t KeyType;
uint8_t KeySize;
uint8_t KeyData[32 + 12];
} SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t;
#define SHCI_OPCODE_C2_FUS_WRITE_USER_KEY_IN_AES (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_WRITE_USER_KEY_IN_AES)
/** No command parameters */
/** No response parameters*/
/** Response parameters*/
/** It responds a 1 byte value holding the index given for the stored key */
#define SHCI_OPCODE_C2_FUS_START_WIRELESS_STACK (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_START_WIRELESS_STACK)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_LOAD_USR_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_LOAD_USR_KEY)
/** Command parameters */
/** 1 byte holding the key index value */
#define SHCI_OPCODE_C2_FUS_UPGRADE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_UPGRADE)
/** No command parameters */
/** No response parameters*/
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_ABORT (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_ABORT)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_RESERVED1 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED1)
#define SHCI_OPCODE_C2_FUS_START_WS (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_START_WS)
/** No command parameters */
/** No response parameters*/
@ -176,9 +222,11 @@ extern "C" {
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_RESERVED4 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED4)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_LOCK_USR_KEY (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_LOCK_USR_KEY)
/** Command parameters */
/** 1 byte holding the key index value */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_RESERVED5 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED5)
/** No command parameters */
@ -200,7 +248,19 @@ extern "C" {
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_BLE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_BLE_init)
#define SHCI_OPCODE_C2_FUS_RESERVED10 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED10)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_RESERVED11 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED11)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_FUS_RESERVED12 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED12)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_BLE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_BLE_INIT)
/** THE ORDER SHALL NOT BE CHANGED */
typedef PACKED_STRUCT{
uint8_t* pBleBufferAddress; /**< NOT USED CURRENTLY */
@ -230,11 +290,11 @@ extern "C" {
/** No response parameters*/
#define SHCI_OPCODE_C2_THREAD_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_Thread_init)
#define SHCI_OPCODE_C2_THREAD_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_THREAD_INIT)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_DEBUG_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_Debug_init)
#define SHCI_OPCODE_C2_DEBUG_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_DEBUG_INIT)
/** Command parameters */
typedef PACKED_STRUCT{
uint8_t *pGpioConfig;
@ -251,63 +311,260 @@ extern "C" {
} SHCI_C2_DEBUG_Init_Cmd_Packet_t;
/** No response parameters*/
#define SHCI_OPCODE_C2_FLASH_ERASE_ACTIVITY (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_erase_activity)
#define SHCI_OPCODE_C2_FLASH_ERASE_ACTIVITY (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_ERASE_ACTIVITY)
/** Command parameters */
typedef PACKED_STRUCT{
SHCI_Erase_Activity_t EraseActivity;
} SHCI_C2_FLASH_Erase_Activity_Cmd_Param_t;
typedef enum
{
ERASE_ACTIVITY_OFF = 0x00,
ERASE_ACTIVITY_ON = 0x01,
} SHCI_EraseActivity_t;
typedef PACKED_STRUCT{
SHCI_Header_t Header; /** Does not need to be initialized by the user */
SHCI_C2_FLASH_Erase_Activity_Cmd_Param_t Param;
} SHCI_C2_FLASH_Erase_Activity_Cmd_Packet_t;
/** No response parameters*/
#define SHCI_OPCODE_C2_CONCURRENT_SET_MODE (( SHCI_OGF << 10) + SHCI_OCF_C2_Concurrent_Set_Mode)
#define SHCI_OPCODE_C2_CONCURRENT_SET_MODE (( SHCI_OGF << 10) + SHCI_OCF_C2_CONCURRENT_SET_MODE)
/** command parameters */
typedef enum
{
BLE_ENABLE,
THREAD_ENABLE,
ZIGBEE_ENABLE,
} SHCI_C2_CONCURRENT_Mode_Param_t;
/** No response parameters*/
#define SHCI_OPCODE_C2_FLASH_STORE_DATA (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_store_data)
#define SHCI_OPCODE_C2_FLASH_ERASE_DATA (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_erase_data)
#define SHCI_OPCODE_C2_FLASH_STORE_DATA (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_STORE_DATA)
#define SHCI_OPCODE_C2_FLASH_ERASE_DATA (( SHCI_OGF << 10) + SHCI_OCF_C2_FLASH_ERASE_DATA)
/** command parameters */
typedef enum
{
BLE_IP,
THREAD_IP,
ZIGBEE_IP,
} SHCI_C2_FLASH_Ip_t;
/** No response parameters*/
#define SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER (( SHCI_OGF << 10) + SHCI_OCF_C2_RADIO_Allow_Low_Power)
#define SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER (( SHCI_OGF << 10) + SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER)
#define SHCI_OPCODE_C2_MAC_802_15_4_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_Mac_802_15_4_init)
/** No command parameters */
/** No response parameters*/
#define SHCI_OPCODE_C2_MAC_802_15_4_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_MAC_802_15_4_INIT)
/* Exported constants --------------------------------------------------------*/
/* External variables --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
#define SHCI_OPCODE_C2_REINIT (( SHCI_OGF << 10) + SHCI_OCF_C2_REINIT)
#define SHCI_OPCODE_C2_ZIGBEE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_ZIGBEE_INIT)
#define SHCI_OPCODE_C2_LLD_TESTS_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_LLD_TESTS_INIT)
#define SHCI_OPCODE_C2_EXTPA_CONFIG (( SHCI_OGF << 10) + SHCI_OCF_C2_EXTPA_CONFIG)
/** Command parameters */
enum
{
EXT_PA_ENABLED_LOW,
EXT_PA_ENABLED_HIGH,
}/* gpio_polarity */;
enum
{
EXT_PA_DISABLED,
EXT_PA_ENABLED,
}/* gpio_status */;
typedef PACKED_STRUCT{
uint32_t gpio_port;
uint16_t gpio_pin_number;
uint8_t gpio_polarity;
uint8_t gpio_status;
} SHCI_C2_EXTPA_CONFIG_Cmd_Param_t;
/** No response parameters*/
/* Exported type --------------------------------------------------------*/
typedef MB_WirelessFwInfoTable_t SHCI_WirelessFwInfoTable_t;
/*
* At startup, the informations relative to the wireless binary are stored in RAM trough a structure defined by
* SHCI_WirelessFwInfoTable_t.This structure contains 4 fields (Version,MemorySize, Stack_info and a reserved part)
* each of those coded on 32 bits as shown on the table below:
*
*
* |7 |6 |5 |4 |3 |2 |1 |0 |7 |6 |5 |4 |3 |2 |1 |0 |7 |6 |5 |4 |3 |2 |1 |0 |7 |6 |5 |4 |3 |2 |1 |0 |
* -------------------------------------------------------------------------------------------------
* Version | Major version | Minor version | Sub version | Branch |Releas Type|
* -------------------------------------------------------------------------------------------------
* MemorySize | SRAM2B (kB) | SRAM2A (kB) | SRAM1 (kB) | FLASH (4kb) |
* -------------------------------------------------------------------------------------------------
* Info stack | Reserved | Reserved | Reserved | Type (MAC,Thread,BLE) |
* -------------------------------------------------------------------------------------------------
* Reserved | Reserved | Reserved | Reserved | Reserved |
* -------------------------------------------------------------------------------------------------
*
*/
/* Field Version */
#define INFO_VERSION_MAJOR_OFFSET 24
#define INFO_VERSION_MAJOR_MASK 0xff000000
#define INFO_VERSION_MINOR_OFFSET 16
#define INFO_VERSION_MINOR_MASK 0x00ff0000
#define INFO_VERSION_SUB_OFFSET 8
#define INFO_VERSION_SUB_MASK 0x0000ff00
#define INFO_VERSION_BRANCH_OFFSET 4
#define INFO_VERSION_BRANCH_MASK 0x0000000f0
#define INFO_VERSION_TYPE_OFFSET 0
#define INFO_VERSION_TYPE_MASK 0x00000000f
#define INFO_VERSION_TYPE_RELEASE 1
/* Field Memory */
#define INFO_SIZE_SRAM2B_OFFSET 24
#define INFO_SIZE_SRAM2B_MASK 0xff000000
#define INFO_SIZE_SRAM2A_OFFSET 16
#define INFO_SIZE_SRAM2A_MASK 0x00ff0000
#define INFO_SIZE_SRAM1_OFFSET 8
#define INFO_SIZE_SRAM1_MASK 0x0000ff00
#define INFO_SIZE_FLASH_OFFSET 0
#define INFO_SIZE_FLASH_MASK 0x000000ff
/* Field stack information */
#define INFO_STACK_TYPE_OFFSET 0
#define INFO_STACK_TYPE_MASK 0x000000ff
#define INFO_STACK_TYPE_NONE 0
#define INFO_STACK_TYPE_BLE_STANDARD 0x1
#define INFO_STACK_TYPE_BLE_HCI 0x2
#define INFO_STACK_TYPE_THREAD_FTD 0x10
#define INFO_STACK_TYPE_THREAD_MTD 0x11
#define INFO_STACK_TYPE_ZIGBEE 0x30
#define INFO_STACK_TYPE_MAC 0x40
#define INFO_STACK_TYPE_BLE_THREAD_FTD_STATIC 0x50
#define INFO_STACK_TYPE_802154_LLD_TESTS 0x60
#define INFO_STACK_TYPE_802154_PHY_VALID 0x61
#define INFO_STACK_TYPE_BLE_PHY_VALID 0x62
#define INFO_STACK_TYPE_BLE_ZIGBEE_FFD_STATIC 0x70
typedef struct {
/**
* Wireless Info
*/
uint8_t VersionMajor;
uint8_t VersionMinor;
uint8_t VersionSub;
uint8_t VersionBranch;
uint8_t VersionReleaseType;
uint8_t MemorySizeSram2B; /*< Multiple of 1K */
uint8_t MemorySizeSram2A; /*< Multiple of 1K */
uint8_t MemorySizeSram1; /*< Multiple of 1K */
uint8_t MemorySizeFlash; /*< Multiple of 4K */
uint8_t StackType;
/**
* Fus Info
*/
uint8_t FusVersionMajor;
uint8_t FusVersionMinor;
uint8_t FusVersionSub;
uint8_t FusMemorySizeSram2B; /*< Multiple of 1K */
uint8_t FusMemorySizeSram2A; /*< Multiple of 1K */
uint8_t FusMemorySizeFlash; /*< Multiple of 4K */
}WirelessFwInfo_t;
/* Exported functions ------------------------------------------------------- */
/**
* For all SHCI_C2_FUS_xxx() command:
* When the wireless FW is running on the CPU2, the command returns SHCI_FUS_CMD_NOT_SUPPORTED
* When any FUS command is sent after the SHCI_FUS_CMD_NOT_SUPPORTED has been received,
* the CPU2 switches on the RSS ( This reboots automatically the device )
*/
/**
* SHCI_C2_FUS_Get_State
* @brief Read the RSS
* When the wireless FW is running on the CPU2, the command returns SHCI_FUS_Command_Not_Supported
* When any RSS command is sent after the SHCI_FUS_Command_Not_Supported has been returned after sending one RSS command,
* the CPU2 switches on the RSS ( This reboots automatically the device )
* SHCI_C2_FUS_GetState
* @brief Read the FUS State
* If the user is not interested by the Error code response, a null value may
* be passed as parameter
*
* @param p_rsp : return the error code when the FUS State Value = 0xFF
* @retval FUS State Values
*/
uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_rsp );
/**
* SHCI_C2_FUS_FwUpgrade
* @brief Request the FUS to install the CPU2 firmware update
*
* @param fw_src_add: Address of the firmware image location
* @param fw_dest_add: Address of the firmware destination
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_add );
/**
* SHCI_C2_FUS_FwDelete
* @brief Delete the wireless stack on CPU2
*
* @param None
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_Get_State( void );
SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void );
/**
* SHCI_C2_FUS_UpdateAuthKey
* @brief Request the FUS to update the authentication key
*
* @param pCmdPacket
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_t *pParam );
/**
* SHCI_C2_FUS_LockAuthKey
* @brief Request the FUS to prevent any future update of the authentication key
*
* @param None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void );
/**
* SHCI_C2_FUS_StoreUsrKey
* @brief Request the FUS to store the user key
*
* @param pParam : command parameter
* @param p_key_index : Index allocated by the FUS to the stored key
*
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *pParam, uint8_t *p_key_index );
/**
* SHCI_C2_FUS_LoadUsrKey
* @brief Request the FUS to load the user key into the AES
*
* @param key_index : index of the user key to load in AES1
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index );
/**
* SHCI_C2_FUS_StartWs
* @brief Request the FUS to reboot on the wireless stack
*
* @param None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void );
/**
* SHCI_C2_FUS_LockUsrKey
* @brief Request the FUS to lock the user key so that it cannot be updated later on
*
* @param key_index : index of the user key to lock
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index );
/**
* SHCI_C2_BLE_Init
* @brief Provides parameters and starts the BLE Stack
*
* @param pCmdPacket : Parameters to be provided to the BLE Stack
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket );
@ -316,34 +573,53 @@ extern "C" {
* @brief Starts the THREAD Stack
*
* @param None
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void );
/**
* SHCI_C2_LLDTESTS_Init
* @brief Starts the LLD tests CLI
*
* @param param_size : Nb of bytes
* @param p_param : pointeur with data to give from M4 to M0
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param );
/**
* SHCI_C2_ZIGBEE_Init
* @brief Starts the Zigbee Stack
*
* @param None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void );
/**
* SHCI_C2_DEBUG_Init
* @brief Starts the Traces
*
* @param None
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket );
/**
* SHCI_C2_FLASH_Erase_Activity
* SHCI_C2_FLASH_EraseActivity
* @brief Provides the information of the start and the end of a flash erase window on the CPU1
*
* @param pCmdPacket: Start/End of erase activity
* @retval None
* @param erase_activity: Start/End of erase activity
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FLASH_Erase_Activity( SHCI_C2_FLASH_Erase_Activity_Cmd_Packet_t *pCmdPacket );
SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activity );
/**
* SHCI_C2_CONCURRENT_SetMode
* @brief Enable/Disable Thread on CPU2 (M0+)
*
* @param Mode: BLE or Thread enable flag
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mode );
@ -352,7 +628,7 @@ extern "C" {
* @brief Store Data in Flash
*
* @param Ip: BLE or THREAD
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip );
@ -361,7 +637,7 @@ extern "C" {
* @brief Erase Data in Flash
*
* @param Ip: BLE or THREAD
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip );
@ -371,7 +647,7 @@ extern "C" {
*
* @param Ip: BLE or 802_15_5
* @param FlagRadioLowPowerOn: True or false
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t FlagRadioLowPowerOn);
@ -381,10 +657,56 @@ extern "C" {
* @brief Starts the MAC 802.15.4 on M0
*
* @param None
* @retval None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void );
/**
* SHCI_GetWirelessFwInfo
* @brief This function read back the informations relative to the wireless binary loaded.
* Refer yourself to SHCI_WirelessFwInfoTable_t structure to get the significance
* of the different parameters returned.
* @param pWirelessInfo : Pointer to WirelessFwInfo_t.
*
* @retval SHCI_Success
*/
SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo );
/**
* SHCI_C2_Reinit
* @brief This is required to allow the CPU1 to fake a set C2BOOT when it has already been set.
* In order to fake a C2BOOT, the CPU1 shall :
* - Send SHCI_C2_Reinit()
* - call SEV instruction
* WARNING:
* This function is intended to be used by the SBSFU
*
* @param None
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_Reinit( void );
/**
* SHCI_C2_ExtpaConfig
* @brief Send the Ext PA configuration
* When the CPU2 receives the command, it controls the Ext PA as requested by the configuration
* This configures only which IO is used to enable/disable the ExtPA and the associated polarity
* This command has no effect on the other IO that is used to control the mode of the Ext PA (Rx/Tx)
*
* @param gpio_port: GPIOx where x can be (A..F) to select the GPIO peripheral for STM32WBxx family
* @param gpio_pin_number: This parameter can be one of GPIO_PIN_x (= LL_GPIO_PIN_x) where x can be (0..15).
* @param gpio_polarity: This parameter can be either
* - EXT_PA_ENABLED_LOW: ExtPA is enabled when GPIO is low
* - EXT_PA_ENABLED_HIGH: ExtPA is enabled when GPIO is high
* @param gpio_status: This parameter can be either
* - EXT_PA_DISABLED: Stop driving the ExtPA
* - EXT_PA_ENABLED: Drive the ExtPA according to radio activity
* (ON before the Event and OFF at the end of the event)
* @retval Status
*/
SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_number, uint8_t gpio_polarity, uint8_t gpio_status);
#ifdef __cplusplus
}
#endif

View File

@ -1,21 +1,21 @@
/**
******************************************************************************
* @file shci.c
* @author MCD Application Team
* @brief System HCI command implementation
******************************************************************************
******************************************************************************
* @file shci.c
* @author MCD Application Team
* @brief System HCI command implementation
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Includes ------------------------------------------------------------------*/
@ -73,18 +73,35 @@ void shci_user_evt_proc(void)
TL_EvtPacket_t *phcievtbuffer;
tSHCI_UserEvtRxParam UserEvtRxParam;
while((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
/**
* Up to release version v1.2.0, a while loop was implemented to read out events from the queue as long as
* it is not empty. However, in a bare metal implementation, this leads to calling in a "blocking" mode
* shci_user_evt_proc() as long as events are received without giving the opportunity to run other tasks
* in the background.
* From now, the events are reported one by one. When it is checked there is still an event pending in the queue,
* a request to the user is made to call again shci_user_evt_proc().
* This gives the opportunity to the application to run other background tasks between each event.
*/
/**
* It is more secure to use LST_remove_head()/LST_insert_head() compare to LST_get_next_node()/LST_remove_node()
* in case the user overwrite the header where the next/prev pointers are located
*/
if((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
{
LST_remove_head ( &SHciAsynchEventQueue, (tListNode **)&phcievtbuffer );
SHCI_TL_UserEventFlow = SHCI_TL_UserEventFlow_Enable;
if (shciContext.UserEvtRx != NULL)
{
UserEvtRxParam.pckt = phcievtbuffer;
UserEvtRxParam.status = SHCI_TL_UserEventFlow_Enable;
shciContext.UserEvtRx((void *)&UserEvtRxParam);
SHCI_TL_UserEventFlow = UserEvtRxParam.status;
}
else
{
SHCI_TL_UserEventFlow = SHCI_TL_UserEventFlow_Enable;
}
if(SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable)
{
@ -99,6 +116,12 @@ void shci_user_evt_proc(void)
}
}
if((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
{
shci_notify_asynch_evt((void*) &SHciAsynchEventQueue);
}
return;
}
@ -115,16 +138,23 @@ void shci_resume_flow( void )
return;
}
void shci_send( TL_CmdPacket_t * p_cmd, TL_EvtPacket_t * p_rsp )
void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payload, TL_EvtPacket_t * p_rsp )
{
Cmd_SetStatus(SHCI_TL_CmdBusy);
memcpy(&(pCmdBuffer->cmdserial), &(p_cmd->cmdserial), p_cmd->cmdserial.cmd.plen + TL_CMD_HDR_SIZE );
pCmdBuffer->cmdserial.cmd.cmdcode = cmd_code;
pCmdBuffer->cmdserial.cmd.plen = len_cmd_payload;
memcpy(pCmdBuffer->cmdserial.cmd.payload, p_cmd_payload, len_cmd_payload );
shciContext.io.Send(0,0);
shci_cmd_resp_wait(SHCI_TL_DEFAULT_TIMEOUT);
/**
* The command complete of a system command does not have the header
* It starts immediately with the evtserial field
*/
memcpy( &(p_rsp->evtserial), pCmdBuffer, ((TL_EvtSerial_t*)pCmdBuffer)->evt.plen + TL_EVT_HDR_SIZE );
Cmd_SetStatus(SHCI_TL_CmdAvailable);
@ -182,6 +212,7 @@ static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus)
static void TlCmdEvtReceived(TL_EvtPacket_t *shcievt)
{
(void)(shcievt);
shci_cmd_resp_release(0); /**< Notify the application the Cmd response has been received */
return;

View File

@ -1,21 +1,21 @@
/**
******************************************************************************
* @file shci_tl.h
* @author MCD Application Team
* @brief System HCI command header for the system channel
******************************************************************************
******************************************************************************
* @file shci_tl.h
* @author MCD Application Team
* @brief System HCI command header for the system channel
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
#ifndef __SHCI_TL_H_
@ -85,10 +85,13 @@ typedef struct
* shci_send
* @brief Send an System HCI Command
*
* @param : None
* @param : cmd_code = Opcode of the command
* @param : len_cmd_payload = Length of the command payload
* @param : p_cmd_payload = Address of the command payload
* @param : p_rsp_status = Address of the full buffer holding the command complete event
* @retval : None
*/
void shci_send( TL_CmdPacket_t * p_cmd, TL_EvtPacket_t * p_rsp );
void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payload, TL_EvtPacket_t * p_rsp_status );
/**
* @brief Register IO bus services.

View File

@ -1,21 +1,21 @@
/**
******************************************************************************
******************************************************************************
* @file stm_list.c
* @author MCD Application Team
* @brief TCircular Linked List Implementation.
******************************************************************************
* @attention
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/******************************************************************************

View File

@ -4,18 +4,18 @@
* @author MCD Application Team
* @brief Header file for linked list library.
******************************************************************************
* @attention
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
#ifndef _STM_LIST_H_

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
* @file tl.h
* @author MCD Application Team
* @brief Header for tl module
******************************************************************************
******************************************************************************
* @file tl.h
* @author MCD Application Team
* @brief Header for tl module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
@ -15,7 +15,7 @@
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/
@ -31,33 +31,35 @@ extern "C" {
#include "stm32_wpan_common.h"
/* Exported defines -----------------------------------------------------------*/
#define TL_BLECMD_PKT_TYPE ( 0x01 )
#define TL_ACL_DATA_PKT_TYPE ( 0x02 )
#define TL_BLEEVT_PKT_TYPE ( 0x04 )
#define TL_OTCMD_PKT_TYPE ( 0x08 )
#define TL_OTRSP_PKT_TYPE ( 0x09 )
#define TL_CLICMD_PKT_TYPE ( 0x0A )
#define TL_OTNOT_PKT_TYPE ( 0x0C )
#define TL_OTACK_PKT_TYPE ( 0x0D )
#define TL_CLINOT_PKT_TYPE ( 0x0E )
#define TL_CLIACK_PKT_TYPE ( 0x0F )
#define TL_SYSCMD_PKT_TYPE ( 0x10 )
#define TL_SYSRSP_PKT_TYPE ( 0x11 )
#define TL_SYSEVT_PKT_TYPE ( 0x12 )
#define TL_LOCCMD_PKT_TYPE ( 0x20 )
#define TL_LOCRSP_PKT_TYPE ( 0x21 )
#define TL_TRACES_APP_PKT_TYPE ( 0x40 )
#define TL_TRACES_WL_PKT_TYPE ( 0x41 )
#define TL_BLECMD_PKT_TYPE ( 0x01 )
#define TL_ACL_DATA_PKT_TYPE ( 0x02 )
#define TL_BLEEVT_PKT_TYPE ( 0x04 )
#define TL_OTCMD_PKT_TYPE ( 0x08 )
#define TL_OTRSP_PKT_TYPE ( 0x09 )
#define TL_CLICMD_PKT_TYPE ( 0x0A )
#define TL_OTNOT_PKT_TYPE ( 0x0C )
#define TL_OTACK_PKT_TYPE ( 0x0D )
#define TL_CLINOT_PKT_TYPE ( 0x0E )
#define TL_CLIACK_PKT_TYPE ( 0x0F )
#define TL_SYSCMD_PKT_TYPE ( 0x10 )
#define TL_SYSRSP_PKT_TYPE ( 0x11 )
#define TL_SYSEVT_PKT_TYPE ( 0x12 )
#define TL_CLIRESP_PKT_TYPE ( 0x15 )
#define TL_M0CMD_PKT_TYPE ( 0x16 )
#define TL_LOCCMD_PKT_TYPE ( 0x20 )
#define TL_LOCRSP_PKT_TYPE ( 0x21 )
#define TL_TRACES_APP_PKT_TYPE ( 0x40 )
#define TL_TRACES_WL_PKT_TYPE ( 0x41 )
#define TL_CMD_HDR_SIZE (4)
#define TL_EVT_HDR_SIZE (3)
#define TL_EVT_CS_PAYLOAD_SIZE (4)
#define TL_CMD_HDR_SIZE (4)
#define TL_EVT_HDR_SIZE (3)
#define TL_EVT_CS_PAYLOAD_SIZE (4)
#define TL_BLEEVT_CC_OPCODE (0x0E)
#define TL_BLEEVT_CS_OPCODE (0x0F)
#define TL_BLEEVT_CC_OPCODE (0x0E)
#define TL_BLEEVT_CS_OPCODE (0x0F)
#define TL_BLEEVT_CS_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t))
#define TL_BLEEVT_CS_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CS_PACKET_SIZE)
#define TL_BLEEVT_CS_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t))
#define TL_BLEEVT_CS_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CS_PACKET_SIZE)
/* Exported types ------------------------------------------------------------*/
/**< Packet header */
@ -184,12 +186,25 @@ typedef struct
uint8_t *p_ThreadNotAckBuffer;
} TL_TH_Config_t;
typedef struct
{
uint8_t *p_LldTestsCliCmdRspBuffer;
uint8_t *p_LldTestsM0CmdBuffer;
} TL_LLD_tests_Config_t;
typedef struct
{
uint8_t *p_Mac_802_15_4_CmdRspBuffer;
uint8_t *p_Mac_802_15_4_NotAckBuffer;
} TL_MAC_802_15_4_Config_t;
typedef struct
{
uint8_t *p_ZigbeeOtCmdRspBuffer;
uint8_t *p_ZigbeeNotAckBuffer;
uint8_t *p_ZigbeeLoggingBuffer;
} TL_ZIGBEE_Config_t;
/**
* @brief Contain the BLE HCI Init Configuration
* @{
@ -249,6 +264,16 @@ void TL_THREAD_SendAck ( void );
void TL_THREAD_CliSendAck ( void );
void TL_THREAD_CliNotReceived( TL_EvtPacket_t * Notbuffer );
/******************************************************************************
* LLD TESTS
******************************************************************************/
void TL_LLDTESTS_Init( TL_LLD_tests_Config_t *p_Config );
void TL_LLDTESTS_SendCliCmd( void );
void TL_LLDTESTS_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer );
void TL_LLDTESTS_SendCliRspAck( void );
void TL_LLDTESTS_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer );
void TL_LLDTESTS_SendM0CmdAck( void );
/******************************************************************************
* MEMORY MANAGER
******************************************************************************/
@ -270,6 +295,17 @@ void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer );
void TL_MAC_802_15_4_SendAck ( void );
/******************************************************************************
* ZIGBEE
******************************************************************************/
void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config );
void TL_ZIGBEE_SendAppliCmdToM0( void );
void TL_ZIGBEE_SendAckAfterAppliNotifFromM0 ( void );
void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer );
void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
void TL_ZIGBEE_LoggingReceived(TL_EvtPacket_t * Otbuffer );
void TL_ZIGBEE_SendAckAfterAppliLoggingFromM0 ( void );
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
* @file tl_mbox.c
* @author MCD Application Team
* @brief Transport layer for the mailbox interface
******************************************************************************
******************************************************************************
* @file tl_mbox.c
* @author MCD Application Team
* @brief Transport layer for the mailbox interface
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
@ -15,7 +15,7 @@
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Includes ------------------------------------------------------------------*/
@ -36,10 +36,12 @@ PLACE_IN_SECTION("MAPPING_TABLE") static volatile MB_RefTable_t TL_RefTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_DeviceInfoTable_t TL_DeviceInfoTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleTable_t TL_BleTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ThreadTable_t TL_ThreadTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_LldTestsTable_t TL_LldTestsTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table;
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table;
/**< tables */
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue;
@ -78,11 +80,12 @@ void TL_Init( void )
TL_RefTable.p_device_info_table = &TL_DeviceInfoTable;
TL_RefTable.p_ble_table = &TL_BleTable;
TL_RefTable.p_thread_table = &TL_ThreadTable;
TL_RefTable.p_lld_tests_table = &TL_LldTestsTable;
TL_RefTable.p_sys_table = &TL_SysTable;
TL_RefTable.p_mem_manager_table = &TL_MemManagerTable;
TL_RefTable.p_traces_table = &TL_TracesTable;
TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table;
TL_RefTable.p_zigbee_table = &TL_Zigbee_Table;
HW_IPCC_Init();
return;
@ -117,6 +120,9 @@ int32_t TL_BLE_Init( void* pConf )
int32_t TL_BLE_SendCmd( uint8_t* buffer, uint16_t size )
{
(void)(buffer);
(void)(size);
((TL_CmdPacket_t*)(TL_RefTable.p_ble_table->pcmd_buffer))->cmdserial.type = TL_BLECMD_PKT_TYPE;
HW_IPCC_BLE_SendCmd();
@ -140,6 +146,9 @@ void HW_IPCC_BLE_RxEvtNot(void)
int32_t TL_BLE_SendAclData( uint8_t* buffer, uint16_t size )
{
(void)(buffer);
(void)(size);
((TL_AclDataPacket_t *)(TL_RefTable.p_ble_table->phci_acl_data_buffer))->AclDataSerial.type = TL_ACL_DATA_PKT_TYPE;
HW_IPCC_BLE_SendAclData();
@ -178,6 +187,9 @@ int32_t TL_SYS_Init( void* pConf )
int32_t TL_SYS_SendCmd( uint8_t* buffer, uint16_t size )
{
(void)(buffer);
(void)(size);
((TL_CmdPacket_t *)(TL_RefTable.p_sys_table->pcmd_buffer))->cmdserial.type = TL_SYSCMD_PKT_TYPE;
HW_IPCC_SYS_SendCmd();
@ -208,6 +220,7 @@ void HW_IPCC_SYS_EvtNot( void )
/******************************************************************************
* THREAD
******************************************************************************/
#ifdef THREAD_WB
void TL_THREAD_Init( TL_TH_Config_t *p_Config )
{
MB_ThreadTable_t * p_thread_table;
@ -280,9 +293,62 @@ void HW_IPCC_THREAD_CliEvtNot( void )
return;
}
__weak void TL_OT_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
__weak void TL_THREAD_NotReceived( TL_EvtPacket_t * Notbuffer ){};
__weak void TL_THREAD_CliNotReceived( TL_EvtPacket_t * Notbuffer ){};
void TL_OT_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
void TL_THREAD_NotReceived( TL_EvtPacket_t * Notbuffer ){};
void TL_THREAD_CliNotReceived( TL_EvtPacket_t * Notbuffer ){};
#endif /* THREAD_WB */
/******************************************************************************
* LLD TESTS
******************************************************************************/
#ifdef LLD_TESTS_WB
void TL_LLDTESTS_Init( TL_LLD_tests_Config_t *p_Config )
{
MB_LldTestsTable_t * p_lld_tests_table;
p_lld_tests_table = TL_RefTable.p_lld_tests_table;
p_lld_tests_table->clicmdrsp_buffer = p_Config->p_LldTestsCliCmdRspBuffer;
p_lld_tests_table->m0cmd_buffer = p_Config->p_LldTestsM0CmdBuffer;
HW_IPCC_LLDTESTS_Init();
return;
}
void TL_LLDTESTS_SendCliCmd( void )
{
((TL_CmdPacket_t *)(TL_RefTable.p_lld_tests_table->clicmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
HW_IPCC_LLDTESTS_SendCliCmd();
return;
}
void HW_IPCC_LLDTESTS_ReceiveCliRsp( void )
{
TL_LLDTESTS_ReceiveCliRsp( (TL_CmdPacket_t*)(TL_RefTable.p_lld_tests_table->clicmdrsp_buffer) );
return;
}
void TL_LLDTESTS_SendCliRspAck( void )
{
HW_IPCC_LLDTESTS_SendCliRspAck();
return;
}
void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void )
{
TL_LLDTESTS_ReceiveM0Cmd( (TL_CmdPacket_t*)(TL_RefTable.p_lld_tests_table->m0cmd_buffer) );
return;
}
void TL_LLDTESTS_SendM0CmdAck( void )
{
HW_IPCC_LLDTESTS_SendM0CmdAck();
return;
}
void TL_LLDTESTS_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer ){};
void TL_LLDTESTS_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer ){};
#endif /* LLD_TESTS_WB */
#ifdef MAC_802_15_4_WB
/******************************************************************************
@ -334,10 +400,89 @@ void HW_IPCC_MAC_802_15_4_EvtNot( void )
return;
}
__weak void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
__weak void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer ){};
void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer ){};
#endif
#ifdef ZIGBEE_WB
/******************************************************************************
* ZIGBEE
******************************************************************************/
void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config )
{
MB_ZigbeeTable_t * p_zigbee_table;
p_zigbee_table = TL_RefTable.p_zigbee_table;
p_zigbee_table->appliCmdM4toM0_buffer = p_Config->p_ZigbeeOtCmdRspBuffer;
p_zigbee_table->notifM0toM4_buffer = p_Config->p_ZigbeeNotAckBuffer;
p_zigbee_table->loggingM0toM4_buffer = p_Config->p_ZigbeeLoggingBuffer;
HW_IPCC_ZIGBEE_Init();
return;
}
void TL_ZIGBEE_SendAppliCmdToM0( void )
{
((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE;
HW_IPCC_ZIGBEE_SendAppliCmd();
return;
}
/* Send an ACK to the M0 */
void TL_ZIGBEE_SendAckAfterAppliNotifFromM0 ( void )
{
((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
HW_IPCC_ZIGBEE_SendAppliCmdAck();
return;
}
/* Used to receive an ACK from the M0 */
void HW_IPCC_ZIGBEE_AppliCmdNotification(void)
{
TL_ZIGBEE_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer) );
return;
}
/* Zigbee callback */
void HW_IPCC_ZIGBEE_AppliAsyncEvtNotification( void )
{
TL_ZIGBEE_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer) );
return;
}
/* Zigbee logging */
void HW_IPCC_ZIGBEE_AppliAsyncLoggingNotification( void )
{
TL_ZIGBEE_LoggingReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->loggingM0toM4_buffer) );
return;
}
/* Send a Logging ACK to the M0 */
void TL_ZIGBEE_SendAckAfterAppliLoggingFromM0 ( void )
{
((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->loggingM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
HW_IPCC_ZIGBEE_SendLoggingAck();
return;
}
void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer ){};
#endif
/******************************************************************************
* MEMORY MANAGER
******************************************************************************/
@ -411,6 +556,9 @@ void HW_IPCC_TRACES_EvtNot(void)
return;
}
__weak void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt ){};
void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt )
{
(void)(hcievt);
}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,21 +1,21 @@
/**
******************************************************************************
* @file utilities_common.h
* @author MCD Application Team
* @brief Common file to utilities
******************************************************************************
******************************************************************************
* @file utilities_common.h
* @author MCD Application Team
* @brief Common file to utilities
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/
@ -32,7 +32,7 @@ extern "C" {
#include <stdlib.h>
#include <stdarg.h>
#include "utilities_conf.h"
#include "app_conf.h"
/* -------------------------------- *
* Basic definitions *