bcmgene_db.h (3601B)
1 /*! \file bcmgene_db.h 2 * 3 * Broadcom Generic Extensible NPL Encapsulation (GENE) header file. 4 * This file contains GENE definitions internal to the BCM library. 5 */ 6 /* 7 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 8 * 9 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 10 */ 11 12 #ifndef BCMINT_LTSW_GENE_DB_H 13 #define BCMINT_LTSW_GENE_DB_H 14 15 #include <sal/sal_types.h> 16 17 /*! 18 * \brief The struct of GENE field value map. 19 */ 20 typedef struct bcmgene_field_value_map_s { 21 22 /*! The input field value. */ 23 uint64_t in; 24 25 union { 26 /*! The output field value. */ 27 uint64_t v; 28 29 /*! The output field string value. */ 30 const char *s; 31 32 } out; 33 34 } bcmgene_field_value_map_t; 35 36 /*! 37 * \brief The struct of GENE field value converter. 38 */ 39 typedef struct bcmgene_field_value_converter_s { 40 41 /*! The flags for controlling the GENE field. */ 42 uint32_t flags; 43 44 /*! The value converter count. */ 45 int maps; 46 47 /*! The value converter for input/output. */ 48 bcmgene_field_value_map_t *map; 49 50 } bcmgene_field_value_converter_t; 51 52 /*! 53 * \brief The struct of GENE field. 54 */ 55 typedef struct bcmgene_field_desc_s { 56 57 /*! The flags for controlling the GENE field. */ 58 uint32_t flags; 59 60 /*! The GENE field handler start base. */ 61 int blk; 62 63 /*! The GENE field handler. */ 64 int offset; 65 66 /*! The bit width of GENE field. */ 67 int width; 68 69 /*! The GENE field is array. */ 70 int depth; 71 72 /*! The name of GENE field. */ 73 const char *field; 74 75 /*! The field value converter of GENE field. */ 76 bcmgene_field_value_converter_t *converter; 77 78 } bcmgene_field_desc_t; 79 80 /*! 81 * \brief The struct of GENE table. 82 */ 83 typedef struct bcmgene_table_desc_s { 84 85 /*! The sub-feature of GENE table. */ 86 uint32_t sub_f; 87 88 /*! The flags for controlling the GENE table. */ 89 uint32_t flags; 90 91 /*! The name of GENE table. */ 92 const char *table; 93 94 /*! The minimum index of GENE table. */ 95 int idx_min; 96 97 /*! The maximum index of GENE table. */ 98 int idx_max; 99 100 /*! The key count of GENE table. */ 101 int keys; 102 103 /*! The key array of GENE table. */ 104 bcmgene_field_desc_t *key; 105 106 /*! The field count of GENE table. */ 107 int flds; 108 109 /*! The field array of GENE table. */ 110 bcmgene_field_desc_t *fld; 111 112 } bcmgene_table_desc_t; 113 114 /*! 115 * \brief The struct of GENE functionality. 116 */ 117 typedef struct bcmgene_func_desc_s { 118 119 /*! The indicator of GENE functionality. */ 120 uint32_t func; 121 122 /*! The table count for this GENE functionality. */ 123 int tbls; 124 125 /*! The table array for this GENE functionality. */ 126 bcmgene_table_desc_t *tbl; 127 128 } bcmgene_func_desc_t; 129 130 /*! 131 * \brief The struct of GENE descriptor. 132 */ 133 typedef struct bcmgene_desc_s { 134 135 /*! The name of GENE. */ 136 const char *name; 137 138 /*! The feature of GENE. */ 139 int feature; 140 141 /*! The functionality count of GENE. */ 142 int funcs; 143 144 /*! The functionality array of GENE. */ 145 bcmgene_func_desc_t *func; 146 147 } bcmgene_desc_t; 148 149 150 /*! 151 * \brief The struct of GENE database. 152 */ 153 typedef struct bcmgene_db_s { 154 155 /*! The version of GENE database. */ 156 const char *ver; 157 158 /*! The descriptor count of GENE. */ 159 int genes; 160 161 /*! The descriptor array of GENE. */ 162 bcmgene_desc_t *gene; 163 164 } bcmgene_db_t; 165 166 /*! 167 * \brief Get the GENE database for a device. 168 * 169 * \param [in] unit Unit Number. 170 * 171 * \retval !NULL Success. 172 * \retval NULL Failure. 173 */ 174 extern bcmgene_db_t * 175 bcmi_ltsw_gene_db_get(int unit); 176 177 #endif /* BCMINT_LTSW_GENE_DB_H */