Skip to content

Commit

Permalink
[bsp][ifx] add bt support (#8028)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guozhanxin authored Sep 18, 2023
1 parent b0deb61 commit 23794d2
Show file tree
Hide file tree
Showing 11 changed files with 823 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bsp/Infineon/libraries/IFX_PSOC6_HAL/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ if GetDepend('BSP_USING_RTC'):
src += ['mtb-hal-cat1/source/cyhal_rtc.c']
src += ['mtb-pdl-cat1/drivers/source/cy_rtc.c']

if GetDepend('BSP_USING_ON_CHIP_FLASH'):
if GetDepend('BSP_USING_ON_CHIP_FLASH') or GetDepend('BSP_USING_CYW43012_BT') :
src += ['mtb-hal-cat1/source/cyhal_flash.c']
src += ['mtb-pdl-cat1/drivers/source/cy_flash.c']

Expand Down
4 changes: 4 additions & 0 deletions bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ menu "Board extended module Drivers"
bool "Enable cyw43012 wifi"
select PKG_USING_WLAN_CYW43012
default n
config BSP_USING_CYW43012_BT
bool "Enable cyw43012 Bluetooth"
select PKG_USING_BT_CYW43012
default n
endmenu

endmenu
42 changes: 42 additions & 0 deletions bsp/Infineon/psoc6-evaluationkit-062S2/board/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,48 @@ if GetDepend(['BSP_USING_CYW43012_WIFI']):
"CY_RTOS_AWARE",
"CY_SUPPORTS_DEVICE_VALIDATION",
]
if GetDepend(['BSP_USING_CYW43012_BT']):
CPPDEFINES += [
"COMPONENT_43012",
"COMPONENT_APP_CY8CKIT_062S2_43012",
"COMPONENT_AW_AM497",
"COMPONENT_CAT1",
"COMPONENT_CAT1A",
"COMPONENT_CM0P_SLEEP",
"COMPONENT_CM4",
"COMPONENT_CM4_0",
"COMPONENT_Debug",
"COMPONENT_FREERTOS",
"COMPONENT_GCC_ARM",
"COMPONENT_HCI_UART",
"COMPONENT_MW_ABSTRACTION_RTOS",
"COMPONENT_MW_BTSTACK",
"COMPONENT_MW_BTSTACK_INTEGRATION",
"COMPONENT_MW_CLIB_SUPPORT",
"COMPONENT_MW_CMSIS",
"COMPONENT_MW_CORE_LIB",
"COMPONENT_MW_CORE_MAKE",
"COMPONENT_MW_FREERTOS",
"COMPONENT_MW_KV_STORE",
"COMPONENT_MW_MTB_HAL_CAT1",
"COMPONENT_MW_MTB_PDL_CAT1",
"COMPONENT_MW_RECIPE_MAKE_CAT1A",
"COMPONENT_MW_RETARGET_IO",
"COMPONENT_MW_SERIAL_FLASH",
"COMPONENT_PSOC6_02",
"COMPONENT_WICED_BLE",
"COMPONENT_WIFI_INTERFACE_SDIO",
"CORE_NAME_CM4_0=1",
"CY8C624ALQI_S2D42",
"CY_APPNAME_mtb_example_btstack_freertos_hello_sensor",
"CY_RETARGET_IO_CONVERT_LF_TO_CRLF",
"CY_RTOS_AWARE",
"CY_SUPPORTS_DEVICE_VALIDATION",
"CY_TARGET_BOARD=APP_CY8CKIT_062S2_43012",
"CY_USING_HAL",
"TARGET_APP_CY8CKIT_062S2_43012",
"USE_INTERNAL_FLASH"
]
group = DefineGroup('Drivers', src, depend=[''], CPPPATH=path, CPPDEFINES=CPPDEFINES)

Return('group')
8 changes: 7 additions & 1 deletion bsp/Infineon/psoc6-evaluationkit-062S2/libs/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ elif rtconfig.PLATFORM in ['gcc', 'armclang']:
src += Glob(cwd + '/TARGET_RTT-062S2/config/GeneratedSource/*.c')

