1// Copyright 2017 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#pragma once 6 7#include <ddk/debug.h> 8 9#define WAIT_ON(COND, N, UNITS) \ 10 ({ \ 11 int count = 0; \ 12 while (!(COND) && ++count <= N) \ 13 zx_nanosleep(zx_deadline_after(ZX_##UNITS##SEC(1))); \ 14 count <= N; \ 15 }) \ 16 17#define WAIT_ON_US(COND, N) WAIT_ON(COND, N, U) 18#define WAIT_ON_MS(COND, N) WAIT_ON(COND, N, M) 19 20#define LOG_ERROR(fmt, ...) zxlogf(ERROR, "i915: " fmt, ##__VA_ARGS__) 21#define LOG_WARN(fmt, ...) zxlogf(WARN, "i915: " fmt, ##__VA_ARGS__) 22#define LOG_INFO(fmt, ...) zxlogf(INFO, "i915: " fmt, ##__VA_ARGS__) 23#define LOG_TRACE(fmt, ...) zxlogf(TRACE, "i915: " fmt, ##__VA_ARGS__) 24#define LOG_SPEW(fmt, ...) zxlogf(SPEW, "i915: " fmt, ##__VA_ARGS__) 25