arch/arm/src/sam34/sam_wdt.c: Appease nxstyle

This commit is contained in:
YAMAMOTO Takashi
2020-12-05 22:45:25 +09:00
committed by Xiang Xiao
parent 8eb0712dec
commit f22982f7e6
+37 -29
View File
@@ -59,7 +59,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
/* The minimum frequency of the WWDG clock is:
*
* So the maximum delay (in milliseconds) is then:
@@ -88,6 +90,7 @@
/****************************************************************************
* Private Types
****************************************************************************/
/* This structure provides the private representation of the "lower-half"
* driver state structure. This structure must be cast-compatible with the
* well-known watchdog_lowerhalf_s structure.
@@ -96,6 +99,7 @@
struct sam34_lowerhalf_s
{
FAR const struct watchdog_ops_s *ops; /* Lower half operations */
xcpt_t handler; /* Current EWI interrupt handler */
uint32_t timeout; /* The actual timeout value */
bool started; /* The timer has been started */
@@ -106,6 +110,7 @@ struct sam34_lowerhalf_s
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* Register operations ******************************************************/
#ifdef CONFIG_SAM34_WDT_REGDEBUG
@@ -137,6 +142,7 @@ static int sam34_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd,
/****************************************************************************
* Private Data
****************************************************************************/
/* "Lower half" driver methods */
static const struct watchdog_ops_s g_wdgops =
@@ -177,8 +183,8 @@ static uint32_t sam34_getreg(uint32_t addr)
uint32_t val = getreg32(addr);
/* Is this the same value that we read from the same register last time? Are
* we polling the register? If so, suppress some of the output.
/* Is this the same value that we read from the same register last time?
* Are we polling the register? If so, suppress some of the output.
*/
if (addr == prevaddr && val == preval)
@@ -204,7 +210,7 @@ static uint32_t sam34_getreg(uint32_t addr)
{
/* Yes.. then show how many times the value repeated */
wdinfo("[repeats %d more times]\n", count-3);
wdinfo("[repeats %d more times]\n", count - 3);
}
/* Save the new address, value, and count */
@@ -291,8 +297,8 @@ static int sam34_interrupt(int irq, FAR void *context, FAR void *arg)
* Start the watchdog timer, resetting the time to the current timeout,
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
*
* Returned Value:
* Zero on success; a negated errno value on failure.
@@ -315,14 +321,15 @@ static int sam34_start(FAR struct watchdog_lowerhalf_s *lower)
#if defined(CONFIG_SAM34_JTAG_FULL_ENABLE) || \
defined(CONFIG_SAM34_JTAG_NOJNTRST_ENABLE) || \
defined(CONFIG_SAM34_JTAG_SW_ENABLE)
{
mr_val |= (WDT_MR_WDDBGHLT|WDT_MR_WDIDLEHLT);
}
{
mr_val |= (WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT);
}
#endif
/* TODO: WDT_MR_WDFIEN if handler available? WDT_MR_WDRPROC? */
mr_val |= (WDT_MR_WDD(priv->window) | WDT_MR_WDV(priv->reload) | WDT_MR_WDRSTEN);
mr_val |= (WDT_MR_WDD(priv->window) | WDT_MR_WDV(priv->reload) |
WDT_MR_WDRSTEN);
sam34_putreg(mr_val, SAM_WDT_MR);
priv->started = true;
return OK;
@@ -335,8 +342,8 @@ static int sam34_start(FAR struct watchdog_lowerhalf_s *lower)
* Stop the watchdog timer
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
*
* Returned Value:
* Zero on success; a negated errno value on failure.
@@ -366,8 +373,8 @@ static int sam34_stop(FAR struct watchdog_lowerhalf_s *lower)
* intervals during normal operation to prevent an MCU reset.
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
*
* Returned Value:
* Zero on success; a negated errno value on failure.
@@ -389,8 +396,8 @@ static int sam34_keepalive(FAR struct watchdog_lowerhalf_s *lower)
* Get the current watchdog timer status
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
* status - The location to return the watchdog status information.
*
* Returned Value:
@@ -425,9 +432,11 @@ static int sam34_getstatus(FAR struct watchdog_lowerhalf_s *lower,
status->timeout = priv->timeout;
/* Get the time remaining until the watchdog expires (in milliseconds) */
/* REVISIT: not sure if you can read this... */
elapsed = ((sam34_getreg(SAM_WDT_MR) & WDT_MR_WDV_MASK) >> WDT_MR_WDV_SHIFT);
elapsed = ((sam34_getreg(SAM_WDT_MR) & WDT_MR_WDV_MASK) >>
WDT_MR_WDV_SHIFT);
status->timeleft = (priv->timeout * elapsed) / (priv->reload + 1);
@@ -445,8 +454,8 @@ static int sam34_getstatus(FAR struct watchdog_lowerhalf_s *lower,
* Set a new timeout value (and reset the watchdog timer)
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
* timeout - The new timeout value in millisecnds.
*
* Returned Value:
@@ -472,8 +481,7 @@ static int sam34_settimeout(FAR struct watchdog_lowerhalf_s *lower,
return -ERANGE;
}
reload = ((timeout * WDT_FCLK) / 1000) - 1;
reload = ((timeout * WDT_FCLK) / 1000) - 1;
/* Make sure that the final reload value is within range */
@@ -510,8 +518,8 @@ static int sam34_settimeout(FAR struct watchdog_lowerhalf_s *lower,
* behavior.
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
* newhandler - The new watchdog expiration function pointer. If this
* function pointer is NULL, then the reset-on-expiration
* behavior is restored,
@@ -542,7 +550,7 @@ static xcpt_t sam34_capture(FAR struct watchdog_lowerhalf_s *lower,
/* Save the new handler */
priv->handler = handler;
priv->handler = handler;
/* Are we attaching or detaching the handler? */
@@ -582,8 +590,8 @@ static xcpt_t sam34_capture(FAR struct watchdog_lowerhalf_s *lower,
* are forwarded to the lower half driver through this method.
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
* cmd - The ioctl command value
* arg - The optional argument that accompanies the 'cmd'. The
* interpretation of this argument depends on the particular
@@ -624,7 +632,8 @@ static int sam34_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd,
else if (mintime < priv->timeout)
{
uint32_t window = (((priv->timeout - mintime) * WDT_FCLK) / 1000) - 1;
uint32_t window = (((priv->timeout - mintime) * WDT_FCLK) /
1000) - 1;
DEBUGASSERT(window <= priv->reload);
priv->window = window;
ret = OK;
@@ -642,8 +651,8 @@ static int sam34_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd,
* Name: sam_wdtinitialize
*
* Description:
* Initialize the WDT watchdog timer. The watchdog timer is initialized and
* registers as 'devpath'.
* Initialize the WDT watchdog timer. The watchdog timer is initialized
* and registers as 'devpath'.
*
* Input Parameters:
* devpath - The full path to the watchdog. This should be of the form
@@ -700,7 +709,6 @@ void sam_wdtinitialize(FAR const char *devpath)
*/
watchdog_register(devpath, (FAR struct watchdog_lowerhalf_s *)priv);
}
#endif /* CONFIG_WDT_DISABLE_ON_RESET */