mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 11:36:59 +03:00
more esp32/esp32-s3 convergence
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
set(lib_dir ${build_dir}/esp-idf)
|
||||
|
||||
set(driver i2s.c i2s_hal.c spi_bus_lock.c)
|
||||
if(IDF_TARGET STREQUAL esp32)
|
||||
set(driver esp32/i2s.c esp32/i2s_hal.c esp32/spi_bus_lock.c)
|
||||
else()
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(REPLACE ".c" ".c.obj" driver_obj "${driver}")
|
||||
|
||||
idf_component_register( SRCS ${driver}
|
||||
@@ -10,8 +15,8 @@ idf_component_register( SRCS ${driver}
|
||||
)
|
||||
|
||||
# CMake is just a pile of crap
|
||||
message("!! overriding ${driver} !!")
|
||||
message("CAREFUL, LIBRARIES STRIPPING FROM DUPLICATED COMPONENTS DEPENDS ON THIS BEING REBUILD")
|
||||
message(STATUS "!! overriding ${driver} !!")
|
||||
message(STATUS "CAREFUL, LIBRARIES STRIPPING FROM DUPLICATED COMPONENTS DEPENDS ON THIS BEING REBUILD")
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${COMPONENT_LIB}
|
||||
|
||||
@@ -935,7 +935,7 @@ esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_start(spi_device_handle_t handl
|
||||
ret = check_trans_valid(handle, trans_desc);
|
||||
if (ret!=ESP_OK) return ret;
|
||||
SPI_CHECK(!spi_bus_device_is_polling(handle), "Cannot send polling transaction while the previous polling transaction is not terminated.", ESP_ERR_INVALID_STATE );
|
||||
|
||||
ESP_LOGI("gragra", "LOCAL SPI_MASTER");
|
||||
/* If device_acquiring_lock is set to handle, it means that the user has already
|
||||
* acquired the bus thanks to the function `spi_device_acquire_bus()`.
|
||||
* In that case, we don't need to take the lock again. */
|
||||
1047
components/_override/esp32/spi_master.c.debug
Normal file
1047
components/_override/esp32/spi_master.c.debug
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,8 @@
|
||||
if(IDF_TARGET STREQUAL "esp32")
|
||||
idf_component_register( SRC_DIRS .
|
||||
INCLUDE_DIRS .
|
||||
PRIV_REQUIRES services bt display console tools platform_config
|
||||
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
172
components/driver_bt/bt_app_core - Copy.c.old
Normal file
172
components/driver_bt/bt_app_core - Copy.c.old
Normal file
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_bt.h"
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "bt_app_core.h"
|
||||
#include "tools.h"
|
||||
|
||||
static const char *TAG = "btappcore";
|
||||
|
||||
static void bt_app_task_handler(void *arg);
|
||||
static bool bt_app_send_msg(bt_app_msg_t *msg);
|
||||
static void bt_app_work_dispatched(bt_app_msg_t *msg);
|
||||
|
||||
static xQueueHandle s_bt_app_task_queue;
|
||||
static bool running;
|
||||
|
||||
bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback)
|
||||
{
|
||||
ESP_LOGV(TAG,"%s event 0x%x, param len %d", __func__, event, param_len);
|
||||
|
||||
bt_app_msg_t msg;
|
||||
memset(&msg, 0, sizeof(bt_app_msg_t));
|
||||
|
||||
msg.sig = BT_APP_SIG_WORK_DISPATCH;
|
||||
msg.event = event;
|
||||
msg.cb = p_cback;
|
||||
|
||||
if (param_len == 0) {
|
||||
return bt_app_send_msg(&msg);
|
||||
} else if (p_params && param_len > 0) {
|
||||
if ((msg.param = clone_obj_psram(p_params, param_len)) != NULL) {
|
||||
/* check if caller has provided a copy callback to do the deep copy */
|
||||
if (p_copy_cback) {
|
||||
p_copy_cback(&msg, msg.param, p_params);
|
||||
}
|
||||
return bt_app_send_msg(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool bt_app_send_msg(bt_app_msg_t *msg)
|
||||
{
|
||||
if (msg == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (xQueueSend(s_bt_app_task_queue, msg, 10 / portTICK_RATE_MS) != pdTRUE) {
|
||||
ESP_LOGE(TAG,"%s xQueue send failed", __func__);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void bt_app_work_dispatched(bt_app_msg_t *msg)
|
||||
{
|
||||
if (msg->cb) {
|
||||
msg->cb(msg->event, msg->param);
|
||||
}
|
||||
}
|
||||
|
||||
static void bt_app_task_handler(void *arg)
|
||||
{
|
||||
bt_app_msg_t msg;
|
||||
esp_err_t err;
|
||||
|
||||
s_bt_app_task_queue = xQueueCreate(10, sizeof(bt_app_msg_t));
|
||||
|
||||
esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
|
||||
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||
|
||||
if ((err = esp_bt_controller_init(&bt_cfg)) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(err));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((err = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT)) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(err));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((err = esp_bluedroid_init()) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "%s initialize bluedroid failed: %s\n", __func__, esp_err_to_name(err));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((err = esp_bluedroid_enable()) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "%s enable bluedroid failed: %s\n", __func__, esp_err_to_name(err));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Bluetooth device name, connection mode and profile set up */
|
||||
bt_app_work_dispatch((bt_av_hdl_stack_evt_t*) arg, BT_APP_EVT_STACK_UP, NULL, 0, NULL);
|
||||
|
||||
#if (CONFIG_BT_SSP_ENABLED)
|
||||
/* Set default parameters for Secure Simple Pairing */
|
||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
||||
esp_bt_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
||||
#endif
|
||||
|
||||
running = true;
|
||||
|
||||
while (running) {
|
||||
if (pdTRUE == xQueueReceive(s_bt_app_task_queue, &msg, (portTickType)portMAX_DELAY)) {
|
||||
ESP_LOGV(TAG,"%s, sig 0x%x, 0x%x", __func__, msg.sig, msg.event);
|
||||
|
||||
switch (msg.sig) {
|
||||
case BT_APP_SIG_WORK_DISPATCH:
|
||||
bt_app_work_dispatched(&msg);
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG,"%s, unhandled sig: %d", __func__, msg.sig);
|
||||
break;
|
||||
}
|
||||
|
||||
if (msg.param) {
|
||||
free(msg.param);
|
||||
}
|
||||
} else {
|
||||
ESP_LOGW(TAG,"No messaged received from queue.");
|
||||
}
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "bt_app_task shutting down");
|
||||
|
||||
if (esp_bluedroid_disable() != ESP_OK) goto exit;
|
||||
// this disable has a sleep timer BTA_DISABLE_DELAY in bt_target.h and
|
||||
// if we don't wait for it then disable crashes... don't know why
|
||||
vTaskDelay(2*200 / portTICK_PERIOD_MS);
|
||||
|
||||
ESP_LOGD(TAG, "esp_bluedroid_disable called successfully");
|
||||
if (esp_bluedroid_deinit() != ESP_OK) goto exit;
|
||||
|
||||
ESP_LOGD(TAG, "esp_bluedroid_deinit called successfully");
|
||||
if (esp_bt_controller_disable() != ESP_OK) goto exit;
|
||||
|
||||
ESP_LOGD(TAG, "esp_bt_controller_disable called successfully");
|
||||
if (esp_bt_controller_deinit() != ESP_OK) goto exit;
|
||||
|
||||
ESP_LOGD(TAG, "bt stopped successfully");
|
||||
|
||||
exit:
|
||||
vQueueDelete(s_bt_app_task_queue);
|
||||
running = false;
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
void bt_app_task_start_up(bt_av_hdl_stack_evt_t* handler)
|
||||
{
|
||||
xTaskCreate(bt_app_task_handler, "BtAppT", 4096, handler, configMAX_PRIORITIES - 3, NULL);
|
||||
}
|
||||
|
||||
void bt_app_task_shut_down(void)
|
||||
{
|
||||
running = false;
|
||||
}
|
||||
1064
components/driver_bt/bt_app_source - Copy.c.old
Normal file
1064
components/driver_bt/bt_app_source - Copy.c.old
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,8 @@
|
||||
# for the forgetful, REQUIRES cannot use CONFIG_XXX due to parsing order
|
||||
if(IDF_TARGET STREQUAL "esp32")
|
||||
set(target_requires "driver_bt")
|
||||
endif()
|
||||
|
||||
idf_component_register( SRC_DIRS . external ac101 tas57xx wm8978
|
||||
INCLUDE_DIRS . ac101
|
||||
PRIV_REQUIRES
|
||||
@@ -6,7 +11,6 @@ idf_component_register( SRC_DIRS . external ac101 tas57xx wm8978
|
||||
esp_common
|
||||
esp-dsp
|
||||
platform_config
|
||||
driver_bt
|
||||
services
|
||||
spotify
|
||||
raop
|
||||
@@ -14,6 +18,7 @@ idf_component_register( SRC_DIRS . external ac101 tas57xx wm8978
|
||||
tools
|
||||
audio
|
||||
_override
|
||||
${target_requires}
|
||||
EMBED_FILES vu_s.data arrow.data
|
||||
)
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
|
||||
set( WEBPACK_DIR webapp/webpack/dist )
|
||||
|
||||
# for the forgetful, REQUIRES cannot use CONFIG_XXX due to parsing order
|
||||
if(IDF_TARGET STREQUAL "esp32")
|
||||
set(target_requires "driver_bt")
|
||||
endif()
|
||||
|
||||
idf_component_register( SRC_DIRS . webapp UML-State-Machine-in-C/src
|
||||
INCLUDE_DIRS . webapp UML-State-Machine-in-C/src
|
||||
REQUIRES squeezelite-ota json mdns
|
||||
PRIV_REQUIRES tools services platform_config esp_common json newlib freertos spi_flash nvs_flash mdns pthread wpa_supplicant platform_console esp_http_server console driver_bt
|
||||
PRIV_REQUIRES tools services platform_config esp_common json newlib freertos spi_flash nvs_flash mdns pthread wpa_supplicant platform_console esp_http_server console ${target_requires}
|
||||
)
|
||||
|
||||
include(webapp/webapp.cmake)
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "network_status.h"
|
||||
#include <string.h>
|
||||
#ifdef BT_ENABLED
|
||||
#ifdef CONFIG_BT_ENABLED
|
||||
#include "bt_app_core.h"
|
||||
#endif
|
||||
#include "esp_log.h"
|
||||
@@ -266,7 +266,7 @@ cJSON* network_status_get_basic_info(cJSON** old) {
|
||||
*old = network_status_update_float(old, "Voltage", battery_value_svc());
|
||||
*old = network_update_cjson_number(old, "disconnect_count", nm->num_disconnect);
|
||||
*old = network_status_update_float(old, "avg_conn_time", nm->num_disconnect > 0 ? (nm->total_connected_time / nm->num_disconnect) : 0);
|
||||
#ifdef BT_ENABLED
|
||||
#ifdef CONFIG_BT_ENABLED
|
||||
*old = network_update_cjson_number(old, "bt_status", bt_app_source_get_a2d_state());
|
||||
*old = network_update_cjson_number(old, "bt_sub_status", bt_app_source_get_media_state());
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,3 @@ idf_component_register(SRC_DIRS .
|
||||
PRIV_REQUIRES _override esp_common wifi-manager pthread squeezelite-ota platform_console telnet display targets
|
||||
LDFRAGMENTS "linker.lf"
|
||||
)
|
||||
#get_target_property(ill ${COMPONENT_LIB} INTERFACE_LINK_LIBRARIES)
|
||||
#message("${COMPONENT_LIB} INTERFACE_LINK_LIBRARIES = ${ill}")
|
||||
|
||||
|
||||
@@ -63,6 +63,11 @@ RTC_NOINIT_ATTR uint32_t RecoveryRebootCounter ;
|
||||
RTC_NOINIT_ATTR uint16_t ColdBootIndicatorFlag;
|
||||
bool cold_boot=true;
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S3
|
||||
extern const char _ctype_[];
|
||||
const char* __ctype_ptr__ = _ctype_;
|
||||
#endif
|
||||
|
||||
static bool bNetworkConnected=false;
|
||||
|
||||
// as an exception _init function don't need include
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[mapping:cpp]
|
||||
archive: libstdc++.a
|
||||
entries:
|
||||
if IDF_TARGET = "esp32":
|
||||
* (extram_bss)
|
||||
else:
|
||||
* (default)
|
||||
|
||||
Reference in New Issue
Block a user