通过设置全局变量I2S0,I2S1触发DMA机制的咨询
Posted: Wed Jan 25, 2023 5:18 am
在跟踪esp32-web-camera的代码时,看到了通过设置全局变量I2S0,I2S1,触发DMA的机制,对于结构体i2s_dev_t的各字段不是很理解,不懂哪里有这方面的文档,另外通过设置变量I2S0而实现DMA机制,能不能帮忙描述下?
以下是样例中,ll_cam.c中设置I2S0的代码
bool ll_cam_start(cam_obj_t *cam, int frame_pos)
{
I2S0.conf.rx_start = 0;
I2S_ISR_ENABLE(in_suc_eof);
I2S0.conf.rx_reset = 1;
I2S0.conf.rx_reset = 0;
I2S0.conf.rx_fifo_reset = 1;
I2S0.conf.rx_fifo_reset = 0;
I2S0.lc_conf.in_rst = 1;
I2S0.lc_conf.in_rst = 0;
I2S0.lc_conf.ahbm_fifo_rst = 1;
I2S0.lc_conf.ahbm_fifo_rst = 0;
I2S0.lc_conf.ahbm_rst = 1;
I2S0.lc_conf.ahbm_rst = 0;
I2S0.rx_eof_num = cam->dma_half_buffer_size / sizeof(dma_elem_t);
I2S0.in_link.addr = ((uint32_t)&cam->dma[0]) & 0xfffff;
I2S0.in_link.start = 1;
I2S0.conf.rx_start = 1;
return true;
}
以下是样例中,ll_cam.c中设置I2S0的代码
bool ll_cam_start(cam_obj_t *cam, int frame_pos)
{
I2S0.conf.rx_start = 0;
I2S_ISR_ENABLE(in_suc_eof);
I2S0.conf.rx_reset = 1;
I2S0.conf.rx_reset = 0;
I2S0.conf.rx_fifo_reset = 1;
I2S0.conf.rx_fifo_reset = 0;
I2S0.lc_conf.in_rst = 1;
I2S0.lc_conf.in_rst = 0;
I2S0.lc_conf.ahbm_fifo_rst = 1;
I2S0.lc_conf.ahbm_fifo_rst = 0;
I2S0.lc_conf.ahbm_rst = 1;
I2S0.lc_conf.ahbm_rst = 0;
I2S0.rx_eof_num = cam->dma_half_buffer_size / sizeof(dma_elem_t);
I2S0.in_link.addr = ((uint32_t)&cam->dma[0]) & 0xfffff;
I2S0.in_link.start = 1;
I2S0.conf.rx_start = 1;
return true;
}