From b1002d05f75041ee81f995b84048eae0b3764922 Mon Sep 17 00:00:00 2001 From: asterix Date: Mon, 26 May 2008 13:25:21 +0000 Subject: [PATCH] Add setup and teardown function. Use _TEST define for main. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1371 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/arm/drv/pwm_test.c | 41 ++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/bertos/cpu/arm/drv/pwm_test.c b/bertos/cpu/arm/drv/pwm_test.c index 447b3d59..a96e6941 100644 --- a/bertos/cpu/arm/drv/pwm_test.c +++ b/bertos/cpu/arm/drv/pwm_test.c @@ -85,18 +85,35 @@ pwm_enable(PWM_TEST_CH##index, true); \ } while (0) + +/** + * Setup all needed to test PWM on AT91 + * + */ +int pwm_setup(void) +{ + IRQ_ENABLE; + kdbg_init(); + sysirq_init(); + timer_init(); + + pwm_init(); + + return 0; +} + + /** * Test suit for genation of pwm waveform. * */ -void pwm_test(void) +int pwm_test(void) { kputs("PWM test\n\n"); kputs("Init pwm.."); - - pwm_init(); + pwm_setup(); kputs("done.\n"); PWM_TEST_CH_SET(0); @@ -107,15 +124,23 @@ void pwm_test(void) kprintf("PWM test set ch[%d] =>freq[%ld], duty[%d]\n", PWM_TEST_CH2, PWM_TEST_CH2_FREQ, PWM_TEST_CH2_DUTY); PWM_TEST_CH_SET(3); kprintf("PWM test set ch[%d] =>freq[%ld], duty[%d]\n", PWM_TEST_CH3, PWM_TEST_CH3_FREQ, PWM_TEST_CH3_DUTY); + + return 0; +} + +/** + * + */ +int pwm_tearDown(void) +{ + /* */ + return 0; } +#ifdef _TEST int main(void) { - IRQ_ENABLE; - kdbg_init(); - sysirq_init(); - timer_init(); pwm_test(); @@ -154,6 +179,6 @@ int main(void) } } - +#endif -- 2.25.1