Import Mbed OS hard-float snapshot
This commit is contained in:
@@ -0,0 +1,258 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file mbox_def.h
|
||||
* @author MCD Application Team
|
||||
* @brief Mailbox definition
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MBOX_H
|
||||
#define __MBOX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stm32_wpan_common.h"
|
||||
|
||||
/**
|
||||
* This file shall be identical between the CPU1 and the CPU2
|
||||
*/
|
||||
|
||||
/**
|
||||
*********************************************************************************
|
||||
* TABLES
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* Version
|
||||
* [0:3] = Build - 0: Untracked - 15:Released - x: Tracked version
|
||||
* [4:7] = branch - 0: Mass Market - x: ...
|
||||
* [8:15] = Subversion
|
||||
* [16:23] = Version minor
|
||||
* [24:31] = Version major
|
||||
*
|
||||
* Memory Size
|
||||
* [0:7] = Flash ( Number of 4k sector)
|
||||
* [8:15] = Reserved ( Shall be set to 0 - may be used as flash extension )
|
||||
* [16:23] = SRAM2b ( Number of 1k sector)
|
||||
* [24:31] = SRAM2a ( Number of 1k sector)
|
||||
*/
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint32_t Version;
|
||||
} MB_SafeBootInfoTable_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint32_t Version;
|
||||
uint32_t MemorySize;
|
||||
uint32_t FusInfo;
|
||||
} MB_FusInfoTable_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint32_t Version;
|
||||
uint32_t MemorySize;
|
||||
uint32_t InfoStack;
|
||||
uint32_t Reserved;
|
||||
} MB_WirelessFwInfoTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MB_SafeBootInfoTable_t SafeBootInfoTable;
|
||||
MB_FusInfoTable_t FusInfoTable;
|
||||
MB_WirelessFwInfoTable_t WirelessFwInfoTable;
|
||||
} MB_DeviceInfoTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *pcmd_buffer;
|
||||
uint8_t *pcs_buffer;
|
||||
uint8_t *pevt_queue;
|
||||
uint8_t *phci_acl_data_buffer;
|
||||
} MB_BleTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *notack_buffer;
|
||||
uint8_t *clicmdrsp_buffer;
|
||||
uint8_t *otcmdrsp_buffer;
|
||||
} MB_ThreadTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *clicmdrsp_buffer;
|
||||
uint8_t *m0cmd_buffer;
|
||||
} MB_LldTestsTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *cmdrsp_buffer;
|
||||
uint8_t *m0cmd_buffer;
|
||||
} MB_LldBleTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *notifM0toM4_buffer;
|
||||
uint8_t *appliCmdM4toM0_buffer;
|
||||
uint8_t *requestM0toM4_buffer;
|
||||
} MB_ZigbeeTable_t;
|
||||
/**
|
||||
* msg
|
||||
* [0:7] = cmd/evt
|
||||
* [8:31] = Reserved
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *pcmd_buffer;
|
||||
uint8_t *sys_queue;
|
||||
} MB_SysTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *spare_ble_buffer;
|
||||
uint8_t *spare_sys_buffer;
|
||||
uint8_t *blepool;
|
||||
uint32_t blepoolsize;
|
||||
uint8_t *pevt_free_buffer_queue;
|
||||
uint8_t *traces_evt_pool;
|
||||
uint32_t tracespoolsize;
|
||||
} MB_MemManagerTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *traces_queue;
|
||||
} MB_TracesTable_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *p_cmdrsp_buffer;
|
||||
uint8_t *p_notack_buffer;
|
||||
uint8_t *evt_queue;
|
||||
} MB_Mac_802_15_4_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MB_DeviceInfoTable_t *p_device_info_table;
|
||||
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_TracesTable_t *p_traces_table;
|
||||
MB_Mac_802_15_4_t *p_mac_802_15_4_table;
|
||||
MB_ZigbeeTable_t *p_zigbee_table;
|
||||
MB_LldTestsTable_t *p_lld_tests_table;
|
||||
MB_LldBleTable_t *p_lld_ble_table;
|
||||
} MB_RefTable_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
*********************************************************************************
|
||||
* IPCC CHANNELS
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
/* 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--------------------|
|
||||
* | |
|
||||
* | (LLD BLE) |
|
||||
* |----HW_IPCC_LLD_BLE_CMD_CHANNEL----------------->|
|
||||
* | |
|
||||
* |<---HW_IPCC_LLD_BLE_RSP_CHANNEL------------------|
|
||||
* | |
|
||||
* |<---HW_IPCC_LLD_BLE_M0_CMD_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_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_LLD_BLE_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5
|
||||
#define HW_IPCC_LLD_BLE_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_LLD_BLE_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_LLD_BLE_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5
|
||||
#define HW_IPCC_LLD_BLE_RSP_CHANNEL LL_IPCC_CHANNEL_5
|
||||
#define HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL LL_IPCC_CHANNEL_5
|
||||
#endif /*__MBOX_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,590 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file shci.c
|
||||
* @author MCD Application Team
|
||||
* @brief HCI command for the system channel
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32_wpan_common.h"
|
||||
|
||||
#include "shci_tl.h"
|
||||
#include "shci.h"
|
||||
#include "stm32wbxx.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Global variables ----------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Local Functions Definition ------------------------------------------------------*/
|
||||
/* Public Functions Definition ------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* C2 COMMAND
|
||||
* These commands are sent to the CPU2
|
||||
*/
|
||||
uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_error_code )
|
||||
{
|
||||
/**
|
||||
* A command status event + payload has the same size than the expected command complete
|
||||
*/
|
||||
uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1];
|
||||
TL_EvtPacket_t * p_rsp;
|
||||
|
||||
p_rsp = (TL_EvtPacket_t *)local_buffer;
|
||||
|
||||
shci_send( SHCI_OPCODE_C2_FUS_GET_STATE,
|
||||
0,
|
||||
0,
|
||||
p_rsp );
|
||||
|
||||
if(p_error_code != 0)
|
||||
{
|
||||
*p_error_code = (SHCI_FUS_GetState_ErrorCode_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[1]);
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket )
|
||||
{
|
||||
/**
|
||||
* 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_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_EvtPacket_t * p_rsp;
|
||||
|
||||
p_rsp = (TL_EvtPacket_t *)local_buffer;
|
||||
|
||||
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_LLD_BLE_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 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_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_EraseActivity( SHCI_EraseActivity_t erase_activity )
|
||||
{
|
||||
/**
|
||||
* 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] = erase_activity;
|
||||
|
||||
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_EvtPacket_t * p_rsp;
|
||||
|
||||
p_rsp = (TL_EvtPacket_t *)local_buffer;
|
||||
|
||||
local_buffer[0] = Mode;
|
||||
|
||||
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_EvtPacket_t * p_rsp;
|
||||
|
||||
p_rsp = (TL_EvtPacket_t *)local_buffer;
|
||||
|
||||
local_buffer[0] = Ip;
|
||||
|
||||
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_EvtPacket_t * p_rsp;
|
||||
|
||||
p_rsp = (TL_EvtPacket_t *)local_buffer;
|
||||
|
||||
local_buffer[0] = Ip;
|
||||
|
||||
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_EvtPacket_t * p_rsp;
|
||||
|
||||
p_rsp = (TL_EvtPacket_t *)local_buffer;
|
||||
|
||||
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_EvtPacket_t * p_rsp;
|
||||
|
||||
p_rsp = (TL_EvtPacket_t *)local_buffer;
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONTROL_Source_t Source)
|
||||
{
|
||||
/**
|
||||
* TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 1 byte of command parameter
|
||||
* 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] = (uint8_t)Source;
|
||||
|
||||
shci_send( SHCI_OPCODE_C2_SET_FLASH_ACTIVITY_CONTROL,
|
||||
1,
|
||||
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****/
|
||||
@@ -0,0 +1,771 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file shci.h
|
||||
* @author MCD Application Team
|
||||
* @brief HCI command for the system channel
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SHCI_H
|
||||
#define __SHCI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "mbox_def.h" /* Requested to expose the MB_WirelessFwInfoTable_t structure */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* SYSTEM EVENT */
|
||||
typedef enum
|
||||
{
|
||||
WIRELESS_FW_RUNNING = 0x00,
|
||||
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 )
|
||||
|
||||
/**
|
||||
* THE ORDER SHALL NOT BE CHANGED TO GUARANTEE COMPATIBILITY WITH THE CPU1 DEFINITION
|
||||
*/
|
||||
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
|
||||
{
|
||||
uint32_t MetaData[3];
|
||||
} SHCI_Header_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SHCI_Success = 0x00,
|
||||
SHCI_UNKNOWN_CMD = 0x01,
|
||||
SHCI_ERR_UNSUPPORTED_FEATURE = 0x11,
|
||||
SHCI_ERR_INVALID_HCI_CMD_PARAMS = 0x12,
|
||||
SHCI_FUS_CMD_NOT_SUPPORTED = 0xFF,
|
||||
} SHCI_CmdStatus_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SHCI_8BITS = 0x01,
|
||||
SHCI_16BITS = 0x02,
|
||||
SHCI_32BITS = 0x04,
|
||||
} SHCI_Busw_t;
|
||||
|
||||
#define SHCI_OGF ( 0x3F )
|
||||
#define SHCI_OCF_BASE ( 0x50 )
|
||||
|
||||
/**
|
||||
* THE ORDER SHALL NOT BE CHANGED TO GUARANTEE COMPATIBILITY WITH THE CPU2 DEFINITION
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SHCI_OCF_C2_RESERVED1 = SHCI_OCF_BASE,
|
||||
SHCI_OCF_C2_RESERVED2,
|
||||
SHCI_OCF_C2_FUS_GET_STATE,
|
||||
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_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_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_C2_SET_FLASH_ACTIVITY_CONTROL,
|
||||
SHCI_OCF_C2_LLD_BLE_INIT
|
||||
} SHCI_OCF_t;
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_GET_STATE (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_GET_STATE)
|
||||
/** No command 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_RESERVED1 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED1)
|
||||
/** No command parameters */
|
||||
/** No response parameters*/
|
||||
|
||||
#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_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_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,
|
||||
};
|
||||
|
||||
/* List of supported key size */
|
||||
enum
|
||||
{
|
||||
KEYSIZE_16 = 16,
|
||||
KEYSIZE_32 = 32,
|
||||
};
|
||||
|
||||
typedef PACKED_STRUCT{
|
||||
uint8_t KeyType;
|
||||
uint8_t KeySize;
|
||||
uint8_t KeyData[32 + 12];
|
||||
} SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t;
|
||||
|
||||
/** Response parameters*/
|
||||
/** It responds a 1 byte value holding the index given for the stored key */
|
||||
|
||||
#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 */
|
||||
|
||||
/** No response parameters*/
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_START_WS (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_START_WS)
|
||||
/** No command parameters */
|
||||
/** No response parameters*/
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_RESERVED2 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED2)
|
||||
/** No command parameters */
|
||||
/** No response parameters*/
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_RESERVED3 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED3)
|
||||
/** 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 */
|
||||
/** No response parameters*/
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_RESERVED6 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED6)
|
||||
/** No command parameters */
|
||||
/** No response parameters*/
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_RESERVED7 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED7)
|
||||
/** No command parameters */
|
||||
/** No response parameters*/
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_RESERVED8 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED8)
|
||||
/** No command parameters */
|
||||
/** No response parameters*/
|
||||
|
||||
#define SHCI_OPCODE_C2_FUS_RESERVED9 (( SHCI_OGF << 10) + SHCI_OCF_C2_FUS_RESERVED9)
|
||||
/** No command parameters */
|
||||
/** No response parameters*/
|
||||
|
||||
#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 */
|
||||
uint32_t BleBufferSize; /**< Size of the Buffer allocated in pBleBufferAddress */
|
||||
uint16_t NumAttrRecord;
|
||||
uint16_t NumAttrServ;
|
||||
uint16_t AttrValueArrSize;
|
||||
uint8_t NumOfLinks;
|
||||
uint8_t ExtendedPacketLengthEnable;
|
||||
uint8_t PrWriteListSize;
|
||||
uint8_t MblockCount;
|
||||
uint16_t AttMtu;
|
||||
uint16_t SlaveSca;
|
||||
uint8_t MasterSca;
|
||||
uint8_t LsSource;
|
||||
uint32_t MaxConnEventLength;
|
||||
uint16_t HsStartupTime;
|
||||
uint8_t ViterbiEnable;
|
||||
uint8_t LlOnly;
|
||||
uint8_t HwVersion;
|
||||
} SHCI_C2_Ble_Init_Cmd_Param_t;
|
||||
|
||||
typedef PACKED_STRUCT{
|
||||
SHCI_Header_t Header; /** Does not need to be initialized by the user */
|
||||
SHCI_C2_Ble_Init_Cmd_Param_t Param;
|
||||
} SHCI_C2_Ble_Init_Cmd_Packet_t;
|
||||
|
||||
/** No response parameters*/
|
||||
|
||||
#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)
|
||||
/** Command parameters */
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t thread_config;
|
||||
uint8_t ble_config;
|
||||
uint8_t mac_802_15_4_config;
|
||||
uint8_t zigbee_config;
|
||||
} SHCI_C2_DEBUG_TracesConfig_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t ble_dtb_cfg;
|
||||
uint8_t reserved[3];
|
||||
} SHCI_C2_DEBUG_GeneralConfig_t;
|
||||
|
||||
typedef PACKED_STRUCT{
|
||||
uint8_t *pGpioConfig;
|
||||
uint8_t *pTracesConfig;
|
||||
uint8_t *pGeneralConfig;
|
||||
uint8_t GpioConfigSize;
|
||||
uint8_t TracesConfigSize;
|
||||
uint8_t GeneralConfigSize;
|
||||
} SHCI_C2_DEBUG_init_Cmd_Param_t;
|
||||
|
||||
typedef PACKED_STRUCT{
|
||||
SHCI_Header_t Header; /** Does not need to be initialized by the user */
|
||||
SHCI_C2_DEBUG_init_Cmd_Param_t Param;
|
||||
} 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)
|
||||
/** Command parameters */
|
||||
typedef enum
|
||||
{
|
||||
ERASE_ACTIVITY_OFF = 0x00,
|
||||
ERASE_ACTIVITY_ON = 0x01,
|
||||
} SHCI_EraseActivity_t;
|
||||
|
||||
/** No response parameters*/
|
||||
|
||||
#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)
|
||||
/** 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_MAC_802_15_4_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_MAC_802_15_4_INIT)
|
||||
|
||||
#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_LLD_BLE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_LLD_BLE_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*/
|
||||
|
||||
#define SHCI_OPCODE_C2_SET_FLASH_ACTIVITY_CONTROL (( SHCI_OGF << 10) + SHCI_OCF_C2_SET_FLASH_ACTIVITY_CONTROL)
|
||||
/** Command parameters */
|
||||
typedef enum
|
||||
{
|
||||
FLASH_ACTIVITY_CONTROL_PES,
|
||||
FLASH_ACTIVITY_CONTROL_SEM7,
|
||||
}SHCI_C2_SET_FLASH_ACTIVITY_CONTROL_Source_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 0x01
|
||||
#define INFO_STACK_TYPE_BLE_HCI 0x02
|
||||
#define INFO_STACK_TYPE_BLE_LIGHT 0x03
|
||||
#define INFO_STACK_TYPE_THREAD_FTD 0x10
|
||||
#define INFO_STACK_TYPE_THREAD_MTD 0x11
|
||||
#define INFO_STACK_TYPE_ZIGBEE_FFD 0x30
|
||||
#define INFO_STACK_TYPE_ZIGBEE_RFD 0x31
|
||||
#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_LLD_TESTS 0x63
|
||||
#define INFO_STACK_TYPE_BLE_RLV 0x64
|
||||
#define INFO_STACK_TYPE_802154_RLV 0x65
|
||||
#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_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 Status
|
||||
*/
|
||||
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 Status
|
||||
*/
|
||||
SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket );
|
||||
|
||||
/**
|
||||
* SHCI_C2_THREAD_Init
|
||||
* @brief Starts the THREAD Stack
|
||||
*
|
||||
* @param 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_LLD_BLE_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_LLD_BLE_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 Status
|
||||
*/
|
||||
SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket );
|
||||
|
||||
/**
|
||||
* SHCI_C2_FLASH_EraseActivity
|
||||
* @brief Provides the information of the start and the end of a flash erase window on the CPU1
|
||||
*
|
||||
* @param erase_activity: Start/End of erase activity
|
||||
* @retval Status
|
||||
*/
|
||||
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 Status
|
||||
*/
|
||||
SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mode );
|
||||
|
||||
/**
|
||||
* SHCI_C2_FLASH_StoreData
|
||||
* @brief Store Data in Flash
|
||||
*
|
||||
* @param Ip: BLE or THREAD
|
||||
* @retval Status
|
||||
*/
|
||||
SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip );
|
||||
|
||||
/**
|
||||
* SHCI_C2_FLASH_EraseData
|
||||
* @brief Erase Data in Flash
|
||||
*
|
||||
* @param Ip: BLE or THREAD
|
||||
* @retval Status
|
||||
*/
|
||||
SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip );
|
||||
|
||||
/**
|
||||
* SHCI_C2_RADIO_AllowLowPower
|
||||
* @brief Allow or forbid IP_radio (802_15_4 or BLE) to enter in low power mode.
|
||||
*
|
||||
* @param Ip: BLE or 802_15_5
|
||||
* @param FlagRadioLowPowerOn: True or false
|
||||
* @retval Status
|
||||
*/
|
||||
SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t FlagRadioLowPowerOn);
|
||||
|
||||
|
||||
/**
|
||||
* SHCI_C2_MAC_802_15_4_Init
|
||||
* @brief Starts the MAC 802.15.4 on M0
|
||||
*
|
||||
* @param 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);
|
||||
|
||||
/**
|
||||
* SHCI_C2_SetFlashActivityControl
|
||||
* @brief Set the mechanism to be used on CPU2 to prevent the CPU1 to either write or erase in flash
|
||||
*
|
||||
* @param Source: It can be one of the following list
|
||||
* - FLASH_ACTIVITY_CONTROL_PES : The CPU2 set the PES bit to prevent the CPU1 to either read or write in flash
|
||||
* - FLASH_ACTIVITY_CONTROL_SEM7 : The CPU2 gets the semaphore 7 to prevent the CPU1 to either read or write in flash.
|
||||
* This requires the CPU1 to first get semaphore 7 before erasing or writing the flash.
|
||||
*
|
||||
* @retval Status
|
||||
*/
|
||||
SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONTROL_Source_t Source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__SHCI_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,353 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file shci.c
|
||||
* @author MCD Application Team
|
||||
* @brief System HCI command implementation
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32_wpan_common.h"
|
||||
|
||||
#include "stm_list.h"
|
||||
#include "shci_tl.h"
|
||||
|
||||
#include "mbed_toolchain.h"
|
||||
|
||||
/**
|
||||
* These traces are not yet supported in an usual way in the delivery package
|
||||
* They can enabled by adding the definition of TL_SHCI_CMD_DBG_EN and/or TL_SHCI_EVT_DBG_EN in the preprocessor option in the IDE
|
||||
*/
|
||||
#if ( (TL_SHCI_CMD_DBG_EN != 0) || (TL_SHCI_EVT_DBG_EN != 0) )
|
||||
#include "app_conf.h"
|
||||
#include "dbg_trace.h"
|
||||
#endif
|
||||
|
||||
#if (TL_SHCI_CMD_DBG_EN != 0)
|
||||
#define TL_SHCI_CMD_DBG_MSG PRINT_MESG_DBG
|
||||
#define TL_SHCI_CMD_DBG_BUF PRINT_LOG_BUFF_DBG
|
||||
#else
|
||||
#define TL_SHCI_CMD_DBG_MSG(...)
|
||||
#define TL_SHCI_CMD_DBG_BUF(...)
|
||||
#endif
|
||||
|
||||
#if (TL_SHCI_EVT_DBG_EN != 0)
|
||||
#define TL_SHCI_EVT_DBG_MSG PRINT_MESG_DBG
|
||||
#define TL_SHCI_EVT_DBG_BUF PRINT_LOG_BUFF_DBG
|
||||
#else
|
||||
#define TL_SHCI_EVT_DBG_MSG(...)
|
||||
#define TL_SHCI_EVT_DBG_BUF(...)
|
||||
#endif
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
SHCI_TL_CMD_RESP_RELEASE,
|
||||
SHCI_TL_CMD_RESP_WAIT,
|
||||
} SHCI_TL_CmdRespStatus_t;
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
/**
|
||||
* The default System HCI layer timeout is set to 33s
|
||||
*/
|
||||
#define SHCI_TL_DEFAULT_TIMEOUT (33000)
|
||||
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Public variables ---------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/**
|
||||
* START of Section SYSTEM_DRIVER_CONTEXT
|
||||
*/
|
||||
PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") static tListNode SHciAsynchEventQueue;
|
||||
PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") static volatile SHCI_TL_CmdStatus_t SHCICmdStatus;
|
||||
PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") static TL_CmdPacket_t *pCmdBuffer;
|
||||
PLACE_IN_SECTION("SYSTEM_DRIVER_CONTEXT") SHCI_TL_UserEventFlowStatus_t SHCI_TL_UserEventFlow;
|
||||
/**
|
||||
* END of Section SYSTEM_DRIVER_CONTEXT
|
||||
*/
|
||||
|
||||
static tSHciContext shciContext;
|
||||
static void (* StatusNotCallBackFunction) (SHCI_TL_CmdStatus_t status);
|
||||
|
||||
static volatile SHCI_TL_CmdRespStatus_t CmdRspStatusFlag;
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus);
|
||||
static void TlCmdEvtReceived(TL_EvtPacket_t *shcievt);
|
||||
static void TlUserEvtReceived(TL_EvtPacket_t *shcievt);
|
||||
static void TlInit( TL_CmdPacket_t * p_cmdbuffer );
|
||||
static void OutputCmdTrace(TL_CmdPacket_t *pCmdBuffer);
|
||||
static void OutputRspTrace(TL_EvtPacket_t *p_rsp);
|
||||
static void OutputEvtTrace(TL_EvtPacket_t *phcievtbuffer);
|
||||
|
||||
/* Interface ------- ---------------------------------------------------------*/
|
||||
void shci_init(void(* UserEvtRx)(void* pData), void* pConf)
|
||||
{
|
||||
StatusNotCallBackFunction = ((SHCI_TL_HciInitConf_t *)pConf)->StatusNotCallBack;
|
||||
shciContext.UserEvtRx = UserEvtRx;
|
||||
|
||||
shci_register_io_bus (&shciContext.io);
|
||||
|
||||
TlInit((TL_CmdPacket_t *)(((SHCI_TL_HciInitConf_t *)pConf)->p_cmdbuffer));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void shci_user_evt_proc(void)
|
||||
{
|
||||
TL_EvtPacket_t *phcievtbuffer;
|
||||
tSHCI_UserEvtRxParam UserEvtRxParam;
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
OutputEvtTrace(phcievtbuffer);
|
||||
|
||||
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)
|
||||
{
|
||||
TL_MM_EvtDone( phcievtbuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* put back the event in the queue
|
||||
*/
|
||||
LST_insert_head ( &SHciAsynchEventQueue, (tListNode *)phcievtbuffer );
|
||||
}
|
||||
}
|
||||
|
||||
if((LST_is_empty(&SHciAsynchEventQueue) == FALSE) && (SHCI_TL_UserEventFlow != SHCI_TL_UserEventFlow_Disable))
|
||||
{
|
||||
shci_notify_asynch_evt((void*) &SHciAsynchEventQueue);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void shci_resume_flow( void )
|
||||
{
|
||||
SHCI_TL_UserEventFlow = SHCI_TL_UserEventFlow_Enable;
|
||||
|
||||
/**
|
||||
* It is better to go through the background process as it is not sure from which context this API may
|
||||
* be called
|
||||
*/
|
||||
shci_notify_asynch_evt((void*) &SHciAsynchEventQueue);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
pCmdBuffer->cmdserial.cmd.cmdcode = cmd_code;
|
||||
pCmdBuffer->cmdserial.cmd.plen = len_cmd_payload;
|
||||
|
||||
memcpy(pCmdBuffer->cmdserial.cmd.payload, p_cmd_payload, len_cmd_payload );
|
||||
|
||||
OutputCmdTrace(pCmdBuffer);
|
||||
|
||||
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 );
|
||||
|
||||
OutputRspTrace(p_rsp);
|
||||
|
||||
Cmd_SetStatus(SHCI_TL_CmdAvailable);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
static void TlInit( TL_CmdPacket_t * p_cmdbuffer )
|
||||
{
|
||||
TL_SYS_InitConf_t Conf;
|
||||
|
||||
pCmdBuffer = p_cmdbuffer;
|
||||
|
||||
LST_init_head (&SHciAsynchEventQueue);
|
||||
|
||||
Cmd_SetStatus(SHCI_TL_CmdAvailable);
|
||||
|
||||
SHCI_TL_UserEventFlow = SHCI_TL_UserEventFlow_Enable;
|
||||
|
||||
/* Initialize low level driver */
|
||||
if (shciContext.io.Init)
|
||||
{
|
||||
|
||||
Conf.p_cmdbuffer = (uint8_t *)p_cmdbuffer;
|
||||
Conf.IoBusCallBackCmdEvt = TlCmdEvtReceived;
|
||||
Conf.IoBusCallBackUserEvt = TlUserEvtReceived;
|
||||
shciContext.io.Init(&Conf);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus)
|
||||
{
|
||||
if(shcicmdstatus == SHCI_TL_CmdBusy)
|
||||
{
|
||||
if(StatusNotCallBackFunction != 0)
|
||||
{
|
||||
StatusNotCallBackFunction( SHCI_TL_CmdBusy );
|
||||
}
|
||||
SHCICmdStatus = SHCI_TL_CmdBusy;
|
||||
}
|
||||
else
|
||||
{
|
||||
SHCICmdStatus = SHCI_TL_CmdAvailable;
|
||||
if(StatusNotCallBackFunction != 0)
|
||||
{
|
||||
StatusNotCallBackFunction( SHCI_TL_CmdAvailable );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void TlCmdEvtReceived(TL_EvtPacket_t *shcievt)
|
||||
{
|
||||
(void)(shcievt);
|
||||
shci_cmd_resp_release(0); /**< Notify the application the Cmd response has been received */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
|
||||
{
|
||||
LST_insert_tail(&SHciAsynchEventQueue, (tListNode *)shcievt);
|
||||
shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); /**< Notify the application a full HCI event has been received */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void OutputCmdTrace(TL_CmdPacket_t *pCmdBuffer)
|
||||
{
|
||||
TL_SHCI_CMD_DBG_MSG("sys cmd: 0x%04X", pCmdBuffer->cmdserial.cmd.cmdcode);
|
||||
|
||||
if(pCmdBuffer->cmdserial.cmd.plen != 0)
|
||||
{
|
||||
TL_SHCI_CMD_DBG_MSG(" payload:");
|
||||
TL_SHCI_CMD_DBG_BUF(pCmdBuffer->cmdserial.cmd.payload, pCmdBuffer->cmdserial.cmd.plen, "");
|
||||
}
|
||||
TL_SHCI_CMD_DBG_MSG("\r\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void OutputRspTrace(TL_EvtPacket_t *p_rsp)
|
||||
{
|
||||
switch(p_rsp->evtserial.evt.evtcode)
|
||||
{
|
||||
case TL_BLEEVT_CC_OPCODE:
|
||||
TL_SHCI_CMD_DBG_MSG("sys rsp: 0x%02X", p_rsp->evtserial.evt.evtcode);
|
||||
TL_SHCI_CMD_DBG_MSG(" cmd opcode: 0x%02X", ((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->cmdcode);
|
||||
TL_SHCI_CMD_DBG_MSG(" status: 0x%02X", ((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
|
||||
if((p_rsp->evtserial.evt.plen-4) != 0)
|
||||
{
|
||||
TL_SHCI_CMD_DBG_MSG(" payload:");
|
||||
TL_SHCI_CMD_DBG_BUF(&((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[1], p_rsp->evtserial.evt.plen-4, "");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
TL_SHCI_CMD_DBG_MSG("unknown sys rsp received: %02X", p_rsp->evtserial.evt.evtcode);
|
||||
break;
|
||||
}
|
||||
|
||||
TL_SHCI_CMD_DBG_MSG("\r\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void OutputEvtTrace(TL_EvtPacket_t *phcievtbuffer)
|
||||
{
|
||||
if(phcievtbuffer->evtserial.evt.evtcode != TL_BLEEVT_VS_OPCODE)
|
||||
{
|
||||
TL_SHCI_EVT_DBG_MSG("unknown sys evt received: %02X", phcievtbuffer->evtserial.evt.evtcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
TL_SHCI_EVT_DBG_MSG("sys evt: 0x%02X", phcievtbuffer->evtserial.evt.evtcode);
|
||||
TL_SHCI_EVT_DBG_MSG(" subevtcode: 0x%04X", ((TL_AsynchEvt_t*)(phcievtbuffer->evtserial.evt.payload))->subevtcode);
|
||||
if((phcievtbuffer->evtserial.evt.plen-2) != 0)
|
||||
{
|
||||
TL_SHCI_EVT_DBG_MSG(" payload:");
|
||||
TL_SHCI_EVT_DBG_BUF(((TL_AsynchEvt_t*)(phcievtbuffer->evtserial.evt.payload))->payload, phcievtbuffer->evtserial.evt.plen-2, "");
|
||||
}
|
||||
}
|
||||
|
||||
TL_SHCI_EVT_DBG_MSG("\r\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Weak implementation ----------------------------------------------------------------*/
|
||||
MBED_WEAK void shci_cmd_resp_wait(uint32_t timeout)
|
||||
{
|
||||
(void)timeout;
|
||||
|
||||
CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT;
|
||||
while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MBED_WEAK void shci_cmd_resp_release(uint32_t flag)
|
||||
{
|
||||
(void)flag;
|
||||
|
||||
CmdRspStatusFlag = SHCI_TL_CMD_RESP_RELEASE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file shci_tl.h
|
||||
* @author MCD Application Team
|
||||
* @brief System HCI command header for the system channel
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __SHCI_TL_H_
|
||||
#define __SHCI_TL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "tl.h"
|
||||
|
||||
/* Exported defines -----------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
SHCI_TL_UserEventFlow_Disable,
|
||||
SHCI_TL_UserEventFlow_Enable,
|
||||
} SHCI_TL_UserEventFlowStatus_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SHCI_TL_CmdBusy,
|
||||
SHCI_TL_CmdAvailable
|
||||
} SHCI_TL_CmdStatus_t;
|
||||
|
||||
/**
|
||||
* @brief Structure used to manage the BUS IO operations.
|
||||
* All the structure fields will point to functions defined at user level.
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int32_t (* Init) (void* pConf); /**< Pointer to SHCI TL function for the IO Bus initialization */
|
||||
int32_t (* DeInit) (void); /**< Pointer to SHCI TL function for the IO Bus de-initialization */
|
||||
int32_t (* Reset) (void); /**< Pointer to SHCI TL function for the IO Bus reset */
|
||||
int32_t (* Receive) (uint8_t*, uint16_t); /**< Pointer to SHCI TL function for the IO Bus data reception */
|
||||
int32_t (* Send) (uint8_t*, uint16_t); /**< Pointer to SHCI TL function for the IO Bus data transmission */
|
||||
int32_t (* DataAck) (uint8_t*, uint16_t* len); /**< Pointer to SHCI TL function for the IO Bus data ack reception */
|
||||
int32_t (* GetTick) (void); /**< Pointer to BSP function for getting the HAL time base timestamp */
|
||||
} tSHciIO;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Contain the SHCI context
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tSHciIO io; /**< Manage the BUS IO operations */
|
||||
void (* UserEvtRx) (void * pData); /**< User System events callback function pointer */
|
||||
} tSHciContext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SHCI_TL_UserEventFlowStatus_t status;
|
||||
TL_EvtPacket_t *pckt;
|
||||
} tSHCI_UserEvtRxParam;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *p_cmdbuffer;
|
||||
void (* StatusNotCallBack) (SHCI_TL_CmdStatus_t status);
|
||||
} SHCI_TL_HciInitConf_t;
|
||||
|
||||
/**
|
||||
* shci_send
|
||||
* @brief Send an System HCI Command
|
||||
*
|
||||
* @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( 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.
|
||||
* @param fops The SHCI IO structure managing the IO BUS
|
||||
* @retval None
|
||||
*/
|
||||
void shci_register_io_bus(tSHciIO* fops);
|
||||
|
||||
/**
|
||||
* @brief Interrupt service routine that must be called when the system channel
|
||||
* reports a packet has been received
|
||||
*
|
||||
* @param pdata Packet or event pointer
|
||||
* @retval None
|
||||
*/
|
||||
void shci_notify_asynch_evt(void* pdata);
|
||||
|
||||
/**
|
||||
* @brief This function resume the User Event Flow which has been stopped on return
|
||||
* from UserEvtRx() when the User Event has not been processed.
|
||||
*
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void shci_resume_flow(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is called when an System HCI Command is sent to the CPU2 and the response is waited.
|
||||
* It is called from the same context the System HCI command has been sent.
|
||||
* It shall not return until the command response notified by shci_cmd_resp_release() is received.
|
||||
* A weak implementation is available in shci_tl.c based on polling mechanism
|
||||
* The user may re-implement this function in the application to improve performance :
|
||||
* - It may use UTIL_SEQ_WaitEvt() API when using the Sequencer
|
||||
* - It may use a semaphore when using cmsis_os interface
|
||||
*
|
||||
* @param timeout: Waiting timeout
|
||||
* @retval None
|
||||
*/
|
||||
void shci_cmd_resp_wait(uint32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief This function is called when an System HCI command is received from the CPU2.
|
||||
* A weak implementation is available in shci_tl.c based on polling mechanism
|
||||
* The user may re-implement this function in the application to improve performance :
|
||||
* - It may use UTIL_SEQ_SetEvt() API when using the Sequencer
|
||||
* - It may use a semaphore when using cmsis_os interface
|
||||
*
|
||||
*
|
||||
* @param flag: Release flag
|
||||
* @retval None
|
||||
*/
|
||||
void shci_cmd_resp_release(uint32_t flag);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This process shall be called each time the shci_notify_asynch_evt notification is received
|
||||
*
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
void shci_user_evt_proc(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize the System Host Controller Interface.
|
||||
* This function must be called before any communication on the System Channel
|
||||
*
|
||||
* @param pData: System events callback function pointer
|
||||
* This callback is triggered when an user event is received on
|
||||
* the System Channel from CPU2.
|
||||
* @param pConf: Configuration structure pointer
|
||||
* @retval None
|
||||
*/
|
||||
void shci_init(void(* UserEvtRx)(void* pData), void* pConf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SHCI_TL_H_ */
|
||||
@@ -0,0 +1,155 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_wpan_common.h
|
||||
* @author MCD Application Team
|
||||
* @brief Common file to utilities
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32_WPAN_COMMON_H
|
||||
#define __STM32_WPAN_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* -------------------------------- *
|
||||
* Basic definitions *
|
||||
* -------------------------------- */
|
||||
|
||||
#undef NULL
|
||||
#define NULL 0U
|
||||
|
||||
#undef FALSE
|
||||
#define FALSE 0U
|
||||
|
||||
#undef TRUE
|
||||
#define TRUE (!0U)
|
||||
|
||||
/* -------------------------------- *
|
||||
* Critical Section definition *
|
||||
* -------------------------------- */
|
||||
#undef BACKUP_PRIMASK
|
||||
#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK()
|
||||
|
||||
#undef DISABLE_IRQ
|
||||
#define DISABLE_IRQ() __disable_irq()
|
||||
|
||||
#undef RESTORE_PRIMASK
|
||||
#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit)
|
||||
|
||||
/* -------------------------------- *
|
||||
* Macro delimiters *
|
||||
* -------------------------------- */
|
||||
#undef M_BEGIN
|
||||
#define M_BEGIN do {
|
||||
|
||||
#undef M_END
|
||||
#define M_END } while(0)
|
||||
|
||||
/* -------------------------------- *
|
||||
* Some useful macro definitions *
|
||||
* -------------------------------- */
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#undef MODINC
|
||||
#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END
|
||||
|
||||
#undef MODDEC
|
||||
#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END
|
||||
|
||||
#undef MODADD
|
||||
#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END
|
||||
|
||||
#undef MODSUB
|
||||
#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m )
|
||||
|
||||
#undef ALIGN
|
||||
#ifdef WIN32
|
||||
#define ALIGN(n)
|
||||
#else
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#endif
|
||||
|
||||
#undef PAUSE
|
||||
#define PAUSE( t ) M_BEGIN \
|
||||
volatile int _i; \
|
||||
for ( _i = t; _i > 0; _i -- ); \
|
||||
M_END
|
||||
#undef DIVF
|
||||
#define DIVF( x, y ) ((x)/(y))
|
||||
|
||||
#undef DIVC
|
||||
#define DIVC( x, y ) (((x)+(y)-1)/(y))
|
||||
|
||||
#undef DIVR
|
||||
#define DIVR( x, y ) (((x)+((y)/2))/(y))
|
||||
|
||||
#undef SHRR
|
||||
#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1)
|
||||
|
||||
#undef BITN
|
||||
#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1)
|
||||
|
||||
#undef BITNSET
|
||||
#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END
|
||||
|
||||
/* -------------------------------- *
|
||||
* Section attribute *
|
||||
* -------------------------------- */
|
||||
#undef PLACE_IN_SECTION
|
||||
#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__)))
|
||||
|
||||
/* ----------------------------------- *
|
||||
* Packed usage (compiler dependent) *
|
||||
* ----------------------------------- */
|
||||
#undef PACKED__
|
||||
#undef PACKED_STRUCT
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050U)
|
||||
#define PACKED__ __attribute__((packed))
|
||||
#define PACKED_STRUCT struct PACKED__
|
||||
#else
|
||||
#define PACKED__(TYPE) __packed TYPE
|
||||
#define PACKED_STRUCT PACKED__(struct)
|
||||
#endif
|
||||
#elif defined ( __GNUC__ )
|
||||
#define PACKED__ __attribute__((packed))
|
||||
#define PACKED_STRUCT struct PACKED__
|
||||
#elif defined (__ICCARM__)
|
||||
#define PACKED_STRUCT __packed struct
|
||||
#elif
|
||||
#define PACKED_STRUCT __packed struct
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__STM32_WPAN_COMMON_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,208 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm_list.c
|
||||
* @author MCD Application Team
|
||||
* @brief TCircular Linked List Implementation.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Include Files
|
||||
******************************************************************************/
|
||||
#include "utilities_common.h"
|
||||
|
||||
#include "stm_list.h"
|
||||
|
||||
/******************************************************************************
|
||||
* Function Definitions
|
||||
******************************************************************************/
|
||||
void LST_init_head (tListNode * listHead)
|
||||
{
|
||||
listHead->next = listHead;
|
||||
listHead->prev = listHead;
|
||||
}
|
||||
|
||||
uint8_t LST_is_empty (tListNode * listHead)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
uint8_t return_value;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
if(listHead->next == listHead)
|
||||
{
|
||||
return_value = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_value = FALSE;
|
||||
}
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
void LST_insert_head (tListNode * listHead, tListNode * node)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
node->next = listHead->next;
|
||||
node->prev = listHead;
|
||||
listHead->next = node;
|
||||
(node->next)->prev = node;
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
void LST_insert_tail (tListNode * listHead, tListNode * node)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
node->next = listHead;
|
||||
node->prev = listHead->prev;
|
||||
listHead->prev = node;
|
||||
(node->prev)->next = node;
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
void LST_remove_node (tListNode * node)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
(node->prev)->next = node->next;
|
||||
(node->next)->prev = node->prev;
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
void LST_remove_head (tListNode * listHead, tListNode ** node )
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
*node = listHead->next;
|
||||
LST_remove_node (listHead->next);
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
void LST_remove_tail (tListNode * listHead, tListNode ** node )
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
*node = listHead->prev;
|
||||
LST_remove_node (listHead->prev);
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
void LST_insert_node_after (tListNode * node, tListNode * ref_node)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
node->next = ref_node->next;
|
||||
node->prev = ref_node;
|
||||
ref_node->next = node;
|
||||
(node->next)->prev = node;
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
void LST_insert_node_before (tListNode * node, tListNode * ref_node)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
node->next = ref_node;
|
||||
node->prev = ref_node->prev;
|
||||
ref_node->prev = node;
|
||||
(node->prev)->next = node;
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
int LST_get_size (tListNode * listHead)
|
||||
{
|
||||
int size = 0;
|
||||
tListNode * temp;
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
temp = listHead->next;
|
||||
while (temp != listHead)
|
||||
{
|
||||
size++;
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
void LST_get_next_node (tListNode * ref_node, tListNode ** node)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
*node = ref_node->next;
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
|
||||
void LST_get_prev_node (tListNode * ref_node, tListNode ** node)
|
||||
{
|
||||
uint32_t primask_bit;
|
||||
|
||||
primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */
|
||||
__disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
|
||||
|
||||
*node = ref_node->prev;
|
||||
|
||||
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm_list.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for linked list library.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _STM_LIST_H_
|
||||
#define _STM_LIST_H_
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
typedef struct _tListNode {
|
||||
struct _tListNode * next;
|
||||
struct _tListNode * prev;
|
||||
} tListNode;
|
||||
|
||||
void LST_init_head (tListNode * listHead);
|
||||
|
||||
uint8_t LST_is_empty (tListNode * listHead);
|
||||
|
||||
void LST_insert_head (tListNode * listHead, tListNode * node);
|
||||
|
||||
void LST_insert_tail (tListNode * listHead, tListNode * node);
|
||||
|
||||
void LST_remove_node (tListNode * node);
|
||||
|
||||
void LST_remove_head (tListNode * listHead, tListNode ** node );
|
||||
|
||||
void LST_remove_tail (tListNode * listHead, tListNode ** node );
|
||||
|
||||
void LST_insert_node_after (tListNode * node, tListNode * ref_node);
|
||||
|
||||
void LST_insert_node_before (tListNode * node, tListNode * ref_node);
|
||||
|
||||
int LST_get_size (tListNode * listHead);
|
||||
|
||||
void LST_get_next_node (tListNode * ref_node, tListNode ** node);
|
||||
|
||||
void LST_get_prev_node (tListNode * ref_node, tListNode ** node);
|
||||
|
||||
#endif /* _STM_LIST_H_ */
|
||||
@@ -0,0 +1,334 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tl.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header for tl module
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TL_H
|
||||
#define __TL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#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_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_BLEEVT_CC_OPCODE (0x0E)
|
||||
#define TL_BLEEVT_CS_OPCODE (0x0F)
|
||||
#define TL_BLEEVT_VS_OPCODE (0xFF)
|
||||
|
||||
#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 */
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint32_t *next;
|
||||
uint32_t *prev;
|
||||
} TL_PacketHeader_t;
|
||||
|
||||
/*******************************************************************************
|
||||
* Event type
|
||||
*/
|
||||
|
||||
/**
|
||||
* This the payload of TL_Evt_t for a command status event
|
||||
*/
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t status;
|
||||
uint8_t numcmd;
|
||||
uint16_t cmdcode;
|
||||
} TL_CsEvt_t;
|
||||
|
||||
/**
|
||||
* This the payload of TL_Evt_t for a command complete event
|
||||
*/
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t numcmd;
|
||||
uint16_t cmdcode;
|
||||
uint8_t payload[1];
|
||||
} TL_CcEvt_t;
|
||||
|
||||
/**
|
||||
* This the payload of TL_Evt_t for an asynchronous event
|
||||
*/
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint16_t subevtcode;
|
||||
uint8_t payload[1];
|
||||
} TL_AsynchEvt_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t evtcode;
|
||||
uint8_t plen;
|
||||
uint8_t payload[1];
|
||||
} TL_Evt_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t type;
|
||||
TL_Evt_t evt;
|
||||
} TL_EvtSerial_t;
|
||||
|
||||
/**
|
||||
* This format shall be used for all events (asynchronous and command response) reported
|
||||
* by the CPU2 except for the command response of a system command where the header is not there
|
||||
* and the format to be used shall be TL_EvtSerial_t.
|
||||
* Note: Be careful that the asynchronous events reported by the CPU2 on the system channel do
|
||||
* include the header and shall use TL_EvtPacket_t format. Only the command response format on the
|
||||
* system channel is different.
|
||||
*/
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
TL_PacketHeader_t header;
|
||||
TL_EvtSerial_t evtserial;
|
||||
} TL_EvtPacket_t;
|
||||
|
||||
/*****************************************************************************************
|
||||
* Command type
|
||||
*/
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint16_t cmdcode;
|
||||
uint8_t plen;
|
||||
uint8_t payload[255];
|
||||
} TL_Cmd_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t type;
|
||||
TL_Cmd_t cmd;
|
||||
} TL_CmdSerial_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
TL_PacketHeader_t header;
|
||||
TL_CmdSerial_t cmdserial;
|
||||
} TL_CmdPacket_t;
|
||||
|
||||
/*****************************************************************************************
|
||||
* HCI ACL DATA type
|
||||
*/
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
uint8_t type;
|
||||
uint16_t handle;
|
||||
uint16_t length;
|
||||
uint8_t acl_data[1];
|
||||
} TL_AclDataSerial_t;
|
||||
|
||||
typedef PACKED_STRUCT
|
||||
{
|
||||
TL_PacketHeader_t header;
|
||||
TL_AclDataSerial_t AclDataSerial;
|
||||
} TL_AclDataPacket_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *p_BleSpareEvtBuffer;
|
||||
uint8_t *p_SystemSpareEvtBuffer;
|
||||
uint8_t *p_AsynchEvtPool;
|
||||
uint32_t AsynchEvtPoolSize;
|
||||
uint8_t *p_TracesEvtPool;
|
||||
uint32_t TracesEvtPoolSize;
|
||||
} TL_MM_Config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *p_ThreadOtCmdRspBuffer;
|
||||
uint8_t *p_ThreadCliRspBuffer;
|
||||
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_LldBleCmdRspBuffer;
|
||||
uint8_t *p_LldBleM0CmdBuffer;
|
||||
} TL_LLD_BLE_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_ZigbeeNotifRequestBuffer;
|
||||
} TL_ZIGBEE_Config_t;
|
||||
|
||||
/**
|
||||
* @brief Contain the BLE HCI Init Configuration
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (* IoBusEvtCallBack) ( TL_EvtPacket_t *phcievt );
|
||||
void (* IoBusAclDataTxAck) ( void );
|
||||
uint8_t *p_cmdbuffer;
|
||||
uint8_t *p_AclDataBuffer;
|
||||
} TL_BLE_InitConf_t;
|
||||
|
||||
/**
|
||||
* @brief Contain the SYSTEM HCI Init Configuration
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void (* IoBusCallBackCmdEvt) (TL_EvtPacket_t *phcievt);
|
||||
void (* IoBusCallBackUserEvt) (TL_EvtPacket_t *phcievt);
|
||||
uint8_t *p_cmdbuffer;
|
||||
} TL_SYS_InitConf_t;
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* External variables --------------------------------------------------------*/
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
/******************************************************************************
|
||||
* GENERAL
|
||||
******************************************************************************/
|
||||
void TL_Enable( void );
|
||||
void TL_Init( void );
|
||||
|
||||
/******************************************************************************
|
||||
* BLE
|
||||
******************************************************************************/
|
||||
int32_t TL_BLE_Init( void* pConf );
|
||||
int32_t TL_BLE_SendCmd( uint8_t* buffer, uint16_t size );
|
||||
int32_t TL_BLE_SendAclData( uint8_t* buffer, uint16_t size );
|
||||
|
||||
/******************************************************************************
|
||||
* SYSTEM
|
||||
******************************************************************************/
|
||||
int32_t TL_SYS_Init( void* pConf );
|
||||
int32_t TL_SYS_SendCmd( uint8_t* buffer, uint16_t size );
|
||||
|
||||
/******************************************************************************
|
||||
* THREAD
|
||||
******************************************************************************/
|
||||
void TL_THREAD_Init( TL_TH_Config_t *p_Config );
|
||||
void TL_OT_SendCmd( void );
|
||||
void TL_CLI_SendCmd( void );
|
||||
void TL_OT_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
|
||||
void TL_THREAD_NotReceived( TL_EvtPacket_t * Notbuffer );
|
||||
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 );
|
||||
|
||||
/******************************************************************************
|
||||
* LLD BLE
|
||||
******************************************************************************/
|
||||
void TL_LLD_BLE_Init( TL_LLD_BLE_Config_t *p_Config );
|
||||
void TL_LLD_BLE_SendCliCmd( void );
|
||||
void TL_LLD_BLE_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer );
|
||||
void TL_LLD_BLE_SendCliRspAck( void );
|
||||
void TL_LLD_BLE_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer );
|
||||
void TL_LLD_BLE_SendM0CmdAck( void );
|
||||
void TL_LLD_BLE_SendCmd( void );
|
||||
void TL_LLD_BLE_ReceiveRsp( TL_CmdPacket_t * Notbuffer );
|
||||
void TL_LLD_BLE_SendRspAck( void );
|
||||
/******************************************************************************
|
||||
* MEMORY MANAGER
|
||||
******************************************************************************/
|
||||
void TL_MM_Init( TL_MM_Config_t *p_Config );
|
||||
void TL_MM_EvtDone( TL_EvtPacket_t * hcievt );
|
||||
|
||||
/******************************************************************************
|
||||
* TRACES
|
||||
******************************************************************************/
|
||||
void TL_TRACES_Init( void );
|
||||
void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt );
|
||||
|
||||
/******************************************************************************
|
||||
* MAC 802.15.4
|
||||
******************************************************************************/
|
||||
void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config );
|
||||
void TL_MAC_802_15_4_SendCmd( void );
|
||||
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_SendM4RequestToM0( void );
|
||||
void TL_ZIGBEE_SendM4AckToM0Notify ( void );
|
||||
void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer );
|
||||
void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer );
|
||||
void TL_ZIGBEE_M0RequestReceived(TL_EvtPacket_t * Otbuffer );
|
||||
void TL_ZIGBEE_SendM4AckToM0Request(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*__TL_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
@@ -0,0 +1,688 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tl_mbox.c
|
||||
* @author MCD Application Team
|
||||
* @brief Transport layer for the mailbox interface
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© 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
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32_wpan_common.h"
|
||||
#include "hw.h"
|
||||
|
||||
#include "mbed_toolchain.h"
|
||||
|
||||
#include "stm_list.h"
|
||||
#include "tl.h"
|
||||
#include "mbox_def.h"
|
||||
|
||||
/**
|
||||
* These traces are not yet supported in an usual way in the delivery package
|
||||
* They can enabled by adding the definition of TL_MM_DBG_EN in the preprocessor option in the IDE
|
||||
*/
|
||||
#if(TL_MM_DBG_EN != 0)
|
||||
#include "app_conf.h"
|
||||
#include "dbg_trace.h"
|
||||
#endif
|
||||
|
||||
#if (TL_MM_DBG_EN != 0)
|
||||
#define TL_MM_DBG__MSG PRINT_MESG_DBG
|
||||
#else
|
||||
#define TL_MM_DBG__MSG(...)
|
||||
#endif
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/**< reference table */
|
||||
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_LldBleTable_t TL_LldBleTable;
|
||||
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;
|
||||
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue;
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint8_t CsBuffer[sizeof(TL_PacketHeader_t) + TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t)];
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static tListNode EvtQueue;
|
||||
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static tListNode SystemEvtQueue;
|
||||
|
||||
|
||||
static tListNode LocalFreeBufQueue;
|
||||
static void (* BLE_IoBusEvtCallBackFunction) (TL_EvtPacket_t *phcievt);
|
||||
static void (* BLE_IoBusAclDataTxAck) ( void );
|
||||
static void (* SYS_CMD_IoBusCallBackFunction) (TL_EvtPacket_t *phcievt);
|
||||
static void (* SYS_EVT_IoBusCallBackFunction) (TL_EvtPacket_t *phcievt);
|
||||
|
||||
|
||||
/* Global variables ----------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
static void SendFreeBuf( void );
|
||||
static void OutputMemReleaseTrace(TL_EvtPacket_t * phcievt);
|
||||
|
||||
/* Public Functions Definition ------------------------------------------------------*/
|
||||
|
||||
/******************************************************************************
|
||||
* GENERAL
|
||||
******************************************************************************/
|
||||
void TL_Enable( void )
|
||||
{
|
||||
HW_IPCC_Enable();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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_lld_ble_table = &TL_LldBleTable;
|
||||
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;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* BLE
|
||||
******************************************************************************/
|
||||
int32_t TL_BLE_Init( void* pConf )
|
||||
{
|
||||
MB_BleTable_t * p_bletable;
|
||||
|
||||
TL_BLE_InitConf_t *pInitHciConf = (TL_BLE_InitConf_t *) pConf;
|
||||
|
||||
LST_init_head (&EvtQueue);
|
||||
|
||||
p_bletable = TL_RefTable.p_ble_table;
|
||||
|
||||
p_bletable->pcmd_buffer = pInitHciConf->p_cmdbuffer;
|
||||
p_bletable->phci_acl_data_buffer = pInitHciConf->p_AclDataBuffer;
|
||||
p_bletable->pcs_buffer = (uint8_t*)CsBuffer;
|
||||
p_bletable->pevt_queue = (uint8_t*)&EvtQueue;
|
||||
|
||||
HW_IPCC_BLE_Init();
|
||||
|
||||
BLE_IoBusEvtCallBackFunction = pInitHciConf->IoBusEvtCallBack;
|
||||
BLE_IoBusAclDataTxAck = pInitHciConf->IoBusAclDataTxAck;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HW_IPCC_BLE_RxEvtNot(void)
|
||||
{
|
||||
TL_EvtPacket_t *phcievt;
|
||||
|
||||
while(LST_is_empty(&EvtQueue) == FALSE)
|
||||
{
|
||||
LST_remove_head (&EvtQueue, (tListNode **)&phcievt);
|
||||
|
||||
BLE_IoBusEvtCallBackFunction(phcievt);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HW_IPCC_BLE_AclDataAckNot(void)
|
||||
{
|
||||
BLE_IoBusAclDataTxAck( );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* SYSTEM
|
||||
******************************************************************************/
|
||||
int32_t TL_SYS_Init( void* pConf )
|
||||
{
|
||||
MB_SysTable_t * p_systable;
|
||||
|
||||
TL_SYS_InitConf_t *pInitHciConf = (TL_SYS_InitConf_t *) pConf;
|
||||
|
||||
LST_init_head (&SystemEvtQueue);
|
||||
p_systable = TL_RefTable.p_sys_table;
|
||||
p_systable->pcmd_buffer = pInitHciConf->p_cmdbuffer;
|
||||
p_systable->sys_queue = (uint8_t*)&SystemEvtQueue;
|
||||
|
||||
HW_IPCC_SYS_Init();
|
||||
|
||||
SYS_CMD_IoBusCallBackFunction = pInitHciConf->IoBusCallBackCmdEvt;
|
||||
SYS_EVT_IoBusCallBackFunction = pInitHciConf->IoBusCallBackUserEvt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HW_IPCC_SYS_CmdEvtNot(void)
|
||||
{
|
||||
SYS_CMD_IoBusCallBackFunction( (TL_EvtPacket_t*)(TL_RefTable.p_sys_table->pcmd_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_SYS_EvtNot( void )
|
||||
{
|
||||
TL_EvtPacket_t *p_evt;
|
||||
|
||||
while(LST_is_empty(&SystemEvtQueue) == FALSE)
|
||||
{
|
||||
LST_remove_head (&SystemEvtQueue, (tListNode **)&p_evt);
|
||||
SYS_EVT_IoBusCallBackFunction( p_evt );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* THREAD
|
||||
******************************************************************************/
|
||||
#ifdef THREAD_WB
|
||||
void TL_THREAD_Init( TL_TH_Config_t *p_Config )
|
||||
{
|
||||
MB_ThreadTable_t * p_thread_table;
|
||||
|
||||
p_thread_table = TL_RefTable.p_thread_table;
|
||||
|
||||
p_thread_table->clicmdrsp_buffer = p_Config->p_ThreadCliRspBuffer;
|
||||
p_thread_table->otcmdrsp_buffer = p_Config->p_ThreadOtCmdRspBuffer;
|
||||
p_thread_table->notack_buffer = p_Config->p_ThreadNotAckBuffer;
|
||||
|
||||
HW_IPCC_THREAD_Init();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_OT_SendCmd( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->otcmdrsp_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE;
|
||||
|
||||
HW_IPCC_OT_SendCmd();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_CLI_SendCmd( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->clicmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
|
||||
|
||||
HW_IPCC_CLI_SendCmd();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_THREAD_SendAck ( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
|
||||
|
||||
HW_IPCC_THREAD_SendAck();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_THREAD_CliSendAck ( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_thread_table->notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
|
||||
|
||||
HW_IPCC_THREAD_CliSendAck();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_OT_CmdEvtNot(void)
|
||||
{
|
||||
TL_OT_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_thread_table->otcmdrsp_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_THREAD_EvtNot( void )
|
||||
{
|
||||
TL_THREAD_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_thread_table->notack_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_THREAD_CliEvtNot( void )
|
||||
{
|
||||
TL_THREAD_CliNotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_thread_table->clicmdrsp_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MBED_WEAK void TL_OT_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
|
||||
MBED_WEAK void TL_THREAD_NotReceived( TL_EvtPacket_t * Notbuffer ){};
|
||||
MBED_WEAK 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;
|
||||
}
|
||||
|
||||
MBED_WEAK void TL_LLDTESTS_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer ){};
|
||||
MBED_WEAK void TL_LLDTESTS_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer ){};
|
||||
#endif /* LLD_TESTS_WB */
|
||||
|
||||
/******************************************************************************
|
||||
* LLD BLE
|
||||
******************************************************************************/
|
||||
#ifdef LLD_BLE_WB
|
||||
void TL_LLD_BLE_Init( TL_LLD_BLE_Config_t *p_Config )
|
||||
{
|
||||
MB_LldBleTable_t * p_lld_ble_table;
|
||||
|
||||
p_lld_ble_table = TL_RefTable.p_lld_ble_table;
|
||||
p_lld_ble_table->cmdrsp_buffer = p_Config->p_LldBleCmdRspBuffer;
|
||||
p_lld_ble_table->m0cmd_buffer = p_Config->p_LldBleM0CmdBuffer;
|
||||
HW_IPCC_LLD_BLE_Init();
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_LLD_BLE_SendCliCmd( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_lld_ble_table->cmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
|
||||
HW_IPCC_LLD_BLE_SendCliCmd();
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_LLD_BLE_ReceiveCliRsp( void )
|
||||
{
|
||||
TL_LLD_BLE_ReceiveCliRsp( (TL_CmdPacket_t*)(TL_RefTable.p_lld_ble_table->cmdrsp_buffer) );
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_LLD_BLE_SendCliRspAck( void )
|
||||
{
|
||||
HW_IPCC_LLD_BLE_SendCliRspAck();
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void )
|
||||
{
|
||||
TL_LLD_BLE_ReceiveM0Cmd( (TL_CmdPacket_t*)(TL_RefTable.p_lld_ble_table->m0cmd_buffer) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void TL_LLD_BLE_SendM0CmdAck( void )
|
||||
{
|
||||
HW_IPCC_LLD_BLE_SendM0CmdAck();
|
||||
return;
|
||||
}
|
||||
|
||||
MBED_WEAK void TL_LLD_BLE_ReceiveCliRsp( TL_CmdPacket_t * Notbuffer ){};
|
||||
MBED_WEAK void TL_LLD_BLE_ReceiveM0Cmd( TL_CmdPacket_t * Notbuffer ){};
|
||||
|
||||
/* Transparent Mode */
|
||||
void TL_LLD_BLE_SendCmd( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_lld_ble_table->cmdrsp_buffer))->cmdserial.type = TL_CLICMD_PKT_TYPE;
|
||||
HW_IPCC_LLD_BLE_SendCmd();
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_LLD_BLE_ReceiveRsp( void )
|
||||
{
|
||||
TL_LLD_BLE_ReceiveRsp( (TL_CmdPacket_t*)(TL_RefTable.p_lld_ble_table->cmdrsp_buffer) );
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_LLD_BLE_SendRspAck( void )
|
||||
{
|
||||
HW_IPCC_LLD_BLE_SendRspAck();
|
||||
return;
|
||||
}
|
||||
#endif /* LLD_BLE_WB */
|
||||
|
||||
#ifdef MAC_802_15_4_WB
|
||||
/******************************************************************************
|
||||
* MAC 802.15.4
|
||||
******************************************************************************/
|
||||
void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config )
|
||||
{
|
||||
MB_Mac_802_15_4_t * p_mac_802_15_4_table;
|
||||
|
||||
p_mac_802_15_4_table = TL_RefTable.p_mac_802_15_4_table;
|
||||
|
||||
p_mac_802_15_4_table->p_cmdrsp_buffer = p_Config->p_Mac_802_15_4_CmdRspBuffer;
|
||||
p_mac_802_15_4_table->p_notack_buffer = p_Config->p_Mac_802_15_4_NotAckBuffer;
|
||||
|
||||
HW_IPCC_MAC_802_15_4_Init();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_MAC_802_15_4_SendCmd( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE;
|
||||
|
||||
HW_IPCC_MAC_802_15_4_SendCmd();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_MAC_802_15_4_SendAck ( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
|
||||
|
||||
HW_IPCC_MAC_802_15_4_SendAck();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_MAC_802_15_4_CmdEvtNot(void)
|
||||
{
|
||||
TL_MAC_802_15_4_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_MAC_802_15_4_EvtNot( void )
|
||||
{
|
||||
TL_MAC_802_15_4_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MBED_WEAK void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
|
||||
MBED_WEAK 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->requestM0toM4_buffer = p_Config->p_ZigbeeNotifRequestBuffer;
|
||||
|
||||
HW_IPCC_ZIGBEE_Init();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Zigbee M4 to M0 Request */
|
||||
void TL_ZIGBEE_SendM4RequestToM0( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE;
|
||||
|
||||
HW_IPCC_ZIGBEE_SendM4RequestToM0();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Used to receive an ACK from the M0 */
|
||||
void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void)
|
||||
{
|
||||
TL_ZIGBEE_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Zigbee notification from M0 to M4 */
|
||||
void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void )
|
||||
{
|
||||
TL_ZIGBEE_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send an ACK to the M0 for a Notification */
|
||||
void TL_ZIGBEE_SendM4AckToM0Notify ( void )
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
|
||||
|
||||
HW_IPCC_ZIGBEE_SendM4AckToM0Notify();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Zigbee M0 to M4 Request */
|
||||
void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void )
|
||||
{
|
||||
TL_ZIGBEE_M0RequestReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send an ACK to the M0 for a Request */
|
||||
void TL_ZIGBEE_SendM4AckToM0Request(void)
|
||||
{
|
||||
((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE;
|
||||
|
||||
HW_IPCC_ZIGBEE_SendM4AckToM0Request();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
MBED_WEAK void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){};
|
||||
MBED_WEAK void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer ){};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MEMORY MANAGER
|
||||
******************************************************************************/
|
||||
void TL_MM_Init( TL_MM_Config_t *p_Config )
|
||||
{
|
||||
static MB_MemManagerTable_t * p_mem_manager_table;
|
||||
|
||||
LST_init_head (&FreeBufQueue);
|
||||
LST_init_head (&LocalFreeBufQueue);
|
||||
|
||||
p_mem_manager_table = TL_RefTable.p_mem_manager_table;
|
||||
|
||||
p_mem_manager_table->blepool = p_Config->p_AsynchEvtPool;
|
||||
p_mem_manager_table->blepoolsize = p_Config->AsynchEvtPoolSize;
|
||||
p_mem_manager_table->pevt_free_buffer_queue = (uint8_t*)&FreeBufQueue;
|
||||
p_mem_manager_table->spare_ble_buffer = p_Config->p_BleSpareEvtBuffer;
|
||||
p_mem_manager_table->spare_sys_buffer = p_Config->p_SystemSpareEvtBuffer;
|
||||
p_mem_manager_table->traces_evt_pool = p_Config->p_TracesEvtPool;
|
||||
p_mem_manager_table->tracespoolsize = p_Config->TracesEvtPoolSize;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TL_MM_EvtDone(TL_EvtPacket_t * phcievt)
|
||||
{
|
||||
LST_insert_tail(&LocalFreeBufQueue, (tListNode *)phcievt);
|
||||
|
||||
OutputMemReleaseTrace(phcievt);
|
||||
|
||||
HW_IPCC_MM_SendFreeBuf( SendFreeBuf );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void SendFreeBuf( void )
|
||||
{
|
||||
tListNode *p_node;
|
||||
|
||||
while ( FALSE == LST_is_empty (&LocalFreeBufQueue) )
|
||||
{
|
||||
LST_remove_head( &LocalFreeBufQueue, (tListNode **)&p_node );
|
||||
LST_insert_tail( (tListNode*)(TL_RefTable.p_mem_manager_table->pevt_free_buffer_queue), p_node );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void OutputMemReleaseTrace(TL_EvtPacket_t * phcievt)
|
||||
{
|
||||
switch(phcievt->evtserial.evt.evtcode)
|
||||
{
|
||||
case TL_BLEEVT_CS_OPCODE:
|
||||
TL_MM_DBG__MSG("mm evt released: 0x%02X", phcievt->evtserial.evt.evtcode);
|
||||
TL_MM_DBG__MSG(" cmd opcode: 0x%04X", ((TL_CsEvt_t*)(phcievt->evtserial.evt.payload))->cmdcode);
|
||||
TL_MM_DBG__MSG(" buffer addr: 0x%08X", phcievt);
|
||||
break;
|
||||
|
||||
case TL_BLEEVT_CC_OPCODE:
|
||||
TL_MM_DBG__MSG("mm evt released: 0x%02X", phcievt->evtserial.evt.evtcode);
|
||||
TL_MM_DBG__MSG(" cmd opcode: 0x%04X", ((TL_CcEvt_t*)(phcievt->evtserial.evt.payload))->cmdcode);
|
||||
TL_MM_DBG__MSG(" buffer addr: 0x%08X", phcievt);
|
||||
break;
|
||||
|
||||
case TL_BLEEVT_VS_OPCODE:
|
||||
TL_MM_DBG__MSG("mm evt released: 0x%02X", phcievt->evtserial.evt.evtcode);
|
||||
TL_MM_DBG__MSG(" subevtcode: 0x%04X", ((TL_AsynchEvt_t*)(phcievt->evtserial.evt.payload))->subevtcode);
|
||||
TL_MM_DBG__MSG(" buffer addr: 0x%08X", phcievt);
|
||||
break;
|
||||
|
||||
default:
|
||||
TL_MM_DBG__MSG("mm evt released: 0x%02X", phcievt->evtserial.evt.evtcode);
|
||||
TL_MM_DBG__MSG(" buffer addr: 0x%08X", phcievt);
|
||||
break;
|
||||
}
|
||||
|
||||
TL_MM_DBG__MSG("\r\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* TRACES
|
||||
******************************************************************************/
|
||||
void TL_TRACES_Init( void )
|
||||
{
|
||||
LST_init_head (&TracesEvtQueue);
|
||||
|
||||
TL_RefTable.p_traces_table->traces_queue = (uint8_t*)&TracesEvtQueue;
|
||||
|
||||
HW_IPCC_TRACES_Init();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HW_IPCC_TRACES_EvtNot(void)
|
||||
{
|
||||
TL_EvtPacket_t *phcievt;
|
||||
|
||||
while(LST_is_empty(&TracesEvtQueue) == FALSE)
|
||||
{
|
||||
LST_remove_head (&TracesEvtQueue, (tListNode **)&phcievt);
|
||||
TL_TRACES_EvtReceived( phcievt );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MBED_WEAK void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt )
|
||||
{
|
||||
(void)(hcievt);
|
||||
}
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user