工具与软件:
您好!
我想知道 CC2340R53是否完全支持看门狗回调函数? 我看了看 WatchdogLPF3.c ,它看起来不像任何东西可以用这种方式配置。 WatchdogLPF3是否生成某种中断类型、至少可以将回调函数连接到该类型? 我使用的是 simplelink-lowpower-f3-sdk 版本8.20.00.119。
谢谢
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好、Alexander、
我希望大家发展顺利、我们的 CC2340R5支持看门狗回调:
void UserCallbackFxn(Watchdog_Handle handle) { printf("Watchdog timer triggered!\n"); releaseResources(); } ... Watchdog_Params params; Watchdog_Handle watchdogHandle; Watchdog_init(); Watchdog_Params_init(¶ms); params.resetMode = Watchdog_RESET_ON; params.callbackFxn = (Watchdog_Callback) UserCallbackFxn; watchdogHandle = Watchdog_open(CONFIG_WATCHDOG0, ¶ms); if (watchdogHandle == NULL) { // Error opening Watchdog while (1); }
您可以参考驱动程序部分(并单击"示例"按钮)以查看有关驱动程序的更多详细信息。
谢谢!
Alex F
Alex、您好!
感谢您的回复!
当我浏览 WatchdogLPF3.c 中的 simplelink SDK 代码时、我没有看到使用了 resetMode 和 callbackFxn 参数的任何实现。 我看到它们在通用看门狗 API 中可用、因为其他器件也支持此功能、并且在其特定于器件的看门狗驱动程序中、这些参数会在实现中使用。
例如、下面是用于 Watchdog_open 的 LPF3实现的函数、其中我可以看到它仅设置了 debugStallMode:
Watchdog_Handle WatchdogLPF3_open(Watchdog_Handle handle, Watchdog_Params *params) { uintptr_t key; WatchdogLPF3_Object *object; /* get the pointer to the object and hwAttrs */ object = handle->object; /* disable preemption while checking if the Watchdog is open. */ key = HwiP_disable(); /* Check if the Watchdog is open already with the hwAttrs */ if (object->isOpen == true) { HwiP_restore(key); return (NULL); } object->isOpen = true; HwiP_restore(key); /* initialize the Watchdog object */ object->debugStallMode = params->debugStallMode; /* initialize the watchdog hardware */ WatchdogLPF3_initHw(handle); /* return handle of the Watchdog object */ return (handle); }
在不同的看门狗驱动程序实现(来自 CC2640R2的 SDK 中的 WatchdogCC26XX.c)中、您可以看到它确实 设置了复位模式并设置了回调函数:
Watchdog_Handle WatchdogCC26XX_open(Watchdog_Handle handle, Watchdog_Params *params) { unsigned int key; HwiP_Params hwiParams; WatchdogCC26XX_Object *object; /* get the pointer to the object and hwAttrs */ object = handle->object; /* disable preemption while checking if the WatchDog is open. */ key = HwiP_disable(); /* Check if the Watchdog is open already with the HWAttrs */ if (object->isOpen == true) { HwiP_restore(key); DebugP_log1("Watchdog: Handle %x already in use.", (uintptr_t)handle); return (NULL); } object->isOpen = true; HwiP_restore(key); /* initialize the Watchdog object */ object->debugStallMode = params->debugStallMode; object->resetMode = params->resetMode; /* Construct Hwi object for Watchdog */ HwiP_Params_init(&hwiParams); hwiParams.arg = (uintptr_t)handle; /* setup callback function if defined */ if (params->callbackFxn != NULL) { HwiP_plug(INT_NMI_FAULT, (void *)params->callbackFxn); } /* initialize the watchdog hardware */ WatchdogCC26XX_initHw(handle); DebugP_log1("Watchdog: handle %x opened" ,(uintptr_t)handle); /* return handle of the Watchdog object */ return (handle); }
我找不到 simplelink f3 SDK 可以设置此值的任何其他位置。 我在您的解释中遗漏了什么? 我当前拥有的看门狗实现确实复位了器件、但从不调用回调。
从驱动程序文档中引用的这个文档似乎用于在该系列器件之间共享的通用看门狗接口。 我更想知道看门狗 LPF3的功能、而不仅仅是通用看门狗接口。
这确实有助于我找到 LPF3看门狗驱动程序的文档、该驱动程序不支持回调函数和 resetMode。 特定于器件的驱动程序文档可在 SDK 中找到: simplelink_lowpower_f3_sdk_8_20_00_119/docs/drivers/doxygen/html/_watchdog_l_p_f3_8h.html