63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
#include "ut_odout.h"
|
|
|
|
#include "..\mock_mcu\mock_mcu_hal_r8.h"
|
|
#include "..\..\src\hw\board\setup.h"
|
|
|
|
static adcClkDiv_t not_accesed_adc_clk = MCU_ADC_DIV128;
|
|
static timerClkDiv_t not_accesed_pwm_clk = MCU_TIM_DIV1024;
|
|
static uint16_t not_accesed_pwm_top = 0;
|
|
static uint8_t not_accesed_pwm_chb_en = 255;
|
|
|
|
static int ut_bsp_startup(startupCfg_t* exp_cfg)
|
|
{
|
|
printf(" Input: \n");
|
|
|
|
startupCfg_t not_accesd_cfg;
|
|
not_accesd_cfg.adc_clk = not_accesed_adc_clk;
|
|
not_accesd_cfg.pwm_clk = not_accesed_pwm_clk;
|
|
not_accesd_cfg.pwm_top = not_accesed_pwm_top;
|
|
not_accesd_cfg.pwm_chb_en = not_accesed_pwm_chb_en;
|
|
mock_mcu_startup_write_cfg(¬_accesd_cfg);
|
|
|
|
bsp_startup();
|
|
|
|
startupCfg_t cfg;
|
|
mock_mcu_startup_read_cfg(&cfg);
|
|
|
|
printf(" Output: ADC-CLK:%d PWN-CLK:%d PWM-TOP:%d PWM-CHB-EN:%d \n", cfg.adc_clk, cfg.pwm_clk, cfg.pwm_top, cfg.pwm_chb_en);
|
|
printf("Expected: ADC-CLK:%d PWN-CLK:%d PWM-TOP:%d PWM-CHB-EN:%d \n", exp_cfg->adc_clk, exp_cfg->pwm_clk, exp_cfg->pwm_top, exp_cfg->pwm_chb_en);
|
|
|
|
if((cfg.adc_clk==exp_cfg->adc_clk)&&(cfg.pwm_clk==exp_cfg->pwm_clk)&&(cfg.pwm_top==exp_cfg->pwm_top)&&(cfg.pwm_chb_en==exp_cfg->pwm_chb_en))
|
|
{
|
|
printf("PASS\n\n");
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
printf("FAIL\n\n");
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
int ut_bsp_startup_test(void)
|
|
{
|
|
printf("******************************************************\n");
|
|
printf("void bsp_startup(void) \n");
|
|
|
|
int test_res;
|
|
int pass = 1;
|
|
|
|
startupCfg_t exp_cfg;
|
|
|
|
// Control level - LOW
|
|
exp_cfg.adc_clk = MCU_ADC_DIV2;
|
|
exp_cfg.pwm_clk = MCU_TIM_DIV1;
|
|
exp_cfg.pwm_top = 511;
|
|
exp_cfg.pwm_chb_en = 1;
|
|
test_res = ut_bsp_startup(&exp_cfg);
|
|
if(!test_res) pass = 0;
|
|
|
|
return pass;
|
|
}
|
|
|