mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-06 12:58:45 +00:00
[refactor][examples] add case success message
This commit is contained in:
parent
72e16855d6
commit
d0b959f99d
62 changed files with 643433 additions and 376 deletions
|
@ -1,3 +1,25 @@
|
|||
/**
|
||||
* @file bl702_config.h
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#ifndef __BL702_CONFIG_H__
|
||||
#define __BL702_CONFIG_H__
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/**
|
||||
* @file board.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_clock.h"
|
||||
#include "bl702_glb.h"
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/**
|
||||
* @file peripheral_config.h
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#ifndef _PERIPHERAL_CONFIG_H_
|
||||
#define _PERIPHERAL_CONFIG_H_
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
// <q> GPIO3 <2> [GPIO_FUN_UNUSED//GPIO_FUN_I2S//GPIO_FUN_SPI//GPIO_FUN_I2C//GPIO_FUN_PWM//GPIO_FUN_CAM//GPIO_FUN_UART0_RX//GPIO_FUN_UART1_RX//GPIO_FUN_QDEC]
|
||||
// <i> config gpio3 function
|
||||
#define CONFIG_GPIO3_FUNC GPIO_FUN_PWM
|
||||
#define CONFIG_GPIO3_FUNC GPIO_FUN_UNUSED
|
||||
|
||||
// <q> GPIO4 <2> [GPIO_FUN_UNUSED//GPIO_FUN_I2S//GPIO_FUN_SPI//GPIO_FUN_I2C//GPIO_FUN_PWM//GPIO_FUN_CAM//GPIO_FUN_UART0_RTS//GPIO_FUN_UART1_RTS//GPIO_FUN_QDEC]
|
||||
// <i> config gpio4 function
|
||||
|
|
|
@ -66,7 +66,5 @@ int main(void)
|
|||
} else {
|
||||
MSG("PosId = %d NegId = %d V= %d mV \r\n", result_val.posChan, result_val.negChan, (uint32_t)(result_val.volt * 1000));
|
||||
}
|
||||
|
||||
// bflb_platform_delay_ms(500);
|
||||
}
|
||||
}
|
|
@ -68,6 +68,8 @@ int main(void)
|
|||
bflb_platform_delay_ms(500);
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -60,6 +60,8 @@ int main(void)
|
|||
bflb_platform_delay_ms(500);
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -58,10 +58,10 @@ int main(void)
|
|||
adc_channel_start(adc_test);
|
||||
device_read(adc_test, 0, (void *)&result_val, sizeof(result_val) / sizeof(adc_channel_val_t));
|
||||
MSG("PosId = %d NegId = %d V= %d mV \r\n", result_val.posChan, result_val.negChan, (uint32_t)(result_val.volt * 1000));
|
||||
// bflb_platform_delay_ms(10);
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
return SUCCESS;
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -87,4 +87,7 @@ int main(void)
|
|||
cam_stop();
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,4 +94,7 @@ int main(void)
|
|||
cam_stop();
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,4 +61,7 @@ int main(void)
|
|||
device_write(dac, DAC_CHANNEL_0, zfb_source, sizeof(zfb_source));
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,12 +32,12 @@ void dma_transfer_done(struct device *dev, void *args, uint32_t size, uint32_t s
|
|||
if (!state) {
|
||||
for (index = 0; index < 8000; index++) {
|
||||
if (dma_dst_buffer[index] != 0xff) {
|
||||
MSG("dma transfer failed\r\n");
|
||||
BL_CASE_FAIL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MSG("dma transfer success\r\n");
|
||||
BL_CASE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,8 +64,8 @@ int main(void)
|
|||
|
||||
dma_channel_start(dma);
|
||||
|
||||
/*wait callback to check memory transfering is success*/
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ int main(void)
|
|||
}
|
||||
}
|
||||
|
||||
MSG("flash write and read test success\r\n");
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,6 +184,8 @@ int main(void)
|
|||
|
||||
vTaskStartScheduler();
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ int main(void)
|
|||
gpio_irq_enable(GPIO_PIN_12, ENABLE);
|
||||
MSG("gpio int test !\r\n");
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,13 @@ int main(void)
|
|||
{
|
||||
bflb_platform_init(0);
|
||||
|
||||
while (1) {
|
||||
for (uint8_t i = 0; i < 10; i++) {
|
||||
MSG("hello world!\r\n");
|
||||
bflb_platform_delay_ms(1000);
|
||||
bflb_platform_delay_ms(200);
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,10 +52,10 @@ int main(void)
|
|||
|
||||
if (i2c_transfer(i2c0, &msg[0], 2) == 0) {
|
||||
MSG("\r\n read:%0x\r\n", msg[1].buf[0] << 8 | msg[1].buf[1]);
|
||||
MSG("\r\n i2c case success\r\n");
|
||||
BL_CASE_SUCCESS;
|
||||
} else
|
||||
MSG("\r\n i2c case failed\r\n");
|
||||
BL_CASE_FAIL;
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -46,11 +46,11 @@ int main(void)
|
|||
|
||||
if (i2c_transfer(i2c0, &msg1, 1) == 0) {
|
||||
MSG("\r\n read:%0x\r\n", msg1.buf[0] << 8 | msg1.buf[1]);
|
||||
MSG("\r\n i2c case success\r\n");
|
||||
BL_CASE_SUCCESS;
|
||||
} else
|
||||
MSG("\r\n i2c case failed\r\n");
|
||||
BL_CASE_FAIL;
|
||||
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -44,6 +44,9 @@
|
|||
#include "fhm_onechannel_16k_20.h"
|
||||
#include "bsp_es8388.h"
|
||||
|
||||
struct device *i2s;
|
||||
struct device *dma_ch2;
|
||||
|
||||
static ES8388_Cfg_Type ES8388Cfg = {
|
||||
.work_mode = ES8388_CODEC_MDOE, /*!< ES8388 work mode */
|
||||
.role = ES8388_SLAVE, /*!< ES8388 role */
|
||||
|
@ -65,46 +68,41 @@ int main(void)
|
|||
|
||||
/* register & open i2s device */
|
||||
i2s_register(I2S0_INDEX, "I2S", DEVICE_OFLAG_RDWR);
|
||||
struct device *i2s = device_find("I2S");
|
||||
|
||||
((i2s_device_t *)i2s)->iis_mode = I2S_MODE_MASTER;
|
||||
((i2s_device_t *)i2s)->interface_mode = I2S_MODE_LEFT;
|
||||
((i2s_device_t *)i2s)->sampl_freq_hz = 16 * 1000;
|
||||
((i2s_device_t *)i2s)->channel_num = I2S_FS_CHANNELS_NUM_MONO;
|
||||
((i2s_device_t *)i2s)->frame_size = I2S_FRAME_LEN_16;
|
||||
((i2s_device_t *)i2s)->data_size = I2S_DATA_LEN_16;
|
||||
((i2s_device_t *)i2s)->fifo_threshold = 8;
|
||||
|
||||
i2s = device_find("I2S");
|
||||
if (i2s) {
|
||||
I2S_DEV(i2s)->iis_mode = I2S_MODE_MASTER;
|
||||
I2S_DEV(i2s)->interface_mode = I2S_MODE_LEFT;
|
||||
I2S_DEV(i2s)->sampl_freq_hz = 16 * 1000;
|
||||
I2S_DEV(i2s)->channel_num = I2S_FS_CHANNELS_NUM_2;
|
||||
I2S_DEV(i2s)->frame_size = I2S_FRAME_LEN_16;
|
||||
I2S_DEV(i2s)->data_size = I2S_DATA_LEN_16;
|
||||
I2S_DEV(i2s)->fifo_threshold = 8;
|
||||
device_open(i2s, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_DMA_RX);
|
||||
MSG("device open success\r\n");
|
||||
}
|
||||
|
||||
/* register & open dma device */
|
||||
if (dma_allocate_register("i2s_dma", DEVICE_OFLAG_RDWR) == SUCCESS) {
|
||||
MSG("dma allocate success\r\n");
|
||||
}
|
||||
|
||||
struct device *i2s_dma = device_find("i2s_dma");
|
||||
|
||||
if (i2s_dma) {
|
||||
((dma_device_t *)i2s_dma)->direction = DMA_MEMORY_TO_PERIPH;
|
||||
((dma_device_t *)i2s_dma)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||
((dma_device_t *)i2s_dma)->src_req = DMA_REQUEST_NONE;
|
||||
((dma_device_t *)i2s_dma)->dst_req = DMA_REQUEST_I2S_TX;
|
||||
((dma_device_t *)i2s_dma)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
((dma_device_t *)i2s_dma)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
|
||||
device_open(i2s_dma, 0);
|
||||
dma_register(DMA0_CH2_INDEX, "dma_ch2_i2s_tx", DEVICE_OFLAG_RDWR);
|
||||
dma_ch2 = device_find("dma_ch2_i2s_tx");
|
||||
if (dma_ch2) {
|
||||
DMA_DEV(dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||
DMA_DEV(dma_ch2)->transfer_mode = DMA_LLI_CYCLE_MODE;
|
||||
DMA_DEV(dma_ch2)->src_req = DMA_REQUEST_NONE;
|
||||
DMA_DEV(dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
||||
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
device_open(dma_ch2, 0);
|
||||
|
||||
/* connect i2s device and dma device */
|
||||
device_control(i2s, DEVICE_CTRL_I2S_ATTACH_TX_DMA, (void *)i2s_dma);
|
||||
|
||||
/* start play source*/
|
||||
device_write(i2s, 0, fhm_onechannel_16k_20, sizeof(fhm_onechannel_16k_20));
|
||||
device_control(i2s, DEVICE_CTRL_ATTACH_TX_DMA, (void *)dma_ch2);
|
||||
}
|
||||
|
||||
/* start send */
|
||||
device_write(i2s, 0, fhm_onechannel_16k_20, sizeof(fhm_onechannel_16k_20));
|
||||
|
||||
MSG("Play Music start \r\n");
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
10
examples/i2s/i2s_play_from_record/CMakeLists.txt
Normal file
10
examples/i2s/i2s_play_from_record/CMakeLists.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
|
||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/es8388 )
|
||||
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/es8388/bsp_es8388.c )
|
||||
set(mains main.c)
|
||||
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,696 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project Name="i2s_play_from_record" Version="1" Language="C">
|
||||
<Description>CPU: RV32IMAFC
|
||||
Chip: bl70x
|
||||
Board: bl70x_iot
|
||||
</Description>
|
||||
<Dependencies Name="Debug"/>
|
||||
<VirtualDirectory Name="app">
|
||||
<File Name="../main.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="chip">
|
||||
<VirtualDirectory Name="riscv">
|
||||
<File Name="../../../../drivers/bl702_driver/startup/interrupt.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/startup/system_bl702.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="startup">
|
||||
<File Name="../../../../drivers/bl702_driver/startup/GCC/entry.S">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/startup/GCC/start_load.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="hal">
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_adc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dma.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_gpio.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2s.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mtimer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pwm.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_spi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_timer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_uart.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_usb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_clock.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_cam.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mjpeg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="std">
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_acomp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_adc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_aon.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_cam.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_clock.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dma.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ef_ctrl.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_emac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_glb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_hbn.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c_gpio_sim.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2s.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ir.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_common.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_kys.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_l1c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_mjpeg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pds.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_psram.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pwm.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_qdec.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romapi.c" ExcludeProjConfig="BuildSet;CK_Link_Debug;OpenOCD_Debug">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romdriver.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_dbg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_eng.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg_ext.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_ctrl.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash_ext.c" ExcludeProjConfig="">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_spi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_timer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_uart.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_usb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash_ext.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="board">
|
||||
<File Name="../../../../bsp/bsp_common/platform/bflb_platform.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/board/bl706_avb/board.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/es8388/bsp_es8388.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/fatfs/fatfs_spi_sd.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/spi_sd/bsp_spi_sd.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="common">
|
||||
<File Name="../../../../common/device/drv_device.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/memheap/drv_mmheap.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/ring_buffer/ring_buffer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/soft_crc/softcrc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/misc/misc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="script">
|
||||
<File Name="../../../../tools/openocd/bl70x_gdb.init">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/regs/bl70x_reg.svc">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<MonitorProgress>
|
||||
<DebugLaunch>154</DebugLaunch>
|
||||
<FlashOperate>104</FlashOperate>
|
||||
</MonitorProgress>
|
||||
<VirtualDirectory Name="components">
|
||||
<VirtualDirectory Name="fatfs">
|
||||
<File Name="../../../../components/fatfs/diskio.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ff.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ffsystem.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ffunicode.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="shell">
|
||||
<File Name="../../../../components/shell/shell.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="usb_stack">
|
||||
<VirtualDirectory Name="class">
|
||||
<VirtualDirectory Name="cdc">
|
||||
<File Name="../../../../components/usb_stack/class/cdc/usbd_cdc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="hid">
|
||||
<File Name="../../../../components/usb_stack/class/hid/usbd_hid.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="msc">
|
||||
<File Name="../../../../components/usb_stack/class/msc/usbd_msc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="core">
|
||||
<File Name="../../../../components/usb_stack/core/usbd_core.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Dependencies Name="BuildSet"/>
|
||||
<DebugSessions>
|
||||
<watchExpressions/>
|
||||
<memoryExpressions>;;;</memoryExpressions>
|
||||
<statistics>;;MHZ;</statistics>
|
||||
<peripheralTabs>
|
||||
<Tab disFormat="Hex">glb</Tab>
|
||||
<Tab disFormat="Hex">uart</Tab>
|
||||
</peripheralTabs>
|
||||
<WatchDisplayFormat>1</WatchDisplayFormat>
|
||||
<LocalDisplayFormat>1</LocalDisplayFormat>
|
||||
<debugLayout/>
|
||||
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
|
||||
</DebugSessions>
|
||||
<DebugSessions>
|
||||
<watchExpressions/>
|
||||
<memoryExpressions>;;;</memoryExpressions>
|
||||
<statistics>;;MHZ;</statistics>
|
||||
<peripheralTabs>
|
||||
<Tab disFormat="Hex">glb</Tab>
|
||||
<Tab disFormat="Hex">uart</Tab>
|
||||
</peripheralTabs>
|
||||
<WatchDisplayFormat>1</WatchDisplayFormat>
|
||||
<LocalDisplayFormat>1</LocalDisplayFormat>
|
||||
<debugLayout/>
|
||||
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
|
||||
</DebugSessions>
|
||||
<BuildConfigs>
|
||||
<BuildConfig Name="OpenOCD_Debug">
|
||||
<Target>
|
||||
<ROMBank Selected="1">
|
||||
<ROM1>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x23000000</Start>
|
||||
<Size>0x100000</Size>
|
||||
</ROM1>
|
||||
<ROM2>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x22014000</Start>
|
||||
<Size>0x4000</Size>
|
||||
</ROM2>
|
||||
<ROM3>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x42018000</Start>
|
||||
<Size>0x8000</Size>
|
||||
</ROM3>
|
||||
<ROM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM4>
|
||||
<ROM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM5>
|
||||
</ROMBank>
|
||||
<RAMBank>
|
||||
<RAM1>
|
||||
<InUse>yes</InUse>
|
||||
<Start>0x42020000</Start>
|
||||
<Size>0xc000</Size>
|
||||
<Init>yes</Init>
|
||||
</RAM1>
|
||||
<RAM2>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM2>
|
||||
<RAM3>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM3>
|
||||
<RAM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM4>
|
||||
<RAM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM5>
|
||||
</RAMBank>
|
||||
<CPU>rv32imafc</CPU>
|
||||
<UseMiniLib>yes</UseMiniLib>
|
||||
<Endian>little</Endian>
|
||||
<UseHardFloat>no</UseHardFloat>
|
||||
<UseEnhancedLRW>no</UseEnhancedLRW>
|
||||
<UseContinueBuild>no</UseContinueBuild>
|
||||
<UseSemiHost>no</UseSemiHost>
|
||||
</Target>
|
||||
<Output>
|
||||
<OutputName>$(ProjectName)</OutputName>
|
||||
<Type>Executable</Type>
|
||||
<CreateHexFile>no</CreateHexFile>
|
||||
<CreateBinFile>yes</CreateBinFile>
|
||||
<Preprocessor>no</Preprocessor>
|
||||
<Disassmeble>yes</Disassmeble>
|
||||
<CallGraph>no</CallGraph>
|
||||
<Map>yes</Map>
|
||||
</Output>
|
||||
<User>
|
||||
<BeforeCompile>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
|
||||
</AfterMake>
|
||||
</User>
|
||||
<Compiler>
|
||||
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;</Define>
|
||||
<Undefine/>
|
||||
<Optim>Optimize more (-O2)</Optim>
|
||||
<DebugLevel>Default (-g)</DebugLevel>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_avb;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;D:/bflb-SDK/bl_mcu_sdk/bsp/bsp_common/es8388;D:/bflb-SDK/bl_mcu_sdk/bsp/bsp_common/fatfs;D:/bflb-SDK/bl_mcu_sdk/bsp/bsp_common/spi_sd</IncludePath>
|
||||
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -fno-jump-tables -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -msmall-data-limit=4</OtherFlags>
|
||||
<Verbose>no</Verbose>
|
||||
<Ansi>no</Ansi>
|
||||
<Syntax>no</Syntax>
|
||||
<Pedantic>no</Pedantic>
|
||||
<PedanticErr>no</PedanticErr>
|
||||
<InhibitWarn>no</InhibitWarn>
|
||||
<AllWarn>yes</AllWarn>
|
||||
<WarnErr>no</WarnErr>
|
||||
<OneElfS>yes</OneElfS>
|
||||
<Fstrict>no</Fstrict>
|
||||
</Compiler>
|
||||
<Asm>
|
||||
<Define/>
|
||||
<Undefine/>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags/>
|
||||
<DebugLevel>gdwarf2</DebugLevel>
|
||||
</Asm>
|
||||
<Linker>
|
||||
<Garbage>yes</Garbage>
|
||||
<Garbage2>yes</Garbage2>
|
||||
<LDFile>$(ProjectPath)../../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
|
||||
<LibName/>
|
||||
<LibPath/>
|
||||
<OtherFlags/>
|
||||
<AutoLDFile>no</AutoLDFile>
|
||||
<LinkType/>
|
||||
</Linker>
|
||||
<Debug>
|
||||
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
|
||||
<Connector>OpenOCD</Connector>
|
||||
<StopAt>yes</StopAt>
|
||||
<StopAtText>main</StopAtText>
|
||||
<InitFile/>
|
||||
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
|
||||
<AutoRun>yes</AutoRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>23000000</SoftResetVal>
|
||||
<ResetAfterLoad>no</ResetAfterLoad>
|
||||
<Dumpcore>no</Dumpcore>
|
||||
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
|
||||
<ConfigICE>
|
||||
<IP>localhost</IP>
|
||||
<PORT>1025</PORT>
|
||||
<CPUNumber>0</CPUNumber>
|
||||
<Clock>2000</Clock>
|
||||
<Delay>10</Delay>
|
||||
<WaitReset>50</WaitReset>
|
||||
<DDC>yes</DDC>
|
||||
<TRST>no</TRST>
|
||||
<DebugPrint>no</DebugPrint>
|
||||
<Connect>Normal</Connect>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>21000000</SoftResetVal>
|
||||
<RTOSType>Bare Metal</RTOSType>
|
||||
<DownloadToFlash>yes</DownloadToFlash>
|
||||
<ResetAfterConnect>yes</ResetAfterConnect>
|
||||
<GDBName/>
|
||||
<GDBServerType>Local</GDBServerType>
|
||||
<OtherFlags>-arch riscv</OtherFlags>
|
||||
</ConfigICE>
|
||||
<ConfigSIM>
|
||||
<SIMTarget/>
|
||||
<OtherFlags/>
|
||||
<NoGraphic>yes</NoGraphic>
|
||||
<Log>no</Log>
|
||||
<SimTrace>no</SimTrace>
|
||||
</ConfigSIM>
|
||||
<ConfigOpenOCD>
|
||||
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
|
||||
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
|
||||
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
|
||||
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
|
||||
<OpenOCDTclPort>6666</OpenOCDTclPort>
|
||||
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
|
||||
</ConfigOpenOCD>
|
||||
</Debug>
|
||||
<Flash>
|
||||
<InitFile/>
|
||||
<Erase>Erase Sectors</Erase>
|
||||
<Algorithms Path="">bl70x_flasher.elf</Algorithms>
|
||||
<Program>yes</Program>
|
||||
<Verify>yes</Verify>
|
||||
<ResetAndRun>no</ResetAndRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal/>
|
||||
<External>no</External>
|
||||
<Command/>
|
||||
<Arguments/>
|
||||
</Flash>
|
||||
</BuildConfig>
|
||||
<BuildConfig Name="CK_Link_Debug">
|
||||
<Target>
|
||||
<ROMBank Selected="1">
|
||||
<ROM1>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x23000000</Start>
|
||||
<Size>0x100000</Size>
|
||||
</ROM1>
|
||||
<ROM2>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x22014000</Start>
|
||||
<Size>0x4000</Size>
|
||||
</ROM2>
|
||||
<ROM3>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x42018000</Start>
|
||||
<Size>0x8000</Size>
|
||||
</ROM3>
|
||||
<ROM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM4>
|
||||
<ROM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM5>
|
||||
</ROMBank>
|
||||
<RAMBank>
|
||||
<RAM1>
|
||||
<InUse>yes</InUse>
|
||||
<Start>0x42020000</Start>
|
||||
<Size>0xc000</Size>
|
||||
<Init>yes</Init>
|
||||
</RAM1>
|
||||
<RAM2>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM2>
|
||||
<RAM3>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM3>
|
||||
<RAM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM4>
|
||||
<RAM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM5>
|
||||
</RAMBank>
|
||||
<CPU>rv32imafc</CPU>
|
||||
<UseMiniLib>no</UseMiniLib>
|
||||
<Endian>little</Endian>
|
||||
<UseHardFloat>no</UseHardFloat>
|
||||
<UseEnhancedLRW>no</UseEnhancedLRW>
|
||||
<UseContinueBuild>no</UseContinueBuild>
|
||||
<UseSemiHost>no</UseSemiHost>
|
||||
</Target>
|
||||
<Output>
|
||||
<OutputName>$(ProjectName)</OutputName>
|
||||
<Type>Executable</Type>
|
||||
<CreateHexFile>no</CreateHexFile>
|
||||
<CreateBinFile>yes</CreateBinFile>
|
||||
<Preprocessor>no</Preprocessor>
|
||||
<Disassmeble>yes</Disassmeble>
|
||||
<CallGraph>no</CallGraph>
|
||||
<Map>yes</Map>
|
||||
</Output>
|
||||
<User>
|
||||
<BeforeCompile>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
|
||||
</AfterMake>
|
||||
</User>
|
||||
<Compiler>
|
||||
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;</Define>
|
||||
<Undefine/>
|
||||
<Optim>Optimize more (-O2)</Optim>
|
||||
<DebugLevel>Default (-g)</DebugLevel>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -fno-jump-tables -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -msmall-data-limit=4</OtherFlags>
|
||||
<Verbose>no</Verbose>
|
||||
<Ansi>no</Ansi>
|
||||
<Syntax>no</Syntax>
|
||||
<Pedantic>no</Pedantic>
|
||||
<PedanticErr>no</PedanticErr>
|
||||
<InhibitWarn>no</InhibitWarn>
|
||||
<AllWarn>yes</AllWarn>
|
||||
<WarnErr>no</WarnErr>
|
||||
<OneElfS>yes</OneElfS>
|
||||
<Fstrict>no</Fstrict>
|
||||
</Compiler>
|
||||
<Asm>
|
||||
<Define/>
|
||||
<Undefine/>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags/>
|
||||
<DebugLevel>gdwarf2</DebugLevel>
|
||||
</Asm>
|
||||
<Linker>
|
||||
<Garbage>yes</Garbage>
|
||||
<Garbage2>yes</Garbage2>
|
||||
<LDFile>$(ProjectPath)../../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
|
||||
<LibName/>
|
||||
<LibPath/>
|
||||
<OtherFlags/>
|
||||
<AutoLDFile>no</AutoLDFile>
|
||||
<LinkType/>
|
||||
</Linker>
|
||||
<Debug>
|
||||
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
|
||||
<Connector>ICE</Connector>
|
||||
<StopAt>yes</StopAt>
|
||||
<StopAtText>main</StopAtText>
|
||||
<InitFile/>
|
||||
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
|
||||
<AutoRun>yes</AutoRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>23000000</SoftResetVal>
|
||||
<ResetAfterLoad>no</ResetAfterLoad>
|
||||
<Dumpcore>no</Dumpcore>
|
||||
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
|
||||
<ConfigICE>
|
||||
<IP>localhost</IP>
|
||||
<PORT>1025</PORT>
|
||||
<CPUNumber>0</CPUNumber>
|
||||
<Clock>2000</Clock>
|
||||
<Delay>10</Delay>
|
||||
<WaitReset>50</WaitReset>
|
||||
<DDC>yes</DDC>
|
||||
<TRST>no</TRST>
|
||||
<DebugPrint>no</DebugPrint>
|
||||
<Connect>Normal</Connect>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>21000000</SoftResetVal>
|
||||
<RTOSType>Bare Metal</RTOSType>
|
||||
<DownloadToFlash>yes</DownloadToFlash>
|
||||
<ResetAfterConnect>yes</ResetAfterConnect>
|
||||
<GDBName/>
|
||||
<GDBServerType>Local</GDBServerType>
|
||||
<OtherFlags>-arch riscv</OtherFlags>
|
||||
</ConfigICE>
|
||||
<ConfigSIM>
|
||||
<SIMTarget/>
|
||||
<OtherFlags/>
|
||||
<NoGraphic>yes</NoGraphic>
|
||||
<Log>no</Log>
|
||||
<SimTrace>no</SimTrace>
|
||||
</ConfigSIM>
|
||||
<ConfigOpenOCD>
|
||||
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
|
||||
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
|
||||
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
|
||||
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
|
||||
<OpenOCDTclPort>6666</OpenOCDTclPort>
|
||||
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
|
||||
</ConfigOpenOCD>
|
||||
</Debug>
|
||||
<Flash>
|
||||
<InitFile/>
|
||||
<Erase>Erase Sectors</Erase>
|
||||
<Algorithms Path="">bl702_flasher.elf</Algorithms>
|
||||
<Program>yes</Program>
|
||||
<Verify>yes</Verify>
|
||||
<ResetAndRun>no</ResetAndRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal/>
|
||||
<External>no</External>
|
||||
<Command/>
|
||||
<Arguments/>
|
||||
</Flash>
|
||||
</BuildConfig>
|
||||
</BuildConfigs>
|
||||
</Project>
|
128
examples/i2s/i2s_play_from_record/main.c
Normal file
128
examples/i2s/i2s_play_from_record/main.c
Normal file
|
@ -0,0 +1,128 @@
|
|||
/**
|
||||
* @file fatfs_posix_api.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hal_i2s.h"
|
||||
#include "hal_dma.h"
|
||||
#include "bsp_es8388.h"
|
||||
|
||||
#define BUFF_SIZE (1 * 1024)
|
||||
|
||||
struct device *i2s;
|
||||
struct device *dma_ch2, *dma_ch3;
|
||||
struct device *uart;
|
||||
|
||||
volatile static uint8_t buff_using_num = 0;
|
||||
static uint8_t Data_Buff[2][BUFF_SIZE] __attribute__((section(".system_ram"), aligned(4)));
|
||||
|
||||
static ES8388_Cfg_Type ES8388Cfg = {
|
||||
.work_mode = ES8388_CODEC_MDOE, /*!< ES8388 work mode */
|
||||
.role = ES8388_SLAVE, /*!< ES8388 role */
|
||||
.mic_input_mode = ES8388_DIFF_ENDED_MIC, /*!< ES8388 mic input mode */
|
||||
.mic_pga = ES8388_MIC_PGA_9DB, /*!< ES8388 mic PGA */
|
||||
.i2s_frame = ES8388_LEFT_JUSTIFY_FRAME, /*!< ES8388 I2S frame */
|
||||
.data_width = ES8388_DATA_LEN_16, /*!< ES8388 I2S dataWitdh */
|
||||
};
|
||||
|
||||
static void dma_ch3_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
||||
{
|
||||
device_read(i2s, 0, Data_Buff[!buff_using_num], BUFF_SIZE);
|
||||
|
||||
device_write(i2s, 0, Data_Buff[buff_using_num], BUFF_SIZE);
|
||||
|
||||
buff_using_num = !buff_using_num;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bflb_platform_init(0);
|
||||
|
||||
/* init ES8388 Codec */
|
||||
ES8388_Init(&ES8388Cfg);
|
||||
//ES8388_Reg_Dump();
|
||||
ES8388_Set_Voice_Volume(60);
|
||||
|
||||
/* register & open i2s device */
|
||||
i2s_register(I2S0_INDEX, "I2S", DEVICE_OFLAG_RDWR);
|
||||
i2s = device_find("I2S");
|
||||
if (i2s) {
|
||||
I2S_DEV(i2s)->iis_mode = I2S_MODE_MASTER;
|
||||
I2S_DEV(i2s)->interface_mode = I2S_MODE_LEFT;
|
||||
I2S_DEV(i2s)->sampl_freq_hz = 16 * 1000;
|
||||
I2S_DEV(i2s)->channel_num = I2S_FS_CHANNELS_NUM_2;
|
||||
I2S_DEV(i2s)->frame_size = I2S_FRAME_LEN_16;
|
||||
I2S_DEV(i2s)->data_size = I2S_DATA_LEN_16;
|
||||
I2S_DEV(i2s)->fifo_threshold = 8;
|
||||
device_open(i2s, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_DMA_RX);
|
||||
}
|
||||
|
||||
/* register & open dma device */
|
||||
dma_register(DMA0_CH3_INDEX, "dma_ch3_i2s_rx", DEVICE_OFLAG_RDWR);
|
||||
dma_ch3 = device_find("dma_ch3_i2s_rx");
|
||||
if (dma_ch3) {
|
||||
DMA_DEV(dma_ch3)->direction = DMA_PERIPH_TO_MEMORY;
|
||||
DMA_DEV(dma_ch3)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||
DMA_DEV(dma_ch3)->src_req = DMA_REQUEST_I2S_RX;
|
||||
DMA_DEV(dma_ch3)->dst_req = DMA_REQUEST_NONE;
|
||||
DMA_DEV(dma_ch3)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
DMA_DEV(dma_ch3)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
device_open(dma_ch3, 0);
|
||||
|
||||
/* connect i2s device and dma device */
|
||||
device_control(i2s, DEVICE_CTRL_ATTACH_RX_DMA, (void *)dma_ch3);
|
||||
|
||||
/* Set the interrupt function, for double buffering*/
|
||||
device_set_callback(dma_ch3, dma_ch3_irq_callback);
|
||||
device_control(dma_ch3, DEVICE_CTRL_SET_INT, NULL);
|
||||
}
|
||||
|
||||
dma_register(DMA0_CH2_INDEX, "dma_ch2_i2s_tx", DEVICE_OFLAG_RDWR);
|
||||
dma_ch2 = device_find("dma_ch2_i2s_tx");
|
||||
if (dma_ch2) {
|
||||
DMA_DEV(dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||
DMA_DEV(dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||
DMA_DEV(dma_ch2)->src_req = DMA_REQUEST_NONE;
|
||||
DMA_DEV(dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
||||
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
device_open(dma_ch2, 0);
|
||||
|
||||
/* connect i2s device and dma device */
|
||||
device_control(i2s, DEVICE_CTRL_ATTACH_TX_DMA, (void *)dma_ch2);
|
||||
|
||||
/* Set the interrupt function, for double buffering*/
|
||||
device_set_callback(dma_ch2, NULL);
|
||||
device_control(dma_ch2, DEVICE_CTRL_SET_INT, NULL);
|
||||
}
|
||||
|
||||
uart = device_find("debug_log");
|
||||
|
||||
device_read(i2s, 0, Data_Buff[0], BUFF_SIZE);
|
||||
device_write(i2s, 0, Data_Buff[1], BUFF_SIZE);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,13 @@
|
|||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
|
||||
if(${SUPPORT_SHELL} STREQUAL "y")
|
||||
set(TARGET_REQUIRED_LIBS fatfs shell)
|
||||
else()
|
||||
set(TARGET_REQUIRED_LIBS fatfs)
|
||||
endif()
|
||||
|
||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/es8388 ${BSP_COMMON_DIR}/spi_sd )
|
||||
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/es8388/bsp_es8388.c ${BSP_COMMON_DIR}/fatfs/fatfs_spi_sd.c ${BSP_COMMON_DIR}/spi_sd/bsp_spi_sd.c wav_play_form_sd_card.c)
|
||||
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/es8388/bsp_es8388.c ${BSP_COMMON_DIR}/fatfs/fatfs_spi_sd.c ${BSP_COMMON_DIR}/spi_sd/bsp_spi_sd.c wav_play_from_sd_card.c sd_play_shell.c)
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
|
706
examples/i2s/i2s_play_from_sd/cdk/i2s_play_from_sd.cdkproj
Normal file
706
examples/i2s/i2s_play_from_sd/cdk/i2s_play_from_sd.cdkproj
Normal file
|
@ -0,0 +1,706 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project Name="i2s_play_from_sd" Version="1" Language="C">
|
||||
<Description>CPU: RV32IMAFC
|
||||
Chip: bl70x
|
||||
Board: bl70x_iot
|
||||
</Description>
|
||||
<Dependencies Name="Debug"/>
|
||||
<VirtualDirectory Name="app">
|
||||
<File Name="../main.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../wav_play_from_sd_card.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../sd_play_shell.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="chip">
|
||||
<VirtualDirectory Name="riscv">
|
||||
<File Name="../../../../drivers/bl702_driver/startup/interrupt.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/startup/system_bl702.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="startup">
|
||||
<File Name="../../../../drivers/bl702_driver/startup/GCC/entry.S">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/startup/GCC/start_load.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="hal">
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_adc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dma.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_gpio.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2s.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mtimer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pwm.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_spi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_timer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_uart.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_usb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_clock.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_cam.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mjpeg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="std">
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_acomp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_adc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_aon.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_cam.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_clock.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dma.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ef_ctrl.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_emac.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_glb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_hbn.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c_gpio_sim.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2s.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ir.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_common.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_kys.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_l1c.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_mjpeg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pds.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_psram.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pwm.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_qdec.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romapi.c" ExcludeProjConfig="BuildSet;CK_Link_Debug;OpenOCD_Debug">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romdriver.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_dbg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_eng.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg_ext.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_ctrl.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash_ext.c" ExcludeProjConfig="">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_spi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_timer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_uart.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_usb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash_ext.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="board">
|
||||
<File Name="../../../../bsp/bsp_common/platform/bflb_platform.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/board/bl706_avb/board.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/es8388/bsp_es8388.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/fatfs/fatfs_spi_sd.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../bsp/bsp_common/spi_sd/bsp_spi_sd.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="common">
|
||||
<File Name="../../../../common/device/drv_device.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/memheap/drv_mmheap.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/ring_buffer/ring_buffer.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/soft_crc/softcrc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../common/misc/misc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="script">
|
||||
<File Name="../../../../tools/openocd/bl70x_gdb.init">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../drivers/bl702_driver/regs/bl70x_reg.svc">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<MonitorProgress>
|
||||
<DebugLaunch>154</DebugLaunch>
|
||||
<FlashOperate>104</FlashOperate>
|
||||
</MonitorProgress>
|
||||
<VirtualDirectory Name="components">
|
||||
<VirtualDirectory Name="fatfs">
|
||||
<File Name="../../../../components/fatfs/diskio.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ff.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ffsystem.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/ffunicode.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/fatfs/fatfs_posix_api.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="shell">
|
||||
<File Name="../../../../components/shell/shell.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../components/shell/shell_fs.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="usb_stack">
|
||||
<VirtualDirectory Name="class">
|
||||
<VirtualDirectory Name="cdc">
|
||||
<File Name="../../../../components/usb_stack/class/cdc/usbd_cdc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="hid">
|
||||
<File Name="../../../../components/usb_stack/class/hid/usbd_hid.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="msc">
|
||||
<File Name="../../../../components/usb_stack/class/msc/usbd_msc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="core">
|
||||
<File Name="../../../../components/usb_stack/core/usbd_core.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Dependencies Name="BuildSet"/>
|
||||
<DebugSessions>
|
||||
<watchExpressions/>
|
||||
<memoryExpressions>;;;</memoryExpressions>
|
||||
<statistics>;;MHZ;</statistics>
|
||||
<peripheralTabs>
|
||||
<Tab disFormat="Hex">glb</Tab>
|
||||
<Tab disFormat="Hex">uart</Tab>
|
||||
</peripheralTabs>
|
||||
<WatchDisplayFormat>1</WatchDisplayFormat>
|
||||
<LocalDisplayFormat>1</LocalDisplayFormat>
|
||||
<debugLayout/>
|
||||
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
|
||||
</DebugSessions>
|
||||
<BuildConfigs>
|
||||
<BuildConfig Name="OpenOCD_Debug">
|
||||
<Target>
|
||||
<ROMBank Selected="1">
|
||||
<ROM1>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x23000000</Start>
|
||||
<Size>0x100000</Size>
|
||||
</ROM1>
|
||||
<ROM2>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x22014000</Start>
|
||||
<Size>0x4000</Size>
|
||||
</ROM2>
|
||||
<ROM3>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x42018000</Start>
|
||||
<Size>0x8000</Size>
|
||||
</ROM3>
|
||||
<ROM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM4>
|
||||
<ROM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM5>
|
||||
</ROMBank>
|
||||
<RAMBank>
|
||||
<RAM1>
|
||||
<InUse>yes</InUse>
|
||||
<Start>0x42020000</Start>
|
||||
<Size>0xc000</Size>
|
||||
<Init>yes</Init>
|
||||
</RAM1>
|
||||
<RAM2>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM2>
|
||||
<RAM3>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM3>
|
||||
<RAM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM4>
|
||||
<RAM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM5>
|
||||
</RAMBank>
|
||||
<CPU>rv32imafc</CPU>
|
||||
<UseMiniLib>yes</UseMiniLib>
|
||||
<Endian>little</Endian>
|
||||
<UseHardFloat>no</UseHardFloat>
|
||||
<UseEnhancedLRW>no</UseEnhancedLRW>
|
||||
<UseContinueBuild>no</UseContinueBuild>
|
||||
<UseSemiHost>no</UseSemiHost>
|
||||
</Target>
|
||||
<Output>
|
||||
<OutputName>$(ProjectName)</OutputName>
|
||||
<Type>Executable</Type>
|
||||
<CreateHexFile>no</CreateHexFile>
|
||||
<CreateBinFile>yes</CreateBinFile>
|
||||
<Preprocessor>no</Preprocessor>
|
||||
<Disassmeble>yes</Disassmeble>
|
||||
<CallGraph>no</CallGraph>
|
||||
<Map>yes</Map>
|
||||
</Output>
|
||||
<User>
|
||||
<BeforeCompile>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
|
||||
</AfterMake>
|
||||
</User>
|
||||
<Compiler>
|
||||
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;</Define>
|
||||
<Undefine/>
|
||||
<Optim>Optimize more (-O2)</Optim>
|
||||
<DebugLevel>Default (-g)</DebugLevel>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_avb;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;D:/bflb-SDK/bl_mcu_sdk/bsp/bsp_common/es8388;D:/bflb-SDK/bl_mcu_sdk/bsp/bsp_common/fatfs;D:/bflb-SDK/bl_mcu_sdk/bsp/bsp_common/spi_sd</IncludePath>
|
||||
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -fno-jump-tables -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -msmall-data-limit=4</OtherFlags>
|
||||
<Verbose>no</Verbose>
|
||||
<Ansi>no</Ansi>
|
||||
<Syntax>no</Syntax>
|
||||
<Pedantic>no</Pedantic>
|
||||
<PedanticErr>no</PedanticErr>
|
||||
<InhibitWarn>no</InhibitWarn>
|
||||
<AllWarn>yes</AllWarn>
|
||||
<WarnErr>no</WarnErr>
|
||||
<OneElfS>yes</OneElfS>
|
||||
<Fstrict>no</Fstrict>
|
||||
</Compiler>
|
||||
<Asm>
|
||||
<Define/>
|
||||
<Undefine/>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags/>
|
||||
<DebugLevel>gdwarf2</DebugLevel>
|
||||
</Asm>
|
||||
<Linker>
|
||||
<Garbage>yes</Garbage>
|
||||
<Garbage2>yes</Garbage2>
|
||||
<LDFile>$(ProjectPath)../../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
|
||||
<LibName/>
|
||||
<LibPath/>
|
||||
<OtherFlags/>
|
||||
<AutoLDFile>no</AutoLDFile>
|
||||
<LinkType/>
|
||||
</Linker>
|
||||
<Debug>
|
||||
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
|
||||
<Connector>OpenOCD</Connector>
|
||||
<StopAt>yes</StopAt>
|
||||
<StopAtText>main</StopAtText>
|
||||
<InitFile/>
|
||||
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
|
||||
<AutoRun>yes</AutoRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>23000000</SoftResetVal>
|
||||
<ResetAfterLoad>no</ResetAfterLoad>
|
||||
<Dumpcore>no</Dumpcore>
|
||||
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
|
||||
<ConfigICE>
|
||||
<IP>localhost</IP>
|
||||
<PORT>1025</PORT>
|
||||
<CPUNumber>0</CPUNumber>
|
||||
<Clock>2000</Clock>
|
||||
<Delay>10</Delay>
|
||||
<WaitReset>50</WaitReset>
|
||||
<DDC>yes</DDC>
|
||||
<TRST>no</TRST>
|
||||
<DebugPrint>no</DebugPrint>
|
||||
<Connect>Normal</Connect>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>21000000</SoftResetVal>
|
||||
<RTOSType>Bare Metal</RTOSType>
|
||||
<DownloadToFlash>yes</DownloadToFlash>
|
||||
<ResetAfterConnect>yes</ResetAfterConnect>
|
||||
<GDBName/>
|
||||
<GDBServerType>Local</GDBServerType>
|
||||
<OtherFlags>-arch riscv</OtherFlags>
|
||||
</ConfigICE>
|
||||
<ConfigSIM>
|
||||
<SIMTarget/>
|
||||
<OtherFlags/>
|
||||
<NoGraphic>yes</NoGraphic>
|
||||
<Log>no</Log>
|
||||
<SimTrace>no</SimTrace>
|
||||
</ConfigSIM>
|
||||
<ConfigOpenOCD>
|
||||
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
|
||||
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
|
||||
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
|
||||
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
|
||||
<OpenOCDTclPort>6666</OpenOCDTclPort>
|
||||
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
|
||||
</ConfigOpenOCD>
|
||||
</Debug>
|
||||
<Flash>
|
||||
<InitFile/>
|
||||
<Erase>Erase Sectors</Erase>
|
||||
<Algorithms Path="">bl70x_flasher.elf</Algorithms>
|
||||
<Program>yes</Program>
|
||||
<Verify>yes</Verify>
|
||||
<ResetAndRun>no</ResetAndRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal/>
|
||||
<External>no</External>
|
||||
<Command/>
|
||||
<Arguments/>
|
||||
</Flash>
|
||||
</BuildConfig>
|
||||
<BuildConfig Name="CK_Link_Debug">
|
||||
<Target>
|
||||
<ROMBank Selected="1">
|
||||
<ROM1>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x23000000</Start>
|
||||
<Size>0x100000</Size>
|
||||
</ROM1>
|
||||
<ROM2>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x22014000</Start>
|
||||
<Size>0x4000</Size>
|
||||
</ROM2>
|
||||
<ROM3>
|
||||
<InUse>no</InUse>
|
||||
<Start>0x42018000</Start>
|
||||
<Size>0x8000</Size>
|
||||
</ROM3>
|
||||
<ROM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM4>
|
||||
<ROM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
</ROM5>
|
||||
</ROMBank>
|
||||
<RAMBank>
|
||||
<RAM1>
|
||||
<InUse>yes</InUse>
|
||||
<Start>0x42020000</Start>
|
||||
<Size>0xc000</Size>
|
||||
<Init>yes</Init>
|
||||
</RAM1>
|
||||
<RAM2>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM2>
|
||||
<RAM3>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM3>
|
||||
<RAM4>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM4>
|
||||
<RAM5>
|
||||
<InUse>no</InUse>
|
||||
<Start/>
|
||||
<Size/>
|
||||
<Init>yes</Init>
|
||||
</RAM5>
|
||||
</RAMBank>
|
||||
<CPU>rv32imafc</CPU>
|
||||
<UseMiniLib>no</UseMiniLib>
|
||||
<Endian>little</Endian>
|
||||
<UseHardFloat>no</UseHardFloat>
|
||||
<UseEnhancedLRW>no</UseEnhancedLRW>
|
||||
<UseContinueBuild>no</UseContinueBuild>
|
||||
<UseSemiHost>no</UseSemiHost>
|
||||
</Target>
|
||||
<Output>
|
||||
<OutputName>$(ProjectName)</OutputName>
|
||||
<Type>Executable</Type>
|
||||
<CreateHexFile>no</CreateHexFile>
|
||||
<CreateBinFile>yes</CreateBinFile>
|
||||
<Preprocessor>no</Preprocessor>
|
||||
<Disassmeble>yes</Disassmeble>
|
||||
<CallGraph>no</CallGraph>
|
||||
<Map>yes</Map>
|
||||
</Output>
|
||||
<User>
|
||||
<BeforeCompile>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName/>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg>no</RunUserProg>
|
||||
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
|
||||
</AfterMake>
|
||||
</User>
|
||||
<Compiler>
|
||||
<Define>ARCH_RISCV;BFLB_USE_HAL_DRIVER;</Define>
|
||||
<Undefine/>
|
||||
<Optim>Optimize more (-O2)</Optim>
|
||||
<DebugLevel>Default (-g)</DebugLevel>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -fno-jump-tables -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -msmall-data-limit=4</OtherFlags>
|
||||
<Verbose>no</Verbose>
|
||||
<Ansi>no</Ansi>
|
||||
<Syntax>no</Syntax>
|
||||
<Pedantic>no</Pedantic>
|
||||
<PedanticErr>no</PedanticErr>
|
||||
<InhibitWarn>no</InhibitWarn>
|
||||
<AllWarn>yes</AllWarn>
|
||||
<WarnErr>no</WarnErr>
|
||||
<OneElfS>yes</OneElfS>
|
||||
<Fstrict>no</Fstrict>
|
||||
</Compiler>
|
||||
<Asm>
|
||||
<Define/>
|
||||
<Undefine/>
|
||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||
<OtherFlags/>
|
||||
<DebugLevel>gdwarf2</DebugLevel>
|
||||
</Asm>
|
||||
<Linker>
|
||||
<Garbage>yes</Garbage>
|
||||
<Garbage2>yes</Garbage2>
|
||||
<LDFile>$(ProjectPath)../../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
|
||||
<LibName/>
|
||||
<LibPath/>
|
||||
<OtherFlags/>
|
||||
<AutoLDFile>no</AutoLDFile>
|
||||
<LinkType/>
|
||||
</Linker>
|
||||
<Debug>
|
||||
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
|
||||
<Connector>ICE</Connector>
|
||||
<StopAt>yes</StopAt>
|
||||
<StopAtText>main</StopAtText>
|
||||
<InitFile/>
|
||||
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
|
||||
<AutoRun>yes</AutoRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>23000000</SoftResetVal>
|
||||
<ResetAfterLoad>no</ResetAfterLoad>
|
||||
<Dumpcore>no</Dumpcore>
|
||||
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
|
||||
<ConfigICE>
|
||||
<IP>localhost</IP>
|
||||
<PORT>1025</PORT>
|
||||
<CPUNumber>0</CPUNumber>
|
||||
<Clock>2000</Clock>
|
||||
<Delay>10</Delay>
|
||||
<WaitReset>50</WaitReset>
|
||||
<DDC>yes</DDC>
|
||||
<TRST>no</TRST>
|
||||
<DebugPrint>no</DebugPrint>
|
||||
<Connect>Normal</Connect>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal>21000000</SoftResetVal>
|
||||
<RTOSType>Bare Metal</RTOSType>
|
||||
<DownloadToFlash>yes</DownloadToFlash>
|
||||
<ResetAfterConnect>yes</ResetAfterConnect>
|
||||
<GDBName/>
|
||||
<GDBServerType>Local</GDBServerType>
|
||||
<OtherFlags>-arch riscv</OtherFlags>
|
||||
</ConfigICE>
|
||||
<ConfigSIM>
|
||||
<SIMTarget/>
|
||||
<OtherFlags/>
|
||||
<NoGraphic>yes</NoGraphic>
|
||||
<Log>no</Log>
|
||||
<SimTrace>no</SimTrace>
|
||||
</ConfigSIM>
|
||||
<ConfigOpenOCD>
|
||||
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
|
||||
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
|
||||
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
|
||||
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
|
||||
<OpenOCDTclPort>6666</OpenOCDTclPort>
|
||||
<OpenOCDConfigOptions>-f ../../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
|
||||
</ConfigOpenOCD>
|
||||
</Debug>
|
||||
<Flash>
|
||||
<InitFile/>
|
||||
<Erase>Erase Sectors</Erase>
|
||||
<Algorithms Path="">bl702_flasher.elf</Algorithms>
|
||||
<Program>yes</Program>
|
||||
<Verify>yes</Verify>
|
||||
<ResetAndRun>no</ResetAndRun>
|
||||
<ResetType>Hard Reset</ResetType>
|
||||
<SoftResetVal/>
|
||||
<External>no</External>
|
||||
<Command/>
|
||||
<Arguments/>
|
||||
</Flash>
|
||||
</BuildConfig>
|
||||
</BuildConfigs>
|
||||
<DebugSessions>
|
||||
<watchExpressions/>
|
||||
<memoryExpressions>;;;</memoryExpressions>
|
||||
<statistics>;;MHZ;</statistics>
|
||||
<peripheralTabs>
|
||||
<Tab disFormat="Hex">glb</Tab>
|
||||
<Tab disFormat="Hex">uart</Tab>
|
||||
</peripheralTabs>
|
||||
<WatchDisplayFormat>1</WatchDisplayFormat>
|
||||
<LocalDisplayFormat>1</LocalDisplayFormat>
|
||||
<debugLayout/>
|
||||
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
|
||||
</DebugSessions>
|
||||
</Project>
|
|
@ -33,14 +33,31 @@
|
|||
*
|
||||
* This case use shell module to complete human-computer interaction.
|
||||
*/
|
||||
|
||||
#include "ff.h"
|
||||
#include "wav_play_form_sd_card.h"
|
||||
#include "fatfs_posix_api.h"
|
||||
#include "wav_play_from_sd_card.h"
|
||||
|
||||
#ifdef SHELL_SUPPORT
|
||||
#include "hal_uart.h"
|
||||
#include "shell.h"
|
||||
#endif
|
||||
|
||||
FATFS Fs_1;
|
||||
audio_dev_t Audio_Dev;
|
||||
|
||||
void fatfs_sd_driver_register(void);
|
||||
|
||||
#ifdef SHELL_SUPPORT
|
||||
void shell_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
||||
{
|
||||
uint8_t data;
|
||||
if (state == UART_EVENT_RX_FIFO) {
|
||||
data = *(uint8_t *)args;
|
||||
shell_handler(data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
FRESULT res;
|
||||
|
@ -50,6 +67,15 @@ int main(void)
|
|||
fatfs_sd_driver_register();
|
||||
sd_wav_play_register(&Audio_Dev);
|
||||
|
||||
#ifdef SHELL_SUPPORT
|
||||
shell_init();
|
||||
struct device *uart = device_find("debug_log");
|
||||
if (uart) {
|
||||
device_set_callback(uart, shell_irq_callback);
|
||||
device_control(uart, DEVICE_CTRL_SET_INT, (void *)(UART_RX_FIFO_IT));
|
||||
}
|
||||
#endif
|
||||
|
||||
res = f_mount(&Fs_1, "sd:", 1);
|
||||
f_chdrive("sd:");
|
||||
f_chdir("./wav_test");
|
||||
|
@ -64,8 +90,9 @@ int main(void)
|
|||
MSG("fatfs open ERROR\r\n");
|
||||
}
|
||||
|
||||
/* start/stop test */
|
||||
Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_START, NULL);
|
||||
|
||||
/* start/stop test */
|
||||
/*
|
||||
bflb_platform_delay_ms(10000);
|
||||
Audio_Dev.audio_control(&Audio_Dev,AUDIO_CMD_STOP,NULL);
|
||||
|
@ -91,4 +118,7 @@ int main(void)
|
|||
Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_VOLUME, (void *)30);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
140
examples/i2s/i2s_play_from_sd/sd_play_shell.c
Normal file
140
examples/i2s/i2s_play_from_sd/sd_play_shell.c
Normal file
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* @file fatfs_posix_api.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef SHELL_SUPPORT
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ff.h>
|
||||
#include "shell.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
#include "wav_play_from_sd_card.h"
|
||||
|
||||
#define BUF_CNT 128
|
||||
#define MAX_PATH_LEN 255
|
||||
#define MAX_FILENAME_LEN 128
|
||||
#define MAX_INPUT_LEN 20
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
extern audio_dev_t Audio_Dev;
|
||||
|
||||
int cmd_play(size_t argc, char **argv)
|
||||
{
|
||||
char path[SHELL_CONSOLEBUF_SIZE];
|
||||
FILINFO dirent;
|
||||
|
||||
uint8_t flag = 0;
|
||||
uint32_t vol = 0;
|
||||
|
||||
strcpy(path, ".");
|
||||
|
||||
if (argc == 1) {
|
||||
MSG("缺少参数\r\n");
|
||||
MSG("play [-o path] [-s] [-p] [-v volume] \r\n");
|
||||
}
|
||||
|
||||
for (uint8_t i = 1; i < argc; i++) {
|
||||
//cmd
|
||||
if (argv[i][0] == '-') {
|
||||
if (strcmp(argv[i], "-s") == 0) {
|
||||
flag |= 0x01;
|
||||
} else if (strcmp(argv[i], "-p") == 0) {
|
||||
flag |= 0x02;
|
||||
} else if (strcmp(argv[i], "-o") == 0) {
|
||||
if (i + 1 < argc && argv[i + 1][0] != '-') {
|
||||
strcpy(path, argv[i + 1]);
|
||||
i++;
|
||||
}
|
||||
|
||||
flag |= 0x04;
|
||||
} else if (strcmp(argv[i], "-v") == 0) {
|
||||
if (i + 1 < argc && argv[i + 1][0] != '-') {
|
||||
vol = atoi(argv[i + 1]);
|
||||
i++;
|
||||
}
|
||||
|
||||
flag |= 0x08;
|
||||
} else {
|
||||
MSG("参数错误 %s\r\n", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
MSG("参数错误 %s\r\n", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag & 0x04) /* -o */
|
||||
{
|
||||
f_stat(path, &dirent);
|
||||
|
||||
if (f_stat(path, &dirent) != FR_OK || (dirent.fattrib & AM_DIR)) {
|
||||
MSG("-o:无目标文件\r\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Audio_Dev.audio_init(&Audio_Dev, path) == 0) {
|
||||
MSG("open success\r\n");
|
||||
} else {
|
||||
MSG("open error\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (flag & 0x01) /* -s */
|
||||
{
|
||||
if (Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_START, NULL) != 0) {
|
||||
MSG("play start error\r\n");
|
||||
} else {
|
||||
MSG("play start \r\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (flag & 0x02) /* -p */
|
||||
{
|
||||
if (Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_STOP, NULL) != 0) {
|
||||
MSG("play stop error\r\n");
|
||||
} else {
|
||||
MSG("play stop \r\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (flag & 0x08) /* -v */
|
||||
{
|
||||
if (Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_VOLUME, (void *)vol) != 0) {
|
||||
MSG("play set voice volume error\r\n");
|
||||
} else {
|
||||
MSG("set voice volume:%d \r\n", vol);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHELL_CMD_EXPORT_ALIAS(cmd_play, play, play music)
|
||||
#endif
|
376
examples/i2s/i2s_play_from_sd/wav_play_from_sd_card.c
Normal file
376
examples/i2s/i2s_play_from_sd/wav_play_from_sd_card.c
Normal file
|
@ -0,0 +1,376 @@
|
|||
/**
|
||||
* @file wav_play_form_sd_card.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bsp_es8388.h"
|
||||
#include "hal_i2s.h"
|
||||
#include "hal_dma.h"
|
||||
#include "ff.h"
|
||||
#include "wav_play_from_sd_card.h"
|
||||
|
||||
static int wav_data_parser(uint8_t buff[1024], wav_information_t *wav_information);
|
||||
static uint32_t pcm_24bit_to_32bit(uint8_t *buff, uint32_t data_size);
|
||||
static int sd_wav_play_init(audio_dev_t *audio_dev, const TCHAR *path);
|
||||
static int sd_wav_play_control(struct audio_dev *audio_dev, AUDIO_CMD_t cmd, void *args);
|
||||
static int sd_wav_play_callback(audio_dev_t *audio_dev);
|
||||
|
||||
static FIL Wav_Fp;
|
||||
|
||||
static uint8_t Data_Buff0[4 * 1024] __attribute__((section(".system_ram"), aligned(4)));
|
||||
static uint8_t Data_Buff1[4 * 1024] __attribute__((section(".system_ram"), aligned(4)));
|
||||
|
||||
static ES8388_Cfg_Type ES8388Cfg = {
|
||||
.work_mode = ES8388_CODEC_MDOE, /*!< ES8388 work mode */
|
||||
.role = ES8388_SLAVE, /*!< ES8388 role */
|
||||
.mic_input_mode = ES8388_DIFF_ENDED_MIC, /*!< ES8388 mic input mode */
|
||||
.mic_pga = ES8388_MIC_PGA_3DB, /*!< ES8388 mic PGA */
|
||||
.i2s_frame = ES8388_LEFT_JUSTIFY_FRAME, /*!< ES8388 I2S frame */
|
||||
.data_width = ES8388_DATA_LEN_16, /*!< ES8388 I2S dataWitdh */
|
||||
};
|
||||
|
||||
static wav_information_t Wav_Information;
|
||||
static audio_dev_t *p_Audio_Dev = NULL;
|
||||
|
||||
static void dma_ch2_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
||||
{
|
||||
if (p_Audio_Dev && p_Audio_Dev->audio_callback) {
|
||||
p_Audio_Dev->audio_callback(p_Audio_Dev);
|
||||
}
|
||||
}
|
||||
|
||||
/* get File pointer from top of file*/
|
||||
static int wav_data_parser(uint8_t buff[1024], wav_information_t *wav_information)
|
||||
{
|
||||
uint32_t offset = 0;
|
||||
uint32_t chunk_id;
|
||||
|
||||
/* RIFF WAVE Chunk */
|
||||
chunk_id = ((chunk_riff_t *)&buff[offset])->chunk_id;
|
||||
|
||||
if (chunk_id == 0x46464952) {
|
||||
wav_information->chunk_riff_offset = offset;
|
||||
wav_information->chunk_riff = *((chunk_riff_t *)&buff[offset]);
|
||||
offset += sizeof(chunk_riff_t);
|
||||
} else {
|
||||
wav_information->chunk_riff_offset = -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Format Chunk */
|
||||
chunk_id = ((chunk_format_t *)&buff[offset])->chunk_id;
|
||||
|
||||
if (chunk_id == 0x20746D66 && offset < 1000) /* fmt */
|
||||
{
|
||||
wav_information->chunk_format_offset = offset;
|
||||
wav_information->chunk_format = *((chunk_format_t *)&buff[offset]);
|
||||
offset += ((chunk_format_t *)&buff[offset])->chunk_size + 8;
|
||||
} else {
|
||||
wav_information->chunk_format_offset = -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Fact/list Chunk */
|
||||
chunk_id = ((chunk_fact_t *)&buff[offset])->chunk_id;
|
||||
|
||||
if ((chunk_id == 0X74636166 || chunk_id == 0X5453494C) && offset < 1000) /*fact or list*/
|
||||
{
|
||||
wav_information->chunk_fact_offset = offset;
|
||||
wav_information->chunk_fact = *((chunk_fact_t *)&buff[offset]);
|
||||
offset += ((chunk_fact_t *)&buff[offset])->chunk_size + 8;
|
||||
} else {
|
||||
wav_information->chunk_fact_offset = -1;
|
||||
}
|
||||
|
||||
/* Data Chunk */
|
||||
chunk_id = ((chunk_data_t *)&buff[offset])->chunk_id;
|
||||
|
||||
if (chunk_id == 0X61746164 && offset < 1000) {
|
||||
wav_information->chunk_data_offset = offset;
|
||||
wav_information->chunk_data = *((chunk_data_t *)&buff[offset]);
|
||||
} else {
|
||||
wav_information->chunk_data_offset = -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t pcm_24bit_to_32bit(uint8_t *buff, uint32_t data_size)
|
||||
{
|
||||
/* buff大小应该在data_size的三分之四倍以上 */
|
||||
for (uint16_t i = data_size / 3; i > 0; i--) {
|
||||
buff[i * 4 - 1] = buff[i * 3 - 1];
|
||||
buff[i * 4 - 2] = buff[i * 3 - 2];
|
||||
buff[i * 4 - 3] = buff[i * 3 - 3];
|
||||
buff[i * 4 - 4] = 0;
|
||||
}
|
||||
|
||||
return data_size / 3 * 4;
|
||||
}
|
||||
|
||||
static int sd_wav_play_init(audio_dev_t *audio_dev, const TCHAR *path)
|
||||
{
|
||||
unsigned int num;
|
||||
int res;
|
||||
uint8_t buff[1024];
|
||||
|
||||
audio_dev->buff_using = 1;
|
||||
audio_dev->device = (struct device *)NULL;
|
||||
audio_dev->audio_state = 0;
|
||||
|
||||
f_close(&Wav_Fp);
|
||||
res = f_open(&Wav_Fp, path, FA_READ);
|
||||
|
||||
res |= f_lseek(&Wav_Fp, 0);
|
||||
res |= f_read(&Wav_Fp, buff, sizeof(buff), &num);
|
||||
|
||||
if (res != FR_OK) {
|
||||
MSG("wav file open error\r\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Parse the WAV file */
|
||||
res = wav_data_parser(buff, &Wav_Information);
|
||||
|
||||
if (res == 0) {
|
||||
audio_dev->wav_information = &Wav_Information;
|
||||
/*
|
||||
MSG("RIFF_offset: %d\r\n", Wav_Information.chunk_riff_offset);
|
||||
MSG("format_offset:%d\r\n", Wav_Information.chunk_format_offset);
|
||||
MSG("fact_offset: %d\r\n", Wav_Information.chunk_fact_offset);
|
||||
MSG("data_offset: %d\r\n", Wav_Information.chunk_data_offset);
|
||||
*/
|
||||
} else {
|
||||
MSG("wav file parse error\r\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
audio_dev->device = device_find("I2S");
|
||||
|
||||
if (audio_dev->device) {
|
||||
device_close(audio_dev->device);
|
||||
} else {
|
||||
i2s_register(I2S0_INDEX, "I2S", DEVICE_OFLAG_RDWR);
|
||||
audio_dev->device = device_find("I2S");
|
||||
}
|
||||
|
||||
struct device *dma_ch2 = device_find("i2s_ch2");
|
||||
|
||||
if (dma_ch2) {
|
||||
device_close(dma_ch2);
|
||||
} else {
|
||||
dma_register(DMA0_CH2_INDEX, "i2s_ch2", DEVICE_OFLAG_RDWR);
|
||||
dma_ch2 = device_find("i2s_ch2");
|
||||
}
|
||||
|
||||
if ((audio_dev->device) && dma_ch2) {
|
||||
/* I2S Config */
|
||||
((i2s_device_t *)(audio_dev->device))->interface_mode = I2S_MODE_LEFT;
|
||||
((i2s_device_t *)(audio_dev->device))->sampl_freq_hz = audio_dev->wav_information->chunk_format.sample_rate;
|
||||
((i2s_device_t *)(audio_dev->device))->channel_num = audio_dev->wav_information->chunk_format.num_of_channels;
|
||||
uint8_t pcm_w = audio_dev->wav_information->chunk_format.bits_per_sample / 8;
|
||||
|
||||
if (pcm_w <= 2) {
|
||||
((i2s_device_t *)(audio_dev->device))->frame_size = I2S_FRAME_LEN_16;
|
||||
} else {
|
||||
((i2s_device_t *)(audio_dev->device))->frame_size = I2S_FRAME_LEN_32;
|
||||
}
|
||||
|
||||
((i2s_device_t *)(audio_dev->device))->data_size = ((i2s_device_t *)(audio_dev->device))->frame_size;
|
||||
((i2s_device_t *)(audio_dev->device))->fifo_threshold = 8;
|
||||
res = device_open((audio_dev->device), DEVICE_OFLAG_DMA_TX);
|
||||
|
||||
/* ES8388 Config */
|
||||
switch (((i2s_device_t *)(audio_dev->device))->data_size) {
|
||||
case I2S_FRAME_LEN_16:
|
||||
ES8388Cfg.data_width = ES8388_DATA_LEN_16;
|
||||
break;
|
||||
|
||||
case I2S_FRAME_LEN_24:
|
||||
ES8388Cfg.data_width = ES8388_DATA_LEN_24;
|
||||
break;
|
||||
|
||||
case I2S_FRAME_LEN_32:
|
||||
ES8388Cfg.data_width = ES8388_DATA_LEN_32;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
ES8388_Init(&ES8388Cfg);
|
||||
ES8388_Set_Voice_Volume(20);
|
||||
|
||||
MSG("sampl_freq_hz : %d\r\n", ((i2s_device_t *)(audio_dev->device))->sampl_freq_hz);
|
||||
MSG("channel_num : %d\r\n", ((i2s_device_t *)(audio_dev->device))->channel_num);
|
||||
MSG("data_size : %d\r\n", ((i2s_device_t *)(audio_dev->device))->data_size);
|
||||
|
||||
/* DMA Config */
|
||||
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||
((dma_device_t *)dma_ch2)->src_req = (uint32_t)NULL;
|
||||
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
||||
|
||||
switch (((i2s_device_t *)(audio_dev->device))->data_size * ((i2s_device_t *)(audio_dev->device))->channel_num) {
|
||||
case I2S_DATA_LEN_8:
|
||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_8BIT;
|
||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_8BIT;
|
||||
break;
|
||||
|
||||
case I2S_DATA_LEN_16:
|
||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
break;
|
||||
|
||||
default:
|
||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||
break;
|
||||
}
|
||||
|
||||
device_open(dma_ch2, 0);
|
||||
device_set_callback(dma_ch2, dma_ch2_irq_callback);
|
||||
device_control(dma_ch2, DEVICE_CTRL_SET_INT, NULL);
|
||||
device_control((audio_dev->device), DEVICE_CTRL_I2S_ATTACH_TX_DMA, (void *)dma_ch2);
|
||||
|
||||
/* Fill data frist*/
|
||||
f_lseek(&Wav_Fp, audio_dev->wav_information->chunk_data_offset + sizeof(chunk_data_t));
|
||||
|
||||
if (audio_dev->wav_information->chunk_format.bits_per_sample / 8 == 3) {
|
||||
f_read(&Wav_Fp, audio_dev->buff[0], audio_dev->buff_size_max / 4 * 3, &num);
|
||||
audio_dev->buff_data_size[0] = pcm_24bit_to_32bit(audio_dev->buff[0], num);
|
||||
f_read(&Wav_Fp, audio_dev->buff[1], audio_dev->buff_size_max / 4 * 3, &num);
|
||||
audio_dev->buff_data_size[1] = pcm_24bit_to_32bit(audio_dev->buff[1], num);
|
||||
} else {
|
||||
f_read(&Wav_Fp, audio_dev->buff[0], audio_dev->buff_size_max, &num);
|
||||
audio_dev->buff_data_size[0] = num;
|
||||
f_read(&Wav_Fp, audio_dev->buff[1], audio_dev->buff_size_max, &num);
|
||||
audio_dev->buff_data_size[1] = num;
|
||||
}
|
||||
|
||||
audio_dev->audio_state = 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sd_wav_play_control(struct audio_dev *audio_dev, AUDIO_CMD_t cmd, void *args)
|
||||
{
|
||||
int res = -1;
|
||||
|
||||
switch (cmd) {
|
||||
case AUDIO_CMD_START:
|
||||
if (audio_dev->audio_state) {
|
||||
res = device_write(audio_dev->device, 0, audio_dev->buff[!audio_dev->buff_using], audio_dev->buff_data_size[!audio_dev->buff_using]);
|
||||
audio_dev->audio_state = 2;
|
||||
res = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AUDIO_CMD_STOP:
|
||||
if (audio_dev->audio_state) {
|
||||
audio_dev->audio_state = 1;
|
||||
res = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AUDIO_CMD_VOLUME:
|
||||
if (audio_dev->audio_state) {
|
||||
res = ES8388_Set_Voice_Volume((uint32_t)args);
|
||||
res = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int sd_wav_play_callback(audio_dev_t *audio_dev)
|
||||
{
|
||||
unsigned int num = 0;
|
||||
uint8_t buff_using = audio_dev->buff_using;
|
||||
|
||||
if (audio_dev->buff_data_size[!buff_using]) {
|
||||
/* start i2s-dma */
|
||||
if (audio_dev->audio_state == 2 && audio_dev->buff[!buff_using]) {
|
||||
device_write(audio_dev->device, 0, audio_dev->buff[!buff_using], audio_dev->buff_data_size[!buff_using]);
|
||||
audio_dev->buff_using = !buff_using;
|
||||
}
|
||||
|
||||
/* fill data */
|
||||
if (audio_dev->wav_information->chunk_format.bits_per_sample / 8 == 3) {
|
||||
f_read(&Wav_Fp, audio_dev->buff[buff_using], audio_dev->buff_size_max / 4 * 3, &num);
|
||||
num = pcm_24bit_to_32bit(audio_dev->buff[buff_using], num);
|
||||
} else {
|
||||
f_read(&Wav_Fp, audio_dev->buff[buff_using], audio_dev->buff_size_max, &num);
|
||||
}
|
||||
|
||||
audio_dev->buff_data_size[buff_using] = num;
|
||||
}
|
||||
|
||||
/* play end, refill the buff for next time*/
|
||||
if (num == 0 && audio_dev->buff_data_size[!buff_using] == 0) {
|
||||
f_lseek(&Wav_Fp, audio_dev->wav_information->chunk_data_offset + sizeof(chunk_data_t));
|
||||
|
||||
if (audio_dev->wav_information->chunk_format.bits_per_sample / 8 == 3) {
|
||||
f_read(&Wav_Fp, audio_dev->buff[0], audio_dev->buff_size_max / 4 * 3, &num);
|
||||
audio_dev->buff_data_size[0] = pcm_24bit_to_32bit(audio_dev->buff[0], num);
|
||||
f_read(&Wav_Fp, audio_dev->buff[1], audio_dev->buff_size_max / 4 * 3, &num);
|
||||
audio_dev->buff_data_size[1] = pcm_24bit_to_32bit(audio_dev->buff[1], num);
|
||||
} else {
|
||||
f_read(&Wav_Fp, audio_dev->buff[0], audio_dev->buff_size_max, &num);
|
||||
audio_dev->buff_data_size[0] = num;
|
||||
f_read(&Wav_Fp, audio_dev->buff[1], audio_dev->buff_size_max, &num);
|
||||
audio_dev->buff_data_size[1] = num;
|
||||
}
|
||||
|
||||
audio_dev->audio_state = 1;
|
||||
MSG("End of the play\r\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_wav_play_register(audio_dev_t *audio_dev)
|
||||
{
|
||||
p_Audio_Dev = audio_dev;
|
||||
audio_dev->audio_init = sd_wav_play_init,
|
||||
audio_dev->audio_control = sd_wav_play_control,
|
||||
audio_dev->audio_callback = sd_wav_play_callback,
|
||||
|
||||
audio_dev->buff[0] = Data_Buff0;
|
||||
audio_dev->buff[1] = Data_Buff1;
|
||||
audio_dev->buff_data_size[0] = 0;
|
||||
audio_dev->buff_data_size[1] = 0;
|
||||
audio_dev->audio_state = 0;
|
||||
audio_dev->buff_size_max = sizeof(Data_Buff1);
|
||||
return 0;
|
||||
}
|
111
examples/i2s/i2s_play_from_sd/wav_play_from_sd_card.h
Normal file
111
examples/i2s/i2s_play_from_sd/wav_play_from_sd_card.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
/**
|
||||
* @file wav_play_form_sd_card.h
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __MAV_PLAY_H__
|
||||
#define __MAV_PLAY_H__
|
||||
|
||||
#include "hal_i2s.h"
|
||||
|
||||
//WAV文件块定义
|
||||
|
||||
/* RIFF (RIFF WAVE Chunk) */
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t chunk_id; /*chunk id:"RIFF",(0X46464952) */
|
||||
uint32_t chunk_size; /*file size -8 */
|
||||
uint32_t format; /* "WAVE" (0X45564157) */
|
||||
} chunk_riff_t;
|
||||
|
||||
/* fmt (Format Chunk)*/
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t chunk_id; /* chunk id:"fmt",(0X20746D66) */
|
||||
uint32_t chunk_size; /* fmt size -8 = 20*/
|
||||
uint16_t audio_format; /* 音频格式;0X10,表示线性 PCM; 0X11 表示 IMA ADPCM */
|
||||
uint16_t num_of_channels; /* 通道数量;1,表示单声道;2,表示双声道*/
|
||||
uint32_t sample_rate; /* 采样率;0X1F40,表示 8Khz */
|
||||
uint32_t byte_rate; /* 字节速率 */
|
||||
uint16_t block_align; /*块对齐(字节)*/
|
||||
uint16_t bits_per_sample; /*单个采样数据大小;4 位 ADPCM,设置为 4*/
|
||||
} chunk_format_t;
|
||||
|
||||
//fact (Fact Chunk)
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t chunk_id; //chunk id;这里固定为"fact",即 0X74636166;
|
||||
uint32_t chunk_size; //子集合大小(不包括 ID 和 Size);这里为:4.
|
||||
uint32_t data_fact_size; //数据转换为 PCM 格式后的大小
|
||||
} chunk_fact_t;
|
||||
|
||||
//data (Data Chunk)
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint32_t chunk_id; //chunk id;这里固定为"data",即 0X61746164
|
||||
uint32_t chunk_size; //子集合大小(不包括 ID 和 Size);文件大小-60.
|
||||
} chunk_data_t;
|
||||
|
||||
//
|
||||
typedef enum {
|
||||
CHUNK_RIFF,
|
||||
CHUNK_FORMAT,
|
||||
CHUNK_FACT,
|
||||
CHUNK_DATA,
|
||||
} mav_chunk_t;
|
||||
|
||||
//.wav information
|
||||
typedef struct
|
||||
{
|
||||
int chunk_riff_offset; //在数据里的位置偏移,-1表示没有此块
|
||||
chunk_riff_t chunk_riff;
|
||||
int chunk_format_offset;
|
||||
chunk_format_t chunk_format;
|
||||
int chunk_fact_offset;
|
||||
chunk_fact_t chunk_fact;
|
||||
int chunk_data_offset;
|
||||
chunk_data_t chunk_data;
|
||||
} wav_information_t;
|
||||
|
||||
typedef enum {
|
||||
AUDIO_CMD_START,
|
||||
AUDIO_CMD_STOP,
|
||||
AUDIO_CMD_VOLUME,
|
||||
} AUDIO_CMD_t;
|
||||
|
||||
//播放控制块
|
||||
typedef struct audio_dev {
|
||||
uint8_t *buff[2];
|
||||
uint32_t buff_data_size[2]; //buff内数据长度
|
||||
uint32_t buff_size_max; //buff的大小
|
||||
uint8_t buff_using; //正在使用的buff
|
||||
|
||||
uint8_t audio_state; //状态
|
||||
uint8_t audio_type; //类型
|
||||
|
||||
int (*audio_init)(struct audio_dev *audio_dev, const TCHAR *path);
|
||||
int (*audio_control)(struct audio_dev *audio_dev, AUDIO_CMD_t cmd, void *args);
|
||||
|
||||
int (*audio_callback)(struct audio_dev *audio_dev); //中断回调函数,用来重新装载buff,
|
||||
|
||||
struct device *device; //i2s的device,可以考虑换成指向其他外设
|
||||
wav_information_t *wav_information; //wav信息结构体,可以考虑换成一个共用体指向其他音乐格式数据
|
||||
} audio_dev_t;
|
||||
|
||||
int sd_wav_play_register(audio_dev_t *audio_dev);
|
||||
|
||||
#endif
|
|
@ -53,12 +53,12 @@ int main(void)
|
|||
|
||||
MSG("memheap test\r\n");
|
||||
if (!memheap_test()) {
|
||||
MSG("memheap test success\r\n");
|
||||
BL_CASE_SUCCESS;
|
||||
} else {
|
||||
MSG("memheap test failed\r\n");
|
||||
BL_CASE_FAIL;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -202,7 +202,11 @@ int main(void)
|
|||
MSG("DSA verify time=%dms\r\n", (unsigned int)bflb_platform_get_time_ms());
|
||||
|
||||
MSG("Finished\r\n");
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
||||
/*@} end of group SEC_DSA_Private_Functions */
|
||||
|
|
|
@ -184,6 +184,9 @@ int main(void)
|
|||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
||||
/*@} end of group SEC_ECDH_Private_Functions */
|
||||
|
|
|
@ -213,6 +213,9 @@ int main(void)
|
|||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
||||
/*@} end of group SEC_ECDSA_Private_Functions */
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE
|
||||
${BSP_COMMON_DIR}/il9341
|
||||
${BSP_COMMON_DIR}/touch )
|
||||
set(TARGET_REQUIRED_SRCS
|
||||
${BSP_COMMON_DIR}/il9341/bsp_il9341.c
|
||||
${BSP_COMMON_DIR}/touch/touch.c
|
||||
${BSP_COMMON_DIR}/touch/xpt2046.c)
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
||||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE
|
||||
${BSP_COMMON_DIR}/il9341
|
||||
${BSP_COMMON_DIR}/touch )
|
||||
set(TARGET_REQUIRED_SRCS
|
||||
${BSP_COMMON_DIR}/il9341/bsp_il9341.c
|
||||
${BSP_COMMON_DIR}/touch/touch.c
|
||||
${BSP_COMMON_DIR}/touch/xpt2046.c)
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -116,8 +116,10 @@ int main(void)
|
|||
MSG("pds wakeTim\r\n");
|
||||
MSG("hbn wakeTim\r\n\r\n");
|
||||
|
||||
while (1)
|
||||
;
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
||||
SHELL_CMD_EXPORT(wfi, enter wfi mode)
|
||||
|
|
|
@ -167,7 +167,7 @@ int main(void)
|
|||
BL_Err_Type stat;
|
||||
bflb_platform_init(0);
|
||||
|
||||
MSG("PSRAM write read case \n");
|
||||
MSG("PSRAM write read case \r\n");
|
||||
|
||||
bsp_sf_psram_init(1);
|
||||
bsp_sf_psram_read_id(psram_id);
|
||||
|
@ -178,14 +178,12 @@ int main(void)
|
|||
stat = Psram_Random_Write_Read();
|
||||
|
||||
if (stat == ERROR) {
|
||||
MSG("psram random write read fail\n");
|
||||
BL_CASE_FAIL;
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
L1C_Cache_Hit_Count_Get(&hitCountLow, &hitCountHigh);
|
||||
missCount = L1C_Cache_Miss_Count_Get();
|
||||
MSG("Hit count low=%08x, high=%08x, Miss count=%08x\r\n", hitCountLow, hitCountHigh, missCount);
|
||||
MSG("System time%dms\r\n", bflb_platform_get_time_ms());
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -39,10 +39,9 @@ void test32(void)
|
|||
MSG("addr = 0x%08X, val = 0x%08X\r\n", (BSP_PSRAM_BASE + i), *((volatile uint32_t *)(BSP_PSRAM_BASE + i)));
|
||||
|
||||
if (i / 4 != val) {
|
||||
MSG("Error!\r\n");
|
||||
|
||||
while (1)
|
||||
;
|
||||
BL_CASE_FAIL;
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,10 +60,9 @@ void test8(void)
|
|||
MSG("addr = 0x%08X, val = 0x%08X\r\n", (BSP_PSRAM_BASE + i), *((volatile uint8_t *)(BSP_PSRAM_BASE + i)));
|
||||
|
||||
if ((uint8_t)i != val) {
|
||||
MSG("Error!\r\n");
|
||||
|
||||
while (1)
|
||||
;
|
||||
BL_CASE_FAIL;
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +82,7 @@ int main(void)
|
|||
test8();
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
|
||||
while (1)
|
||||
;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,87 +1,87 @@
|
|||
/**
|
||||
* @file pwm_dc_motor.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_pwm.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_clock.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
pwm_dutycycle_config_t pwm_cfg[2];
|
||||
|
||||
pwm_cfg[0].threshold_low = 0;
|
||||
pwm_cfg[0].threshold_high = 0;
|
||||
|
||||
pwm_cfg[1].threshold_low = 0;
|
||||
pwm_cfg[1].threshold_high = 0;
|
||||
|
||||
bflb_platform_init(0);
|
||||
|
||||
pwm_register(PWM_CH0_INDEX, "dc_motor_ch0", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH1_INDEX, "dc_motor_ch1", DEVICE_OFLAG_RDWR);
|
||||
|
||||
struct device *dc_motor_ch0 = device_find("dc_motor_ch0");
|
||||
struct device *dc_motor_ch1 = device_find("dc_motor_ch1");
|
||||
|
||||
if (dc_motor_ch0) {
|
||||
PWM_DEV(dc_motor_ch0)->period = 32; //frequence = 32K/1/32 = 1Khz
|
||||
PWM_DEV(dc_motor_ch0)->threshold_low = 16;
|
||||
PWM_DEV(dc_motor_ch0)->threshold_high = 32;
|
||||
device_open(dc_motor_ch0, DEVICE_OFLAG_STREAM_TX);
|
||||
pwm_channel_start(dc_motor_ch0);
|
||||
}
|
||||
if (dc_motor_ch1) {
|
||||
PWM_DEV(dc_motor_ch1)->period = 32; //frequence = 32K/1/32 = 1Khz
|
||||
PWM_DEV(dc_motor_ch1)->threshold_low = 16;
|
||||
PWM_DEV(dc_motor_ch1)->threshold_high = 32;
|
||||
device_open(dc_motor_ch1, DEVICE_OFLAG_STREAM_TX);
|
||||
pwm_channel_start(dc_motor_ch1);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
pwm_cfg[1].threshold_low = 0;
|
||||
pwm_cfg[1].threshold_high = 0;
|
||||
device_control(dc_motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
for (pwm_cfg[0].threshold_high = 16; pwm_cfg[0].threshold_high <= 32; pwm_cfg[0].threshold_high++) {
|
||||
device_control(dc_motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
|
||||
for (pwm_cfg[0].threshold_high = 32; 16 <= pwm_cfg[0].threshold_high && pwm_cfg[0].threshold_high <= 32; pwm_cfg[0].threshold_high--) {
|
||||
device_control(dc_motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
|
||||
pwm_cfg[0].threshold_low = 0;
|
||||
pwm_cfg[0].threshold_high = 0;
|
||||
device_control(dc_motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
for (pwm_cfg[1].threshold_high = 16; pwm_cfg[1].threshold_high <= 32; pwm_cfg[1].threshold_high++) {
|
||||
device_control(dc_motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
|
||||
for (pwm_cfg[1].threshold_high = 32; 16 <= pwm_cfg[1].threshold_high && pwm_cfg[1].threshold_high <= 32; pwm_cfg[1].threshold_high--) {
|
||||
device_control(dc_motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @file pwm_dc_motor.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_pwm.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_clock.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
pwm_dutycycle_config_t pwm_cfg[2];
|
||||
|
||||
pwm_cfg[0].threshold_low = 0;
|
||||
pwm_cfg[0].threshold_high = 0;
|
||||
|
||||
pwm_cfg[1].threshold_low = 0;
|
||||
pwm_cfg[1].threshold_high = 0;
|
||||
|
||||
bflb_platform_init(0);
|
||||
|
||||
pwm_register(PWM_CH0_INDEX, "dc_motor_ch0", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH1_INDEX, "dc_motor_ch1", DEVICE_OFLAG_RDWR);
|
||||
|
||||
struct device *dc_motor_ch0 = device_find("dc_motor_ch0");
|
||||
struct device *dc_motor_ch1 = device_find("dc_motor_ch1");
|
||||
|
||||
if (dc_motor_ch0) {
|
||||
PWM_DEV(dc_motor_ch0)->period = 32; //frequence = 32K/1/32 = 1Khz
|
||||
PWM_DEV(dc_motor_ch0)->threshold_low = 16;
|
||||
PWM_DEV(dc_motor_ch0)->threshold_high = 32;
|
||||
device_open(dc_motor_ch0, DEVICE_OFLAG_STREAM_TX);
|
||||
pwm_channel_start(dc_motor_ch0);
|
||||
}
|
||||
if (dc_motor_ch1) {
|
||||
PWM_DEV(dc_motor_ch1)->period = 32; //frequence = 32K/1/32 = 1Khz
|
||||
PWM_DEV(dc_motor_ch1)->threshold_low = 16;
|
||||
PWM_DEV(dc_motor_ch1)->threshold_high = 32;
|
||||
device_open(dc_motor_ch1, DEVICE_OFLAG_STREAM_TX);
|
||||
pwm_channel_start(dc_motor_ch1);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
pwm_cfg[1].threshold_low = 0;
|
||||
pwm_cfg[1].threshold_high = 0;
|
||||
device_control(dc_motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
for (pwm_cfg[0].threshold_high = 16; pwm_cfg[0].threshold_high <= 32; pwm_cfg[0].threshold_high++) {
|
||||
device_control(dc_motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
|
||||
for (pwm_cfg[0].threshold_high = 32; 16 <= pwm_cfg[0].threshold_high && pwm_cfg[0].threshold_high <= 32; pwm_cfg[0].threshold_high--) {
|
||||
device_control(dc_motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
|
||||
pwm_cfg[0].threshold_low = 0;
|
||||
pwm_cfg[0].threshold_high = 0;
|
||||
device_control(dc_motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
for (pwm_cfg[1].threshold_high = 16; pwm_cfg[1].threshold_high <= 32; pwm_cfg[1].threshold_high++) {
|
||||
device_control(dc_motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
|
||||
for (pwm_cfg[1].threshold_high = 32; 16 <= pwm_cfg[1].threshold_high && pwm_cfg[1].threshold_high <= 32; pwm_cfg[1].threshold_high--) {
|
||||
device_control(dc_motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
bflb_platform_delay_ms(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
**board/bl706_iot/pinmux_config.h** 中 **CONFIG_GPIO20_FUNC**、**CONFIG_GPIO21_FUNC** 选择 **GPIO_FUN_PWM**
|
||||
|
||||
**board/bl706_iot/clock_config.h** 中
|
||||
|
||||
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_RC_32K**,也可选择其他时钟源,用其他时钟源时应注意 case 中的设置要匹配
|
||||
- **BSP_PWM_CLOCK_DIV** 设置成 **1**
|
||||
|
||||
将两个通道分别接到 H 桥或半桥的两个通道
|
||||
|
||||
```bash
|
||||
|
||||
$ make APP=pwm_dc_motor BOARD=bl706_iot
|
||||
|
||||
```
|
||||
|
||||
**board/bl706_iot/pinmux_config.h** 中 **CONFIG_GPIO20_FUNC**、**CONFIG_GPIO21_FUNC** 选择 **GPIO_FUN_PWM**
|
||||
|
||||
**board/bl706_iot/clock_config.h** 中
|
||||
|
||||
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_RC_32K**,也可选择其他时钟源,用其他时钟源时应注意 case 中的设置要匹配
|
||||
- **BSP_PWM_CLOCK_DIV** 设置成 **1**
|
||||
|
||||
将两个通道分别接到 H 桥或半桥的两个通道
|
||||
|
||||
```bash
|
||||
|
||||
$ make APP=pwm_dc_motor BOARD=bl706_iot
|
||||
|
||||
```
|
||||
|
||||
**正常运行后,GPIO20 和 GPIO21 引脚分别先后输出 PWM 波**
|
|
@ -49,7 +49,8 @@ int main(void)
|
|||
pwm_channel_start(pwm);
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,139 +1,139 @@
|
|||
/**
|
||||
* @file pwm_step_motor.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_pwm.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_clock.h"
|
||||
/* 一二相励磁:八拍(A+B+,B+,B+A-,A-,A-B-,B-,B-A+,A+。。。。)
|
||||
___ ___ ___
|
||||
CH0 |___ ___ ___ ___ ___|
|
||||
___ ___ ___
|
||||
CH1 ___| |___ ___ ___ ___
|
||||
___ ___ ___
|
||||
CH2 ___ ___ ___| |___ ___
|
||||
___ ___ ___
|
||||
CH3 ___ ___ ___ ___ ___|
|
||||
|
||||
*/
|
||||
|
||||
struct device *motor_ch0;
|
||||
struct device *motor_ch1;
|
||||
struct device *motor_ch2;
|
||||
struct device *motor_ch3;
|
||||
|
||||
enum motor_dir_type {
|
||||
CW,
|
||||
CCW,
|
||||
STOP
|
||||
};
|
||||
|
||||
void motor_set_dir(enum motor_dir_type dir)
|
||||
{
|
||||
pwm_dutycycle_config_t pwm_cfg[4];
|
||||
|
||||
if (dir == CW) {
|
||||
pwm_cfg[0].threshold_low = 2;
|
||||
pwm_cfg[0].threshold_high = 7;
|
||||
pwm_cfg[1].threshold_low = 1;
|
||||
pwm_cfg[1].threshold_high = 4;
|
||||
pwm_cfg[2].threshold_low = 3;
|
||||
pwm_cfg[2].threshold_high = 6;
|
||||
pwm_cfg[3].threshold_low = 5;
|
||||
pwm_cfg[3].threshold_high = 8;
|
||||
}
|
||||
|
||||
else if (dir == CCW) {
|
||||
pwm_cfg[0].threshold_low = 2;
|
||||
pwm_cfg[0].threshold_high = 7;
|
||||
pwm_cfg[1].threshold_low = 5;
|
||||
pwm_cfg[1].threshold_high = 8;
|
||||
pwm_cfg[2].threshold_low = 3;
|
||||
pwm_cfg[2].threshold_high = 6;
|
||||
pwm_cfg[3].threshold_low = 1;
|
||||
pwm_cfg[3].threshold_high = 4;
|
||||
} else if (dir == STOP) {
|
||||
pwm_cfg[0].threshold_low = 0;
|
||||
pwm_cfg[0].threshold_high = 0;
|
||||
pwm_cfg[1].threshold_low = 0;
|
||||
pwm_cfg[1].threshold_high = 0;
|
||||
pwm_cfg[2].threshold_low = 0;
|
||||
pwm_cfg[2].threshold_high = 0;
|
||||
pwm_cfg[3].threshold_low = 0;
|
||||
pwm_cfg[3].threshold_high = 0;
|
||||
}
|
||||
device_control(motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
device_control(motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
device_control(motor_ch2, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[2]);
|
||||
device_control(motor_ch3, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[3]);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bflb_platform_init(0);
|
||||
|
||||
pwm_register(PWM_CH0_INDEX, "motor_ch0", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH1_INDEX, "motor_ch1", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH2_INDEX, "motor_ch2", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH3_INDEX, "motor_ch3", DEVICE_OFLAG_RDWR);
|
||||
|
||||
motor_ch0 = device_find("motor_ch0");
|
||||
motor_ch1 = device_find("motor_ch1");
|
||||
motor_ch2 = device_find("motor_ch2");
|
||||
motor_ch3 = device_find("motor_ch3");
|
||||
|
||||
if (motor_ch0) {
|
||||
PWM_DEV(motor_ch0)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch0)->threshold_low = 2;
|
||||
PWM_DEV(motor_ch0)->threshold_high = 7;
|
||||
PWM_DEV(motor_ch0)->polarity_invert_mode = ENABLE;
|
||||
device_open(motor_ch0, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
if (motor_ch1) {
|
||||
PWM_DEV(motor_ch1)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch1)->threshold_low = 1;
|
||||
PWM_DEV(motor_ch1)->threshold_high = 4;
|
||||
device_open(motor_ch1, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
if (motor_ch2) {
|
||||
PWM_DEV(motor_ch2)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch2)->threshold_low = 3;
|
||||
PWM_DEV(motor_ch2)->threshold_high = 6;
|
||||
device_open(motor_ch2, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
if (motor_ch3) {
|
||||
PWM_DEV(motor_ch3)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch3)->threshold_low = 5;
|
||||
PWM_DEV(motor_ch3)->threshold_high = 8;
|
||||
device_open(motor_ch3, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
pwm_channel_start(motor_ch0);
|
||||
pwm_channel_start(motor_ch1);
|
||||
pwm_channel_start(motor_ch2);
|
||||
pwm_channel_start(motor_ch3);
|
||||
|
||||
while (1) {
|
||||
motor_set_dir(CW);
|
||||
bflb_platform_delay_ms(5000);
|
||||
motor_set_dir(CCW);
|
||||
bflb_platform_delay_ms(5000);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @file pwm_step_motor.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_pwm.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_clock.h"
|
||||
/* 一二相励磁:八拍(A+B+,B+,B+A-,A-,A-B-,B-,B-A+,A+。。。。)
|
||||
___ ___ ___
|
||||
CH0 |___ ___ ___ ___ ___|
|
||||
___ ___ ___
|
||||
CH1 ___| |___ ___ ___ ___
|
||||
___ ___ ___
|
||||
CH2 ___ ___ ___| |___ ___
|
||||
___ ___ ___
|
||||
CH3 ___ ___ ___ ___ ___|
|
||||
|
||||
*/
|
||||
|
||||
struct device *motor_ch0;
|
||||
struct device *motor_ch1;
|
||||
struct device *motor_ch2;
|
||||
struct device *motor_ch3;
|
||||
|
||||
enum motor_dir_type {
|
||||
CW,
|
||||
CCW,
|
||||
STOP
|
||||
};
|
||||
|
||||
void motor_set_dir(enum motor_dir_type dir)
|
||||
{
|
||||
pwm_dutycycle_config_t pwm_cfg[4];
|
||||
|
||||
if (dir == CW) {
|
||||
pwm_cfg[0].threshold_low = 2;
|
||||
pwm_cfg[0].threshold_high = 7;
|
||||
pwm_cfg[1].threshold_low = 1;
|
||||
pwm_cfg[1].threshold_high = 4;
|
||||
pwm_cfg[2].threshold_low = 3;
|
||||
pwm_cfg[2].threshold_high = 6;
|
||||
pwm_cfg[3].threshold_low = 5;
|
||||
pwm_cfg[3].threshold_high = 8;
|
||||
}
|
||||
|
||||
else if (dir == CCW) {
|
||||
pwm_cfg[0].threshold_low = 2;
|
||||
pwm_cfg[0].threshold_high = 7;
|
||||
pwm_cfg[1].threshold_low = 5;
|
||||
pwm_cfg[1].threshold_high = 8;
|
||||
pwm_cfg[2].threshold_low = 3;
|
||||
pwm_cfg[2].threshold_high = 6;
|
||||
pwm_cfg[3].threshold_low = 1;
|
||||
pwm_cfg[3].threshold_high = 4;
|
||||
} else if (dir == STOP) {
|
||||
pwm_cfg[0].threshold_low = 0;
|
||||
pwm_cfg[0].threshold_high = 0;
|
||||
pwm_cfg[1].threshold_low = 0;
|
||||
pwm_cfg[1].threshold_high = 0;
|
||||
pwm_cfg[2].threshold_low = 0;
|
||||
pwm_cfg[2].threshold_high = 0;
|
||||
pwm_cfg[3].threshold_low = 0;
|
||||
pwm_cfg[3].threshold_high = 0;
|
||||
}
|
||||
device_control(motor_ch0, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[0]);
|
||||
device_control(motor_ch1, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[1]);
|
||||
device_control(motor_ch2, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[2]);
|
||||
device_control(motor_ch3, DEIVCE_CTRL_PWM_DUTYCYCLE_CONFIG, &pwm_cfg[3]);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bflb_platform_init(0);
|
||||
|
||||
pwm_register(PWM_CH0_INDEX, "motor_ch0", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH1_INDEX, "motor_ch1", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH2_INDEX, "motor_ch2", DEVICE_OFLAG_RDWR);
|
||||
pwm_register(PWM_CH3_INDEX, "motor_ch3", DEVICE_OFLAG_RDWR);
|
||||
|
||||
motor_ch0 = device_find("motor_ch0");
|
||||
motor_ch1 = device_find("motor_ch1");
|
||||
motor_ch2 = device_find("motor_ch2");
|
||||
motor_ch3 = device_find("motor_ch3");
|
||||
|
||||
if (motor_ch0) {
|
||||
PWM_DEV(motor_ch0)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch0)->threshold_low = 2;
|
||||
PWM_DEV(motor_ch0)->threshold_high = 7;
|
||||
PWM_DEV(motor_ch0)->polarity_invert_mode = ENABLE;
|
||||
device_open(motor_ch0, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
if (motor_ch1) {
|
||||
PWM_DEV(motor_ch1)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch1)->threshold_low = 1;
|
||||
PWM_DEV(motor_ch1)->threshold_high = 4;
|
||||
device_open(motor_ch1, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
if (motor_ch2) {
|
||||
PWM_DEV(motor_ch2)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch2)->threshold_low = 3;
|
||||
PWM_DEV(motor_ch2)->threshold_high = 6;
|
||||
device_open(motor_ch2, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
if (motor_ch3) {
|
||||
PWM_DEV(motor_ch3)->period = 8; //frequence = 32K/32/8 = 125hz
|
||||
PWM_DEV(motor_ch3)->threshold_low = 5;
|
||||
PWM_DEV(motor_ch3)->threshold_high = 8;
|
||||
device_open(motor_ch3, DEVICE_OFLAG_STREAM_TX);
|
||||
}
|
||||
pwm_channel_start(motor_ch0);
|
||||
pwm_channel_start(motor_ch1);
|
||||
pwm_channel_start(motor_ch2);
|
||||
pwm_channel_start(motor_ch3);
|
||||
|
||||
while (1) {
|
||||
motor_set_dir(CW);
|
||||
bflb_platform_delay_ms(5000);
|
||||
motor_set_dir(CCW);
|
||||
bflb_platform_delay_ms(5000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
**board/bl706_iot/pinmux_config.h** 中, 以下宏设置成 **GPIO_FUN_PWM**
|
||||
|
||||
- **CONFIG_GPIO10_FUNC**
|
||||
- **CONFIG_GPIO11_FUNC**
|
||||
- **CONFIG_GPIO12_FUNC**
|
||||
- **CONFIG_GPIO3_FUNC**
|
||||
|
||||
**board/bl706_iot/clock_config.h** 中
|
||||
|
||||
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_RC_32K**,
|
||||
- **BSP_PWM_CLOCK_DIV** 设置成 **32**
|
||||
|
||||
```bash
|
||||
|
||||
$ make APP=pwm_it BOARD=bl706_iot
|
||||
|
||||
**board/bl706_iot/pinmux_config.h** 中, 以下宏设置成 **GPIO_FUN_PWM**
|
||||
|
||||
- **CONFIG_GPIO10_FUNC**
|
||||
- **CONFIG_GPIO11_FUNC**
|
||||
- **CONFIG_GPIO12_FUNC**
|
||||
- **CONFIG_GPIO3_FUNC**
|
||||
|
||||
**board/bl706_iot/clock_config.h** 中
|
||||
|
||||
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_RC_32K**,
|
||||
- **BSP_PWM_CLOCK_DIV** 设置成 **32**
|
||||
|
||||
```bash
|
||||
|
||||
$ make APP=pwm_it BOARD=bl706_iot
|
||||
|
||||
```
|
|
@ -42,8 +42,9 @@ int main(void)
|
|||
device_control(uart, DEVICE_CTRL_SET_INT, (void *)(UART_RX_FIFO_IT));
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -229,7 +229,9 @@ int main(void)
|
|||
/*unmount*/
|
||||
f_mount(NULL, "1:", 1);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ void main(void)
|
|||
device_write(uart, 0, (uint8_t *)(&image[i * 104]), 104);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
6
examples/spi/spi_i2s_mono_play/CMakeLists.txt
Normal file
6
examples/spi/spi_i2s_mono_play/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
640071
examples/spi/spi_i2s_mono_play/fhm_onechannel_16k_20.h
Normal file
640071
examples/spi/spi_i2s_mono_play/fhm_onechannel_16k_20.h
Normal file
File diff suppressed because it is too large
Load diff
277
examples/spi/spi_i2s_mono_play/main.c
Normal file
277
examples/spi/spi_i2s_mono_play/main.c
Normal file
|
@ -0,0 +1,277 @@
|
|||
/**
|
||||
* @file main.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_spi.h"
|
||||
#include "hal_i2c.h"
|
||||
#include "hal_uart.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_dma.h"
|
||||
#include "fhm_onechannel_16k_20.h"
|
||||
|
||||
#define SPI0_CS GPIO_PIN_10
|
||||
#define ES8374_SLAVE_ADDR 0x10
|
||||
|
||||
typedef struct audio_dev {
|
||||
uint8_t *buff1;
|
||||
uint8_t *buff2;
|
||||
uint32_t buff1_data_size;
|
||||
uint32_t buff2_data_size;
|
||||
uint32_t buff_size_max;
|
||||
uint8_t buff_using;
|
||||
|
||||
uint8_t audio_state;
|
||||
uint8_t audio_type;
|
||||
|
||||
int (*audio_init)(struct audio_dev *audio_dev);
|
||||
int (*audio_control)(struct audio_dev *audio_dev, int cmd, void *args);
|
||||
|
||||
int (*audio_callback)(struct audio_dev *audio_dev);
|
||||
struct device *device;
|
||||
} audio_dev_t;
|
||||
|
||||
int record_callback(audio_dev_t *audio_dev);
|
||||
|
||||
audio_dev_t Audio_Dev = { 0 };
|
||||
|
||||
struct device *spi0;
|
||||
struct device *i2c0;
|
||||
struct device *dma_ch2; //spi tx
|
||||
|
||||
uint8_t test_buff[4 * 1024];
|
||||
|
||||
void dma_ch2_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
||||
{
|
||||
record_callback(&Audio_Dev);
|
||||
}
|
||||
|
||||
uint8_t spi_init(void)
|
||||
{
|
||||
spi_register(SPI0_INDEX, "spi0", DEVICE_OFLAG_RDWR);
|
||||
dma_register(DMA0_CH3_INDEX, "ch2", DEVICE_OFLAG_RDWR);
|
||||
spi0 = device_find("spi0");
|
||||
|
||||
if (spi0) {
|
||||
((spi_device_t *)spi0)->mode = SPI_SLVAE_MODE;
|
||||
((spi_device_t *)spi0)->direction = SPI_MSB_BYTE0_DIRECTION_FIRST;
|
||||
((spi_device_t *)spi0)->clk_polaraity = SPI_POLARITY_HIGH;
|
||||
((spi_device_t *)spi0)->datasize = SPI_DATASIZE_16BIT;
|
||||
((spi_device_t *)spi0)->clk_phase = SPI_PHASE_1EDGE;
|
||||
((spi_device_t *)spi0)->fifo_threshold = 2;
|
||||
|
||||
device_open(spi0, DEVICE_OFLAG_DMA_TX);
|
||||
}
|
||||
|
||||
dma_ch2 = device_find("ch2");
|
||||
|
||||
if (dma_ch2) {
|
||||
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||
((dma_device_t *)dma_ch2)->src_req = DMA_REQUEST_NONE;
|
||||
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_SPI0_TX;
|
||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
device_open(dma_ch2, 0);
|
||||
device_set_callback(dma_ch2, dma_ch2_irq_callback);
|
||||
device_control(dma_ch2, DEVICE_CTRL_SET_INT, NULL);
|
||||
device_control(spi0, DEVICE_CTRL_ATTACH_TX_DMA, dma_ch2);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void i2c_init(void)
|
||||
{
|
||||
i2c_register(I2C0_INDEX, "i2c", DEVICE_OFLAG_RDWR);
|
||||
i2c0 = device_find("i2c");
|
||||
|
||||
if (i2c0) {
|
||||
((i2c_device_t *)i2c0)->id = 0;
|
||||
((i2c_device_t *)i2c0)->mode = I2C_HW_MODE;
|
||||
((i2c_device_t *)i2c0)->phase = 15;
|
||||
device_open(i2c0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int es8374_write_reg(uint8_t addr, uint8_t data)
|
||||
{
|
||||
i2c_msg_t msg1;
|
||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
||||
msg1.len = 1,
|
||||
msg1.buf = &data;
|
||||
msg1.flags = SUB_ADDR_1BYTE | I2C_WR;
|
||||
msg1.subaddr = addr;
|
||||
bflb_platform_delay_ms(10);
|
||||
return i2c_transfer(i2c0, &msg1, 1);
|
||||
}
|
||||
|
||||
BL_Err_Type es8388_read_reg(uint8_t addr, uint8_t *rdata)
|
||||
{
|
||||
i2c_msg_t msg1;
|
||||
msg1.len = 1,
|
||||
msg1.buf = rdata;
|
||||
msg1.subaddr = addr;
|
||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
||||
msg1.flags = SUB_ADDR_1BYTE | I2C_RD;
|
||||
return i2c_transfer(i2c0, &msg1, 1);
|
||||
}
|
||||
|
||||
uint8_t es8374_config_master(void)
|
||||
{
|
||||
es8374_write_reg(0x00, 0x3F);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x00, 0x03);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x01, 0x7F);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x05, 0x11);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x6F, 0xA0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x72, 0x41);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x09, 0x01);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0C, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0D, 0x13);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0E, 0xE0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0A, 0x3A);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0B, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x09, 0x41);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x24, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x36, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x12, 0x30);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x13, 0x20);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x21, 0x50);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x22, 0x55);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x21, 0x24);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x00, 0x80);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x14, 0x8A);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x15, 0x40);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1A, 0xA0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1B, 0x19);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1C, 0x90);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1D, 0x2B);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1F, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1E, 0xA0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x28, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x25, 0x1F);
|
||||
bflb_platform_delay_ms(10); //增益
|
||||
es8374_write_reg(0x38, 0x00);
|
||||
bflb_platform_delay_ms(10); //DAC音量
|
||||
es8374_write_reg(0x37, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x6D, 0x60);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x03, 0x20);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x06, 0x03);
|
||||
bflb_platform_delay_ms(10); // 0x0600 ---8K sample. 0x0300 -16K
|
||||
es8374_write_reg(0x07, 0x00);
|
||||
bflb_platform_delay_ms(10); //
|
||||
es8374_write_reg(0x0F, 0x95);
|
||||
bflb_platform_delay_ms(10); //0x9D 8K 0x95 16K
|
||||
es8374_write_reg(0x10, 0x0D);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x11, 0x0D);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x02, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t es8374_config_dump(void)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
uint8_t val = 0;
|
||||
|
||||
for (i = 0; i < 0X6D; i++) {
|
||||
es8388_read_reg(i, &val);
|
||||
MSG("0x%x = 0x%x\r\n", i, val);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int record_init(audio_dev_t *audio_dev)
|
||||
{
|
||||
audio_dev->buff1 = (void *)fhm_onechannel_16k_20;
|
||||
audio_dev->buff_size_max = sizeof(fhm_onechannel_16k_20);
|
||||
audio_dev->buff1_data_size = sizeof(fhm_onechannel_16k_20);
|
||||
audio_dev->audio_state = 1;
|
||||
|
||||
i2c_init();
|
||||
es8374_config_master();
|
||||
//es8374_config_dump();
|
||||
//memset(test_buff,0x55,sizeof(test_buff));
|
||||
|
||||
spi_init();
|
||||
MSG("play start\r\n");
|
||||
device_write(spi0, 0, audio_dev->buff1, audio_dev->buff1_data_size);
|
||||
audio_dev->buff_using = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int record_callback(audio_dev_t *audio_dev)
|
||||
{
|
||||
MSG("play end\r\n");
|
||||
MSG("play start\r\n");
|
||||
device_write(spi0, 0, audio_dev->buff1, audio_dev->buff1_data_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bflb_platform_init(0);
|
||||
|
||||
MSG("spi_i2s_record case \r\n");
|
||||
|
||||
record_init(&Audio_Dev);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
7
examples/spi/spi_i2s_mono_play/readme.md
Normal file
7
examples/spi/spi_i2s_mono_play/readme.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
**board/bl706_avb/pinmux_config.h** 中 **PINMUX_SELECT** 选择 **PINMUX_LVGL**
|
||||
|
||||
```bash
|
||||
|
||||
$ make APP=spi_i2s_mono_play BOARD=bl706_avb
|
||||
|
||||
```
|
9
examples/spi/spi_i2s_mono_record/CMakeLists.txt
Normal file
9
examples/spi/spi_i2s_mono_record/CMakeLists.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||
set(TARGET_REQUIRED_LIBS fatfs)
|
||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/es8388)
|
||||
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/es8388/bsp_es8388.c)
|
||||
set(mains main.c)
|
||||
generate_bin()
|
||||
|
||||
|
||||
|
365
examples/spi/spi_i2s_mono_record/main.c
Normal file
365
examples/spi/spi_i2s_mono_record/main.c
Normal file
|
@ -0,0 +1,365 @@
|
|||
/**
|
||||
* @file main.c
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2021 Bouffalolab team
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "hal_spi.h"
|
||||
#include "hal_i2c.h"
|
||||
#include "hal_uart.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_dma.h"
|
||||
|
||||
#define SPI0_CS GPIO_PIN_10
|
||||
#define ES8374_SLAVE_ADDR 0x10
|
||||
|
||||
//播放控制块
|
||||
typedef struct audio_dev {
|
||||
uint8_t *buff1;
|
||||
uint8_t *buff2;
|
||||
uint32_t buff1_data_size; //buff1内数据长度
|
||||
uint32_t buff2_data_size; //buff1内数据长度
|
||||
uint32_t buff_size_max; //buff的大小
|
||||
uint8_t buff_using; //正在使用的buff
|
||||
|
||||
uint8_t audio_state; //状态
|
||||
uint8_t audio_type; //类型
|
||||
|
||||
int (*audio_init)(struct audio_dev *audio_dev); //初始化函数
|
||||
int (*audio_control)(struct audio_dev *audio_dev, int cmd, void *args);
|
||||
|
||||
int (*audio_callback)(struct audio_dev *audio_dev); //中断回调函数,用来重新装载buff,
|
||||
|
||||
struct device *device; //i2s的device,可以考虑换成指向其他外设
|
||||
//wav_information_t *wav_information; //wav信息结构体,可以考虑换成一个共用体指向其他音乐格式数据
|
||||
} audio_dev_t;
|
||||
|
||||
int record_callback(audio_dev_t *audio_dev);
|
||||
|
||||
audio_dev_t Audio_Dev = { 0 };
|
||||
|
||||
struct device *spi0;
|
||||
struct device *i2c0;
|
||||
struct device *uart0;
|
||||
struct device *dma_ch2; //uart tx
|
||||
struct device *dma_ch3; //spi rx
|
||||
|
||||
uint8_t buff1[2 * 1024] __attribute__((section(".system_ram"), aligned(4)));
|
||||
uint8_t buff2[2 * 1024] __attribute__((section(".system_ram"), aligned(4)));
|
||||
|
||||
int record_callback(audio_dev_t *audio_dev);
|
||||
|
||||
void dma_ch3_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
||||
{
|
||||
Audio_Dev.audio_callback(&Audio_Dev);
|
||||
}
|
||||
|
||||
void uart0_rx_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
||||
{
|
||||
if (state == UART_EVENT_RX_FIFO) {
|
||||
if (memcmp((uint8_t *)args, "start record\r\n", 14) == 0) {
|
||||
//MSG("start recording...\r\n");
|
||||
Audio_Dev.audio_state = 1;
|
||||
} else if (memcmp((uint8_t *)args, "stop record\r\n", 14) == 0) {
|
||||
//MSG("stop recording...\r\n");
|
||||
Audio_Dev.audio_state = 0;
|
||||
} else {
|
||||
//MSG("error code...\r\n");
|
||||
}
|
||||
} else if (state == UART_EVENT_RTO) {
|
||||
if (memcmp((uint8_t *)args, "start record\r\n", 14) == 0) {
|
||||
//MSG("start recording...\r\n");
|
||||
Audio_Dev.audio_state = 1;
|
||||
} else if (memcmp((uint8_t *)args, "stop record\r\n", 14) == 0) {
|
||||
//MSG("stop recording...\r\n");
|
||||
Audio_Dev.audio_state = 0;
|
||||
} else {
|
||||
//MSG("error code...\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t spi_init(void)
|
||||
{
|
||||
spi_register(SPI0_INDEX, "spi0", DEVICE_OFLAG_RDWR);
|
||||
dma_register(DMA0_CH3_INDEX, "ch3", DEVICE_OFLAG_RDWR);
|
||||
spi0 = device_find("spi0");
|
||||
|
||||
if (spi0) {
|
||||
((spi_device_t *)spi0)->mode = SPI_SLVAE_MODE;
|
||||
((spi_device_t *)spi0)->direction = SPI_MSB_BYTE0_DIRECTION_FIRST;
|
||||
((spi_device_t *)spi0)->clk_polaraity = SPI_POLARITY_LOW;
|
||||
((spi_device_t *)spi0)->datasize = SPI_DATASIZE_16BIT;
|
||||
((spi_device_t *)spi0)->clk_polaraity = SPI_POLARITY_LOW;
|
||||
((spi_device_t *)spi0)->clk_phase = SPI_PHASE_1EDGE;
|
||||
((spi_device_t *)spi0)->fifo_threshold = 2;
|
||||
|
||||
device_open(spi0, DEVICE_OFLAG_DMA_RX);
|
||||
}
|
||||
|
||||
dma_ch3 = device_find("ch3");
|
||||
|
||||
if (dma_ch3) {
|
||||
((dma_device_t *)dma_ch3)->direction = DMA_PERIPH_TO_MEMORY;
|
||||
((dma_device_t *)dma_ch3)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||
((dma_device_t *)dma_ch3)->src_req = DMA_REQUEST_SPI0_RX;
|
||||
((dma_device_t *)dma_ch3)->dst_req = DMA_REQUEST_NONE;
|
||||
((dma_device_t *)dma_ch3)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
((dma_device_t *)dma_ch3)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||
device_open(dma_ch3, 0);
|
||||
device_set_callback(dma_ch3, dma_ch3_irq_callback);
|
||||
device_control(dma_ch3, DEVICE_CTRL_SET_INT, NULL);
|
||||
device_control(spi0, DEVICE_CTRL_ATTACH_RX_DMA, dma_ch3);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void uart_init(void)
|
||||
{
|
||||
dma_register(DMA0_CH2_INDEX, "ch2", DEVICE_OFLAG_RDWR);
|
||||
uart0 = device_find("debug_log");
|
||||
|
||||
if (uart0) {
|
||||
device_close(uart0);
|
||||
} else {
|
||||
uart_register(UART0_INDEX, "debug_log", DEVICE_OFLAG_RDWR);
|
||||
}
|
||||
|
||||
uart0 = device_find("debug_log");
|
||||
|
||||
if (uart0) {
|
||||
((uart_device_t *)uart0)->baudrate = 2000000;
|
||||
((uart_device_t *)uart0)->fifo_threshold = 64;
|
||||
device_open(uart0, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_INT_RX);
|
||||
device_set_callback(uart0, uart0_rx_irq_callback);
|
||||
device_control(uart0, DEVICE_CTRL_SET_INT, (void *)(UART_RX_FIFO_IT | UART_RTO_IT));
|
||||
}
|
||||
|
||||
dma_ch2 = device_find("ch2");
|
||||
|
||||
if (dma_ch2) {
|
||||
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||
((dma_device_t *)dma_ch2)->src_req = DMA_REQUEST_NONE;
|
||||
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_UART0_TX;
|
||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_8BIT;
|
||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_8BIT;
|
||||
device_open(dma_ch2, 0);
|
||||
device_set_callback(dma_ch2, NULL);
|
||||
device_control(dma_ch2, DEVICE_CTRL_CLR_INT, NULL);
|
||||
|
||||
device_control(uart0, DEVICE_CTRL_ATTACH_TX_DMA, dma_ch2);
|
||||
}
|
||||
}
|
||||
|
||||
void i2c_init(void)
|
||||
{
|
||||
i2c_register(I2C0_INDEX, "i2c", DEVICE_OFLAG_RDWR);
|
||||
i2c0 = device_find("i2c");
|
||||
|
||||
if (i2c0) {
|
||||
((i2c_device_t *)i2c0)->id = 0;
|
||||
((i2c_device_t *)i2c0)->mode = I2C_HW_MODE;
|
||||
((i2c_device_t *)i2c0)->phase = 15;
|
||||
device_open(i2c0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int es8374_write_reg(uint8_t addr, uint8_t data)
|
||||
{
|
||||
i2c_msg_t msg1;
|
||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
||||
msg1.len = 1,
|
||||
msg1.buf = &data;
|
||||
msg1.flags = SUB_ADDR_1BYTE | I2C_WR;
|
||||
msg1.subaddr = addr;
|
||||
bflb_platform_delay_ms(10);
|
||||
return i2c_transfer(i2c0, &msg1, 1);
|
||||
}
|
||||
|
||||
BL_Err_Type es8388_read_reg(uint8_t addr, uint8_t *rdata)
|
||||
{
|
||||
i2c_msg_t msg1;
|
||||
msg1.len = 1,
|
||||
msg1.buf = rdata;
|
||||
msg1.subaddr = addr;
|
||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
||||
msg1.flags = SUB_ADDR_1BYTE | I2C_RD;
|
||||
return i2c_transfer(i2c0, &msg1, 1);
|
||||
}
|
||||
|
||||
uint8_t es8374_config_master(void)
|
||||
{
|
||||
es8374_write_reg(0x00, 0x3F);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x00, 0x03);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x01, 0x7F);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x05, 0x11);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x6F, 0xA0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x72, 0x41);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x09, 0x01);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0C, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0D, 0x13);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0E, 0xE0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0A, 0x3A);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x0B, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x09, 0x41);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x24, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x36, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x12, 0x30);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x13, 0x20);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x21, 0x50);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x22, 0x55);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x21, 0x24);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x00, 0x80);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x14, 0x8A);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x15, 0x40);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1A, 0xA0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1B, 0x19);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1C, 0x90);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1D, 0x2B);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1F, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x1E, 0xA0);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x28, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x25, 0x1F);
|
||||
bflb_platform_delay_ms(10); //增益
|
||||
es8374_write_reg(0x38, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x37, 0x00);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x6D, 0x60);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x03, 0x20);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x06, 0x03);
|
||||
bflb_platform_delay_ms(10); // 0x0600 ---8K sample. 0x100 48k
|
||||
es8374_write_reg(0x07, 0x00);
|
||||
bflb_platform_delay_ms(10); //
|
||||
es8374_write_reg(0x0F, 0x95);
|
||||
bflb_platform_delay_ms(10); //0x9D 8K 0x95 16K
|
||||
es8374_write_reg(0x10, 0x0D);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x11, 0x0D);
|
||||
bflb_platform_delay_ms(10);
|
||||
es8374_write_reg(0x02, 0x08);
|
||||
bflb_platform_delay_ms(10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t es8374_config_dump(void)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
uint8_t val = 0;
|
||||
|
||||
for (i = 0; i < 0X6D; i++) {
|
||||
es8388_read_reg(i, &val);
|
||||
MSG("0x%x = 0x%x\r\n", i, val);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int record_init(audio_dev_t *audio_dev)
|
||||
{
|
||||
audio_dev->buff1 = buff1;
|
||||
audio_dev->buff2 = buff2;
|
||||
audio_dev->buff_size_max = sizeof(buff1);
|
||||
audio_dev->audio_state = 0;
|
||||
audio_dev->audio_init = record_init;
|
||||
audio_dev->audio_callback = record_callback;
|
||||
|
||||
i2c_init();
|
||||
uart_init();
|
||||
es8374_config_master();
|
||||
//es8374_config_dump();
|
||||
|
||||
spi_init();
|
||||
|
||||
device_read(spi0, 0, audio_dev->buff1, audio_dev->buff_size_max);
|
||||
audio_dev->buff_using = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int record_callback(audio_dev_t *audio_dev)
|
||||
{
|
||||
if (audio_dev->buff_using == 1) {
|
||||
device_read(spi0, 0, audio_dev->buff2, audio_dev->buff_size_max);
|
||||
|
||||
if (audio_dev->audio_state) {
|
||||
device_write(uart0, 0, audio_dev->buff1, audio_dev->buff_size_max);
|
||||
}
|
||||
|
||||
audio_dev->buff_using = 2;
|
||||
} else if (audio_dev->buff_using == 2) {
|
||||
device_read(spi0, 0, audio_dev->buff1, audio_dev->buff_size_max);
|
||||
|
||||
if (audio_dev->audio_state) {
|
||||
device_write(uart0, 0, audio_dev->buff2, audio_dev->buff_size_max);
|
||||
}
|
||||
|
||||
audio_dev->buff_using = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bflb_platform_init(0);
|
||||
|
||||
MSG("spi_i2s_record case \r\n");
|
||||
|
||||
record_init(&Audio_Dev);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
7
examples/spi/spi_i2s_mono_record/readme.md
Normal file
7
examples/spi/spi_i2s_mono_record/readme.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
**board/bl706_avb/pinmux_config.h** 中 **PINMUX_SELECT** 选择 **PINMUX_LVGL**
|
||||
|
||||
```bash
|
||||
|
||||
$ make APP=spi_i2s_mono_record BOARD=bl706_avb
|
||||
|
||||
```
|
|
@ -114,6 +114,8 @@ int main(void)
|
|||
|
||||
LCD_Display_Test();
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,8 @@ int main(void)
|
|||
/* Disable spi master mode */
|
||||
device_close(spi);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -35,7 +35,8 @@ int main(void)
|
|||
bflb_platform_init(0);
|
||||
bflb_platform_set_alarm_time(1000000, systick_isr);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,4 +74,7 @@ int main(void)
|
|||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ int main(void)
|
|||
device_control(uart, DEVICE_CTRL_SET_INT, (void *)(UART_RX_FIFO_IT | UART_RTO_IT));
|
||||
}
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
__asm volatile("nop");
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
*/
|
||||
#include "hal_uart.h"
|
||||
|
||||
const uint8_t buffer[10] = "12345678\r\n";
|
||||
static uint8_t buffer[100];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bflb_platform_init(0);
|
||||
|
@ -30,14 +31,15 @@ int main(void)
|
|||
struct device *uart1 = device_find("uart1");
|
||||
|
||||
if (uart1) {
|
||||
device_open(uart1, DEVICE_OFLAG_STREAM_TX);
|
||||
device_open(uart1, DEVICE_OFLAG_STREAM_TX | DEVICE_OFLAG_STREAM_RX);
|
||||
MSG("device find success\r\n");
|
||||
}
|
||||
|
||||
device_read(uart1, 0, buffer, 10);
|
||||
device_write(uart1, 0, buffer, 10);
|
||||
|
||||
BL_CASE_SUCCESS;
|
||||
while (1) {
|
||||
MSG("\r\n uart0 and uart1 poll tx case\r\n");
|
||||
bflb_platform_delay_ms(1000);
|
||||
bflb_platform_delay_ms(100);
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ void uart_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t s
|
|||
}
|
||||
|
||||
MSG("\r\n");
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -468,22 +468,27 @@ int main(void)
|
|||
if (play_status == 1) {
|
||||
if (music_tx_flag == 0) {
|
||||
musci_size = sizeof(music);
|
||||
frame_count = musci_size / AUDIO_IN_PACKET;
|
||||
last_frame_size = musci_size % AUDIO_IN_PACKET;
|
||||
frame_count = musci_size / 4064;
|
||||
last_frame_size = musci_size % 4064;
|
||||
frame_cnt = 0;
|
||||
//MSG("frame_count:%d,last_frame_size:%d\r\n",frame_count,last_frame_size);
|
||||
audio_pos = 0;
|
||||
|
||||
if (last_frame_size % AUDIO_IN_PACKET) {
|
||||
MSG("data len is not AUDIO_IN_PACKET multiple\r\n");
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
MSG("frame_count:%d,last_frame_size:%d\r\n", frame_count, last_frame_size);
|
||||
music_tx_flag = 1;
|
||||
}
|
||||
|
||||
if (!device_control(dma_ch2, DMA_CHANNEL_GET_STATUS, NULL)) {
|
||||
if (frame_cnt < frame_count) {
|
||||
device_write(usb_fs, AUDIO_IN_EP, &music[audio_pos], AUDIO_IN_PACKET);
|
||||
device_write(usb_fs, AUDIO_IN_EP, &music[audio_pos], 4064);
|
||||
frame_cnt++;
|
||||
audio_pos += AUDIO_IN_PACKET;
|
||||
audio_pos += 4064;
|
||||
} else {
|
||||
device_write(usb_fs, AUDIO_IN_EP, &music[audio_pos], last_frame_size);
|
||||
frame_cnt = 0;
|
||||
audio_pos = 0;
|
||||
music_tx_flag = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const unsigned char music[1984961] = {
|
||||
const unsigned char music[1984960] = {
|
||||
0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFE, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF,
|
||||
|
@ -124059,5 +124059,4 @@ const unsigned char music[1984961] = {
|
|||
0xC1, 0xFB, 0x52, 0x01, 0x4C, 0x03, 0x70, 0x02, 0x9F, 0x04, 0x11, 0x02, 0xBF, 0x04, 0xF9, 0x04,
|
||||
0x9C, 0x03, 0x00, 0x08, 0xEA, 0x05, 0x88, 0x04, 0x16, 0x05, 0x4E, 0x07, 0xC3, 0x05, 0x36, 0x07,
|
||||
0xAF, 0x06, 0x4D, 0x04, 0x5C, 0x0B, 0xEE, 0x0C, 0x38, 0x0C, 0x2F, 0x0B, 0x7F, 0x10, 0x86, 0x10,
|
||||
0x8E
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue