summaryrefslogtreecommitdiffstats
path: root/bsps/arm/lpc176x/include/bsp/watchdog.h
blob: ff5d1730fa4da3c6c67ea001809b48133bf6af65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
 * @file
 *
 * @ingroup lpc176x
 *
 * @brief API of the Watchdog driver for the lpc176x bsp in RTEMS.
 */

/*
 * Copyright (c) 2014 Taller Technologies.
 *
 * @author  Boretto Martin    (martin.boretto@tallertechnologies.com)
 * @author  Diaz Marcos (marcos.diaz@tallertechnologies.com)
 * @author  Lenarduzzi Federico  (federico.lenarduzzi@tallertechnologies.com)
 * @author  Daniel Chicco  (daniel.chicco@tallertechnologies.com)
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license/LICENSE.
 */

#ifndef LIBBSP_ARM_LPC176X_WATCHDOG_H
#define LIBBSP_ARM_LPC176X_WATCHDOG_H

#include <bsp/watchdog-defs.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/**
 * @brief Checks if the watchdog was executed by software or not. Set when
 *        the watchdog timer times out, cleared by software.
 *
 * @return TRUE if the watchdog was executed.
 *         FALSE otherwise.
 */
bool lpc176x_been_reset_by_watchdog( void );

/**
 * @brief Resets the watchdog timer.
 */
void lpc176x_watchdog_reset( void );

/**
 * @brief Configures the watchdog's timer.
 *
 * @param tcount Timer's out value.
 * @return RTEMS_SUCCESSFUL if the watchdog was configured successfully.
 */
rtems_status_code lpc176x_watchdog_config( lpc176x_microseconds tcount );

/**
 * @brief Configures the timer watchdog using interrupt.
 *
 * @param tcount Timer's out value.
 * @param interrupt Interrupt to register.
 * @return RTEMS_SUCCESSFUL if the watchdog was configured successfully
 *                          with interrupts.
 */
rtems_status_code lpc176x_watchdog_config_with_interrupt(
  lpc176x_wd_isr_funct interrupt,
  lpc176x_microseconds tcount
);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif  /* LIBBSP_ARM_LPC176X_WATCHDOG_H */