/* fpga_dump * generic multiplexing code */ int fpga_dump( int devnum, void *buf, size_t bsize ) { int ret_val = FPGA_FAIL; /* assume failure */ fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ ); if ( desc ) { switch ( desc->devtype ) { case fpga_xilinx: #if defined(CONFIG_FPGA_XILINX) ret_val = xilinx_dump( desc->devdesc, buf, bsize ); #else fpga_no_sup( (char *)__FUNCTION__, "Xilinx devices" ); #endif break; case fpga_altera: #if defined(CONFIG_FPGA_ALTERA) ret_val = altera_dump( desc->devdesc, buf, bsize ); #else fpga_no_sup( (char *)__FUNCTION__, "Altera devices" ); #endif break; default: printf( "%s: Invalid or unsupported device type %d\n", __FUNCTION__, desc->devtype ); } } return ret_val; }
/* fpga_reloc * generic multiplexing code */ int fpga_reloc( fpga_type devtype, void *desc, ulong reloc_off ) { int ret_val = FPGA_FAIL; PRINTF( "%s: Relocating Device of type %d @ 0x%p with offset %lx\n", __FUNCTION__, devtype, desc, reloc_off ); switch ( devtype ) { case fpga_xilinx: #if defined(CONFIG_FPGA_XILINX) ret_val = xilinx_reloc( desc, reloc_off ); #else fpga_no_sup( (char *)__FUNCTION__, "Xilinx devices" ); #endif break; case fpga_altera: #if defined(CONFIG_FPGA_ALTERA) ret_val = altera_reloc( desc, reloc_off ); #else fpga_no_sup( (char *)__FUNCTION__, "Altera devices" ); #endif break; default: printf( "%s: Invalid or unsupported device type %d\n", __FUNCTION__, devtype ); } return ret_val; }
int fpga_fsload(int devnum, const void *buf, size_t size, fpga_fs_info *fpga_fsinfo) { int ret_val = FPGA_FAIL; /* assume failure */ const fpga_desc *desc = fpga_validate(devnum, buf, size, (char *)__func__); if (desc) { switch (desc->devtype) { case fpga_xilinx: #if defined(CONFIG_FPGA_XILINX) ret_val = xilinx_loadfs(desc->devdesc, buf, size, fpga_fsinfo); #else fpga_no_sup((char *)__func__, "Xilinx devices"); #endif break; default: printf("%s: Invalid or unsupported device type %d\n", __func__, desc->devtype); } } return ret_val; }
/* * fpga_dev_info * generic multiplexing code */ static int fpga_dev_info(int devnum) { int ret_val = FPGA_FAIL; /* assume failure */ const fpga_desc * const desc = fpga_get_desc(devnum); if (desc) { debug("%s: Device Descriptor @ 0x%p\n", __func__, desc->devdesc); switch (desc->devtype) { case fpga_xilinx: #if defined(CONFIG_FPGA_XILINX) printf("Xilinx Device\nDescriptor @ 0x%p\n", desc); ret_val = xilinx_info(desc->devdesc); #else fpga_no_sup((char *)__func__, "Xilinx devices"); #endif break; case fpga_altera: #if defined(CONFIG_FPGA_ALTERA) printf("Altera Device\nDescriptor @ 0x%p\n", desc); ret_val = altera_info(desc->devdesc); #else fpga_no_sup((char *)__func__, "Altera devices"); #endif break; case fpga_lattice: #if defined(CONFIG_FPGA_LATTICE) printf("Lattice Device\nDescriptor @ 0x%p\n", desc); ret_val = lattice_info(desc->devdesc); #else fpga_no_sup((char *)__func__, "Lattice devices"); #endif break; default: printf("%s: Invalid or unsupported device type %d\n", __func__, desc->devtype); } } else { printf("%s: Invalid device number %d\n", __func__, devnum); } return ret_val; }
/* * Generic multiplexing code */ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype) { int ret_val = FPGA_FAIL; /* assume failure */ const fpga_desc *desc = fpga_validate(devnum, buf, bsize, (char *)__func__); if (desc) { switch (desc->devtype) { case fpga_xilinx: #if defined(CONFIG_FPGA_XILINX) ret_val = xilinx_load(desc->devdesc, buf, bsize, bstype); #else fpga_no_sup((char *)__func__, "Xilinx devices"); #endif break; case fpga_altera: #if defined(CONFIG_FPGA_ALTERA) ret_val = altera_load(desc->devdesc, buf, bsize); #else fpga_no_sup((char *)__func__, "Altera devices"); #endif break; case fpga_lattice: #if defined(CONFIG_FPGA_LATTICE) ret_val = lattice_load(desc->devdesc, buf, bsize); #else fpga_no_sup((char *)__func__, "Lattice devices"); #endif break; default: printf("%s: Invalid or unsupported device type %d\n", __func__, desc->devtype); } } return ret_val; }