forked from espressif/esp-idf
component/bt: implement UIPC API functions according to esp_audio component
This commit is contained in:
@@ -41,7 +41,7 @@ typedef int32_t INT32;
|
|||||||
typedef bool BOOLEAN;
|
typedef bool BOOLEAN;
|
||||||
|
|
||||||
#define PACKED __packed
|
#define PACKED __packed
|
||||||
#define INLINE __inline
|
// #define INLINE __inline
|
||||||
|
|
||||||
#define BCM_STRCPY_S(x1,x2,x3) strcpy((x1),(x3))
|
#define BCM_STRCPY_S(x1,x2,x3) strcpy((x1),(x3))
|
||||||
#define BCM_STRNCPY_S(x1,x2,x3,x4) strncpy((x1),(x3),(x4))
|
#define BCM_STRNCPY_S(x1,x2,x3,x4) strncpy((x1),(x3),(x4))
|
||||||
|
@@ -39,7 +39,7 @@ static spi_flash_counters_t s_flash_stats;
|
|||||||
#define COUNTER_STOP(counter) \
|
#define COUNTER_STOP(counter) \
|
||||||
do{ \
|
do{ \
|
||||||
s_flash_stats.counter.count++; \
|
s_flash_stats.counter.count++; \
|
||||||
s_flash_stats.counter.time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_FREQ / 1000000); \\
|
s_flash_stats.counter.time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_FREQ / 1000000); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define COUNTER_ADD_BYTES(counter, size) \
|
#define COUNTER_ADD_BYTES(counter, size) \
|
||||||
|
@@ -25,7 +25,10 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "uipc.h"
|
#include "uipc.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "EspAudio.h"
|
||||||
|
#include "EspAudioCom.h"
|
||||||
|
#include "bt_trace.h"
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** Constants & Macros
|
** Constants & Macros
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@@ -48,6 +51,8 @@ const char* dump_uipc_event(tUIPC_EVENT event)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void UIPC_Init(void *dummy)
|
void UIPC_Init(void *dummy)
|
||||||
{
|
{
|
||||||
|
LOG_ERROR("Free memory: %d bytes\n", system_get_free_heap_size());
|
||||||
|
EspAudio_Init();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +67,17 @@ void UIPC_Init(void *dummy)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BOOLEAN UIPC_Open(tUIPC_CH_ID ch_id, tUIPC_RCV_CBACK *p_cback)
|
BOOLEAN UIPC_Open(tUIPC_CH_ID ch_id, tUIPC_RCV_CBACK *p_cback)
|
||||||
{
|
{
|
||||||
|
if (ch_id == UIPC_CH_ID_AV_AUDIO) {
|
||||||
|
// TODO: review the stream param config parameter here
|
||||||
|
EspAudioPlayerStreamCfg(StreamSampleRate_44k, StreamChannel_Two, StreamBitLen_16BIT);
|
||||||
|
EspAudio_SetupStream("stream.pcm", InputSrcType_Stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (p_cback) {
|
||||||
|
p_cback(ch_id, UIPC_OPEN_EVT);
|
||||||
|
}
|
||||||
|
*/
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,6 +121,9 @@ BOOLEAN UIPC_SendBuf(tUIPC_CH_ID ch_id, BT_HDR *p_msg)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BOOLEAN UIPC_Send(tUIPC_CH_ID ch_id, UINT16 msg_evt, UINT8 *p_buf, UINT16 msglen)
|
BOOLEAN UIPC_Send(tUIPC_CH_ID ch_id, UINT16 msg_evt, UINT8 *p_buf, UINT16 msglen)
|
||||||
{
|
{
|
||||||
|
if (ch_id == UIPC_CH_ID_AV_AUDIO) {
|
||||||
|
EspAudioPlayerStreamWrite(p_buf, msglen);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,28 +1,24 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
#include "bt.h"
|
#include "bt.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
|
#include "nvs_flash.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
|
||||||
extern void bte_main_boot_entry(void *);
|
extern void bte_main_boot_entry(void *);
|
||||||
extern void bt_app_task_start_up(void);
|
extern void bt_app_task_start_up(void);
|
||||||
extern void bt_app_core_start(void);
|
extern void bt_app_core_start(void);
|
||||||
|
|
||||||
void pingTask(void *pvParameters)
|
|
||||||
{
|
|
||||||
while (1) {
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
printf("ping\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_main()
|
void app_main()
|
||||||
{
|
{
|
||||||
|
nvs_flash_init();
|
||||||
|
system_init();
|
||||||
|
printf("Free memory: %d bytes\n", system_get_free_heap_size());
|
||||||
bt_controller_init();
|
bt_controller_init();
|
||||||
xTaskCreatePinnedToCore(&pingTask, "pingTask", 2048, NULL, 5, NULL, 0);
|
|
||||||
bt_app_task_start_up();
|
bt_app_task_start_up();
|
||||||
// bte_main_boot_entry(bt_app_core_start);
|
// bte_main_boot_entry(bt_app_core_start);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user