소스 검색

refactoring step 3 - components

squeezelite is a component
platform_esp32 is the main
philippe44 5 년 전
부모
커밋
53b0ab2390
49개의 변경된 파일98개의 추가작업 그리고 42개의 파일을 삭제
  1. 1 2
      .gitignore
  2. 1 1
      components/driver_bt/CMakeLists.txt
  3. 0 0
      components/driver_bt/bt_app_core.c
  4. 0 0
      components/driver_bt/bt_app_core.h
  5. 1 2
      components/driver_bt/bt_app_handler.c
  6. 3 1
      components/driver_bt/component.mk
  7. 0 0
      components/squeezelite/alac.c
  8. 0 0
      components/squeezelite/buffer.c
  9. 18 0
      components/squeezelite/component.mk
  10. 0 0
      components/squeezelite/decode.c
  11. 0 0
      components/squeezelite/embedded.c
  12. 0 0
      components/squeezelite/embedded.h
  13. 0 0
      components/squeezelite/faad.c.nocompile
  14. 0 0
      components/squeezelite/flac.c
  15. 0 0
      components/squeezelite/helix-aac.c
  16. 0 0
      components/squeezelite/mad.c
  17. 0 0
      components/squeezelite/main.c
  18. 0 0
      components/squeezelite/mpg.c
  19. 0 0
      components/squeezelite/output.c
  20. 0 0
      components/squeezelite/output_bt.c
  21. 0 0
      components/squeezelite/output_embedded.c
  22. 0 0
      components/squeezelite/output_i2s.c
  23. 0 0
      components/squeezelite/output_pack.c
  24. 0 0
      components/squeezelite/pcm.c
  25. 0 0
      components/squeezelite/process.c
  26. 0 0
      components/squeezelite/resample.c
  27. 0 0
      components/squeezelite/resample16.c
  28. 0 0
      components/squeezelite/slimproto.c
  29. 0 0
      components/squeezelite/slimproto.h
  30. 4 4
      components/squeezelite/squeezelite.h
  31. 0 0
      components/squeezelite/stream.c
  32. 0 0
      components/squeezelite/utils.c
  33. 0 0
      components/squeezelite/vorbis.c
  34. 0 0
      components/tools/perf_trace.h
  35. 30 0
      components/tools/trace.h
  36. 7 0
      main/CMakeLists.txt
  37. 24 0
      main/Params.txt
  38. 0 0
      main/cmd_decl.h
  39. 0 0
      main/cmd_squeezelite.c
  40. 0 0
      main/cmd_squeezelite.h
  41. 0 0
      main/cmd_wifi.c
  42. 0 0
      main/cmd_wifi.h
  43. 8 18
      main/component.mk
  44. 1 0
      main/console.c
  45. 0 0
      main/console.h
  46. 0 0
      main/esp_app_main.c
  47. 0 0
      main/nvs_utilities.c
  48. 0 0
      main/nvs_utilities.h
  49. 0 14
      main/platform_esp32.h

+ 1 - 2
.gitignore

@@ -64,6 +64,5 @@ $RECYCLE.BIN/
 libs/
 
 /cdump.cmd
-/_codecs
+/_*
 sdkconfig
-/tmp

+ 1 - 1
components/platform_esp32/CMakeLists.txt → components/driver_bt/CMakeLists.txt

@@ -1,6 +1,6 @@
 set(COMPONENT_ADD_INCLUDEDIRS . )
 
-set(COMPONENT_SRCS "esp_app_main.c" "platform_esp32.c" "bt_app_core.c" "cmd_wifi.c" "console.c" "nvs_utilities.c" "cmd_squeezelite.c")
+set(COMPONENT_SRCS "bt_app_core.c" )
 set(REQUIRES esp_common)
 set(REQUIRES_COMPONENTS freertos nvs_flash esp32 spi_flash newlib log console )
 

+ 0 - 0
components/platform_esp32/bt_app_core.c → components/driver_bt/bt_app_core.c


+ 0 - 0
components/platform_esp32/bt_app_core.h → components/driver_bt/bt_app_core.h


+ 1 - 2
components/platform_esp32/bt_app_handler.c → components/driver_bt/bt_app_handler.c

@@ -17,8 +17,7 @@
 #include "argtable3/argtable3.h"
 
 #include "bt_app_core.h"
-
-#include "platform_esp32.h"
+#include "trace.h"
 
 static const char * TAG = "platform";
 

+ 3 - 1
components/platform_esp32/component.mk → components/driver_bt/component.mk

@@ -6,4 +6,6 @@
 # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
 # please read the SDK documents if you need to do this.
 #
-CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
+
+CFLAGS += -I$(COMPONENT_PATH)/../tools
+#CFLAGS += -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG

+ 0 - 0
main/alac.c → components/squeezelite/alac.c


+ 0 - 0
main/buffer.c → components/squeezelite/buffer.c


+ 18 - 0
components/squeezelite/component.mk

@@ -0,0 +1,18 @@
+#
+# "main" pseudo-component makefile.
+#
+# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
+CFLAGS += -O3 -DLINKALL -DLOOPBACK -DNO_FAAD -DRESAMPLE16 -DEMBEDDED -DTREMOR_ONLY -DBYTES_PER_FRAME=4 	\
+	-I$(COMPONENT_PATH)/../codecs/inc			\
+	-I$(COMPONENT_PATH)/../codecs/inc/mad 		\
+	-I$(COMPONENT_PATH)/../codecs/inc/alac		\
+	-I$(COMPONENT_PATH)/../codecs/inc/helix-aac	\
+	-I$(COMPONENT_PATH)/../codecs/inc/vorbis 	\
+	-I$(COMPONENT_PATH)/../codecs/inc/soxr 		\
+	-I$(COMPONENT_PATH)/../codecs/inc/resample16	\
+	-I$(COMPONENT_PATH)/../tools
+
+#	-I$(COMPONENT_PATH)/../codecs/inc/faad2
+
+
+

+ 0 - 0
main/decode.c → components/squeezelite/decode.c


+ 0 - 0
main/embedded.c → components/squeezelite/embedded.c


+ 0 - 0
main/embedded.h → components/squeezelite/embedded.h


+ 0 - 0
main/faad.c.nocompile → components/squeezelite/faad.c.nocompile


+ 0 - 0
main/flac.c → components/squeezelite/flac.c


+ 0 - 0
main/helix-aac.c → components/squeezelite/helix-aac.c


+ 0 - 0
main/mad.c → components/squeezelite/mad.c


+ 0 - 0
main/main.c → components/squeezelite/main.c


+ 0 - 0
main/mpg.c → components/squeezelite/mpg.c


+ 0 - 0
main/output.c → components/squeezelite/output.c


+ 0 - 0
main/output_bt.c → components/squeezelite/output_bt.c


+ 0 - 0
main/output_embedded.c → components/squeezelite/output_embedded.c


+ 0 - 0
main/output_i2s.c → components/squeezelite/output_i2s.c


+ 0 - 0
main/output_pack.c → components/squeezelite/output_pack.c


+ 0 - 0
main/pcm.c → components/squeezelite/pcm.c


+ 0 - 0
main/process.c → components/squeezelite/process.c


+ 0 - 0
main/resample.c → components/squeezelite/resample.c


+ 0 - 0
main/resample16.c → components/squeezelite/resample16.c


+ 0 - 0
main/slimproto.c → components/squeezelite/slimproto.c


+ 0 - 0
main/slimproto.h → components/squeezelite/slimproto.h


+ 4 - 4
main/squeezelite.h → components/squeezelite/squeezelite.h

@@ -287,10 +287,10 @@
 #include <sys/types.h>
 #endif /* SUN */
 
-#define STREAM_THREAD_STACK_SIZE  64 * 1024
-#define DECODE_THREAD_STACK_SIZE 128 * 1024
-#define OUTPUT_THREAD_STACK_SIZE  64 * 1024
-#define IR_THREAD_STACK_SIZE      64 * 1024
+#define STREAM_THREAD_STACK_SIZE  8 * 1024
+#define DECODE_THREAD_STACK_SIZE 20 * 1024
+#define OUTPUT_THREAD_STACK_SIZE  8 * 1024
+#define IR_THREAD_STACK_SIZE      8 * 1024
 #if !OSX
 #define thread_t pthread_t;
 #endif

+ 0 - 0
main/stream.c → components/squeezelite/stream.c


+ 0 - 0
main/utils.c → components/squeezelite/utils.c


+ 0 - 0
main/vorbis.c → components/squeezelite/vorbis.c


+ 0 - 0
components/platform_esp32/perf_trace.h → components/tools/perf_trace.h


+ 30 - 0
components/tools/trace.h