CPPPATH = [ cwd + '/TARGET_RTT-062S2',
cwd + '/TARGET_RTT-062S2/config/GeneratedSource']
cwd + '/TARGET_RTT-062S2/config/GeneratedSource',
cwd + '/TARGET_RTT-062S2/config',
cwd + '/TARGET_RTT-062S2/bluetooth'
]
if GetDepend(['BSP_USING_CYW43012_BT']):
src += Glob(cwd + '/TARGET_RTT-062S2/bluetooth/*.c')

if rtconfig.PLATFORM in ['gcc']:
src += [cwd + '/TARGET_RTT-062S2/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/startup_psoc6_02_cm4.S']
elif rtconfig.PLATFORM in ['armclang']:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/***************************************************************************//**
* File Name: cycfg_bt_settings.h
*
* Description:
* Bluetooth Configurator configuration.
* This file should not be modified. It was automatically generated by
* Bluetooth Configurator 2.60.0.1460
*
********************************************************************************
* Copyright 2023 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#if !defined(CYCFG_BT_SETTINGS_H)
#define CYCFG_BT_SETTINGS_H

#include "wiced_bt_cfg.h"
#include "wiced_bt_ble.h"
#include "wiced_bt_constants.h"

extern const wiced_bt_cfg_settings_t wiced_bt_cfg_settings;

#endif /* CYCFG_BT_SETTINGS_H */

/* [] END OF FILE */
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/***************************************************************************//**
* File Name: cycfg_gap.c
*
* Description:
* BLE device's GAP configuration.
* This file should not be modified. It was automatically generated by
* Bluetooth Configurator 2.60.0.1460
*
********************************************************************************
* Copyright 2023 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#include "cycfg_gap.h"

/* Device address */
wiced_bt_device_address_t cy_bt_device_address = {0x00, 0xA0, 0x50, 0x00, 0x00, 0x00};

