blob: b1449858b732069689013f1a107a40266288dabc [file] [log] [blame]
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_FIRMWARE_GIGABOOT_INCLUDE_REG_H_
#define SRC_FIRMWARE_GIGABOOT_INCLUDE_REG_H_
#include <stdint.h>
#define REG8(addr) ((volatile uint8_t *)(uintptr_t)(addr))
#define REG16(addr) ((volatile uint16_t *)(uintptr_t)(addr))
#define REG32(addr) ((volatile uint32_t *)(uintptr_t)(addr))
#define REG64(addr) ((volatile uint64_t *)(uintptr_t)(addr))
#define writeb(v, a) (*REG8(a) = (v))
#define readb(a) (*REG8(a))
#define writew(v, a) (*REG16(a) = (v))
#define readw(a) (*REG16(a))
#define writel(v, a) (*REG32(a) = (v))
#define readl(a) (*REG32(a))
#define writell(v, a) (*REG64(a) = (v))
#define readll(a) (*REG64(a))
#endif // SRC_FIRMWARE_GIGABOOT_INCLUDE_REG_H_