@@ -0,0 +1,30 @@
+/* 
+ *  Squeezelite for esp32
+ *
+ *  (c) Sebastien 2019
+ *      Philippe G. 2019, philippe_44@outlook.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+ 
+#pragma once
+
+#ifndef QUOTE
+#define QUOTE(name) #name
+#endif
+
+#define ESP_LOG_DEBUG_EVENT(tag,e) ESP_LOGD(tag,"evt: " e)
+
+

+ 7 - 0
main/CMakeLists.txt

@@ -0,0 +1,7 @@
+set(COMPONENT_ADD_INCLUDEDIRS . )
+
+set(COMPONENT_SRCS "esp_app_main.c" "platform_esp32.c" "cmd_wifi.c" "console.c" "nvs_utilities.c" "cmd_squeezelite.c")
+set(REQUIRES esp_common)
+set(REQUIRES_COMPONENTS freertos nvs_flash esp32 spi_flash newlib log console )
+
+register_component()

+ 24 - 0
main/Params.txt

@@ -0,0 +1,24 @@
+LWIP
+Enable Copy between L2 and L3 no (no)
+Default receive window size 32768 (5740)
+Default transmit window size 8192 (5740)
+TCP:Default TCP receive mail box size 32 (6)
+
+WiFi
+Max number of WiFi static RX buffer 12-16 (6)
+Max number of WiFi dynamic buffer 24-64 (16 or 10)
+Max number of WiFi static TX buffer 12-16 (6)
+
+SPI RAM
+Maximum malloc() to always put in internal memory 512 (2048)
+
+MBED_TLS
+Memory allocation strategy: external
+
+Put .bss in SPIRAM?
+
+nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\" -e flac"
+nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\""
+nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -R -u m -Z 192000 -r \"44100-44100\" -s 192.168.2.144"
+nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'RIVAARENA'\" -b 500:2000 -d all=info -m ESP32 -r \"44100-44100\" -e flac"
+nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32 -R -Z 96000 -r \"44100-44100\""

+ 0 - 0
components/platform_esp32/cmd_decl.h → main/cmd_decl.h


+ 0 - 0
components/platform_esp32/cmd_squeezelite.c → main/cmd_squeezelite.c


+ 0 - 0
components/platform_esp32/cmd_squeezelite.h → main/cmd_squeezelite.h


+ 0 - 0
components/platform_esp32/cmd_wifi.c → main/cmd_wifi.c


+ 0 - 0
components/platform_esp32/cmd_wifi.h → main/cmd_wifi.h


+ 8 - 18
main/component.mk

@@ -1,20 +1,10 @@
 #
-# "main" pseudo-component makefile.
+# Component Makefile
 #
-# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
-CFLAGS += -O3 -DLINKALL -DLOOPBACK -DNO_FAAD -DRESAMPLE16 -DEMBEDDED -DTREMOR_ONLY -DBYTES_PER_FRAME=4 	\
-	-I$(COMPONENT_PATH)/../components/codecs/inc			\
-	-I$(COMPONENT_PATH)/../components/codecs/inc/mad 		\
-	-I$(COMPONENT_PATH)/../components/codecs/inc/alac		\
-	-I$(COMPONENT_PATH)/../components/codecs/inc/helix-aac	\
-	-I$(COMPONENT_PATH)/../components/codecs/inc/vorbis 	\
-	-I$(COMPONENT_PATH)/../components/codecs/inc/soxr 		\
-	-I$(COMPONENT_PATH)/../components/codecs/inc/resample16	\
-	-I$(COMPONENT_PATH)/../components/platform_esp32
-	
-LDFLAGS += -s
-
-#	-I$(COMPONENT_PATH)/../components/codecs/inc/faad2
-
-
-
+# This Makefile should, at the very least, just include $(SDK_PATH)/Makefile. By default,
+# this will take the sources in the src/ directory, compile them and link them into
+# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
+# please read the SDK documents if you need to do this.
+#
+CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
+LDFLAGS += -s

+ 1 - 0
components/platform_esp32/console.c → main/console.c

@@ -22,6 +22,7 @@
 #include "nvs_flash.h"
 #include "pthread.h"
 #include "platform_esp32.h"
+#include "esp_pthread.h"
 #include "cmd_decl.h"
 #include "console.h"
 

+ 0 - 0
components/platform_esp32/console.h → main/console.h


+ 0 - 0
components/platform_esp32/esp_app_main.c → main/esp_app_main.c


+ 0 - 0
components/platform_esp32/nvs_utilities.c → main/nvs_utilities.c


+ 0 - 0
components/platform_esp32/nvs_utilities.h → main/nvs_utilities.h


+ 0 - 14
components/platform_esp32/platform_esp32.h → main/platform_esp32.h

@@ -21,24 +21,10 @@
  
 #pragma once
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "esp_pthread.h"
 
-#ifndef QUOTE
-#define QUOTE(name) #name
-#endif
-
-#define ESP_LOG_DEBUG_EVENT(tag,e) ESP_LOGD(tag,"evt: " e)
-
 extern void run_command(char * line);
 extern bool wait_for_wifi();
 extern void console_start();
 extern pthread_cond_t wifi_connect_suspend_cond;
 extern pthread_t wifi_connect_suspend_mutex;
-
-#ifdef __cplusplus
-}
-#endif