[lib] static_assert() and read/write() registers

Change-Id: I30d8fc2166bb47de7c1090e7bc577b9f1bd7ca3f
diff --git a/include/assert.h b/include/assert.h
new file mode 100644
index 0000000..9e00561
--- /dev/null
+++ b/include/assert.h
@@ -0,0 +1,8 @@
+// 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.
+
+#pragma once
+
+#define static_assert(e, msg) _Static_assert(e, msg)
+
diff --git a/include/reg.h b/include/reg.h
new file mode 100644
index 0000000..9b00a79
--- /dev/null
+++ b/include/reg.h
@@ -0,0 +1,22 @@
+// 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.
+
+#pragma once
+
+#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))
+