[beken-72xx] Add initial BK7231Q support, add WA2 board

This commit is contained in:
Kuba Szczodrzyński
2023-06-20 17:22:12 +02:00
parent 05e13dafed
commit 273a86532b
18 changed files with 753 additions and 18 deletions

View File

@@ -0,0 +1,170 @@
{
"pcb": {
"ic": {
"11": {
"C_NAME": "GPIO30",
"GPIO": "P30",
"IRQ": null,
"USB": "DN"
},
"12": {
"C_NAME": "GPIO29",
"GPIO": "P29",
"IRQ": null,
"USB": "DP"
},
"14": {
"C_NAME": "GPIO6",
"GPIO": "P6",
"IRQ": null,
"PWM": 0
},
"15": {
"C_NAME": "GPIO7",
"GPIO": "P7",
"IRQ": null,
"PWM": 1
},
"16": {
"C_NAME": "GPIO8",
"GPIO": "P8",
"IRQ": null,
"PWM": 2
},
"17": {
"C_NAME": "GPIO17",
"GPIO": "P17",
"IRQ": null,
"SD": "D1",
"SPI": "MISO"
},
"18": {
"C_NAME": "GPIO16",
"GPIO": "P16",
"IRQ": null,
"SD": "D0",
"SPI": "MOSI"
},
"19": {
"C_NAME": "GPIO14",
"GPIO": "P14",
"IRQ": null,
"SD": "CLK",
"SPI": "SCK"
},
"20": {
"C_NAME": "GPIO15",
"GPIO": "P15",
"IRQ": null,
"SD": "CMD",
"SPI": "CS"
},
"21": {
"C_NAME": "GPIO19",
"GPIO": "P19",
"IRQ": null,
"SD": "D3",
"PWM": 5
},
"22": {
"C_NAME": "GPIO18",
"GPIO": "P18",
"IRQ": null,
"SD": "D2",
"PWM": 4
},
"23": {
"IO": "I",
"CTRL": "TEST"
},
"24": {
"C_NAME": "GPIO9",
"GPIO": "P9",
"IRQ": null,
"PWM": 3
},
"25": {
"C_NAME": "GPIO10",
"GPIO": "P10",
"IRQ": null,
"UART": "1_RX"
},
"26": {
"C_NAME": "GPIO11",
"GPIO": "P11",
"IRQ": null,
"UART": "1_TX"
},
"27": {
"C_NAME": "GPIO1",
"GPIO": "P1",
"IRQ": null,
"UART": "2_RX",
"I2C": "2_SDA"
},
"28": {
"C_NAME": "GPIO0",
"GPIO": "P0",
"IRQ": null,
"UART": "2_TX",
"I2C": "2_SCL"
},
"29": {
"C_NAME": "GPIO20",
"GPIO": "P20",
"IRQ": null,
"I2C": "1_SCL",
"JTAG": "TCK",
"FLASH": "FSCK"
},
"30": {
"C_NAME": "GPIO21",
"GPIO": "P21",
"IRQ": null,
"I2C": "1_SDA",
"JTAG": "TMS",
"FLASH": "^FCS"
},
"31": {
"C_NAME": "GPIO22",
"GPIO": "P22",
"IRQ": null,
"JTAG": "TDI",
"FLASH": "FSI"
},
"32": {
"C_NAME": "GPIO23",
"GPIO": "P23",
"IRQ": null,
"ADC": 3,
"JTAG": "TDO",
"FLASH": "FSO"
},
"33": {
"C_NAME": "GPIO25",
"GPIO": "P25",
"IRQ": null
},
"34": {
"C_NAME": "GPIO28",
"GPIO": "P28",
"IRQ": null
},
"35": {
"C_NAME": "GPIO4",
"GPIO": "P4",
"IRQ": null,
"ADC": 1,
"I2S": "DIN"
},
"36": {
"IO": "I",
"CTRL": "CODE"
},
"37": {
"IO": "I",
"CTRL": "CEN"
}
}
}
}

View File

