1234567891011121314151617181920212223242526272829303132333435 |
- #include <stdio.h>
- #include <software_watchdog.h>
- // in this test it is expected that the watchdog_timeout_cb not called
- int test_result = 0;
- void watchdog_timeout_cb(void *data)
- {
- SoftwareWatchdog *watchdog = data;
- printf("!! watchdog_timeout_cb called !! \n");
- fflush(stdout);
- test_result = -1;
- }
- int main(void){
- printHelloWorld();
- SoftwareWatchdog watchdog1;
- struct timespec timeout;
- timeout.tv_nsec = 100*1000000;
- timeout.tv_sec = 1;
- swd_setup(&watchdog1, "watchdog1", watchdog_timeout_cb, timeout, NULL);
- swd_enable(&watchdog1);
- printf("Main: Sleeping for some seconds:\n");
- for (int i = 3; i > 0; i--) {
- swd_kick(&watchdog1);
- printf("%d\n", i);
- fflush(stdout);
- sleep(1);
- }
- return test_result;
- }
|