royfengsss commented on PR #15829: URL: https://github.com/apache/nuttx/pull/15829#issuecomment-2664875845
Sorry for late. @tmedicci , the test is also similar to https://github.com/apache/nuttx/pull/15433, I just list as below ``` static int WDTExceptionTest1(void) { // WDT Open printf("---------- open ----------\n"); int wdt_handle = open("/dev/watchdog0", O_RDONLY); // open if (wdt_handle < 0) { printf("open error. errno=%d\n", errno); return -1; } // Set timeout printf("---------- set timeout ----------\n"); unsigned long msec = 40 * 1000; // 40 sec int ret = ioctl(wdt_handle, WDIOC_SETTIMEOUT, msec); if (ret < 0) { printf("SetTimeout error. errno=%d\n", errno); return -1; } // WDT Register printf("---------- regiter irq ----------\n"); struct watchdog_capture_s wdt_cap_reg = { .newhandler = (void *)SampleHandler, .oldhandler = NULL, }; ret = ioctl(wdt_handle, WDIOC_CAPTURE, &wdt_cap_reg); if (ret < 0) { printf("Registered error. errno=%d\n", errno); return -1; } // WDT Start printf("---------- start ----------\n"); ret = ioctl(wdt_handle, WDIOC_START, 0); if (ret < 0) { printf("Start error. errno=%d\n", errno); return -1; } // WDT Stop printf("---------- stop ----------\n"); ret = ioctl(wdt_handle, WDIOC_STOP, 0); if (ret < 0) { printf("Stop error. errno=%d\n", errno); return -1; } // WDT Close printf("---------- close ----------\n"); ret = close(wdt_handle); if (ret < 0) { printf("Close error. errno=%d", errno); return -1; } return 0; } static int WDTExceptionTest2(void) { // WDT Open printf("---------- open ----------\n"); int wdt_handle = open("/dev/watchdog0", O_RDONLY); // open if (wdt_handle < 0) { printf("open error. errno=%d\n", errno); return -1; } // Set timeout printf("---------- set timeout ----------\n"); unsigned long msec = 40 * 1000; // 40 sec int ret = ioctl(wdt_handle, WDIOC_SETTIMEOUT, msec); if (ret < 0) { printf("SetTimeout error. errno=%d\n", errno); return -1; } // WDT Register printf("---------- regiter irq ----------\n"); struct watchdog_capture_s wdt_cap_reg = { .newhandler = (void *)SampleHandler, .oldhandler = NULL, }; ret = ioctl(wdt_handle, WDIOC_CAPTURE, &wdt_cap_reg); if (ret < 0) { printf("Registered error. errno=%d\n", errno); return -1; } // WDT Unregister printf("---------- unregister irq ----------\n"); struct watchdog_capture_s wdt_cap_unreg = { .newhandler = NULL, .oldhandler = (void *)SampleHandler, }; ret = ioctl(wdt_handle, WDIOC_CAPTURE, &wdt_cap_unreg); if (ret < 0) { printf("Unregistered error. errno=%d\n", errno); return -1; } // WDT Close printf("---------- close ----------\n"); ret = close(wdt_handle); if (ret < 0) { printf("Close error. errno=%d", errno); return -1; } return 0; } ``` Without this fix, the code will trap to assertion. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
