mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2025-10-29 11:33:20 +00:00
bk new spi & spidma (#1745)
* bk new spi & spidma * long app version fix * esp fix
This commit is contained in:
parent
6c3e1478e8
commit
61d035f616
3
.github/workflows/workflow.yaml
vendored
3
.github/workflows/workflow.yaml
vendored
@ -289,7 +289,7 @@ jobs:
|
||||
with:
|
||||
repository: espressif/esp-idf
|
||||
path: sdk/esp-idf
|
||||
ref: v5.5-beta1
|
||||
ref: v5.5
|
||||
submodules: recursive
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
@ -303,6 +303,7 @@ jobs:
|
||||
pip3 install configobj
|
||||
pip3 install toml
|
||||
pip3 install fdt
|
||||
pip3 install esptool
|
||||
- name: Run make
|
||||
run: |
|
||||
cd sdk/esp-idf
|
||||
|
||||
20
Makefile
20
Makefile
@ -388,7 +388,7 @@ OpenXR809: prebuild_OpenXR809 sdk/OpenXR809/project/oxr_sharedApp/shared sdk/Ope
|
||||
|
||||
.PHONY: build-BK7231
|
||||
build-BK7231: $(SDK_PATH)/apps/$(APP_NAME)
|
||||
cd $(SDK_PATH)/platforms/$(TARGET_PLATFORM)/toolchain/$(APPS_BUILD_PATH) && sh $(APPS_BUILD_CMD) $(APP_NAME) $(APP_VERSION) $(TARGET_PLATFORM)
|
||||
cd $(SDK_PATH)/platforms/$(TARGET_PLATFORM)/toolchain/$(APPS_BUILD_PATH) && bash $(APPS_BUILD_CMD) $(APP_NAME) $(APP_VERSION) $(TARGET_PLATFORM)
|
||||
rm $(SDK_PATH)/platforms/$(TARGET_PLATFORM)/toolchain/$(APPS_BUILD_PATH)/tools/generate/$(APP_NAME)_*.rbl || /bin/true
|
||||
rm $(SDK_PATH)/platforms/$(TARGET_PLATFORM)/toolchain/$(APPS_BUILD_PATH)/tools/generate/$(APP_NAME)_*.bin || /bin/true
|
||||
|
||||
@ -439,7 +439,7 @@ OpenESP32: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-32
|
||||
IDF_TARGET="esp32" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-32 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32 merge_bin -o output/$(APP_VERSION)/OpenESP32_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x1000 ./platforms/ESP-IDF/build-32/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-32/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-32/OpenBeken.bin
|
||||
python3 -m esptool -c esp32 merge_bin -o output/$(APP_VERSION)/OpenESP32_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x1000 ./platforms/ESP-IDF/build-32/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-32/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-32/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-32/OpenBeken.bin output/$(APP_VERSION)/OpenESP32_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP32C3
|
||||
@ -447,7 +447,7 @@ OpenESP32C3: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32c3" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-c3
|
||||
IDF_TARGET="esp32c3" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-c3 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32c3 merge_bin -o output/$(APP_VERSION)/OpenESP32C3_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c3/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c3/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c3/OpenBeken.bin
|
||||
python3 -m esptool -c esp32c3 merge_bin -o output/$(APP_VERSION)/OpenESP32C3_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c3/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c3/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c3/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-c3/OpenBeken.bin output/$(APP_VERSION)/OpenESP32C3_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP32C2
|
||||
@ -455,7 +455,7 @@ OpenESP32C2: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32c2" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-c2
|
||||
IDF_TARGET="esp32c2" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-c2 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32c2 merge_bin -o output/$(APP_VERSION)/OpenESP32C2_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c2/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c2/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c2/OpenBeken.bin
|
||||
python3 -m esptool -c esp32c2 merge_bin -o output/$(APP_VERSION)/OpenESP32C2_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c2/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c2/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c2/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-c2/OpenBeken.bin output/$(APP_VERSION)/OpenESP32C2_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP32C5
|
||||
@ -463,7 +463,7 @@ OpenESP32C5: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32c5" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-c5
|
||||
IDF_TARGET="esp32c5" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-c5 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32c5 merge_bin -o output/$(APP_VERSION)/OpenESP32C5_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c5/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c5/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c5/OpenBeken.bin
|
||||
python3 -m esptool -c esp32c5 merge_bin -o output/$(APP_VERSION)/OpenESP32C5_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c5/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c5/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c5/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-c5/OpenBeken.bin output/$(APP_VERSION)/OpenESP32C5_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP32C61
|
||||
@ -471,7 +471,7 @@ OpenESP32C61: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32c61" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-c61
|
||||
IDF_TARGET="esp32c61" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-c61 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32c61 merge_bin -o output/$(APP_VERSION)/OpenESP32C61_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c61/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c61/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c61/OpenBeken.bin
|
||||
python3 -m esptool -c esp32c61 merge_bin -o output/$(APP_VERSION)/OpenESP32C61_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c61/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c61/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c61/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-c61/OpenBeken.bin output/$(APP_VERSION)/OpenESP32C61_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP32C6
|
||||
@ -479,7 +479,7 @@ OpenESP32C6: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32c6" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-c6
|
||||
IDF_TARGET="esp32c6" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-c6 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32c6 merge_bin -o output/$(APP_VERSION)/OpenESP32C6_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c6/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c6/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c6/OpenBeken.bin
|
||||
python3 -m esptool -c esp32c6 merge_bin -o output/$(APP_VERSION)/OpenESP32C6_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-c6/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-c6/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-c6/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-c6/OpenBeken.bin output/$(APP_VERSION)/OpenESP32C6_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP32S2
|
||||
@ -487,7 +487,7 @@ OpenESP32S2: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32s2" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-s2
|
||||
IDF_TARGET="esp32s2" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-s2 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32s2 merge_bin -o output/$(APP_VERSION)/OpenESP32S2_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x1000 ./platforms/ESP-IDF/build-s2/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-s2/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-s2/OpenBeken.bin
|
||||
python3 -m esptool -c esp32s2 merge_bin -o output/$(APP_VERSION)/OpenESP32S2_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x1000 ./platforms/ESP-IDF/build-s2/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-s2/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-s2/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-s2/OpenBeken.bin output/$(APP_VERSION)/OpenESP32S2_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP32S3
|
||||
@ -495,7 +495,7 @@ OpenESP32S3: prebuild_ESPIDF
|
||||
IDF_TARGET="esp32s3" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake platforms/ESP-IDF -B platforms/ESP-IDF/build-s3
|
||||
IDF_TARGET="esp32s3" APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) cmake --build ./platforms/ESP-IDF/build-s3 -j $(shell nproc)
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
esptool.py -c esp32s3 merge_bin -o output/$(APP_VERSION)/OpenESP32S3_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-s3/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-s3/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-s3/OpenBeken.bin
|
||||
python3 -m esptool -c esp32s3 merge_bin -o output/$(APP_VERSION)/OpenESP32S3_$(APP_VERSION).factory.bin --flash_mode dio --flash_size $(ESP_FSIZE) 0x0 ./platforms/ESP-IDF/build-s3/bootloader/bootloader.bin 0x8000 ./platforms/ESP-IDF/build-s3/partition_table/partition-table.bin 0x10000 ./platforms/ESP-IDF/build-s3/OpenBeken.bin
|
||||
cp ./platforms/ESP-IDF/build-s3/OpenBeken.bin output/$(APP_VERSION)/OpenESP32S3_$(APP_VERSION).img
|
||||
|
||||
.PHONY: OpenESP8266
|
||||
@ -508,7 +508,7 @@ OpenESP8266: prebuild_ESP8266
|
||||
-rm platforms/ESP-IDF/partitions.csv
|
||||
cp platforms/ESP8266/partitions-1mb.csv platforms/ESP8266/partitions.csv
|
||||
cd platforms/ESP8266/ && idf.py partition_table
|
||||
python3 -m esptool -c esp8266 merge_bin -o output/$(APP_VERSION)/OpenESP8266_1MB_$(APP_VERSION).factory.bin --flash_mode dout --flash_size 1MB 0x0 ./platforms/ESP8266/build/bootloader/bootloader.bin 0x8000 ./platforms/ESP8266/build/partition_table/partition-table.bin 0x10000 ./platforms/ESP8266/build/OpenBeken.bin
|
||||
python3 -m esptool -c esp8266 merge-bin -o output/$(APP_VERSION)/OpenESP8266_1MB_$(APP_VERSION).factory.bin --flash-mode dout --flash-size 1MB 0x0 ./platforms/ESP8266/build/bootloader/bootloader.bin 0x8000 ./platforms/ESP8266/build/partition_table/partition-table.bin 0x10000 ./platforms/ESP8266/build/OpenBeken.bin
|
||||
|
||||
.PHONY: OpenTR6260
|
||||
OpenTR6260: prebuild_OpenTR6260
|
||||
|
||||
@ -56,4 +56,7 @@ int bk_wlan_power_save_set_level(BK_PS_LEVEL level)
|
||||
global_ps_level = level;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void __attribute__((weak)) phy_enter_11b_low_power(void) {}
|
||||
void __attribute__((weak)) phy_exit_11b_low_power(void) {}
|
||||
|
||||
@ -127,8 +127,8 @@ OBKM_SRC += $(OBK_SRCS)driver/drv_rn8209.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_sgp.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_shiftRegister.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_sht3x.c
|
||||
#OBKM_SRC += $(OBK_SRCS)driver/drv_sm15155e.c
|
||||
#OBKM_SRC += $(OBK_SRCS)driver/drv_sm16703P.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_sm15155e.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_sm16703P.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_sm2135.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_sm2235.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_soft_i2c.c
|
||||
@ -140,7 +140,7 @@ OBKM_SRC += $(OBK_SRCS)driver/drv_spidma.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_ssdp.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_tasmotaDeviceGroups.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_tclAC.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_test.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_test.c
|
||||
#OBKM_SRC += $(OBK_SRCS)driver/drv_test_charts.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_test_drivers.c
|
||||
OBKM_SRC += $(OBK_SRCS)driver/drv_textScroller.c
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 2a61aa189bad9c0120eb636b00bb12cfbb03dd95
|
||||
Subproject commit 75f1c12b6164a6e38fe9936c7ab48ba969255fda
|
||||
@ -1 +1 @@
|
||||
Subproject commit cd71a406149a81d84336ac31969c068502753409
|
||||
Subproject commit eeba3418aae54a57932eaae7d8162b71ac2d0a20
|
||||
@ -1 +1 @@
|
||||
Subproject commit b782aa140f605ab7e54e6dc02f653a6d88e35d4d
|
||||
Subproject commit 8aa7b6d1937c919aebd7a522b4f11da703525dba
|
||||
@ -11,7 +11,7 @@ LED_Map 0 1 3 2 4
|
||||
|
||||
*/
|
||||
|
||||
#if (PLATFORM_BK7231N || WINDOWS) && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N || WINDOWS
|
||||
|
||||
|
||||
#include "../new_cfg.h"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#if (PLATFORM_BK7231N || WINDOWS) && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N || WINDOWS
|
||||
|
||||
|
||||
#include "../new_cfg.h"
|
||||
|
||||
@ -13,7 +13,10 @@
|
||||
#include "../../../../platforms/bk7231t/bk7231t_os/beken378/os/FreeRTOSv9.0.0/FreeRTOS/Source/portable/Keil/ARM968es/portmacro.h"
|
||||
#endif // PLATFORM_BK7231T
|
||||
#endif // PLATFORM_BK7231N
|
||||
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
#include "spi_pub.h"
|
||||
uint32_t mode = SPI_MASTER;
|
||||
#endif
|
||||
#include "../logging/logging.h"
|
||||
|
||||
int SPI_DriverInit(void) {
|
||||
@ -23,6 +26,8 @@ int SPI_DriverInit(void) {
|
||||
// Is called in dd.c
|
||||
// spi_init();
|
||||
return 0;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
return 0;
|
||||
#else
|
||||
ADDLOG_ERROR(LOG_FEATURE_DRV, "SPI_DriverInit not supported");
|
||||
return -1;
|
||||
@ -36,6 +41,8 @@ int SPI_DriverDeinit(void) {
|
||||
// Is called in dd.c
|
||||
// spi_exit();
|
||||
return 0;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
return 0;
|
||||
#else
|
||||
ADDLOG_ERROR(LOG_FEATURE_DRV, "SPI_DriverDeinit not supported");
|
||||
return -1;
|
||||
@ -43,8 +50,21 @@ int SPI_DriverDeinit(void) {
|
||||
}
|
||||
|
||||
int SPI_Init(const spi_config_t *config) {
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
struct spi_message msg;
|
||||
msg.send_buf = os_malloc(sizeof(uint8_t));
|
||||
msg.send_len = 0;
|
||||
msg.recv_buf = os_malloc(sizeof(uint8_t));
|
||||
msg.recv_len = 0;
|
||||
mode = config->role == SPI_ROLE_MASTER ? SPI_MASTER : SPI_SLAVE;
|
||||
int ret = bk_spi_master_dma_init((SPI_MODE_0 | SPI_MSB | mode), config->baud_rate, &msg);
|
||||
free(msg.send_buf);
|
||||
free(msg.recv_buf);
|
||||
return ret;
|
||||
#else
|
||||
return bk_spi_init(0, config);
|
||||
#endif
|
||||
#elif PLATFORM_BK7231T && !PLATFORM_BEKEN_NEW
|
||||
int err = 0;
|
||||
|
||||
@ -93,6 +113,12 @@ int SPI_Init(const spi_config_t *config) {
|
||||
spi_trans.trans_done = 1;
|
||||
|
||||
return err;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
mode = config->role == SPI_ROLE_MASTER ? SPI_MASTER : SPI_SLAVE;
|
||||
if(mode == SPI_MASTER)
|
||||
return bk_spi_master_init(config->baud_rate, ((config->polarity == SPI_POLARITY_LOW ? 0 : SPI_CPOL) | (config->phase == SPI_PHASE_1ST_EDGE ? 0 : SPI_CPHA)));
|
||||
else
|
||||
return bk_spi_slave_init(config->baud_rate, ((config->polarity == SPI_POLARITY_LOW ? 0 : SPI_CPOL) | (config->phase == SPI_PHASE_1ST_EDGE ? 0 : SPI_CPHA)));
|
||||
#else
|
||||
ADDLOG_ERROR(LOG_FEATURE_DRV, "SPI_Init not supported");
|
||||
return -1;
|
||||
@ -115,6 +141,11 @@ int SPI_Deinit(void) {
|
||||
err |= sddev_control(ICU_DEV_NAME, CMD_CLK_PWR_DOWN, ¶m);
|
||||
|
||||
return err;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
if(mode == SPI_MASTER)
|
||||
return bk_spi_master_deinit();
|
||||
else
|
||||
return bk_spi_slave_deinit();
|
||||
#else
|
||||
ADDLOG_ERROR(LOG_FEATURE_DRV, "SPI_Deinit not supported");
|
||||
return -1;
|
||||
@ -135,8 +166,17 @@ static inline int Spi_wait_for_ready() {
|
||||
#endif
|
||||
|
||||
int SPI_WriteBytes(const void *data, uint32_t size) {
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
struct spi_message msg;
|
||||
msg.send_buf = data;
|
||||
msg.send_len = size;
|
||||
msg.recv_buf = NULL;
|
||||
msg.recv_len = 0;
|
||||
return bk_spi_dma_transfer(mode, &msg);
|
||||
#else
|
||||
return bk_spi_write_bytes(0, data, size);
|
||||
#endif
|
||||
#elif PLATFORM_BK7231T && !PLATFORM_BEKEN_NEW
|
||||
GLOBAL_INT_DECLARATION();
|
||||
GLOBAL_INT_DISABLE();
|
||||
@ -159,6 +199,16 @@ int SPI_WriteBytes(const void *data, uint32_t size) {
|
||||
|
||||
err |= Spi_wait_for_ready();
|
||||
return err;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
struct spi_message msg;
|
||||
msg.send_buf = data;
|
||||
msg.send_len = size;
|
||||
msg.recv_buf = NULL;
|
||||
msg.recv_len = 0;
|
||||
if(mode == SPI_MASTER)
|
||||
return bk_spi_master_xfer(&msg);
|
||||
else
|
||||
return bk_spi_slave_xfer(&msg);
|
||||
#else
|
||||
ADDLOG_ERROR(LOG_FEATURE_DRV, "SPI_WriteBytes not supported");
|
||||
return -1;
|
||||
@ -166,8 +216,17 @@ int SPI_WriteBytes(const void *data, uint32_t size) {
|
||||
}
|
||||
|
||||
int SPI_ReadBytes(void *data, uint32_t size) {
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
struct spi_message msg;
|
||||
msg.recv_buf = data;
|
||||
msg.recv_len = size;
|
||||
msg.send_buf = NULL;
|
||||
msg.send_len = 0;
|
||||
return bk_spi_dma_transfer(mode, &msg);
|
||||
#else
|
||||
return bk_spi_read_bytes(0, data, size);
|
||||
#endif
|
||||
#elif PLATFORM_BK7231T && !PLATFORM_BEKEN_NEW
|
||||
GLOBAL_INT_DECLARATION();
|
||||
GLOBAL_INT_DISABLE();
|
||||
@ -190,6 +249,16 @@ int SPI_ReadBytes(void *data, uint32_t size) {
|
||||
|
||||
err |= Spi_wait_for_ready();
|
||||
return err;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
struct spi_message msg;
|
||||
msg.recv_buf = data;
|
||||
msg.recv_len = size;
|
||||
msg.send_buf = NULL;
|
||||
msg.send_len = 0;
|
||||
if(mode == SPI_MASTER)
|
||||
return bk_spi_master_xfer(&msg);
|
||||
else
|
||||
return bk_spi_slave_xfer(&msg);
|
||||
#else
|
||||
ADDLOG_ERROR(LOG_FEATURE_DRV, "SPI_ReadBytes not supported");
|
||||
return -1;
|
||||
@ -198,8 +267,17 @@ int SPI_ReadBytes(void *data, uint32_t size) {
|
||||
|
||||
int SPI_Transmit(const void *txData, uint32_t txSize, void *rxData,
|
||||
uint32_t rxSize) {
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
struct spi_message msg;
|
||||
msg.send_buf = txData;
|
||||
msg.send_len = txSize;
|
||||
msg.recv_buf = rxData;
|
||||
msg.recv_len = rxSize;
|
||||
return bk_spi_dma_transfer(mode, &msg);
|
||||
#else
|
||||
return bk_spi_transmit(0, txData, txSize, rxData, rxSize);
|
||||
#endif
|
||||
#elif PLATFORM_BK7231T && !PLATFORM_BEKEN_NEW
|
||||
int err = 0;
|
||||
|
||||
@ -210,6 +288,16 @@ int SPI_Transmit(const void *txData, uint32_t txSize, void *rxData,
|
||||
err |= SPI_ReadBytes(rxData, rxSize);
|
||||
|
||||
return err;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
struct spi_message msg;
|
||||
msg.send_buf = txData;
|
||||
msg.send_len = txSize;
|
||||
msg.recv_buf = rxData;
|
||||
msg.recv_len = rxSize;
|
||||
if(mode == SPI_MASTER)
|
||||
return bk_spi_master_xfer(&msg);
|
||||
else
|
||||
return bk_spi_slave_xfer(&msg);
|
||||
#else
|
||||
ADDLOG_ERROR(LOG_FEATURE_DRV, "SPI_Transmit not supported");
|
||||
return -1;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#if (PLATFORM_BK7231N || WINDOWS) && !PLATFORM_BEKEN_NEW
|
||||
#if (PLATFORM_BK7231N || WINDOWS) || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
|
||||
|
||||
#include "../new_cfg.h"
|
||||
@ -162,7 +162,7 @@ void SPILED_Shutdown() {
|
||||
|
||||
void SPILED_Init() {
|
||||
uint32_t val;
|
||||
#if PLATFORM_BK7231N
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
val = GFUNC_MODE_SPI_USE_GPIO_14;
|
||||
sddev_control(GPIO_DEV_NAME, CMD_GPIO_ENABLE_SECOND, &val);
|
||||
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
#include "arm_arch.h"
|
||||
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
#include "sys_config.h"
|
||||
#endif
|
||||
#include "drv_model_pub.h"
|
||||
#include "general_dma_pub.h"
|
||||
#include "gpio_pub.h"
|
||||
@ -8,7 +11,11 @@
|
||||
#include "spi_pub.h"
|
||||
|
||||
#include "../../beken378/driver/general_dma/general_dma.h"
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
#include "spi_bk7231n.h"
|
||||
#else
|
||||
#include "../../beken378/driver/spi/spi.h"
|
||||
#endif
|
||||
|
||||
#include "../new_cfg.h"
|
||||
#include "../new_common.h"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include "../new_common.h"
|
||||
|
||||
#if PLATFORM_BK7231N
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
|
||||
#include "arm_arch.h"
|
||||
#include "drv_model_pub.h"
|
||||
@ -14,6 +14,10 @@
|
||||
#include "sys_ctrl_pub.h"
|
||||
#include "uart_pub.h"
|
||||
#include "spi_pub.h"
|
||||
#if PLATFORM_BEKEN_NEW
|
||||
#define GFUNC_MODE_SPI_USE_GPIO_14 GFUNC_MODE_SPI_GPIO_14
|
||||
#define GFUNC_MODE_SPI_USE_GPIO_16_17 GFUNC_MODE_SPI_GPIO_16_17
|
||||
#endif
|
||||
|
||||
#elif WINDOWS
|
||||
|
||||
|
||||
@ -242,7 +242,7 @@
|
||||
#define ENABLE_DRIVER_HUE 1
|
||||
//#define ENABLE_DRIVER_CHARGINGLIMIT 1
|
||||
#define ENABLE_DRIVER_BATTERY 1
|
||||
#if PLATFORM_BK7231N && !PLATFORM_BEKEN_NEW
|
||||
#if PLATFORM_BK7231N || PLATFORM_BK7238 || PLATFORM_BK7252N
|
||||
//#define ENABLE_DRIVER_PWM_GROUP 1
|
||||
#define ENABLE_DRIVER_SM16703P 1
|
||||
#define ENABLE_DRIVER_PIXELANIM 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user