doubao_chat/apps/demo/demo_edr/app_main.c

102 lines
3.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "system/includes.h"
#include "app_config.h"
#include "generic/log.h"
#include "os/os_api.h"
#include "event/key_event.h"
#include "event/device_event.h"
/*中断列表 */
const struct irq_info irq_info_table[] = {
//中断号 //优先级0-7 //注册的cpu(0或1)
#ifdef CONFIG_IPMASK_ENABLE
//不可屏蔽中断方法:支持写flash,但中断函数和调用函数和const要全部放在内部ram
{ IRQ_SOFT5_IDX, 6, 0 }, //此中断强制注册到cpu0
{ IRQ_SOFT4_IDX, 6, 1 }, //此中断强制注册到cpu1
#if 0 //如下,SPI1使用不可屏蔽中断设置,优先级固定7
{ IRQ_SPI1_IDX, 7, 1 },//中断强制注册到cpu0/1
#endif
#endif
#if CPU_CORE_NUM == 1
{ IRQ_SOFT5_IDX, 7, 0 }, //此中断强制注册到cpu0
{ IRQ_SOFT4_IDX, 7, 1 }, //此中断强制注册到cpu1
{ -2, -2, -2 },//如果加入了该行, 那么只有该行之前的中断注册到对应核, 其他所有中断强制注册到CPU0
#endif
{ -1, -1, -1 },
};
/*任务列表 */
const struct task_info task_info_table[] = {
{"app_core", 15, 1024, 256 },
{"sys_event", 29, 512, 0 },
{"systimer", 14, 256, 0 },
{"sys_timer", 9, 512, 64 },
{"audio_server", 16, 512, 64 },
{"audio_mix", 28, 512, 0 },
{"audio_encoder", 12, 384, 64 },
{"vir_dev_task", 13, 256, 0 },
{"cvsd_encoder", 13, 512, 0 },
{"aec_encoder", 13, 1024, 0 },
{"msbc_encoder", 13, 256, 0 },
{"sbc_encoder", 13, 512, 0 },
#if CPU_CORE_NUM > 1
{"#C0btencry", 16, 512, 128 },
{"#C0btctrler", 19, 512, 384 },
{"#C0btstack", 18, 1024, 384 },
#else
{"btencry", 14, 512, 128 },
{"btctrler", 19, 512, 384 },
{"btstack", 18, 768, 384 },
#endif
{0, 0},
};
static int main_dev_event_handler(struct device_event *event)
{
switch (event->event) {
case DEVICE_EVENT_IN:
break;
case DEVICE_EVENT_OUT:
break;
case DEVICE_EVENT_CHANGE:
break;
}
return false;
}
/*
* 默认的系统事件处理函数
* 当所有活动的app的事件处理函数都返回false时此函数会被调用
*/
void app_default_event_handler(struct sys_event *event)
{
switch (event->type) {
case SYS_KEY_EVENT:
extern int bt_music_key_event_handler(struct key_event * key);
bt_music_key_event_handler((struct key_event *)event->payload);
break;
case SYS_DEVICE_EVENT:
main_dev_event_handler((struct device_event *)event->payload);
break;
case SYS_BT_EVENT:
extern int app_music_bt_event_handler(struct sys_event * event);
app_music_bt_event_handler(event);
break;
default:
ASSERT(0, "unknow event type: %s\n", __func__);
break;
}
}
/*
* 应用程序主函数
*/
void app_main()
{
puts("------------- demo_edr app main-------------\n");
extern void bt_ble_module_init(void);
bt_ble_module_init();
}