diff --git a/.gitmodules b/.gitmodules index 0c5636a..bf24286 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "lib/flac"] path = lib/flac url = https://github.com/xiph/flac.git +[submodule "lib/FreeRTOS"] + path = lib/FreeRTOS + url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b666f6..ba9051c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ set(TARGET_LDSCRIPT_RAM "${CMAKE_SOURCE_DIR}/SDK/devices/LPC55S69/gcc/LPC55S69 set(TARGET_SOURCES "SDK/components/lists/fsl_component_generic_list.c" - "SDK/components/osa/fsl_os_abstraction_bm.c" + "SDK/components/osa/fsl_os_abstraction_free_rtos.c" "SDK/components/serial_manager/fsl_component_serial_manager.c" "SDK/components/serial_manager/fsl_component_serial_port_uart.c" "SDK/components/uart/fsl_adapter_usart.c" @@ -40,6 +40,12 @@ set(TARGET_SOURCES "SDK/devices/LPC55S69/drivers/fsl_pint.c" "SDK/devices/LPC55S69/drivers/fsl_plu.c" "SDK/devices/LPC55S69/drivers/fsl_power.c" + "SDK/devices/LPC55S69/drivers/fsl_powerquad_basic.c" + "SDK/devices/LPC55S69/drivers/fsl_powerquad_cmsis.c" + "SDK/devices/LPC55S69/drivers/fsl_powerquad_data.c" + "SDK/devices/LPC55S69/drivers/fsl_powerquad_math.c" + "SDK/devices/LPC55S69/drivers/fsl_powerquad_matrix.c" + "SDK/devices/LPC55S69/drivers/fsl_powerquad_transform.c" "SDK/devices/LPC55S69/drivers/fsl_prince.c" "SDK/devices/LPC55S69/drivers/fsl_puf.c" "SDK/devices/LPC55S69/drivers/fsl_reset.c" @@ -74,6 +80,7 @@ set(TARGET_SOURCES "board/pin_mux.c" "board/sdmmc_config.c" "src/app_flac_callbacks.c" + "src/app_flac_player.c" "src/main.c" ) @@ -82,12 +89,14 @@ set(TARGET_C_DEFINES "FFR_INCLUDE=\"fsl_iap_ffr.h\"" "MCUXPRESSO_SDK" "SD_ENABLED" + "SDK_OS_FREE_RTOS" "SERIAL_PORT_TYPE_UART=1" "__STARTUP_CLEAR_BSS" ) set(TARGET_C_INCLUDES "SDK/CMSIS/Core/Include" + "SDK/CMSIS/DSP/Include" "SDK/components/lists" "SDK/components/osa" "SDK/components/serial_manager" @@ -109,6 +118,7 @@ set(TARGET_C_INCLUDES # Shared libraries linked with application set(TARGET_LIBS "fro_calib_hardabi" + "freertos_kernel" "FLAC" "c" "m" @@ -145,6 +155,12 @@ set(CMAKE_EXE_LINKER_FLAGS "-specs=nano.specs -specs=nosys.specs -Wl,--gc-sectio set(WITH_OGG OFF CACHE BOOL "" FORCE) add_subdirectory(lib/flac) + +set(FREERTOS_CONFIG_FILE_DIRECTORY "${CMAKE_SOURCE_DIR}/include" CACHE STRING "") +set(FREERTOS_PORT "GCC_ARM_CM33_NTZ_NONSECURE" CACHE STRING "") +set(FREERTOS_HEAP "4" CACHE STRING "") +add_subdirectory(lib/FreeRTOS) + # Shared sources, includes and definitions add_compile_definitions(${TARGET_C_DEFINES}) include_directories(${TARGET_C_INCLUDES}) diff --git a/app_flash.ld b/app_flash.ld index 1b784ab..a7bdccb 100644 --- a/app_flash.ld +++ b/app_flash.ld @@ -1,4 +1,4 @@ -__stack_size__ = 0x08000; +__stack_size__ = 0x02000; __heap_size__ = 0x20000; INCLUDE LPC55S69_cm33_core0_flash.ld \ No newline at end of file diff --git a/include/FreeRTOSConfig.h b/include/FreeRTOSConfig.h new file mode 100644 index 0000000..c2a2bf7 --- /dev/null +++ b/include/FreeRTOSConfig.h @@ -0,0 +1,150 @@ +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +#define configENABLE_MPU 0 +#define configENABLE_FPU 0 +#define configENABLE_TRUSTZONE 0 + +#define configUSE_PREEMPTION 1 +#define configUSE_TICKLESS_IDLE 0 +#define configCPU_CLOCK_HZ (SystemCoreClock) +#define configTICK_RATE_HZ ((TickType_t)1000) +#define configMAX_PRIORITIES 5 +#define configMINIMAL_STACK_SIZE 128 +#define configMAX_TASK_NAME_LEN 16 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_TASK_NOTIFICATIONS 1 +#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3 +#define configUSE_MUTEXES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */ +#define configQUEUE_REGISTRY_SIZE 10 +#define configUSE_QUEUE_SETS 0 +#define configUSE_TIME_SLICING 0 +#define configUSE_NEWLIB_REENTRANT 1 +#define configENABLE_BACKWARD_COMPATIBILITY 0 +#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 +#define configSTACK_DEPTH_TYPE uint16_t +#define configMESSAGE_BUFFER_LENGTH_TYPE size_t + +/* Memory allocation related definitions. */ +#define configSUPPORT_STATIC_ALLOCATION 0 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 +#define configTOTAL_HEAP_SIZE 40960 +#define configAPPLICATION_ALLOCATED_HEAP 0 +#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 + +/* Hook function related definitions. */ +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_MALLOC_FAILED_HOOK 0 +#define configUSE_DAEMON_TASK_STARTUP_HOOK 0 + +/* Run time and task stats gathering related definitions. */ +#define configGENERATE_RUN_TIME_STATS 0 +#define configUSE_TRACE_FACILITY 0 +#define configUSE_STATS_FORMATTING_FUNCTIONS 0 + +/* Co-routine related definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES 1 + +/* Software timer related definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) +#define configTIMER_QUEUE_LENGTH 10 +#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE + +/* Define to trap errors during development. */ +#define configASSERT(x) \ + if ((x) == 0) { \ + taskDISABLE_INTERRUPTS(); \ + for (;;) \ + ; \ + } + +/* FreeRTOS MPU specific definitions. */ +#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0 +#define configTOTAL_MPU_REGIONS 8 /* Default value. */ +#define configTEX_S_C_B_FLASH 0x07UL /* Default value. */ +#define configTEX_S_C_B_SRAM 0x07UL /* Default value. */ +#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 1 +#define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 1 + +/* ARMv8-M secure side port related definitions. */ +#define secureconfigMAX_SECURE_CONTEXTS 5 + +/* Optional functions - most linkers will remove unused functions anyway. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_xResumeFromISR 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 0 +#define INCLUDE_uxTaskGetStackHighWaterMark2 0 +#define INCLUDE_xTaskGetIdleTaskHandle 0 +#define INCLUDE_eTaskGetState 0 +#define INCLUDE_xEventGroupSetBitFromISR 1 +#define INCLUDE_xTimerPendFunctionCall 0 +#define INCLUDE_xTaskAbortDelay 0 +#define INCLUDE_xTaskGetHandle 0 +#define INCLUDE_xTaskResumeFromISR 1 + +#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) +/* Clock manager provides in this variable system core clock frequency */ +#include +extern uint32_t SystemCoreClock; +#endif + +#ifndef configENABLE_FPU +#define configENABLE_FPU 1 +#endif +#ifndef configENABLE_MPU +#define configENABLE_MPU 0 +#endif +#ifndef configENABLE_TRUSTZONE +#define configENABLE_TRUSTZONE 0 +#endif +#ifndef configRUN_FREERTOS_SECURE_ONLY +#define configRUN_FREERTOS_SECURE_ONLY 1 +#endif + +/* Interrupt nesting behaviour configuration. Cortex-M specific. */ +#ifdef __NVIC_PRIO_BITS +/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ +#define configPRIO_BITS __NVIC_PRIO_BITS +#else +#define configPRIO_BITS 3 /* 8 priority levels */ +#endif + +/* The lowest interrupt priority that can be used in a call to a "set priority" +function. */ +#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1U << (configPRIO_BITS)) - 1) + +/* The highest interrupt priority that can be used by any interrupt service +routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL +INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER +PRIORITY THAN THIS! (higher priorities are lower numeric values. */ +#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2 + +/* Interrupt priorities used by the kernel port layer itself. These are generic +to all Cortex-M ports, and do not rely on any particular library functions. */ +#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) +/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! +See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ +#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) + +/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS +standard names. */ +#define vPortSVCHandler SVC_Handler +#define vPortPendSVHandler PendSV_Handler +#define vPortSysTickHandler SysTick_Handler + +#endif /* FREERTOS_CONFIG_H */ diff --git a/include/ffconf.h b/include/ffconf.h index 60e8f3b..a0dabab 100644 --- a/include/ffconf.h +++ b/include/ffconf.h @@ -5,7 +5,7 @@ / FatFs Functional Configurations /---------------------------------------------------------------------------*/ -#define FFCONF_DEF 86631 /* Revision ID */ +#define FFCONF_DEF 86631 /* Revision ID */ /*---------------------------------------------------------------------------/ / MSDK adaptation configuration @@ -16,14 +16,13 @@ / Function Configurations /---------------------------------------------------------------------------*/ -#define FF_FS_READONLY 0 +#define FF_FS_READONLY 0 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only) / Read-only configuration removes writing API functions, f_write(), f_sync(), / f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() / and optional writing functions as well. */ - -#define FF_FS_MINIMIZE 0 +#define FF_FS_MINIMIZE 0 /* This option defines minimization level to remove some basic API functions. / / 0: Basic functions are fully enabled. @@ -32,42 +31,34 @@ / 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. / 3: f_lseek() function is removed in addition to 2. */ - -#define FF_USE_FIND 0 +#define FF_USE_FIND 0 /* This option switches filtered directory read functions, f_findfirst() and / f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */ - -#define FF_USE_MKFS 1 +#define FF_USE_MKFS 1 /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ - -#define FF_USE_FASTSEEK 0 +#define FF_USE_FASTSEEK 0 /* This option switches fast seek function. (0:Disable or 1:Enable) */ - -#define FF_USE_EXPAND 0 +#define FF_USE_EXPAND 0 /* This option switches f_expand function. (0:Disable or 1:Enable) */ - -#define FF_USE_CHMOD 0 +#define FF_USE_CHMOD 0 /* This option switches attribute manipulation functions, f_chmod() and f_utime(). / (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */ - -#define FF_USE_LABEL 0 +#define FF_USE_LABEL 0 /* This option switches volume label functions, f_getlabel() and f_setlabel(). / (0:Disable or 1:Enable) */ - -#define FF_USE_FORWARD 0 +#define FF_USE_FORWARD 0 /* This option switches f_forward() function. (0:Disable or 1:Enable) */ - -#define FF_USE_STRFUNC 1 -#define FF_PRINT_LLI 0 -#define FF_PRINT_FLOAT 0 -#define FF_STRF_ENCODE 3 +#define FF_USE_STRFUNC 1 +#define FF_PRINT_LLI 0 +#define FF_PRINT_FLOAT 0 +#define FF_STRF_ENCODE 3 /* FF_USE_STRFUNC switches string functions, f_gets(), f_putc(), f_puts() and / f_printf(). / @@ -87,12 +78,11 @@ / 3: Unicode in UTF-8 */ - /*---------------------------------------------------------------------------/ / Locale and Namespace Configurations /---------------------------------------------------------------------------*/ -#define FF_CODE_PAGE 932 +#define FF_CODE_PAGE 932 /* This option specifies the OEM code page to be used on the target system. / Incorrect code page setting can cause a file open failure. / @@ -120,9 +110,8 @@ / 0 - Include all code pages above and configured by f_setcp() */ - -#define FF_USE_LFN 2 -#define FF_MAX_LFN 255 +#define FF_USE_LFN 2 +#define FF_MAX_LFN 255 /* The FF_USE_LFN switches the support for LFN (long file name). / / 0: Disable LFN. FF_MAX_LFN has no effect. @@ -140,8 +129,7 @@ / memory for the working buffer, memory management functions, ff_memalloc() and / ff_memfree() exemplified in ffsystem.c, need to be added to the project. */ - -#define FF_LFN_UNICODE 0 +#define FF_LFN_UNICODE 0 /* This option switches the character encoding on the API when LFN is enabled. / / 0: ANSI/OEM in current CP (TCHAR = char) @@ -152,16 +140,14 @@ / Also behavior of string I/O functions will be affected by this option. / When LFN is not enabled, this option has no effect. */ - -#define FF_LFN_BUF 255 -#define FF_SFN_BUF 12 +#define FF_LFN_BUF 255 +#define FF_SFN_BUF 12 /* This set of options defines size of file name members in the FILINFO structure / which is used to read out directory items. These values should be suffcient for / the file names to read. The maximum possible length of the read file name depends / on character encoding. When LFN is not enabled, these options have no effect. */ - -#define FF_FS_RPATH 2 +#define FF_FS_RPATH 2 /* This option configures support for relative path. / / 0: Disable relative path and remove related functions. @@ -169,17 +155,15 @@ / 2: f_getcwd() function is available in addition to 1. */ - /*---------------------------------------------------------------------------/ / Drive/Volume Configurations /---------------------------------------------------------------------------*/ -#define FF_VOLUMES 3 +#define FF_VOLUMES 3 /* Number of volumes (logical drives) to be used. (1-10) */ - -#define FF_STR_VOLUME_ID 0 -#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3" +#define FF_STR_VOLUME_ID 0 +#define FF_VOLUME_STRS "RAM", "NAND", "CF", "SD", "SD2", "USB", "USB2", "USB3" /* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings. / When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive / number in the path name. FF_VOLUME_STRS defines the volume ID strings for each @@ -191,8 +175,7 @@ / const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",... */ - -#define FF_MULTI_PARTITION 0 +#define FF_MULTI_PARTITION 0 /* This option switches support for multiple volumes on the physical drive. / By default (0), each logical drive number is bound to the same physical drive / number and only an FAT volume found on the physical drive will be mounted. @@ -200,9 +183,8 @@ / arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() / funciton will be available. */ - -#define FF_MIN_SS 512 -#define FF_MAX_SS 512 +#define FF_MIN_SS 512 +#define FF_MAX_SS 512 /* This set of options configures the range of sector size to be supported. (512, / 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and / harddisk, but a larger value may be required for on-board flash memory and some @@ -210,45 +192,38 @@ / for variable sector size mode and disk_ioctl() function needs to implement / GET_SECTOR_SIZE command. */ - -#define FF_LBA64 0 +#define FF_LBA64 1 /* This option switches support for 64-bit LBA. (0:Disable or 1:Enable) / To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */ - -#define FF_MIN_GPT 0x10000000 +#define FF_MIN_GPT 0x10000000 /* Minimum number of sectors to switch GPT as partitioning format in f_mkfs and / f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */ - -#define FF_USE_TRIM 0 +#define FF_USE_TRIM 0 /* This option switches support for ATA-TRIM. (0:Disable or 1:Enable) / To enable Trim function, also CTRL_TRIM command should be implemented to the / disk_ioctl() function. */ - - /*---------------------------------------------------------------------------/ / System Configurations /---------------------------------------------------------------------------*/ -#define FF_FS_TINY 0 +#define FF_FS_TINY 0 /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) / At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes. / Instead of private sector buffer eliminated from the file object, common sector / buffer in the filesystem object (FATFS) is used for the file data transfer. */ - -#define FF_FS_EXFAT 1 +#define FF_FS_EXFAT 1 /* This option switches support for exFAT filesystem. (0:Disable or 1:Enable) / To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1) / Note that enabling exFAT discards ANSI C (C89) compatibility. */ - -#define FF_FS_NORTC 1 -#define FF_NORTC_MON 1 -#define FF_NORTC_MDAY 1 -#define FF_NORTC_YEAR 2021 +#define FF_FS_NORTC 1 +#define FF_NORTC_MON 1 +#define FF_NORTC_MDAY 1 +#define FF_NORTC_YEAR 2021 /* The option FF_FS_NORTC switches timestamp functiton. If the system does not have / any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable / the timestamp function. Every object modified by FatFs will have a fixed timestamp @@ -258,8 +233,7 @@ / FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. / These options have no effect in read-only configuration (FF_FS_READONLY = 1). */ - -#define FF_FS_NOFSINFO 0 +#define FF_FS_NOFSINFO 0 /* If you need to know correct free space on the FAT32 volume, set bit 0 of this / option, and f_getfree() function at first time after volume mount will force / a full FAT scan. Bit 1 controls the use of last allocated cluster number. @@ -270,8 +244,7 @@ / bit1=1: Do not trust last allocated cluster number in the FSINFO. */ - -#define FF_FS_LOCK 0 +#define FF_FS_LOCK 4 /* The option FF_FS_LOCK switches file lock function to control duplicated file open / and illegal operation to open objects. This option must be 0 when FF_FS_READONLY / is 1. @@ -282,11 +255,10 @@ / can be opened simultaneously under file lock control. Note that the file / lock control is independent of re-entrancy. */ - /* #include // O/S definitions */ -#define FF_FS_REENTRANT 0 -#define FF_FS_TIMEOUT 1000 -#define FF_SYNC_t HANDLE +#define FF_FS_REENTRANT 0 +#define FF_FS_TIMEOUT 1000 +#define FF_SYNC_t HANDLE /* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs / module itself. Note that regardless of this option, file access to different / volume is always re-entrant and volume control functions, f_mount(), f_mkfs() @@ -304,8 +276,6 @@ / SemaphoreHandle_t and etc. A header file for O/S definitions needs to be / included somewhere in the scope of ff.h. */ - - /*--- End of configuration options ---*/ #endif /* _FFCONF_H_ */ diff --git a/lib/FreeRTOS b/lib/FreeRTOS new file mode 160000 index 0000000..6324f6f --- /dev/null +++ b/lib/FreeRTOS @@ -0,0 +1 @@ +Subproject commit 6324f6fc3e26d8b550fe54d474cd1ea89e238622 diff --git a/src/app_flac_callbacks.c b/src/app_flac_callbacks.c index 92893fb..d3b4e8c 100644 --- a/src/app_flac_callbacks.c +++ b/src/app_flac_callbacks.c @@ -1,3 +1,5 @@ +#include + #include "fsl_debug_console.h" /* FS */ @@ -91,7 +93,9 @@ FLAC__StreamDecoderWriteStatus app_flac_write(const FLAC__StreamDecoder *decoder const FLAC__int32 *const buffer[], void *client_data) { app_flac_client_t *client = client_data; - PRINTF("FP: %p, Decoded FLAC block size: %d\r\n", &client->fd, frame->header.blocksize); + struct mallinfo mi = mallinfo(); + + PRINTF("FP: %p, Decoded FLAC block size: %d, heap: %d\r\n", &client->fd, frame->header.blocksize, mi.uordblks); return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } diff --git a/src/app_flac_player.c b/src/app_flac_player.c new file mode 100644 index 0000000..e69de29 diff --git a/src/main.c b/src/main.c index cd4e2be..44dd0af 100644 --- a/src/main.c +++ b/src/main.c @@ -13,6 +13,9 @@ #include "sdmmc_config.h" /* clang-format on */ +#include "FreeRTOS.h" +#include "task.h" + #include "app_flac_callbacks.h" #define FLAC_FILE_NAME "2:/re_tryment.flac" @@ -21,6 +24,7 @@ static FATFS s_fs; static const TCHAR s_drive_num[] = {SDDISK + '0', ':', '/'}; static status_t sdcardWaitCardInsert(void); +static void vTaskPlayer(void *pvParameters); int main(void) { BOARD_InitBootPins(); @@ -31,6 +35,14 @@ int main(void) { PRINTF("Hello world!!\r\n"); + xTaskCreate(vTaskPlayer, "PLAYER", 4096, NULL, 4, NULL); + + vTaskStartScheduler(); + + return 0; +} + +static void vTaskPlayer(void *pvParameters) { if (sdcardWaitCardInsert() != kStatus_Success) { PRINTF("Card detect failed...\r\n"); goto dead_loop; @@ -78,12 +90,12 @@ int main(void) { FLAC__stream_decoder_delete(decoder); + f_close(&client.fd); + dead_loop: for (;;) { - __WFI(); + vTaskSuspend(NULL); } - - return 0; } static status_t sdcardWaitCardInsert(void) {