const uint8_t cy_bt_adv_packet_elem_0[1] = { 0x06 };
const uint8_t cy_bt_adv_packet_elem_1[5] = { 0x48, 0x65, 0x6C, 0x6C, 0x6F };
const uint8_t cy_bt_adv_packet_elem_2[16] = { 0x38, 0x28, 0x2E, 0x5F, 0xA5, 0x1E, 0xC7, 0xA4, 0xC2, 0x46, 0x47, 0x74, 0xB6, 0xC7, 0x81, 0x2F };
wiced_bt_ble_advert_elem_t cy_bt_adv_packet_data[] =
{
/* Flags */
{
.advert_type = BTM_BLE_ADVERT_TYPE_FLAG,
.len = 1,
.p_data = (uint8_t*)cy_bt_adv_packet_elem_0,
},
/* Complete local name */
{
.advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE,
.len = 5,
.p_data = (uint8_t*)cy_bt_adv_packet_elem_1,
},
/* Complete list of 128-bit UUIDs available */
{
.advert_type = BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE,
.len = 16,
.p_data = (uint8_t*)cy_bt_adv_packet_elem_2,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/***************************************************************************//**
* File Name: cycfg_gap.h
*
* Description:
* Definitions for GAP configuration.
* This file should not be modified. It was automatically generated by
* Bluetooth Configurator 2.60.0.1460
*
********************************************************************************
* Copyright 2023 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#if !defined(CYCFG_GAP_H)
#define CYCFG_GAP_H

#include "stdint.h"
#include "wiced_bt_ble.h"
#include "cycfg_gatt_db.h"

/* Silicon generated 'Company assigned' part of device address */
#define CY_BT_SILICON_DEVICE_ADDRESS_EN 0

/* Appearance */
#define CY_BT_APPEARANCE 0

/* TX Power Level */
#define CY_BT_TX_POWER 0

/* Interval of random address refreshing */
#define CY_BT_RPA_TIMEOUT 900

/* Maximum attribute length */
#define CY_BT_MAX_ATTR_LEN 512
/* Maximum attribute MTU size */
#define CY_BT_MTU_SIZE 23

/* RX PDU size */
#define CY_BT_RX_PDU_SIZE 512

/* Maximum connections */
#define CY_BT_SERVER_MAX_LINKS 1
#define CY_BT_CLIENT_MAX_LINKS 0

/* LE Filter accept list size */
#define CY_BT_FILTER_ACCEPT_LIST_SIZE 0
/* This define is obsolete and kept for backward compatibility only. */
#define CY_BT_WHITE_LIST_SIZE CY_BT_FILTER_ACCEPT_LIST_SIZE

/* L2CAP configuration */
#define CY_BT_L2CAP_MAX_LE_PSM 1
#define CY_BT_L2CAP_MAX_LE_CHANNELS 1
#define CY_BT_L2CAP_MAX_LE_FIXED_CHANNELS 0
#define CY_BT_L2CAP_MAX_BR_ERTM_CHANNELS 0
#define CY_BT_L2CAP_MAX_BR_ERTM_TX_WIN 0
#define CY_BT_L2CAP_MTU_SIZE 512

/* Security level */
#define CY_BT_SECURITY_LEVEL BTM_SEC_BEST_EFFORT

/* Scan configuration */
#define CY_BT_SCAN_MODE BTM_BLE_SCAN_MODE_PASSIVE

#define CY_BT_HIGH_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL
#define CY_BT_HIGH_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW
#define CY_BT_HIGH_DUTY_SCAN_DURATION 5

#define CY_BT_LOW_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL
#define CY_BT_LOW_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW
#define CY_BT_LOW_DUTY_SCAN_DURATION 60

#define CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL
#define CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW
#define CY_BT_HIGH_DUTY_CONN_SCAN_DURATION 30

#define CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL
#define CY_BT_LOW_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW
#define CY_BT_LOW_DUTY_CONN_SCAN_DURATION 30

/* Connection configuration */
#define CY_BT_CONN_MIN_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL
#define CY_BT_CONN_MAX_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL
#define CY_BT_CONN_LATENCY WICED_BT_CFG_DEFAULT_CONN_LATENCY
#define CY_BT_CONN_SUPERVISION_TIMEOUT WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT

/* Advertisement settings */
#define CY_BT_CHANNEL_MAP (BTM_BLE_ADVERT_CHNL_37 | BTM_BLE_ADVERT_CHNL_38 | BTM_BLE_ADVERT_CHNL_39)

#define CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL 48
#define CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL 48
#define CY_BT_HIGH_DUTY_ADV_DURATION 0

#define CY_BT_LOW_DUTY_ADV_MIN_INTERVAL 2048
#define CY_BT_LOW_DUTY_ADV_MAX_INTERVAL 2048
#define CY_BT_LOW_DUTY_ADV_DURATION 0

#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL 400
#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL 800

#define CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL 48
#define CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL 48
#define CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION 30

#define CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL 160
#define CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL 160
#define CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION 30

#define CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL 2048
#define CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL 2048
#define CY_BT_LOW_DUTY_NONCONN_ADV_DURATION 30


/* Advertisement and scan response packets defines */
#define CY_BT_ADV_PACKET_ELEM_COUNT 3
/* CY_BT_ADV_PACKET_DATA_SIZE is obsolete. Use CY_BT_ADV_PACKET_ELEM_COUNT instead */
#define CY_BT_ADV_PACKET_DATA_SIZE CY_BT_ADV_PACKET_ELEM_COUNT

/* cy_bt_device_name is obsolete. Use app_gap_device_name instead. */
#define cy_bt_device_name app_gap_device_name

/* External definitions */
extern wiced_bt_device_address_t cy_bt_device_address;
extern wiced_bt_ble_advert_elem_t cy_bt_adv_packet_data[];

#endif /* CYCFG_GAP_H */
Loading

0 comments on commit 23794d2

Please sign in to comment.