zhangyu-duck commented on code in PR #21546:
URL: https://github.com/apache/nuttx/pull/21546#discussion_r4581372582


##########
arch/tricore/src/tc3xx/tc3xx_wdt.c:
##########
@@ -66,23 +66,45 @@ static void tc3xx_wdt_endinit(uintptr_t con0, uint32_t pw, 
bool set)
 }
 
 /****************************************************************************
- * Name: tc3xx_wdt_disable
+ * Name: tc3xx_wdt_password
+ ****************************************************************************/
+
+static uint32_t tc3xx_wdt_password(uintptr_t con0)
+{
+  return ((getreg32(con0) & TC3XX_WDT_CON0_PW_MASK) >>
+          TC3XX_WDT_CON0_PW_SHIFT) ^ TC3XX_WDT_PW_INVERTED;
+}
+
+/****************************************************************************
+ * Name: tc3xx_wdt_request
  *
  * Description:
- *   Request a watchdog to be disabled.
+ *   Request a watchdog to be disabled or enabled again.
  *
  ****************************************************************************/
 
-static void tc3xx_wdt_disable(uintptr_t con0, uintptr_t con1)
+static void tc3xx_wdt_request(uintptr_t con0, uintptr_t con1, bool disable)
 {
-  uint32_t pw = ((getreg32(con0) & TC3XX_WDT_CON0_PW_MASK) >>
-                 TC3XX_WDT_CON0_PW_SHIFT) ^ TC3XX_WDT_PW_INVERTED;
+  uint32_t pw = tc3xx_wdt_password(con0);
+  uint32_t regval;
 
   tc3xx_wdt_endinit(con0, pw, false);
-  putreg32(getreg32(con1) | TC3XX_WDT_CON1_DR, con1);
+  regval = getreg32(con1) & ~TC3XX_WDT_CON1_DR;
+  putreg32(regval | (disable ? TC3XX_WDT_CON1_DR : 0), con1);
   tc3xx_wdt_endinit(con0, pw, true);
 }
 
+/****************************************************************************
+ * Name: tc3xx_wdt_cpu
+ ****************************************************************************/
+
+static uint32_t tc3xx_wdt_cpu(void)
+{
+  uint32_t cpu = tricore_mfcr(TRICORE_CPU_CORE_ID);
+
+  return cpu > 5 ? 5 : cpu;

Review Comment:
   should select multcpu



-- 
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]

Reply via email to