bbase_util.h (4134B)
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 8 #ifndef BBASE_UTIL_H 9 #define BBASE_UTIL_H 10 11 #include <sal/types.h> 12 #include <sal/core/spl.h> 13 #include <sal/core/libc.h> 14 #include <soc/cm.h> 15 #include <bbase_types.h> 16 #ifndef BMF_INCLUDE_FOR_LKM 17 #include <buser_sal.h> 18 #endif 19 #include <shared/bsl.h> 20 21 extern bprint_fn _bfcprint_fn_func_cb; 22 extern buint32_t _bfcprint_fn_flag; 23 24 #if 0 25 #define BBASE_PRINTF(...) \ 26 if ((_bfcprint_fn_flag & BPRINT_FN_PRINTF) && \ 27 (_bfcprint_fn_func_cb)) { \ 28 _bfcprint_fn_func_cb(__VA_ARGS__); \ 29 } 30 31 #define BBASE_DBG_PRINTF(...) \ 32 if ((_bfcprint_fn_flag & BPRINT_FN_DEBUG) && \ 33 (_bfcprint_fn_func_cb)) { \ 34 _bfcprint_fn_func_cb(__VA_ARGS__); \ 35 } 36 #else 37 #define BBASE_PRINTF bsl_printf 38 #define BBASE_DBG_PRINTF \ 39 if (_bfcprint_fn_flag & BPRINT_FN_DEBUG) bsl_printf 40 41 #endif 42 43 44 #ifndef BMF_SAL_ASSERT 45 #define BMF_SAL_ASSERT(c) 46 #endif 47 48 #ifndef BMF_SAL_PRINTF 49 #define BMF_SAL_PRINTF BBASE_PRINTF 50 #endif 51 52 #ifndef BMF_SAL_DBG_PRINTF 53 #define BMF_SAL_DBG_PRINTF BBASE_DBG_PRINTF 54 #endif 55 56 #ifndef BMF_SAL_MEMCPY 57 #define BMF_SAL_MEMCPY sal_memcpy 58 #define BMACSEC_INCLUDE_LIB_MEMCPY 59 #endif 60 61 #ifndef BMF_SAL_MEMCMP 62 #define BMF_SAL_MEMCMP sal_memcmp 63 #define BMACSEC_INCLUDE_LIB_MEMCMP 64 #endif 65 66 #ifndef BMF_SAL_MEMSET 67 #define BMF_SAL_MEMSET sal_memset 68 #define BMACSEC_INCLUDE_LIB_MEMSET 69 #endif 70 71 72 #ifndef BMF_SAL_STRLEN 73 #define BMF_SAL_STRLEN sal_strlen 74 #define BMACSEC_INCLUDE_LIB_STRLEN 75 #endif 76 77 #ifndef BMF_SAL_STRCPY 78 #define BMF_SAL_STRCPY sal_strcpy 79 #define BMACSEC_INCLUDE_LIB_STRCPY 80 #endif 81 82 #ifndef BMF_SAL_STRNCPY 83 #define BMF_SAL_STRNCPY sal_strncpy 84 #define BMACSEC_INCLUDE_LIB_STRNCPY 85 #endif 86 87 #ifndef BMF_SAL_STRCMP 88 #define BMF_SAL_STRCMP sal_strcmp 89 #define BMACSEC_INCLUDE_LIB_STRCMP 90 #endif 91 92 #ifndef BMF_SAL_STRCMPI 93 #define BMF_SAL_STRCMPI sal_strcmpi 94 #define BMACSEC_INCLUDE_LIB_STRCMPI 95 #endif 96 97 #ifndef BMF_SAL_STRNCMP 98 #define BMF_SAL_STRNCMP sal_strncmp 99 #define BMACSEC_INCLUDE_LIB_STRNCMP 100 #endif 101 102 #ifndef BMF_SAL_STRNCASECMP 103 #define BMF_SAL_STRNCASECMP sal_strncasecmp 104 #define BMACSEC_INCLUDE_LIB_STRCASECMP 105 #endif 106 107 #ifndef BMF_SAL_STRCHR 108 #define BMF_SAL_STRCHR sal_strchr 109 #define BMACSEC_INCLUDE_LIB_STRCHR 110 #endif 111 112 #ifndef BMF_SAL_STRSTR 113 #define BMF_SAL_STRSTR sal_strstr 114 #define BMACSEC_INCLUDE_LIB_STRSTR 115 #endif 116 117 #ifndef BMF_SAL_STRCAT 118 #define BMF_SAL_STRCAT sal_strcat 119 #define BMACSEC_INCLUDE_LIB_STRCAT 120 #endif 121 122 #ifndef BMF_SAL_STRTOK 123 #define BMF_SAL_STRTOK sal_strtok 124 #define BMACSEC_INCLUDE_LIB_STRTOK 125 #endif 126 127 #ifndef BMF_SAL_ATOI 128 #define BMF_SAL_ATOI sal_atoi 129 #define BMACSEC_INCLUDE_LIB_ATOI 130 #endif 131 132 #ifndef BMF_SAL_STRDUP 133 #define BMF_SAL_STRDUP sal_strdup 134 #define BMACSEC_INCLUDE_LIB_STRDUP 135 #endif 136 137 #ifndef BMF_SAL_XSPRINTF 138 #define BMF_SAL_XSPRINTF sal_xsprintf 139 #define BMACSEC_INCLUDE_LIB_XSPRINTF 140 #endif /* BMF_SAL_XSPRINTF */ 141 142 #ifdef BMF_INCLUDE_FOR_LKM 143 144 extern int bmacsec_cli_register(void *); 145 EXPORT_SYMBOL(bmacsec_cli_register); 146 extern int bmacsec_handle_cmd(int, char **); 147 EXPORT_SYMBOL(bmacsec_handle_cmd); 148 149 EXPORT_SYMBOL(_bfcprint_fn_flag); 150 EXPORT_SYMBOL(_bfcprint_fn_func_cb); 151 EXPORT_SYMBOL(bmacsec_memcpy); 152 EXPORT_SYMBOL(bmacsec_memset); 153 EXPORT_SYMBOL(bmacsec_xsprintf); 154 EXPORT_SYMBOL(bmacsec_atoi); 155 EXPORT_SYMBOL(bmacsec_strcat); 156 EXPORT_SYMBOL(bmacsec_strchr); 157 EXPORT_SYMBOL(bmacsec_strcmp); 158 EXPORT_SYMBOL(bmacsec_strcmpi); 159 EXPORT_SYMBOL(bmacsec_strncmp); 160 EXPORT_SYMBOL(bmacsec_strncasecmp); 161 EXPORT_SYMBOL(bmacsec_strcpy); 162 EXPORT_SYMBOL(bmacsec_strdup); 163 EXPORT_SYMBOL(bmacsec_strlen); 164 EXPORT_SYMBOL(bmacsec_strncpy); 165 EXPORT_SYMBOL(bmacsec_strstr); 166 EXPORT_SYMBOL(bmacsec_strtok); 167 168 #endif /* BMF_INCLUDE_FOR_LKM */ 169 170 #endif /* BBASE_UTIL_H */ 171