VSF Documented
Functions
vsf_test.c File Reference
#include "./vsf_test.h"
#include <string.h>
#include "service/trace/vsf_trace.h"

Functions

vsf_err_t vsf_systimer_init (void)
 initialise SysTick to generate a system timer !
 
void vsf_systick_enable (void)
 enable !
 
vsf_systimer_tick_t vsf_systimer_get (void)
 
vsf_systimer_tick_t vsf_systimer_tick_to_us (vsf_systimer_tick_t tick)
 
void vsf_test_trace (uint8_t level, const char *format,...)
 
void vsf_test_run (vsf_test_t *test)
 initialize vsf test
 
void vsf_test_assert (vsf_test_result_t result, const char *file_name, uint32_t line, const char *function_name, const char *condition)
 rong jump. the user does not need to directly call this API
 
void vsf_test_reboot (vsf_test_result_t result, const char *file_name, uint32_t line, const char *function_name, const char *condition)
 reboot, usually called inside an exception.
 
void vsf_test_hw_config (vsf_peripheral_type_t peripheral_type, const vsf_test_inst_t *inst, bool init)
 GPIO config hook called before/after running test cases on an instance. Board override (weak): configure pinmux / GPIO for the peripheral under test.
 
void vsf_test_busy_wait_ms (uint32_t ms)
 Busy-wait for approximately the given milliseconds. Useful for simple inter-step delays in test scenarios where vsf_systimer is not initialized. Calibrated by VSF_TEST_CFG_BUSY_WAIT_CYCLES_PER_MS.
 
void vsf_test_busy_wait_us (uint32_t us)
 
vsf_test_result_t vsf_test_run_suite_case (const vsf_test_suite_t *suite, uint16_t local_idx, const vsf_test_inst_t *inst)
 Run a single test case within a suite. No setup/teardown is performed — the caller is responsible for calling setup before the first case and teardown after the last case.
 
void vsf_test_run_suite (const vsf_test_suite_t *suite)
 Run all cases in a suite. Calls setup before the first case and teardown after the last case. If setup returns false, all cases are skipped.
 

Function Documentation

◆ vsf_systimer_init()

vsf_err_t vsf_systimer_init ( void  )
extern

initialise SysTick to generate a system timer !

Parameters
frequencythe target tick frequency in Hz !
Returns
initialization result in vsf_err_t

◆ vsf_systick_enable()

void vsf_systick_enable ( void  )
extern

enable !

Parameters
void!
Return values
none
Parameters
void!
Return values
bool
Parameters
void!
Return values
none

◆ vsf_systimer_get()

vsf_systimer_tick_t vsf_systimer_get ( void  )
extern

◆ vsf_systimer_tick_to_us()

vsf_systimer_tick_t vsf_systimer_tick_to_us ( vsf_systimer_tick_t  tick)
extern

◆ vsf_test_trace()

void vsf_test_trace ( uint8_t  level,
const char *  format,
  ... 
)

◆ vsf_test_run()

void vsf_test_run ( vsf_test_t test)

initialize vsf test

Parameters
[in]testtest instance pointer (must not be NULL)

◆ vsf_test_assert()

void vsf_test_assert ( vsf_test_result_t  result,
const char *  file_name,
uint32_t  line,
const char *  function_name,
const char *  condition 
)

rong jump. the user does not need to directly call this API

Parameters
[in]resulttest result, vsf_test_result_t
[in]file_namethen name of the file where the assertion occurred
[in]linethe line number of the code where the assertion occurred
[in]function_namethe name of the function where the assertion occurred
[in]conditionString of asserted code
Note
This function will be called when the test case asserts that the condition is not satisfied.

◆ vsf_test_reboot()

void vsf_test_reboot ( vsf_test_result_t  result,
const char *  file_name,
uint32_t  line,
const char *  function_name,
const char *  additional_str 
)

reboot, usually called inside an exception.

Parameters
[in]resulttest result, vsf_test_result_t
[in]file_namethen name of the file where the assertion occurred
[in]linethe line number of the code where the assertion occurred
[in]function_namethe name of the function where the assertion occurred
[in]additional_strprovide additional exception information

◆ vsf_test_hw_config()

void vsf_test_hw_config ( vsf_peripheral_type_t  peripheral_type,
const vsf_test_inst_t inst,
bool  init 
)

GPIO config hook called before/after running test cases on an instance. Board override (weak): configure pinmux / GPIO for the peripheral under test.

Parameters
[in]peripheral_typeVSF_PERIPHERAL_TYPE_* of the instance under test
[in]argHAL handle (or array of handles) for the instance, same as suite->arg
[in]inittrue before cases, false after cases (teardown)

< Board intentionally configures all pins elsewhere (e.g. boot-time pinmux); just record that the default hook ran.

◆ vsf_test_busy_wait_ms()

void vsf_test_busy_wait_ms ( uint32_t  ms)

Busy-wait for approximately the given milliseconds. Useful for simple inter-step delays in test scenarios where vsf_systimer is not initialized. Calibrated by VSF_TEST_CFG_BUSY_WAIT_CYCLES_PER_MS.

Parameters
[in]msmilliseconds to wait

◆ vsf_test_busy_wait_us()

void vsf_test_busy_wait_us ( uint32_t  us)

◆ vsf_test_run_suite_case()

vsf_test_result_t vsf_test_run_suite_case ( const vsf_test_suite_t suite,
uint16_t  local_idx,
const vsf_test_inst_t inst 
)

Run a single test case within a suite. No setup/teardown is performed — the caller is responsible for calling setup before the first case and teardown after the last case.

Parameters
[in]suitepointer to the suite containing the case
[in]local_idxindex of the case within the suite's cases array

◆ vsf_test_run_suite()

void vsf_test_run_suite ( const vsf_test_suite_t suite)

Run all cases in a suite. Calls setup before the first case and teardown after the last case. If setup returns false, all cases are skipped.

Parameters
[in]suitepointer to the suite to run
Generated from commit: vsfteam/vsf@3b461d0