-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/timers/watchdog: add watchdog timer notifier chain
Add support for watchdog timer notifer chain so that users can customize the callback function when the watchdog timer times out which enabled by Auto-monitor Change-Id: I8dcfb2e25354aa5699b976934e9c6503c2a82e55 Signed-off-by: yaojiaqi <[email protected]>
- Loading branch information
Showing
6 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/**************************************************************************** | ||
* drivers/timers/watchdog_notifier.c | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. The | ||
* ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
****************************************************************************/ | ||
|
||
/**************************************************************************** | ||
* Included Files | ||
****************************************************************************/ | ||
|
||
#include <nuttx/arch.h> | ||
#include <nuttx/notifier.h> | ||
|
||
#include <sys/types.h> | ||
|
||
/**************************************************************************** | ||
* Private Data | ||
****************************************************************************/ | ||
|
||
static ATOMIC_NOTIFIER_HEAD(g_watchdog_notifier_list); | ||
|
||
/**************************************************************************** | ||
* Public Functions | ||
****************************************************************************/ | ||
|
||
/**************************************************************************** | ||
* Name: watchdog_notifier_chain_register | ||
* | ||
* Description: | ||
* Add notifier to the watchdog notifier chain | ||
* | ||
* Input Parameters: | ||
* nb - New entry in notifier chain | ||
* | ||
****************************************************************************/ | ||
|
||
void watchdog_notifier_chain_register(FAR struct notifier_block *nb) | ||
{ | ||
atomic_notifier_chain_register(&g_watchdog_notifier_list, nb); | ||
} | ||
|
||
/**************************************************************************** | ||
* Name: watchdog_notifier_chain_unregister | ||
* | ||
* Description: | ||
* Remove notifier from the watchdog notifier chain | ||
* | ||
* Input Parameters: | ||
* nb - Entry to remove from notifier chain | ||
* | ||
****************************************************************************/ | ||
|
||
void watchdog_notifier_chain_unregister(FAR struct notifier_block *nb) | ||
{ | ||
atomic_notifier_chain_unregister(&g_watchdog_notifier_list, nb); | ||
} | ||
|
||
/**************************************************************************** | ||
* Name: watchdog_notifier_call_chain | ||
* | ||
* Description: | ||
* Call functions in the watchdog notifier chain. | ||
* | ||
* Input Parameters: | ||
* action - Value passed unmodified to notifier function | ||
* data - Pointer passed unmodified to notifier function | ||
* | ||
****************************************************************************/ | ||
|
||
void watchdog_notifier_call_chain(unsigned long action, FAR void *data) | ||
{ | ||
atomic_notifier_call_chain(&g_watchdog_notifier_list, action, data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters