doubao_chat/apps/demo/demo_video/app_main.c

75 lines
2.5 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 "app_config.h"
#include "system/includes.h"
#include "os/os_api.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, 2048, 1024 },
{"sys_event", 29, 512, 0 },
{"systimer", 14, 256, 0 },
{"sys_timer", 9, 512, 128 },
{"audio_server", 16, 1024, 256 },
{"audio_encoder", 14, 1024, 64 },
{"video_server", 26, 800, 1024 },
{"dynamic_huffman0", 15, 256, 32 },
{"video0_rec0", 25, 512, 512 },
{"video0_rec1", 25, 512, 512 },
{"audio_rec0", 22, 256, 256 },
{"audio_rec1", 22, 256, 256 },
{0, 0, 0, 0, 0},
};
/*
* hello_video task
*/
static void hello_video_task(void *p)
{
int cnt = 0;
int user_video_rec0_open(void);
int user_video_rec0_close(void);
u32 user_video_frame_callback(void *data, u32 len, u8 type);
//数据回调在:user_video_frame_callback
os_time_dly(10);//延时10个os_tick,等待摄像头电源稳定
user_video_rec0_open();//打开摄像头
while (1) {
os_time_dly(100);
if (++cnt % 5 == 0) {
user_video_rec0_close();//关闭摄像头
os_time_dly(100);
user_video_rec0_open();//打开摄像头
}
}
}
/*
* 应用程序主函数
*/
void app_main()
{
printf("\r\n\r\n\r\n\r\n\r\n -----------video demo app_main run %s-------------\r\n\r\n\r\n\r\n\r\n", __TIME__);
os_task_create(hello_video_task, NULL, 12, 1000, 0, "hello_video_task");
}