1 #ifndef __CB_BDK_WATCHDOG_H__ 2 #define __CB_BDK_WATCHDOG_H__ 3 /***********************license start*********************************** 4 * Copyright (c) 2003-2017 Cavium Inc. ([email protected]). All rights 5 * reserved. 6 * 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: 11 * 12 * * Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * * Redistributions in binary form must reproduce the above 16 * copyright notice, this list of conditions and the following 17 * disclaimer in the documentation and/or other materials provided 18 * with the distribution. 19 * 20 * * Neither the name of Cavium Inc. nor the names of 21 * its contributors may be used to endorse or promote products 22 * derived from this software without specific prior written 23 * permission. 24 * 25 * This Software, including technical data, may be subject to U.S. export 26 * control laws, including the U.S. Export Administration Act and its 27 * associated regulations, and may be subject to export or import 28 * regulations in other countries. 29 * 30 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 31 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 32 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT 33 * TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY 34 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT 35 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES 36 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR 37 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, 38 * QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK 39 * ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 40 ***********************license end**************************************/ 41 42 /** 43 * @file 44 * 45 * Utility functions for controlling the watchdog during boot 46 * 47 * @defgroup watchdog Watchdog related functions 48 * @{ 49 */ 50 51 /** 52 * Setup the watchdog to expire in timeout_ms milliseconds. When the watchdog 53 * expires, the chip three things happen: 54 * 1) Expire 1: interrupt that is ignored by the BDK 55 * 2) Expire 2: DEL3T interrupt, which is disabled and ignored 56 * 3) Expire 3: Soft reset of the chip 57 * 58 * Since we want a soft reset, we actually program the watchdog to expire at 59 * the timeout / 3. 60 * 61 * @param timeout_ms Timeout in milliseconds. If this is zero, the timeout is taken from the 62 * global configuration option BDK_BRD_CFG_WATCHDOG_TIMEOUT 63 */ 64 extern void bdk_watchdog_set(unsigned int timeout_ms); 65 66 /** 67 * Signal the watchdog that we are still running 68 */ 69 extern void bdk_watchdog_poke(void); 70 71 /** 72 * Disable the hardware watchdog 73 */ 74 extern void bdk_watchdog_disable(void); 75 76 /** 77 * Return true if the watchdog is configured and running 78 * 79 * @return Non-zero if watchdog is running 80 */ 81 extern int bdk_watchdog_is_running(void); 82 83 /** @} */ 84 #endif /* !__CB_BDK_WATCHDOG_H__ */ 85