fpga: xilinx: Simplify load/dump/info function handling
Connect FPGA version with appropriate operations
to remove huge switch-cases for every FPGA family.
Tested on Zynq. Spartan2/Spartan3/Virtex2 just compile test.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
diff --git a/include/xilinx.h b/include/xilinx.h
index b72aece..9801267 100644
--- a/include/xilinx.h
+++ b/include/xilinx.h
@@ -40,9 +40,16 @@
size_t size; /* bytes of data part can accept */
void *iface_fns; /* interface function table */
int cookie; /* implementation specific cookie */
+ struct xilinx_fpga_op *operations; /* operations */
char *name; /* device name in bitstream */
} xilinx_desc; /* end, typedef xilinx_desc */
+struct xilinx_fpga_op {
+ int (*load)(xilinx_desc *, const void *, size_t);
+ int (*dump)(xilinx_desc *, const void *, size_t);
+ int (*info)(xilinx_desc *);
+};
+
/* Generic Xilinx Functions
*********************************************************************/
int xilinx_load(xilinx_desc *desc, const void *image, size_t size);