1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12 13#pragma once 14 15/* macros for forcing the compiler to leave in statments it would 16 * normally optimize away */ 17 18#include <utils/attribute.h> 19#include <utils/stringify.h> 20 21/* Macro for doing dummy reads 22 * 23 * Forces a memory read access to the given address. 24 */ 25#define FORCE_READ(address) \ 26 do { \ 27 typeof(*(address)) *_ptr = (address); \ 28 asm volatile ("" : "=m"(*_ptr) : "r"(*_ptr)); \ 29 } while (0) 30