"Das U-Boot" Source Tree
at jcs/rk3128 41 lines 890 B view raw
1/* SPDX-License-Identifier: GPL-2.0+ */ 2/* 3 * Copyright (c) 2011 The Chromium OS Authors. 4 */ 5 6#ifndef __INITCALL_H 7#define __INITCALL_H 8 9#include <asm/types.h> 10#include <event.h> 11#include <hang.h> 12 13_Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); 14 15#define INITCALL(_call) \ 16 do { \ 17 if (_call()) { \ 18 printf("%s(): initcall %s() failed\n", __func__, \ 19 #_call); \ 20 hang(); \ 21 } \ 22 } while (0) 23 24#define INITCALL_EVT(_evt) \ 25 do { \ 26 if (event_notify_null(_evt)) { \ 27 printf("%s(): event %d/%s failed\n", __func__, _evt, \ 28 event_type_name(_evt)) ; \ 29 hang(); \ 30 } \ 31 } while (0) 32 33#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) 34#define WATCHDOG_INIT() INITCALL(init_func_watchdog_init) 35#define WATCHDOG_RESET() INITCALL(init_func_watchdog_reset) 36#else 37#define WATCHDOG_INIT() 38#define WATCHDOG_RESET() 39#endif 40 41#endif