format.h (4047B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * format field manipulations. 8 */ 9 10 #ifndef _SOC_FORMAT_H 11 #define _SOC_FORMAT_H 12 13 #include <soc/defs.h> 14 #if defined(BCM_ESW_SUPPORT) || defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(PORTMOD_SUPPORT) 15 #include <soc/mcm/allenum.h> 16 #endif 17 18 #include <soc/field.h> 19 20 21 /************************************************************* 22 * Function: soc_format_field_length 23 * Purpose: Return the length of a format field in bits. 24 * Value is 0 if field is not found. 25 * Returns: bits in field 26 */ 27 int 28 soc_format_field_length(int unit, soc_format_t format, soc_field_t field); 29 30 /*************************************************************** 31 * Function: 32 * soc_format_field_valid 33 * Purpose: 34 * Verify if field is valid & present in format 35 * Parameters: 36 * format - (IN)Format id. 37 * field - (IN)Field id. 38 * Return: 39 * TRUE -If field is present & valid. 40 * FALSE -Otherwise. 41 */ 42 int 43 soc_format_field_valid(int unit, soc_format_t format, soc_field_t field); 44 45 /**************************************************** 46 * Function: soc_format_field_get 47 * Purpose: Get a format field 48 * Parameters: unit - device 49 * format 50 * entbuf - format entry buffer 51 * field - which field to get 52 * fldbuf - field buffer 53 */ 54 uint32 * 55 soc_format_field_get(int unit, soc_format_t format, const uint32 *entbuf, 56 soc_field_t field, uint32 *fldbuf); 57 58 /******************************************************** 59 * Function: soc_format_field_set 60 * Purpose: Set a format field 61 * Parameters: unit - device 62 * format 63 * entbuf - format entry buffer 64 * field - which field to set 65 * fldbuf - field buffer 66 */ 67 void 68 soc_format_field_set(int unit, soc_format_t format, uint32 *entbuf, 69 soc_field_t field, uint32 *fldbuf); 70 /*********************************************************** 71 * Function: soc_format_field32_get 72 * Purpose: Get a <=32 bit field out of a format entry 73 * Returns: The value of the field 74 */ 75 uint32 76 soc_format_field32_get(int unit, soc_format_t format, const void *entbuf, 77 soc_field_t field); 78 79 /*********************************************************** 80 * Function: soc_format_field32_set 81 * Purpose: Set a <=32 bit field out of a format entry 82 * Returns: void 83 */ 84 void 85 soc_format_field32_set(int unit, soc_format_t format, void *entbuf, 86 soc_field_t field, uint32 value); 87 88 #if defined(BCM_ESW_SUPPORT) 89 #if !defined(SOC_NO_NAMES) 90 extern char *soc_format_name[]; 91 #define SOC_FORMAT_NAME(unit, format) soc_format_name[format] 92 #else 93 #define SOC_FORMAT_NAME(unit, format) "" 94 #endif 95 #endif 96 97 /*********************************************************** 98 * DOP_ID => FORMAT Functionality 99 */ 100 int 101 soc_dop_format_get(int unit, uint16 dop_id, uint16 dop_block, 102 uint16 *n_data_phases, soc_format_t *format); 103 104 /******************************************************************** 105 * Function: _soc_format_fieldinfo_get 106 * Purpose: Get a format field info without reference to chip. 107 * Parameters: unit - device 108 * fmt - format 109 * field - Field in format 110 * Returns Reference to field info format 111 */ 112 soc_field_info_t * 113 soc_format_fieldinfo_get(int unit, soc_format_t fmt, soc_field_t field); 114 115 /******************************************************************** 116 * Function: soc_format_entry_dump 117 * Purpose: Dump the format entry. 118 * Parameters: unit - device 119 * fmt - format 120 * entbuf - format entry buffer 121 * Returns: voiod 122 */ 123 void 124 soc_format_entry_dump(int unit, soc_format_t format, const uint32 *entbuf); 125 #endif