RTEMS 6.1-rc7
Loading...
Searching...
No Matches
watchdog.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (c) 2008 embedded brains GmbH & Co. KG
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef LIBCPU_POWERPC_MPC55XX_WATCHDOG_H
36#define LIBCPU_POWERPC_MPC55XX_WATCHDOG_H
37
38#include <stdbool.h>
39
40#include <rtems.h>
41
43
44#ifdef __cplusplus
45extern "C" {
46#endif /* __cplusplus */
47
48static inline void mpc55xx_watchdog_clear()
49{
50 PPC_SET_SPECIAL_PURPOSE_REGISTER( BOOKE_TSR, BOOKE_TSR_WIS);
51}
52
53static inline void mpc55xx_watchdog_enable_interrupt( bool enable)
54{
55 if (enable) {
56 PPC_SET_SPECIAL_PURPOSE_REGISTER_BITS( BOOKE_TCR, BOOKE_TCR_WIE);
57 } else {
58 PPC_CLEAR_SPECIAL_PURPOSE_REGISTER_BITS( BOOKE_TCR, BOOKE_TCR_WIE);
59 }
60}
61
62static inline rtems_status_code mpc55xx_watchdog_set_time_base_bit( uint32_t bit)
63{
64 if (bit > 63) {
66 }
67
69 BOOKE_TCR,
70 BOOKE_TCR_WP( bit) | BOOKE_TCR_WPEXT( bit >> 2),
71 BOOKE_TCR_WP_MASK | BOOKE_TCR_WPEXT_MASK
72 );
73
74 return RTEMS_SUCCESSFUL;
75}
76
77#ifdef __cplusplus
78}
79#endif /* __cplusplus */
80
81#endif /* LIBCPU_POWERPC_MPC55XX_WATCHDOG_H */
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
@ RTEMS_SUCCESSFUL
This status code indicates successful completion of a requested operation.
Definition: status.h:90
@ RTEMS_INVALID_NUMBER
This status code indicates that a specified number was invalid.
Definition: status.h:142
#define PPC_SET_SPECIAL_PURPOSE_REGISTER(spr, val)
Sets the Special Purpose Register with number spr to the value in val.
Definition: powerpc-utility.h:590
#define PPC_SET_SPECIAL_PURPOSE_REGISTER_BITS(spr, bits)
Sets in the Special Purpose Register with number spr all bits which are set in bits.
Definition: powerpc-utility.h:605
#define PPC_CLEAR_SPECIAL_PURPOSE_REGISTER_BITS(spr, bits)
Clears in the Special Purpose Register with number spr all bits which are set in bits.
Definition: powerpc-utility.h:644
#define PPC_SET_SPECIAL_PURPOSE_REGISTER_BITS_MASKED(spr, bits, mask)
Sets in the Special Purpose Register with number spr all bits which are set in bits....
Definition: powerpc-utility.h:624
General purpose assembler macros, linker command file support and some inline functions for direct re...
This header file defines the RTEMS Classic API.