summaryrefslogtreecommitdiff
path: root/include/axi.h
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2018-08-09 14:51:18 +0200
committerAnatolij Gustschin <agust@denx.de>2018-08-11 08:09:39 +0200
commit9a8bcabd8adac3382bc23bef450a6793e5144110 (patch)
tree65209a7afa8abbc2a55ec2dfb9acf22fe50a010d /include/axi.h
parent9fc8706d65fc812f4e1a2da78d3b4411c866db63 (diff)
axi: Add AXI sandbox driver and simple emulator
Add test infrastructure and tests for the AXI uclass. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'include/axi.h')
-rw-r--r--include/axi.h74
1 files changed, 57 insertions, 17 deletions
diff --git a/include/axi.h b/include/axi.h
index 2ff81c16af..3e40692cdf 100644
--- a/include/axi.h
+++ b/include/axi.h
@@ -1,48 +1,47 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
- * (C) Copyright 2017
- * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
+ * (C) Copyright 2017, 2018
+ * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
*/
#ifndef _AXI_H_
#define _AXI_H_
+/**
+ * enum axi_size_t - Determine size of AXI transfer
+ * @AXI_SIZE_8: AXI sransfer is 8-bit wide
+ * @AXI_SIZE_16: AXI sransfer is 16-bit wide
+ * @AXI_SIZE_32: AXI sransfer is 32-bit wide
+ */
enum axi_size_t {
AXI_SIZE_8,
AXI_SIZE_16,
AXI_SIZE_32,
};
-/**
- * struct axi_ops - driver operations for AXI uclass
- *
- * Drivers should support these operations unless otherwise noted. These
- * operations are intended to be used by uclass code, not directly from
- * other code.
- */
struct axi_ops {
/**
* read() - Read a single value from a specified address on a AXI bus
- *
* @dev: AXI bus to read from.
* @address: The address to read from.
* @data: Pointer to a variable that takes the data value read
* from the address on the AXI bus.
* @size: The size of the data to be read.
- * @return 0 if OK, -ve on error.
+ *
+ * Return: 0 if OK, -ve on error.
*/
int (*read)(struct udevice *dev, ulong address, void *data,
enum axi_size_t size);
/**
* write() - Write a single value to a specified address on a AXI bus
- *
* @dev: AXI bus to write to.
* @address: The address to write to.
* @data: Pointer to the data value to be written to the address
* on the AXI bus.
* @size: The size of the data to write.
- * @return 0 if OK, -ve on error.
+ *
+ * Return 0 if OK, -ve on error.
*/
int (*write)(struct udevice *dev, ulong address, void *data,
enum axi_size_t size);
@@ -52,27 +51,68 @@ struct axi_ops {
/**
* axi_read() - Read a single value from a specified address on a AXI bus
- *
* @dev: AXI bus to read from.
* @address: The address to read from.
* @data: Pointer to a variable that takes the data value read from the
* address on the AXI bus.
* @size: The size of the data to write.
- * @return 0 if OK, -ve on error.
+ *
+ * Return: 0 if OK, -ve on error.
*/
int axi_read(struct udevice *dev, ulong address, void *data,
enum axi_size_t size);
/**
* axi_write() - Write a single value to a specified address on a AXI bus
- *
* @dev: AXI bus to write to.
* @address: The address to write to.
* @data: Pointer to the data value to be written to the address on the
* AXI bus.
* @size: The size of the data to write.
- * @return 0 if OK, -ve on error.
+ *
+ * Return: 0 if OK, -ve on error.
*/
int axi_write(struct udevice *dev, ulong address, void *data,
enum axi_size_t size);
+
+struct axi_emul_ops {
+ /**
+ * read() - Read a single value from a specified address on a AXI bus
+ * @dev: AXI bus to read from.
+ * @address: The address to read from.
+ * @data: Pointer to a variable that takes the data value read
+ * from the address on the AXI bus.
+ * @size: The size of the data to be read.
+ *
+ * Return: 0 if OK, -ve on error.
+ */
+ int (*read)(struct udevice *dev, ulong address, void *data,
+ enum axi_size_t size);
+
+ /**
+ * write() - Write a single value to a specified address on a AXI bus
+ * @dev: AXI bus to write to.
+ * @address: The address to write to.
+ * @data: Pointer to the data value to be written to the address
+ * on the AXI bus.
+ * @size: The size of the data to write.
+ *
+ * Return: 0 if OK, -ve on error.
+ */
+ int (*write)(struct udevice *dev, ulong address, void *data,
+ enum axi_size_t size);
+
+ /**
+ * get_store() - Get address of internal storage of a emulated AXI
+ * device
+ * @dev: Emulated AXI device to get the pointer of the internal
+ * storage for.
+ * @storep: Pointer to the internal storage of the emulated AXI
+ * device.
+ *
+ * Return: 0 if OK, -ve on error.
+ */
+ int (*get_store)(struct udevice *dev, u8 **storep);
+};
+
#endif