除了显示驱动,其余全部测试通过
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
#include "app_config.h"
|
||||
|
||||
#include "system/includes.h"
|
||||
#include "device/includes.h"
|
||||
#include "asm/includes.h"
|
||||
#include "wifi/wifi_connect.h"
|
||||
#include "asm/spi.h"
|
||||
#include "server/audio_dev.h"
|
||||
|
||||
/* Wi-Fi RF 校准参数 */
|
||||
const struct wifi_calibration_param wifi_calibration_param = {
|
||||
.xosc_l = 0x0b,
|
||||
.xosc_r = 0x0b,
|
||||
|
||||
.pa_trim_data = {1, 7, 4, 7, 11, 1, 7},
|
||||
|
||||
.mcs_dgain = {50,50,50,50,72,72,85,80,64,64,62,52,72,90,80,64,64,64,50,43}
|
||||
};
|
||||
|
||||
|
||||
//灯带配置
|
||||
PWM_PLATFORM_DATA_BEGIN(lamp_warm_pwm_data)/* PC1:暖光 */
|
||||
.port = IO_PORTC_01,
|
||||
.pwm_ch = PWM_TIMER2_OPCH2,
|
||||
.freq = 5000,
|
||||
.duty = 100,
|
||||
.point_bit = 1,
|
||||
PWM_PLATFORM_DATA_END()
|
||||
|
||||
PWM_PLATFORM_DATA_BEGIN(lamp_cool_pwm_data)/* PC2:冷光 */
|
||||
.port = IO_PORTC_02,
|
||||
.pwm_ch = PWM_TIMER3_OPCH3,
|
||||
.freq = 5000,
|
||||
.duty = 50,
|
||||
.point_bit = 1,
|
||||
PWM_PLATFORM_DATA_END()
|
||||
|
||||
|
||||
//显示器配置
|
||||
SPI2_PLATFORM_DATA_BEGIN(spi2_data)
|
||||
.clk = 1000000,
|
||||
.mode = SPI_1WIRE_MODE,
|
||||
.port = 'C',
|
||||
.attr = SPI_SCLK_L_UPL_SMPH | SPI_UNIDIR_MODE,
|
||||
SPI2_PLATFORM_DATA_END()
|
||||
|
||||
|
||||
/* debug串口配置 */
|
||||
UART2_PLATFORM_DATA_BEGIN(uart2_data)
|
||||
.baudrate = 1000000,
|
||||
.port = PORT_REMAP,
|
||||
.output_channel = OUTPUT_CHANNEL0,
|
||||
.tx_pin = IO_PORTA_10,
|
||||
.rx_pin = -1,
|
||||
.max_continue_recv_cnt = 1024,
|
||||
.idle_sys_clk_cnt = 500000,
|
||||
.clk_src = PLL_48M,
|
||||
.flags = UART_DEBUG,
|
||||
UART2_PLATFORM_DATA_END();
|
||||
|
||||
/* 音频配置 MIC1(PH8=+ / PH9=-) 差分接法, 功放 NS4150B(SD脚->PA0) */
|
||||
static const struct dac_platform_data dac_data = {
|
||||
.pa_auto_mute = 0, /* 测试中由 audio_test 直接控制功放SD脚(PA0), 关掉SDK自动静音 */
|
||||
.pa_mute_port = 0xff, /* 不使用SDK静音机制 */
|
||||
.pa_mute_value = 0,
|
||||
.differ_output = 0, /* 单端输出 */
|
||||
.hw_channel = 0x03, /* BIT(0)=DACL | BIT(1)=DACR 双通道都开, 兼容功放接任意一路 */
|
||||
.ch_num = 2, /* 数字通道数(与回放双声道对应) */
|
||||
.vcm_init_delay_ms = 1000,
|
||||
};
|
||||
|
||||
//设备注册
|
||||
REGISTER_DEVICES(device_table) = {
|
||||
{"uart2", &uart_dev_ops, (void *)&uart2_data },
|
||||
{"rtc", &rtc_dev_ops, NULL},
|
||||
{"spi2", &spi_dev_ops, (void *)&spi2_data },
|
||||
//{"audio", &audio_dev_ops, (void *)&audio_data },
|
||||
{"lamp_warm_pwm",&pwm_dev_ops,(void *)&lamp_warm_pwm_data},//warm
|
||||
{"lamp_cool_pwm",&pwm_dev_ops,(void *)&lamp_cool_pwm_data},//cool
|
||||
};
|
||||
|
||||
static const struct adc_platform_data adc_data = {
|
||||
.mic_channel = LADC_CH_MIC1_P_N, /* MIC1 差分: PH8=正 PH9=负 */
|
||||
.linein_channel = 0,
|
||||
.mic_ch_num = 1,
|
||||
.linein_ch_num = 0,
|
||||
.all_channel_open = 1,
|
||||
.isel = 2,
|
||||
.dump_num = 320,
|
||||
};
|
||||
|
||||
static const struct audio_pf_data audio_pf_d = {
|
||||
.adc_pf_data = &adc_data,
|
||||
.dac_pf_data = &dac_data,
|
||||
};
|
||||
|
||||
static const struct audio_platform_data audio_data = {
|
||||
.private_data = (void *)&audio_pf_d,
|
||||
};
|
||||
|
||||
/* 电源配置 */
|
||||
static const struct low_power_param power_param = {
|
||||
.config = TCFG_LOWPOWER_LOWPOWER_SEL, //系统休眠
|
||||
.btosc_disable = TCFG_LOWPOWER_BTOSC_DISABLE, //进入低功耗时BTOSC是否保持
|
||||
.vddiom_lev = TCFG_LOWPOWER_VDDIOM_LEVEL, //强VDDIO等级,可选:2.8V 2.9V 3.0V 3.1V 3.2V 3.3V 3.4V 3.5V
|
||||
.vddiow_lev = TCFG_LOWPOWER_VDDIOW_LEVEL, //弱VDDIO等级,可选:2.1V 2.4V 2.8V 3.2V
|
||||
.vdc14_dcdc = TRUE, //打开内部1.4VDCDC,关闭则用外部
|
||||
.vdc14_lev = VDC14_VOL_SEL_LEVEL, //VDD1.4V配置
|
||||
.sysvdd_lev = SYSVDD_VOL_SEL_LEVEL, //内核、sdram电压配置
|
||||
.vlvd_enable = TRUE, //TRUE电压复位使能
|
||||
.vlvd_value = VLVD_SEL_25V, //低电压复位电压值
|
||||
};
|
||||
|
||||
/* 复位配置 */
|
||||
#define LONG_PRESS_RESET_IO IO_PORTB_01
|
||||
|
||||
static const struct long_press lpres_port = {
|
||||
.enable = TRUE,
|
||||
.use_sec4 = TRUE,
|
||||
.edge = FALLING_EDGE,
|
||||
.iomap = LONG_PRESS_RESET_IO,
|
||||
};
|
||||
|
||||
/* 官方示例中的保留唤醒参数。*/
|
||||
static const struct sub_wakeup sub_wkup = {
|
||||
.attribute = BLUETOOTH_RESUME,
|
||||
};
|
||||
|
||||
static const struct charge_wakeup charge_wkup = {
|
||||
.attribute = BLUETOOTH_RESUME,
|
||||
};
|
||||
|
||||
/* 唤醒/长按复位参数 */
|
||||
static const struct wakeup_param wk_param = {
|
||||
.port[0] = NULL,
|
||||
.sub = &sub_wkup,
|
||||
.charge = &charge_wkup,
|
||||
.lpres = &lpres_port,
|
||||
};
|
||||
|
||||
|
||||
#ifdef CONFIG_DEBUG_ENABLE
|
||||
void debug_uart_init()
|
||||
{
|
||||
uart_init(&uart2_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
void board_early_init()
|
||||
{
|
||||
dac_early_init(0, dac_data.differ_output ? (dac_data.ch_num > 1 ? 0xf : 0x3) : dac_data.hw_channel, 1000);
|
||||
devices_init();
|
||||
}
|
||||
|
||||
static void board_power_init(void)
|
||||
{
|
||||
|
||||
power_init(&power_param); //电源模块初始化
|
||||
power_wakeup_init(&wk_param);//复位模块初始化
|
||||
}
|
||||
|
||||
void board_init()
|
||||
{
|
||||
board_power_init();
|
||||
}
|
||||
Reference in New Issue
Block a user