@@ -103,7 +103,7 @@
"C_NAME": "GPIO19",
"GPIO": "P19",
"IRQ": null,
"SD": "D1"
"SD": "D3"
},
"31": {
"C_NAME": "GPIO17",

View File

@@ -0,0 +1,143 @@
{
"pcb": {
"test_pads": {
"TTEST": "wa2.back.test.anchor",
"TTX2": "wa2.back.2tx.anchor",
"TGND": "wa2.back.gnd.anchor",
"TSCK": "wa2.back.sck.anchor",
"TCSN": "wa2.back.csn.anchor",
"TSI": "wa2.back.si.anchor",
"TSO": "wa2.back.so.anchor",
"TP4": "wa2.back.p4.anchor",
"TVCC": "wa2.back.vbat.anchor"
},
"back": [
{
"name": "test_pad_1mm",
"pos": "2.6,6.2"
},
{
"id": "sck",
"name": "label_line_up",
"pos": "2.6,5.4",
"vars": {
"DIR": "left",
"W": 1.3,
"H": 2
}
},
{
"name": "test_pad_1mm",
"pos": "4.6,6.2"
},
{
"id": "so",
"name": "label_line_up",
"pos": "4.6,5.4",
"vars": {
"DIR": "left",
"W": 3.3,
"H": 4
}
},
{
"name": "test_pad_1mm",
"pos": "7.0,6.2"
},
{
"id": "p4",
"name": "label_line_up",
"pos": "7.0,5.4",
"vars": {
"DIR": "right",
"W": 0,
"H": 4
}
},
{
"name": "test_pad_1mm",
"pos": "3.0,8.3"
},
{
"id": "csn",
"name": "label_line_up",
"pos": "2.2,8.4",
"vars": {
"DIR": "left",
"W": 0.9,
"H": 0
}
},
{
"name": "test_pad_1mm",
"pos": "5.2,8.8"
},
{
"id": "si",
"name": "label_line_up",
"pos": "6.0,8.9",
"vars": {
"DIR": "right",
"W": 1,
"H": 0
}
},
{
"name": "test_pad_1mm",
"pos": "2.1,11.6"
},
{
"id": "2tx",
"name": "label_line_up",
"pos": "1.3,11.7",
"vars": {
"DIR": "left",
"W": 0,
"H": 0
}
},
{
"name": "test_pad_1mm",
"pos": "4.3,11.6"
},
{
"id": "test",
"name": "label_line_up",
"pos": "5.1,11.7",
"vars": {
"DIR": "right",
"W": 1.9,
"H": 0
}
},
{
"name": "test_pad_1mm",
"pos": "2.5,14.5"
},
{
"id": "vbat",
"name": "label_line_up",
"pos": "1.7,14.6",
"vars": {
"DIR": "left",
"W": 0.4,
"H": 0
}
},
{
"name": "test_pad_1mm",
"pos": "4.8,14.5"
},
{
"id": "gnd",
"name": "label_line_up",
"pos": "5.6,14.6",
"vars": {
"DIR": "right",
"W": 1.4,
"H": 0
}
}
]
}
}

93
boards/_base/pcb/wa2.json Normal file
View File

@@ -0,0 +1,93 @@
{
"pcb": {
"scale": 10.5,
"templates": [
"tuya2",
"pcb-blue-light",
"rf-type1"
],
"pinout_hidden": "I2S,SD",
"pinout": {
"1": {
"PWR": 3.3
},
"2": {
"IC": 16,
"ARD": "D0"
},
"3": {
"GND": null
},
"4": {
"IC": 15,
"ARD": "D1"
},
"5": {
"IC": 25,
"ARD": "D4"
},
"6": {
"IC": 14,
"ARD": "D2"
},
"7": {
"IC": 26,
"ARD": "D5"
},
"8": {
"IC": 32,
"ARD": [
"D3",
"A0"
]
},
"9": {
"IC": 22,
"ARD": "D6"
},
"10": {
"IC": 37
},
"11": {
"IC": 21,
"ARD": "D7"
},
"TSCK": {
"IC": 29,
"ARD": "D8"
},
"TP4": {
"IC": 35,
"ARD": "D9"
},
"TTEST": {
"IC": 23
},
"TTX2": {
"IC": 28,
"ARD": "D10"
},
"TCSN": {
"IC": 30,
"ARD": "D11"
},
"TSI": {
"IC": 31,
"ARD": "D12"
},
"TSO": {
"IC": 32,
"ARD": [
"D3",
"A0"
]
},
"TVCC": {
"PWR": 3.3
},
"TGND": {
"GND": null
}
}
}
}

View File

@@ -42,7 +42,7 @@ PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
{GPIO17, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D16: P18, SD_D2
{GPIO18, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D17: P19, SD_D1
// D17: P19, SD_D3
{GPIO19, PIN_GPIO | PIN_IRQ, PIN_NONE, 0},
// D18: P20, I2C1_SCL, TCK, FSCK
{GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0},

54
boards/variants/wa2.c Normal file
View File

@@ -0,0 +1,54 @@
/* This file was auto-generated from wa2.json using boardgen */
#include <Arduino.h>
#ifdef LT_VARIANT_INCLUDE
#include LT_VARIANT_INCLUDE
#endif
// clang-format off
PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P8, PWM2
{GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P7, PWM1
{GPIO7, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D2: P6, PWM0
{GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D3: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D4: P10, UART1_RX
{GPIO10, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
// D5: P11, UART1_TX
{GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
// D6: P18, SD_D2, PWM4
{GPIO18, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D7: P19, SD_D3, PWM5
{GPIO19, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D8: P20, I2C1_SCL, TCK, FSCK
{GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0},
// D9: P4, ADC1, DIN
{GPIO4, PIN_GPIO | PIN_IRQ | PIN_I2S, PIN_NONE, 0},
// D10: P0, UART2_TX, I2C2_SCL
{GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D11: P21, I2C1_SDA, TMS, ^FCS
{GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0},
// D12: P22, TDI, FSI
{GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0},
};
PinInfo *lt_arduino_pin_gpio_map[] = {
[0] = &(lt_arduino_pin_info_list[10]), // GPIO0 (D10)
[4] = &(lt_arduino_pin_info_list[9]), // GPIO4 (D9)
[6] = &(lt_arduino_pin_info_list[2]), // GPIO6 (D2)
[7] = &(lt_arduino_pin_info_list[1]), // GPIO7 (D1)
[8] = &(lt_arduino_pin_info_list[0]), // GPIO8 (D0)
[10] = &(lt_arduino_pin_info_list[4]), // GPIO10 (D4)
[11] = &(lt_arduino_pin_info_list[5]), // GPIO11 (D5)
[18] = &(lt_arduino_pin_info_list[6]), // GPIO18 (D6)
[19] = &(lt_arduino_pin_info_list[7]), // GPIO19 (D7)
[20] = &(lt_arduino_pin_info_list[8]), // GPIO20 (D8)
[21] = &(lt_arduino_pin_info_list[11]), // GPIO21 (D11)
[22] = &(lt_arduino_pin_info_list[12]), // GPIO22 (D12)
[23] = &(lt_arduino_pin_info_list[3]), // GPIO23 (D3)
};
// clang-format on

95
boards/variants/wa2.h Normal file
View File

@@ -0,0 +1,95 @@
/* This file was auto-generated from wa2.json using boardgen */
#pragma once
// clang-format off
// Pins
// ----
#define PINS_COUNT 13 // Total GPIO count
#define NUM_DIGITAL_PINS 13 // Digital inputs/outputs
#define NUM_ANALOG_INPUTS 1 // ADC inputs
#define NUM_ANALOG_OUTPUTS 5 // PWM & DAC outputs
#define PINS_GPIO_MAX 23 // Last usable GPIO number
// Wire Interfaces
// ---------------
#define PIN_WIRE1_SCL 20u // GPIO20
#define PIN_WIRE1_SDA 21u // GPIO21
// Serial ports
// ------------
#define PIN_SERIAL1_RX 10u // GPIO10
#define PIN_SERIAL1_TX 11u // GPIO11
#define PIN_SERIAL2_TX 0u // GPIO0
// Pin function macros
// -------------------
#define PIN_ADC1 4u // GPIO4
#define PIN_ADC3 23u // GPIO23
#define PIN_P0 0u // GPIO0
#define PIN_P4 4u // GPIO4
#define PIN_P6 6u // GPIO6
#define PIN_P7 7u // GPIO7
#define PIN_P8 8u // GPIO8
#define PIN_P10 10u // GPIO10
#define PIN_P11 11u // GPIO11
#define PIN_P18 18u // GPIO18
#define PIN_P19 19u // GPIO19
#define PIN_P20 20u // GPIO20
#define PIN_P21 21u // GPIO21
#define PIN_P22 22u // GPIO22
#define PIN_P23 23u // GPIO23
#define PIN_PWM0 6u // GPIO6
#define PIN_PWM1 7u // GPIO7
#define PIN_PWM2 8u // GPIO8
#define PIN_PWM4 18u // GPIO18
#define PIN_PWM5 19u // GPIO19
#define PIN_RX1 10u // GPIO10
#define PIN_SCL1 20u // GPIO20
#define PIN_SCL2 0u // GPIO0
#define PIN_SDA1 21u // GPIO21
#define PIN_TX1 11u // GPIO11
#define PIN_TX2 0u // GPIO0
// Port availability
// -----------------
#define HAS_SERIAL1 1
#define HAS_SERIAL2 1
#define HAS_WIRE1 1
#define SERIAL_INTERFACES_COUNT 2
#define WIRE_INTERFACES_COUNT 1
// Arduino pin names
// -----------------
#define PIN_D0 8u // GPIO8
#define PIN_D1 7u // GPIO7
#define PIN_D2 6u // GPIO6
#define PIN_D3 23u // GPIO23
#define PIN_D4 10u // GPIO10
#define PIN_D5 11u // GPIO11
#define PIN_D6 18u // GPIO18
#define PIN_D7 19u // GPIO19
#define PIN_D8 20u // GPIO20
#define PIN_D9 4u // GPIO4
#define PIN_D10 0u // GPIO0
#define PIN_D11 21u // GPIO21
#define PIN_D12 22u // GPIO22
#define PIN_A0 23u // GPIO23
// Static pin names
// ----------------
static const unsigned char A0 = PIN_A0;
static const unsigned char D0 = PIN_D0;
static const unsigned char D1 = PIN_D1;
static const unsigned char D2 = PIN_D2;
static const unsigned char D3 = PIN_D3;
static const unsigned char D4 = PIN_D4;
static const unsigned char D5 = PIN_D5;
static const unsigned char D6 = PIN_D6;
static const unsigned char D7 = PIN_D7;
static const unsigned char D8 = PIN_D8;
static const unsigned char D9 = PIN_D9;
static const unsigned char D10 = PIN_D10;
static const unsigned char D11 = PIN_D11;
static const unsigned char D12 = PIN_D12;

20
boards/wa2.json Normal file
View File

@@ -0,0 +1,20 @@
{
"_base": [
"beken-72xx",
"beken-7231",
"beken-7231q",
"ic/bk7231q-qfn40",
"pcb/wa2",
"pcb/wa2-test"
],
"build": {
"mcu": "bk7231q",
"variant": "wa2"
},
"name": "WA2 Wi-Fi Module",
"url": "https://docs.libretiny.eu/boards/wa2/",
"vendor": "Tuya Inc.",
"pcb": {
"symbol": "WA2"
}
}

View File

@@ -27,7 +27,7 @@ SOC_BK7271 = 4
SOC_BK7231N = 5
SOC_BK7236 = 6
SOC_NAMES = {
SOC_BK7231: "bk7231",
SOC_BK7231: "bk7231u",
SOC_BK7231U: "bk7231u",
SOC_BK7251: "bk7251",
SOC_BK7271: "bk7271",
@@ -98,13 +98,13 @@ queue.AppendPrivate(
srcs_core = []
# Fix for BK7231T's bootloader compatibility
if board.get("build.bkboot_version") == "1.0.5-bk7231s":
if board.get("build.bkboot_version") in ["1.0.5-bk7231s", "bk7231q"]:
# this has to be public, so that fixups/intc.c sees it
queue.AppendPublic(CPPDEFINES=[("CFG_SUPPORT_BOOTLOADER", "1")])
queue.AddLibrary(
name="bdk_boot",
base_dir="$FAMILY_DIR/base/fixups",
srcs=["+<boot_handlers_105_bk7231s.S>"],
base_dir="$CORES_DIR/beken-72xx/base/fixups",
srcs=["+<boot_handlers_bk7231u.S>"],
)
else:
srcs_core.append("+<driver/entry/boot_handlers.S>")
@@ -216,7 +216,7 @@ queue.AddLibrary(
"+<func.c>",
"+<airkiss/*.c>",
"+<base64/*.c>",
"+<ble_wifi_exchange/*.c>",
SOC != SOC_BK7231 and "+<ble_wifi_exchange/*.c>",
"+<camera_intf/*.c>",
"+<hostapd_intf/*.c>",
"+<joint_up/*.c>",
@@ -320,7 +320,7 @@ queue.AddLibrary(
)
# Sources - chip-specific drivers
if SOC in [SOC_BK7231U, SOC_BK7251]:
if SOC in [SOC_BK7231, SOC_BK7231U, SOC_BK7251]:
queue.AddLibrary(
name="bdk_driver_spi",
base_dir=join(DRIVER_DIR, "spi"),
@@ -486,7 +486,7 @@ queue.AppendPublic(
"sensor",
"usb",
# "wpa", # this is compiled from func/hostapd_intf/hostapd_intf.c
f"ble_{SOC_NAMES[SOC]}",
SOC != SOC_BK7231 and f"ble_{SOC_NAMES[SOC]}",
f"cal_{SOC_NAMES[SOC]}",
f"rf_test_{SOC_NAMES[SOC]}",
f"rf_use_{SOC_NAMES[SOC]}",

View File

@@ -21,7 +21,7 @@ def add_base_dir(
):
out = []
for expr in expressions:
if expr == False:
if expr == False or expr is None:
# support '[cond] and [path]' logical expressions
continue
if expr[1] != "<" or expr[-1] != ">":
@@ -39,6 +39,9 @@ def add_base_dir(
def iter_expressions(expressions: List[str]) -> Generator[Tuple[str, str], None, None]:
for expr in expressions:
if expr == False or expr is None:
# support '[cond] and [path]' logical expressions
continue
if expr[1:2] != "<" or expr[-1:] != ">":
yield ("+", expr)
continue

View File

@@ -0,0 +1,105 @@
#pragma once
#define CFG_AIRKISS_TEST 0
#define CFG_AP_MONITOR_COEXIST 0
#define CFG_AP_SUPPORT_HT_IE 0
#define CFG_BACKGROUND_PRINT 0
#define CFG_BK_AWARE 0
#define CFG_BK_AWARE_OUI "\xC8\x47\x8C"
#define CFG_EASY_FLASH 1
#define CFG_ENABLE_BUTTON 0
#define CFG_ENABLE_DEMO_TEST 0
#define CFG_ENABLE_WPA_LOG 0
#define CFG_GENERAL_DMA 1
#define CFG_IEEE80211N 1
#define CFG_IEEE80211W 0
#define CFG_IPERF_TEST 0
#define CFG_JTAG_ENABLE 0
#define CFG_LESS_MEMERY_IN_RWNX 0
#define CFG_MAC_PHY_BAPASS 1
#define CFG_MSDU_RESV_HEAD_LEN 96
#define CFG_MSDU_RESV_TAIL_LEN 16
#define CFG_REAL_SDIO 0
#define CFG_RELEASE_FIRMWARE 0
#define CFG_RF_OTA_TEST 0
#define CFG_RF_USER_BLE 0
#define CFG_ROLE_LAUNCH 0
#define CFG_RUNNING_PLATFORM SOC_PLATFORM
#define CFG_RWNX_QOS_MSDU 1
#define CFG_RX_SENSITIVITY_TEST 1
#define CFG_SARADC_CALIBRATE 0
#define CFG_SDIO 0
#define CFG_SDIO_TRANS 0
#define CFG_SOC_NAME SOC_BK7231
#define CFG_SUPPORT_BKREG 1
#define CFG_SUPPORT_BLE 0
#define CFG_SUPPORT_BSSID_CONNECT 0
#define CFG_SUPPORT_CALIBRATION 1
#define CFG_SUPPORT_MANUAL_CALI 1
#define CFG_SUPPORT_OTA_HTTP 1
#define CFG_SUPPORT_OTA_TFTP 0
#define CFG_SUPPORT_TPC_PA_MAP 1
#define CFG_SYS_REDUCE_NORMAL_POWER 0
#define CFG_TCP_SERVER_TEST 0
#define CFG_TX_EVM_TEST 1
#define CFG_UART_DEBUG 0
#define CFG_UART_DEBUG_COMMAND_LINE 1
#define CFG_UDISK_MP3 0
#define CFG_USB 0
#define CFG_USE_AP_IDLE 0
#define CFG_USE_AP_PS 0
#define CFG_USE_APP_DEMO_VIDEO_TRANSFER 0
#define CFG_USE_AUD_ADC 0
#define CFG_USE_AUD_DAC 0
#define CFG_USE_AUDIO 0
#define CFG_USE_BLE_PS 0
#define CFG_USE_CAMERA_INTF 0
#define CFG_USE_DEEP_PS 1
#define CFG_USE_DHCP 1
#define CFG_USE_FAKERTC_PS 0
#define CFG_USE_FTPD_UPGRADE 0
#define CFG_USE_HSLAVE_SPI 0
#define CFG_USE_LWIP_NETSTACK 1
#define CFG_USE_MCU_PS 0
#define CFG_USE_SDCARD_HOST 0
#define CFG_USE_SPIDMA 0
#define CFG_USE_STA_PS 1
#define CFG_USE_TEMPERATURE_DETECT 0
#define CFG_USE_TICK_CAL 0
#define CFG_USE_UART1 0
#define CFG_USE_USB_CHARGE 0
#define CFG_USE_USB_HOST 0
#define CFG_USE_WPA_29 1
#define CFG_WFA_CERT 0
#define CFG_WIFI_RAW_TX_CMD 0
#define CFG_WIFI_SENSOR 0
#define CFG_WLAN_FAST_CONNECT 0
#define CFG_WPA_CTRL_IFACE 1
#define CFG_WPA3 0
#define CFG_XTAL_FREQUENCE CFG_XTAL_FREQUENCE_26M
#define CFG_XTAL_FREQUENCE_26M 26000000
#define CFG_XTAL_FREQUENCE_40M 40000000
#define CONFIG_APP_MP3PLAYER 0
#define FPGA_PLATFORM 0
#define OSMALLOC_STATISTICAL 0
#define RF_USE_POLICY WIFI_DEFAULT_BLE_REQUEST
#define SOC_BK7221U 3
#define SOC_BK7231 1
#define SOC_BK7231N 5
#define SOC_BK7231U 2
#define SOC_PLATFORM 1
#define THD_APPLICATION_PRIORITY 3
#define THD_CORE_PRIORITY 2
#define THD_EXTENDED_APP_PRIORITY 5
#define THD_HOSTAPD_PRIORITY 5
#define THD_INIT_PRIORITY 4
#define THD_LWIP_PRIORITY 4
#define THD_MEDIA_PRIORITY 4
#define THD_RECONNECT_PRIORITY 4
#define THD_UBG_PRIORITY 5
#define THD_UMP3_PRIORITY 4
#define THD_WPAS_PRIORITY 5
#define THDD_KEY_SCAN_PRIORITY 7
#define UART1_USE_FIFO_REC 0
#define UART2_USE_FIFO_REC 0
#define WIFI_DEFAULT_BLE_REQUEST 1

View File

@@ -0,0 +1,26 @@
/* Copyright (c) Kuba Szczodrzyński 2023-06-20. */
int ble_active = 0;
int ble_switch_mac_sleeped = 0;
int wifi_notice_ble_status() {
return 0;
}
int wn_txl_hd_pending_is_allow() {
return 1;
}
int if_ble_sleep() {
return 1;
}
void ble_switch_rf_to_wifi() {}
int rwip_get_current_time() {
return 0;
}
int rwip_get_next_target_time() {
return 0;
}

View File

@@ -0,0 +1,19 @@
/* Copyright (c) Kuba Szczodrzyński 2023-06-20. */
#pragma once
#define GPIO_SD1_DMA_MODULE GPIO_SD_DMA_MODULE
#define SARADC_ADC_SATURATION_CFG (SARADC_BASE + 3 * 4)
#define SARADC_ADC_SAT_CTRL_MASK (0x3)
#define SARADC_ADC_DAT_AFTER_STA SARADC_ADC_DATA
#define CMD_GET_SCTRL_RETETION 0xC123F48
#define CMD_SET_SCTRL_RETETION 0xC123F49
inline void turnon_PA_in_temp_dect() {}
inline void turnoff_PA_in_temp_dect() {}
inline int if_ble_sleep() {
return 1;
}

View File

@@ -9,6 +9,11 @@
#include <rtos_pub.h>
#include <sys_rtos.h>
#if LT_BK7231Q
#undef LT_MICROS_HIGH_RES
#define LT_MICROS_HIGH_RES 0
#endif
#define TICKS_PER_US (CFG_XTAL_FREQUENCE / 1000 / 1000)
#define US_PER_OVERFLOW (portTICK_PERIOD_MS * 1000)
#define TICKS_PER_OVERFLOW (TICKS_PER_US * US_PER_OVERFLOW)
@@ -17,6 +22,7 @@ void delayMilliseconds(unsigned long ms) {
rtos_delay_milliseconds(ms);
}
#if LT_MICROS_HIGH_RES
static uint32_t getTicksCount() {
// copied from bk_timer_ctrl(), for speeds
uint32_t timeout = 0;
@@ -28,6 +34,7 @@ static uint32_t getTicksCount() {
}
return REG_READ(TIMER0_2_READ_VALUE);
}
#endif
void delayMicroseconds(unsigned int us) {
#if LT_MICROS_HIGH_RES
@@ -61,10 +68,6 @@ unsigned long millis() {
}
unsigned long micros() {
#if (CFG_SOC_NAME == SOC_BK7231)
#error "Not implemented"
#endif
#if LT_MICROS_HIGH_RES
static uint32_t lastMillis = 0;
static uint32_t correctedMillis = 0;

View File

@@ -12,7 +12,7 @@
#include "uart_pub.h"
// from lt_config.h
#ifndef LT_MICROS_HIGH_RES
#if !defined(LT_MICROS_HIGH_RES) && !LT_BK7231Q
#define LT_MICROS_HIGH_RES 1
#endif
@@ -30,7 +30,7 @@ static void fclk_hdl(UINT8 param);
void fclk_init(void) {
#if (CFG_SOC_NAME == SOC_BK7231)
fclk_timer_hw_init(BK_PWM_TIMER_ID0);
fclk_timer_hw_init(BK_PWM_TIMER_ID3);
#elif LT_MICROS_HIGH_RES
fclk_timer_hw_init(BK_TIMER_ID0);
#else
@@ -51,7 +51,7 @@ static void fclk_timer_hw_init(BK_HW_TIMER_INDEX timer_id) {
fclk_id = timer_id;
if (fclk_id >= BK_PWM_TIMER_ID0) { // pwm timer
pwm_param_t param;
param.channel = (fclk_id - PWM0);
param.channel = (fclk_id - BK_PWM_TIMER_ID0);
param.cfg.bits.en = PWM_ENABLE;
param.cfg.bits.int_en = PWM_INT_EN;
param.cfg.bits.mode = PWM_TIMER_MODE;

View File

@@ -6,3 +6,7 @@
// force including fixups/generic.h, even by BDK/include.h
#include "generic.h"
#if CFG_SOC_NAME == SOC_BK7231
#include "bk7231q.h"
#endif

View File

@@ -116,7 +116,7 @@ Options for controlling default UART log output.
### Misc options
- `LT_USE_TIME` (0) - enables implementation of `gettimeofday()` and `settimeofday()`; checks for `millis()` overflows periodically
- `LT_MICROS_HIGH_RES` (1) - count runtime microseconds using a high-resolution timer; disable if your application doesn't need `micros()`
- `LT_MICROS_HIGH_RES` (1) - count runtime microseconds using a high-resolution timer (if possible); disable if your application doesn't need `micros()`
- `LT_AUTO_DOWNLOAD_REBOOT` (1) - automatically reboot into "download mode" after detecting a flashing protocol command; [read more](../flashing/tools/adr.md)
### Family feature config