2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 /******************************************************************************
18 * @brief header file for wdt driver
21 ******************************************************************************/
31 #include <drv_common.h>
33 /// definition for wdt handle.
34 typedef void *wdt_handle_t;
36 /****** WDT Event *****/
38 WDT_EVENT_TIMEOUT = 0 ///< generate the interrupt
41 typedef void (*wdt_event_cb_t)(wdt_event_e event); ///< Pointer to \ref wdt_event_cb_t : WDT Event call back.
44 \brief WDT Device Driver Capabilities.
47 uint32_t interrupt : 1; ///< supports interrupt
51 \brief get wdt instance count.
52 \return wdt instance count
54 int32_t csi_wdt_get_instance_count(void);
57 \brief Initialize WDT Interface. 1. Initializes the resources needed for the WDT interface 2.registers event callback function
58 \param[in] idx must not exceed return value of csi_wdt_get_instance_count()
59 \param[in] cb_event Pointer to \ref wdt_event_cb_t
60 \return pointer to wdt instance
62 wdt_handle_t csi_wdt_initialize(int32_t idx, wdt_event_cb_t cb_event);
65 \brief De-initialize WDT Interface. stops operation and releases the software resources used by the interface
66 \param[in] handle wdt handle to operate.
69 int32_t csi_wdt_uninitialize(wdt_handle_t handle);
72 \brief Get driver capabilities.
73 \param[in] handle wdt handle to operate.
74 \return \ref wdt_capabilities_t
76 wdt_capabilities_t csi_wdt_get_capabilities(wdt_handle_t handle);
79 \brief Set the WDT value.
80 \param[in] handle wdt handle to operate.
81 \param[in] value the timeout value(ms).
84 int32_t csi_wdt_set_timeout(wdt_handle_t handle, uint32_t value);
88 \param[in] handle wdt handle to operate.
91 int32_t csi_wdt_start(wdt_handle_t handle);
95 \param[in] handle wdt handle to operate.
98 int32_t csi_wdt_stop(wdt_handle_t handle);
101 \brief Restart the WDT.
102 \param[in] handle wdt handle to operate.
105 int32_t csi_wdt_restart(wdt_handle_t handle);
108 \brief Read the WDT Current value.
109 \param[in] handle wdt handle to operate.
110 \param[in] value Pointer to the Value.
113 int32_t csi_wdt_read_current_value(wdt_handle_t handle, uint32_t *value);
119 #endif /* _CSI_WDT_H_ */