merlin16_pcieg3_access.h (23436B)
1 /***************************************************************************************** 2 ***************************************************************************************** 3 * * 4 * Revision : * 5 * * 6 * Description : Functions used internally and available in debug shell only * 7 * * 8 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 9 * 10 * Copyright 2007-2019 Broadcom Inc. All rights reserved. * 11 * No portions of this material may be reproduced in any form without * 12 * the written permission of: * 13 * Broadcom Corporation * 14 * 5300 California Avenue * 15 * Irvine, CA 92617 * 16 * * 17 * All information contained in this document is Broadcom Corporation * 18 * company private proprietary, and trade secret. * 19 */ 20 21 /** @file merlin16_pcieg3_access.h 22 * Implementation of API uC access functions 23 */ 24 25 #ifndef MERLIN16_PCIEG3_API_ACCESS_H 26 #define MERLIN16_PCIEG3_API_ACCESS_H 27 28 #include "merlin16_pcieg3_ipconfig.h" 29 #include "common/srds_api_err_code.h" 30 #include "common/srds_api_uc_common.h" 31 #include "common/srds_api_types.h" 32 #include "merlin16_pcieg3_usr_includes.h" 33 34 35 /*---------------------------------------------*/ 36 /* Serdes IP RAM access - Lane RAM Variables */ 37 /*---------------------------------------------*/ 38 /* rd - read; wr - write */ 39 /* b - byte; w - word */ 40 /* l - lane; c - core */ 41 /* uc - micro */ 42 /* s - signed */ 43 /*---------------------------------------------*/ 44 /** Unsigned Byte Read of a uC RAM Lane variable. 45 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 46 * @param sa__ is an opaque state vector passed through to device access functions. 47 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 48 * @param addr Address of RAM lane variable to be read 49 * @return 8bit unsigned value read from uC RAM 50 */ 51 uint8_t merlin16_pcieg3_rdbl_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 52 53 /** Unsigned Word Read of a uC RAM Lane variable. 54 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 55 * @param sa__ is an opaque state vector passed through to device access functions. 56 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 57 * @param addr Address of RAM lane variable to be read 58 * @return 16bit unsigned value read from uC RAM 59 */ 60 uint16_t merlin16_pcieg3_rdwl_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 61 62 /** Unsigned Byte Write of a uC RAM Lane variable. 63 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 64 * @param sa__ is an opaque state vector passed through to device access functions. 65 * @param addr Address of RAM lane variable to be written 66 * @param wr_val 8bit unsigned value to be written to RAM variable 67 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 68 */ 69 err_code_t merlin16_pcieg3_wrbl_uc_var(srds_access_t *sa__, uint16_t addr, uint8_t wr_val); 70 71 /** Unsigned Word Write of a uC RAM Lane variable. 72 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 73 * @param sa__ is an opaque state vector passed through to device access functions. 74 * @param addr Address of RAM lane variable to be written 75 * @param wr_val 16bit unsigned value to be written to RAM variable 76 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 77 */ 78 err_code_t merlin16_pcieg3_wrwl_uc_var(srds_access_t *sa__, uint16_t addr, uint16_t wr_val); 79 80 81 /* Signed version of above 4 functions */ 82 83 /** Signed Byte Read of a uC RAM Lane variable. 84 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 85 * @param sa__ is an opaque state vector passed through to device access functions. 86 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 87 * @param addr Address of RAM lane variable to be read 88 * @return 8bit signed value read from uC RAM 89 */ 90 int8_t merlin16_pcieg3_rdbls_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 91 92 /** Signed Word Read of a uC RAM Lane variable. 93 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 94 * @param sa__ is an opaque state vector passed through to device access functions. 95 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 96 * @param addr Address of RAM lane variable to be read 97 * @return 16bit signed value read from uC RAM 98 */ 99 int16_t merlin16_pcieg3_rdwls_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 100 101 /** Signed Byte Write of a uC RAM Lane variable. 102 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 103 * @param sa__ is an opaque state vector passed through to device access functions. 104 * @param addr Address of RAM lane variable to be written 105 * @param wr_val 8bit signed value to be written to RAM variable 106 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 107 */ 108 err_code_t merlin16_pcieg3_wrbls_uc_var(srds_access_t *sa__, uint16_t addr, int8_t wr_val); 109 110 /** Signed Word Write of a uC RAM Lane variable. 111 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 112 * @param sa__ is an opaque state vector passed through to device access functions. 113 * @param addr Address of RAM lane variable to be written 114 * @param wr_val 16bit signed value to be written to RAM variable 115 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 116 */ 117 err_code_t merlin16_pcieg3_wrwls_uc_var(srds_access_t *sa__, uint16_t addr, int16_t wr_val); 118 119 120 121 122 /*---------------------------------------------*/ 123 /* Serdes IP RAM access - Core RAM Variables */ 124 /*---------------------------------------------*/ 125 /** Unsigned Byte Read of a uC RAM Core variable. 126 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 127 * @param sa__ is an opaque state vector passed through to device access functions. 128 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 129 * @param addr Address of RAM core variable to be read 130 * @return 8bit unsigned value read from uC RAM 131 */ 132 uint8_t merlin16_pcieg3_rdbc_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr); 133 134 /** Unsigned Word Read of a uC RAM Core variable. 135 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 136 * @param sa__ is an opaque state vector passed through to device access functions. 137 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 138 * @param addr Address of RAM core variable to be read 139 * @return 16bit unsigned value read from uC RAM 140 */ 141 uint16_t merlin16_pcieg3_rdwc_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr); 142 143 /** Unsigned Byte Write of a uC RAM Core variable. 144 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 145 * @param sa__ is an opaque state vector passed through to device access functions. 146 * @param addr Address of RAM core variable to be written 147 * @param wr_val 8bit unsigned value to be written to RAM variable 148 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 149 */ 150 err_code_t merlin16_pcieg3_wrbc_uc_var(srds_access_t *sa__, uint8_t addr, uint8_t wr_val); 151 152 /** Unsigned Word Write of a uC RAM Core variable. 153 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 154 * @param sa__ is an opaque state vector passed through to device access functions. 155 * @param addr Address of RAM core variable to be written 156 * @param wr_val 16bit unsigned value to be written to RAM variable 157 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 158 */ 159 err_code_t merlin16_pcieg3_wrwc_uc_var(srds_access_t *sa__, uint8_t addr, uint16_t wr_val); 160 161 162 /* Signed version of above 4 functions */ 163 164 /** Signed Byte Read of a uC RAM Core variable. 165 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 166 * @param sa__ is an opaque state vector passed through to device access functions. 167 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 168 * @param addr Address of RAM core variable to be read 169 * @return 8bit signed value read from uC RAM 170 */ 171 int8_t merlin16_pcieg3_rdbcs_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr); 172 173 /** Signed Word Read of a uC RAM Core variable. 174 * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 175 * @param sa__ is an opaque state vector passed through to device access functions. 176 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 177 * @param addr Address of RAM core variable to be read 178 * @return 16bit signed value read from uC RAM 179 */ 180 int16_t merlin16_pcieg3_rdwcs_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr); 181 182 /** Signed Byte Write of a uC RAM Core variable. 183 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 184 * @param sa__ is an opaque state vector passed through to device access functions. 185 * @param addr Address of RAM core variable to be written 186 * @param wr_val 8bit signed value to be written to RAM variable 187 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 188 */ 189 err_code_t merlin16_pcieg3_wrbcs_uc_var(srds_access_t *sa__, uint8_t addr, int8_t wr_val); 190 191 /** Signed Word Write of a uC RAM Core variable. 192 * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs. 193 * @param sa__ is an opaque state vector passed through to device access functions. 194 * @param addr Address of RAM core variable to be written 195 * @param wr_val 16bit signed value to be written to RAM variable 196 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 197 */ 198 err_code_t merlin16_pcieg3_wrwcs_uc_var(srds_access_t *sa__, uint8_t addr, int16_t wr_val); 199 200 201 /*---------------------------------------------------*/ 202 /* Micro Commands through uC DSC Command Interface */ 203 /*---------------------------------------------------*/ 204 /** Issue a Micro command through the uC DSC Command Interface and return control immediately. 205 * @param sa__ is an opaque state vector passed through to device access functions. 206 * @param cmd Micro command to be issued 207 * @param supp_info Supplement information for the Micro command to be issued (RAM read/write address or Micro Control command) 208 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 209 */ 210 err_code_t merlin16_pcieg3_pmd_uc_cmd_return_immediate(srds_access_t *sa__, enum srds_pmd_uc_cmd_enum cmd, uint8_t supp_info); 211 212 /** Issue a Micro command through the uC DSC Command Interface. Control returned only after command is finished. 213 * @param sa__ is an opaque state vector passed through to device access functions. 214 * @param cmd Micro command to be issued 215 * @param supp_info Supplement information for the Micro command to be issued (RAM read/write address or Micro Control command) 216 * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued 217 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 218 */ 219 err_code_t merlin16_pcieg3_pmd_uc_cmd(srds_access_t *sa__, enum srds_pmd_uc_cmd_enum cmd, uint8_t supp_info, uint32_t timeout_ms); 220 221 /** Issue a Micro command with data through the uC DSC Command Interface and return control immediately. 222 * @param sa__ is an opaque state vector passed through to device access functions. 223 * @param cmd Micro command to be issued 224 * @param supp_info Supplement information for the Micro command to be issued (RAM write address) 225 * @param data Data to be written to dsc_data for use by uC 226 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 227 */ 228 err_code_t merlin16_pcieg3_pmd_uc_cmd_with_data_return_immediate(srds_access_t *sa__, enum srds_pmd_uc_cmd_enum cmd, uint8_t supp_info, uint16_t data); 229 230 /** Issue a Micro command with data through the uC DSC Command Interface. Control returned only after command is finished. 231 * @param sa__ is an opaque state vector passed through to device access functions. 232 * @param cmd Micro command to be issued 233 * @param supp_info Supplement information for the Micro command to be issued (RAM write address) 234 * @param data Data to be written to dsc_data for use by uC 235 * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued 236 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 237 */ 238 err_code_t merlin16_pcieg3_pmd_uc_cmd_with_data(srds_access_t *sa__, enum srds_pmd_uc_cmd_enum cmd, uint8_t supp_info, uint16_t data, uint32_t timeout_ms); 239 240 /** Issue a Micro Control command through the uC DSC Command Interface and return control immediately. 241 * @param sa__ is an opaque state vector passed through to device access functions. 242 * @param control Micro Control command to be issued 243 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 244 */ 245 err_code_t merlin16_pcieg3_pmd_uc_control_return_immediate(srds_access_t *sa__, enum srds_pmd_uc_ctrl_cmd_enum control); 246 247 /** Issue a Micro Control command through the uC DSC Command Interface. Control returned only after command is finished. 248 * @param sa__ is an opaque state vector passed through to device access functions. 249 * @param control Micro Control command to be issued 250 * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued 251 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 252 */ 253 err_code_t merlin16_pcieg3_pmd_uc_control(srds_access_t *sa__, enum srds_pmd_uc_ctrl_cmd_enum control, uint32_t timeout_ms); 254 255 /** Issue a Micro Control command through the uC DSC DIAG_EN Command Interface. Control returned only after command is finished. 256 * @param sa__ is an opaque state vector passed through to device access functions. 257 * @param control Micro DIAG Control command to be issued 258 * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued 259 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 260 */ 261 err_code_t merlin16_pcieg3_pmd_uc_diag_cmd(srds_access_t *sa__, enum srds_pmd_uc_diag_cmd_enum control, uint32_t timeout_ms); 262 263 /*-------------------------------------------------------*/ 264 /* Program RAM access through Micro Register Interface */ 265 /*-------------------------------------------------------*/ 266 267 /** Unsigned Long Read of a uC Program RAM variable through Micro Register Interface. 268 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 269 * @param sa__ is an opaque state vector passed through to device access functions. 270 * @param addr Address of Program RAM variable to be read 271 * @return 32bit unsigned value read from uC Program RAM 272 */ 273 uint32_t merlin16_pcieg3_rd_long_uc_prog_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 274 275 /** Block uC Program RAM read through Micro Register Interface. 276 * @param sa__ is an opaque state vector passed through to device access functions. 277 * @param *mem Pointer to memory location where the read values from the Block RAM read should be stored 278 * @param addr Starting Address of Program RAM block to be read 279 * @param cnt Number of byte locations to be read from the block 280 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 281 */ 282 err_code_t merlin16_pcieg3_rdblk_uc_prog_ram(srds_access_t *sa__, uint8_t *mem, uint16_t addr, uint16_t cnt); 283 284 /*-----------------------------------------------*/ 285 /* RAM access through Micro Register Interface */ 286 /*-----------------------------------------------*/ 287 /* rd - read; wr - write */ 288 /* b - byte; w - word */ 289 /* l - lane; c - core */ 290 /* s - signed */ 291 /*-----------------------------------------------*/ 292 293 /** Unsigned Long Write of a uC RAM variable through Micro Register Interface. 294 * @param sa__ is an opaque state vector passed through to device access functions. 295 * @param addr Address of RAM variable to be written 296 * @param wr_val 32bit unsigned value to be written to RAM variable 297 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 298 */ 299 err_code_t merlin16_pcieg3_wr_long_uc_ram(srds_access_t *sa__, uint16_t addr, uint32_t wr_val); 300 301 /** Unsigned Word Write of a uC RAM variable through Micro Register Interface. 302 * @param sa__ is an opaque state vector passed through to device access functions. 303 * @param addr Address of RAM variable to be written 304 * @param wr_val 16bit unsigned value to be written to RAM variable 305 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 306 */ 307 err_code_t merlin16_pcieg3_wrw_uc_ram(srds_access_t *sa__, uint16_t addr, uint16_t wr_val); 308 309 /** Unsigned Byte Write of a uC RAM variable through Micro Register Interface. 310 * @param sa__ is an opaque state vector passed through to device access functions. 311 * @param addr Address of RAM variable to be written 312 * @param wr_val 8bit unsigned value to be written to RAM variable 313 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 314 */ 315 err_code_t merlin16_pcieg3_wrb_uc_ram(srds_access_t *sa__, uint16_t addr, uint8_t wr_val); 316 317 /** Unigned Long Read of a uC RAM variable through Micro Register Interface. 318 * @param sa__ is an opaque state vector passed through to device access functions. 319 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 320 * @param addr Address of RAM variable to be read 321 * @return 32bit unsigned value read from uC RAM 322 */ 323 uint32_t merlin16_pcieg3_rd_long_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 324 325 /** Unigned Word Read of a uC RAM variable through Micro Register Interface. 326 * @param sa__ is an opaque state vector passed through to device access functions. 327 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 328 * @param addr Address of RAM variable to be read 329 * @return 16bit unsigned value read from uC RAM 330 */ 331 uint16_t merlin16_pcieg3_rdw_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 332 333 /** Unigned Byte Read of a uC RAM variable through Micro Register Interface. 334 * @param sa__ is an opaque state vector passed through to device access functions. 335 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 336 * @param addr Address of RAM variable to be read 337 * @return 8bit unsigned value read from uC RAM 338 */ 339 uint8_t merlin16_pcieg3_rdb_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 340 341 342 /* Signed versions of above 4 functions */ 343 344 /** Signed Word Write of a uC RAM variable through Micro Register Interface. 345 * @param sa__ is an opaque state vector passed through to device access functions. 346 * @param addr Address of RAM variable to be written 347 * @param wr_val 16bit signed value to be written to RAM variable 348 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 349 */ 350 err_code_t merlin16_pcieg3_wrws_uc_ram(srds_access_t *sa__, uint16_t addr, int16_t wr_val); 351 352 /** Signed Byte Write of a uC RAM variable through Micro Register Interface. 353 * @param sa__ is an opaque state vector passed through to device access functions. 354 * @param addr Address of RAM variable to be written 355 * @param wr_val 8bit signed value to be written to RAM variable 356 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 357 */ 358 err_code_t merlin16_pcieg3_wrbs_uc_ram(srds_access_t *sa__, uint16_t addr, int8_t wr_val); 359 360 /** Signed Word Read of a uC RAM variable through Micro Register Interface. 361 * @param sa__ is an opaque state vector passed through to device access functions. 362 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 363 * @param addr Address of RAM variable to be read 364 * @return 16bit signed value read from uC RAM 365 */ 366 int16_t merlin16_pcieg3_rdws_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 367 368 /** Signed Byte Read of a uC RAM variable through Micro Register Interface. 369 * @param sa__ is an opaque state vector passed through to device access functions. 370 * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors) 371 * @param addr Address of RAM variable to be read 372 * @return 8bit signed value read from uC RAM 373 */ 374 int8_t merlin16_pcieg3_rdbs_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr); 375 376 /** Block RAM read through Micro Register Interface. 377 * @param sa__ is an opaque state vector passed through to device access functions. 378 * @param *mem Pointer to memory location where the read values from the Block RAM read should be stored 379 * @param addr Starting Address of RAM block to be read 380 * @param cnt Number of byte locations to be read from the block 381 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 382 */ 383 err_code_t merlin16_pcieg3_rdblk_uc_ram(srds_access_t *sa__, uint8_t *mem, uint16_t addr, uint16_t cnt); 384 385 /*-----------------------*/ 386 /* Temperature reading */ 387 /*-----------------------*/ 388 389 /** Read die temperature in degrees Ceisius (as integer) 390 * @param sa__ is an opaque state vector passed through to device access functions. 391 * @param *die_temp Die temperature in degrees Celsius 392 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 393 */ 394 err_code_t merlin16_pcieg3_read_die_temperature (srds_access_t *sa__, int16_t *die_temp); 395 396 /** Read die temperature in degrees Ceisius (as double) 397 * @param sa__ is an opaque state vector passed through to device access functions. 398 * @param *die_temp Die temperature in degrees Celsius (as double) 399 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 400 */ 401 err_code_t merlin16_pcieg3_read_die_temperature_double (srds_access_t *sa__, USR_DOUBLE *die_temp); 402 403 404 #endif