1 /* 2 * SPDX-License-Identifier: BSD-3-Clause 3 * Copyright(c) 2023 Napatech A/S 4 */ 5 6 #ifndef _FPGA_MODEL_H_ 7 #define _FPGA_MODEL_H_ 8 9 #include <unistd.h> 10 #include <stdint.h> 11 #include <inttypes.h> 12 13 typedef uint32_t nthw_id_t; 14 15 enum nthw_fpga_bus_type { 16 NTHW_FPGA_BUS_TYPE_UNKNOWN = 17 0, /* Unknown/uninitialized - keep this as the first enum element */ 18 NTHW_FPGA_BUS_TYPE_BAR, 19 NTHW_FPGA_BUS_TYPE_PCI, 20 NTHW_FPGA_BUS_TYPE_CCIP, 21 NTHW_FPGA_BUS_TYPE_RAB0, 22 NTHW_FPGA_BUS_TYPE_RAB1, 23 NTHW_FPGA_BUS_TYPE_RAB2, 24 NTHW_FPGA_BUS_TYPE_NMB, 25 NTHW_FPGA_BUS_TYPE_NDM, 26 NTHW_FPGA_BUS_TYPE_SPI0, 27 NTHW_FPGA_BUS_TYPE_SPI = NTHW_FPGA_BUS_TYPE_SPI0, 28 }; 29 30 typedef enum nthw_fpga_bus_type nthw_fpga_bus_type_e; 31 32 enum nthw_fpga_register_type { 33 NTHW_FPGA_REG_TYPE_UNKNOWN = 34 0, /* Unknown/uninitialized - keep this as the first enum element */ 35 NTHW_FPGA_REG_TYPE_RW, 36 NTHW_FPGA_REG_TYPE_RO, 37 NTHW_FPGA_REG_TYPE_WO, 38 NTHW_FPGA_REG_TYPE_RC1, 39 NTHW_FPGA_REG_TYPE_MIXED, 40 }; 41 42 typedef enum nthw_fpga_register_type nthw_fpga_register_type_e; 43 44 struct nthw_fpga_field_init { 45 nthw_id_t id; 46 uint16_t bw; 47 uint16_t low; 48 uint64_t reset_val; 49 }; 50 51 typedef struct nthw_fpga_field_init nthw_fpga_field_init_s; 52 53 struct nthw_fpga_register_init { 54 nthw_id_t id; 55 uint32_t addr_rel; 56 uint16_t bw; 57 nthw_fpga_register_type_e type; 58 uint64_t reset_val; 59 int nb_fields; 60 struct nthw_fpga_field_init *fields; 61 }; 62 63 typedef struct nthw_fpga_register_init nthw_fpga_register_init_s; 64 65 struct nthw_fpga_module_init { 66 nthw_id_t id; 67 int instance; 68 nthw_id_t def_id; 69 int major_version; 70 int minor_version; 71 nthw_fpga_bus_type_e bus_id; 72 uint32_t addr_base; 73 int nb_registers; 74 struct nthw_fpga_register_init *registers; 75 }; 76 77 typedef struct nthw_fpga_module_init nthw_fpga_module_init_s; 78 79 struct nthw_fpga_prod_param { 80 const nthw_id_t id; 81 const int value; 82 }; 83 84 typedef struct nthw_fpga_prod_param nthw_fpga_prod_param_s; 85 86 struct nthw_fpga_prod_init { 87 int fpga_item_id; 88 int fpga_product_id; 89 int fpga_version; 90 int fpga_revision; 91 int fpga_patch_no; 92 int fpga_build_no; 93 uint32_t fpga_build_time; 94 int nb_prod_params; 95 struct nthw_fpga_prod_param *product_params; 96 int nb_modules; 97 struct nthw_fpga_module_init *modules; 98 }; 99 100 typedef struct nthw_fpga_prod_init nthw_fpga_prod_init_s; 101 102 #endif /* _FPGA_MODEL_H_ */ 103