openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

merlin16_access.h (23241B)


      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_access.h
     22  * Implementation of API uC access functions
     23  */
     24 
     25 #ifndef MERLIN16_API_ACCESS_H
     26 #define MERLIN16_API_ACCESS_H
     27 
     28 #include "merlin16_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_usr_includes.h"
     33 
     34 typedef struct {
     35     uint32_t ucode_size;
     36     uint16_t stack_size;
     37     uint16_t crc_value;
     38 } ucode_info_t;
     39 
     40 /*---------------------------------------------*/
     41 /*  Serdes IP RAM access - Lane RAM Variables  */
     42 /*---------------------------------------------*/
     43 /*          rd - read; wr - write              */
     44 /*          b  - byte; w  - word               */
     45 /*          l  - lane; c  - core               */
     46 /*          uc - micro                         */
     47 /*          s  - signed                        */
     48 /*---------------------------------------------*/
     49 /** Unsigned Byte Read of a uC RAM Lane variable.
     50  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
     51  * @param sa__ is an opaque state vector passed through to device access functions.
     52  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
     53  * @param addr Address of RAM lane variable to be read
     54  * @return 8bit unsigned value read from uC RAM
     55  */
     56 uint8_t merlin16_rdbl_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
     57 
     58 /** Unsigned Word Read of a uC RAM Lane variable.
     59  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
     60  * @param sa__ is an opaque state vector passed through to device access functions.
     61  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
     62  * @param addr Address of RAM lane variable to be read
     63  * @return 16bit unsigned value read from uC RAM
     64  */
     65 uint16_t merlin16_rdwl_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
     66 
     67 /** Unsigned Byte Write of a uC RAM Lane variable.
     68  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
     69  * @param sa__ is an opaque state vector passed through to device access functions.
     70  * @param addr Address of RAM lane variable to be written
     71  * @param wr_val 8bit unsigned value to be written to RAM variable
     72  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
     73  */
     74 err_code_t merlin16_wrbl_uc_var(srds_access_t *sa__, uint16_t addr, uint8_t wr_val);
     75 
     76 /** Unsigned Word Write of a uC RAM Lane variable.
     77  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
     78  * @param sa__ is an opaque state vector passed through to device access functions.
     79  * @param addr Address of RAM lane variable to be written
     80  * @param wr_val 16bit unsigned value to be written to RAM variable
     81  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
     82  */
     83 err_code_t merlin16_wrwl_uc_var(srds_access_t *sa__, uint16_t addr, uint16_t wr_val);
     84 
     85 
     86 /* Signed version of above 4 functions */
     87 
     88 /** Signed Byte Read of a uC RAM Lane variable.
     89  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
     90  * @param sa__ is an opaque state vector passed through to device access functions.
     91  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
     92  * @param addr Address of RAM lane variable to be read
     93  * @return 8bit signed value read from uC RAM
     94  */
     95 int8_t merlin16_rdbls_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
     96 
     97 /** Signed Word Read of a uC RAM Lane variable.
     98  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
     99  * @param sa__ is an opaque state vector passed through to device access functions.
    100  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    101  * @param addr Address of RAM lane variable to be read
    102  * @return 16bit signed value read from uC RAM
    103  */
    104 int16_t merlin16_rdwls_uc_var(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
    105 
    106 /** Signed Byte Write of a uC RAM Lane variable.
    107  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    108  * @param sa__ is an opaque state vector passed through to device access functions.
    109  * @param addr Address of RAM lane variable to be written
    110  * @param wr_val 8bit signed value to be written to RAM variable
    111  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    112  */
    113 err_code_t merlin16_wrbls_uc_var(srds_access_t *sa__, uint16_t addr, int8_t wr_val);
    114 
    115 /** Signed Word Write of a uC RAM Lane variable.
    116  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    117  * @param sa__ is an opaque state vector passed through to device access functions.
    118  * @param addr Address of RAM lane variable to be written
    119  * @param wr_val 16bit signed value to be written to RAM variable
    120  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    121  */
    122 err_code_t merlin16_wrwls_uc_var(srds_access_t *sa__, uint16_t addr, int16_t wr_val);
    123 
    124 
    125 
    126 
    127 /*---------------------------------------------*/
    128 /*  Serdes IP RAM access - Core RAM Variables  */
    129 /*---------------------------------------------*/
    130 /** Unsigned Byte Read of a uC RAM Core variable.
    131  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    132  * @param sa__ is an opaque state vector passed through to device access functions.
    133  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    134  * @param addr Address of RAM core variable to be read
    135  * @return 8bit unsigned value read from uC RAM
    136  */
    137 uint8_t merlin16_rdbc_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr);
    138 
    139 /** Unsigned Word Read of a uC RAM Core variable.
    140  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    141  * @param sa__ is an opaque state vector passed through to device access functions.
    142  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    143  * @param addr Address of RAM core variable to be read
    144  * @return 16bit unsigned value read from uC RAM
    145  */
    146 uint16_t merlin16_rdwc_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr);
    147 
    148 /** Unsigned Byte Write of a uC RAM Core variable.
    149  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    150  * @param sa__ is an opaque state vector passed through to device access functions.
    151  * @param addr Address of RAM core variable to be written
    152  * @param wr_val 8bit unsigned value to be written to RAM variable
    153  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    154  */
    155 err_code_t merlin16_wrbc_uc_var(srds_access_t *sa__, uint8_t addr, uint8_t wr_val);
    156 
    157 /** Unsigned Word Write of a uC RAM Core variable.
    158  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    159  * @param sa__ is an opaque state vector passed through to device access functions.
    160  * @param addr Address of RAM core variable to be written
    161  * @param wr_val 16bit unsigned value to be written to RAM variable
    162  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    163  */
    164 err_code_t merlin16_wrwc_uc_var(srds_access_t *sa__, uint8_t addr, uint16_t wr_val);
    165 
    166 
    167 /* Signed version of above 4 functions */
    168 
    169 /** Signed Byte Read of a uC RAM Core variable.
    170  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    171  * @param sa__ is an opaque state vector passed through to device access functions.
    172  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    173  * @param addr Address of RAM core variable to be read
    174  * @return 8bit signed value read from uC RAM
    175  */
    176 int8_t merlin16_rdbcs_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr);
    177 
    178 /** Signed Word Read of a uC RAM Core variable.
    179  * Read access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    180  * @param sa__ is an opaque state vector passed through to device access functions.
    181  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    182  * @param addr Address of RAM core variable to be read
    183  * @return 16bit signed value read from uC RAM
    184  */
    185 int16_t merlin16_rdwcs_uc_var(srds_access_t *sa__, err_code_t *err_code, uint8_t addr);
    186 
    187 /** Signed Byte Write of a uC RAM Core variable.
    188  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    189  * @param sa__ is an opaque state vector passed through to device access functions.
    190  * @param addr Address of RAM core variable to be written
    191  * @param wr_val 8bit signed value to be written to RAM variable
    192  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    193  */
    194 err_code_t merlin16_wrbcs_uc_var(srds_access_t *sa__, uint8_t addr, int8_t wr_val);
    195 
    196 /** Signed Word Write of a uC RAM Core variable.
    197  * Write access through Micro Register Interface for PMD IPs; through Serdes FW DSC Command Interface for external micro IPs.
    198  * @param sa__ is an opaque state vector passed through to device access functions.
    199  * @param addr Address of RAM core variable to be written
    200  * @param wr_val 16bit signed value to be written to RAM variable
    201  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    202  */
    203 err_code_t merlin16_wrwcs_uc_var(srds_access_t *sa__, uint8_t addr, int16_t wr_val);
    204 
    205 
    206 /*---------------------------------------------------*/
    207 /*  Micro Commands through uC DSC Command Interface  */
    208 /*---------------------------------------------------*/
    209 /** Issue a Micro command through the uC DSC Command Interface and return control immediately.
    210  * @param sa__ is an opaque state vector passed through to device access functions.
    211  * @param cmd Micro command to be issued
    212  * @param supp_info Supplement information for the Micro command to be issued (RAM read/write address or Micro Control command)
    213  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    214  */
    215 err_code_t merlin16_pmd_uc_cmd_return_immediate(srds_access_t *sa__, enum srds_pmd_uc_cmd_enum cmd, uint8_t supp_info);
    216 
    217 /** Issue a Micro command through the uC DSC Command Interface. Control returned only after command is finished.
    218  * @param sa__ is an opaque state vector passed through to device access functions.
    219  * @param cmd Micro command to be issued
    220  * @param supp_info Supplement information for the Micro command to be issued (RAM read/write address or Micro Control command)
    221  * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued
    222  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    223  */
    224 err_code_t merlin16_pmd_uc_cmd(srds_access_t *sa__, enum srds_pmd_uc_cmd_enum cmd, uint8_t supp_info, uint32_t timeout_ms);
    225 
    226 /** Issue a Micro command with data through the uC DSC Command Interface and return control immediately.
    227  * @param sa__ is an opaque state vector passed through to device access functions.
    228  * @param cmd Micro command to be issued
    229  * @param supp_info Supplement information for the Micro command to be issued (RAM write address)
    230  * @param data Data to be written to dsc_data for use by uC
    231  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    232  */
    233 err_code_t merlin16_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);
    234 
    235 /** Issue a Micro command with data through the uC DSC Command Interface. Control returned only after command is finished.
    236  * @param sa__ is an opaque state vector passed through to device access functions.
    237  * @param cmd Micro command to be issued
    238  * @param supp_info Supplement information for the Micro command to be issued (RAM write address)
    239  * @param data Data to be written to dsc_data for use by uC
    240  * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued
    241  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    242  */
    243 err_code_t merlin16_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);
    244 
    245 /** Issue a Micro Control command through the uC DSC Command Interface and return control immediately.
    246  * @param sa__ is an opaque state vector passed through to device access functions.
    247  * @param control Micro Control command to be issued
    248  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    249  */
    250 err_code_t merlin16_pmd_uc_control_return_immediate(srds_access_t *sa__, enum srds_pmd_uc_ctrl_cmd_enum control);
    251 
    252 /** Issue a Micro Control command through the uC DSC Command Interface. Control returned only after command is finished.
    253  * @param sa__ is an opaque state vector passed through to device access functions.
    254  * @param control Micro Control command to be issued
    255  * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued
    256  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    257  */
    258 err_code_t merlin16_pmd_uc_control(srds_access_t *sa__, enum srds_pmd_uc_ctrl_cmd_enum control, uint32_t timeout_ms);
    259 
    260 /** Issue a Micro Control command through the uC DSC DIAG_EN Command Interface. Control returned only after command is finished.
    261  * @param sa__ is an opaque state vector passed through to device access functions.
    262  * @param control Micro DIAG Control command to be issued
    263  * @param timeout_ms Time interval in milliseconds inside which the command should be completed; else error issued
    264  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    265  */
    266 err_code_t merlin16_pmd_uc_diag_cmd(srds_access_t *sa__, enum srds_pmd_uc_diag_cmd_enum control, uint32_t timeout_ms);
    267 
    268 /*-------------------------------------------------------*/
    269 /*  Program RAM access through Micro Register Interface  */
    270 /*-------------------------------------------------------*/
    271 
    272 /** Unsigned Long Read of a uC Program RAM variable through Micro Register Interface.
    273  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    274  * @param sa__ is an opaque state vector passed through to device access functions.
    275  * @param addr Address of Program RAM variable to be read
    276  * @return 32bit unsigned value read from uC Program RAM
    277  */
    278 uint32_t merlin16_rd_long_uc_prog_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
    279 
    280 /** Block uC Program RAM read through Micro Register Interface.
    281  * @param sa__ is an opaque state vector passed through to device access functions.
    282  * @param *mem Pointer to memory location where the read values from the Block RAM read should be stored
    283  * @param addr Starting Address of Program RAM block to be read
    284  * @param cnt Number of byte locations to be read from the block
    285  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    286  */
    287 err_code_t merlin16_rdblk_uc_prog_ram(srds_access_t *sa__, uint8_t *mem, uint16_t addr, uint16_t cnt);
    288 
    289 /*-----------------------------------------------*/
    290 /*  RAM access through Micro Register Interface  */
    291 /*-----------------------------------------------*/
    292 /*           rd - read; wr - write               */
    293 /*           b  - byte; w  - word                */
    294 /*           l  - lane; c  - core                */
    295 /*           s  - signed                         */
    296 /*-----------------------------------------------*/
    297 
    298 /** Unsigned Long Write of a uC RAM variable through Micro Register Interface.
    299  * @param sa__ is an opaque state vector passed through to device access functions.
    300  * @param addr Address of RAM variable to be written
    301  * @param wr_val 32bit unsigned value to be written to RAM variable
    302  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    303  */
    304 err_code_t merlin16_wr_long_uc_ram(srds_access_t *sa__, uint16_t addr, uint32_t wr_val);
    305 
    306 /** Unsigned Word Write of a uC RAM variable through Micro Register Interface.
    307  * @param sa__ is an opaque state vector passed through to device access functions.
    308  * @param addr Address of RAM variable to be written
    309  * @param wr_val 16bit unsigned value to be written to RAM variable
    310  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    311  */
    312 err_code_t merlin16_wrw_uc_ram(srds_access_t *sa__, uint16_t addr, uint16_t wr_val);
    313 
    314 /** Unsigned Byte Write of a uC RAM variable through Micro Register Interface.
    315  * @param sa__ is an opaque state vector passed through to device access functions.
    316  * @param addr Address of RAM variable to be written
    317  * @param wr_val 8bit unsigned value to be written to RAM variable
    318  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    319  */
    320 err_code_t merlin16_wrb_uc_ram(srds_access_t *sa__, uint16_t addr, uint8_t wr_val);
    321 
    322 /** Unigned Long Read of a uC RAM variable through Micro Register Interface.
    323  * @param sa__ is an opaque state vector passed through to device access functions.
    324  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    325  * @param addr Address of RAM variable to be read
    326  * @return 32bit unsigned value read from uC RAM
    327  */
    328 uint32_t merlin16_rd_long_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
    329 
    330 /** Unigned Word Read of a uC RAM variable through Micro Register Interface.
    331  * @param sa__ is an opaque state vector passed through to device access functions.
    332  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    333  * @param addr Address of RAM variable to be read
    334  * @return 16bit unsigned value read from uC RAM
    335  */
    336 uint16_t merlin16_rdw_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
    337 
    338 /** Unigned Byte Read of a uC RAM variable through Micro Register Interface.
    339  * @param sa__ is an opaque state vector passed through to device access functions.
    340  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    341  * @param addr Address of RAM variable to be read
    342  * @return 8bit unsigned value read from uC RAM
    343  */
    344 uint8_t merlin16_rdb_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
    345 
    346 
    347 /* Signed versions of above 4 functions */
    348 
    349 /** Signed Word Write of a uC RAM variable through Micro Register Interface.
    350  * @param sa__ is an opaque state vector passed through to device access functions.
    351  * @param addr Address of RAM variable to be written
    352  * @param wr_val 16bit signed value to be written to RAM variable
    353  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    354  */
    355 err_code_t merlin16_wrws_uc_ram(srds_access_t *sa__, uint16_t addr, int16_t wr_val);
    356 
    357 /** Signed Byte Write of a uC RAM variable through Micro Register Interface.
    358  * @param sa__ is an opaque state vector passed through to device access functions.
    359  * @param addr Address of RAM variable to be written
    360  * @param wr_val 8bit signed value to be written to RAM variable
    361  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    362  */
    363 err_code_t merlin16_wrbs_uc_ram(srds_access_t *sa__, uint16_t addr, int8_t wr_val);
    364 
    365 /** Signed Word Read of a uC RAM variable through Micro Register Interface.
    366  * @param sa__ is an opaque state vector passed through to device access functions.
    367  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    368  * @param addr Address of RAM variable to be read
    369  * @return 16bit signed value read from uC RAM
    370  */
    371 int16_t merlin16_rdws_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
    372 
    373 /** Signed Byte Read of a uC RAM variable through Micro Register Interface.
    374  * @param sa__ is an opaque state vector passed through to device access functions.
    375  * @param *err_code Error Code generated by API (returns ERR_CODE_NONE if no errors)
    376  * @param addr Address of RAM variable to be read
    377  * @return 8bit signed value read from uC RAM
    378  */
    379 int8_t merlin16_rdbs_uc_ram(srds_access_t *sa__, err_code_t *err_code, uint16_t addr);
    380 
    381 /** Block RAM read through Micro Register Interface.
    382  * @param sa__ is an opaque state vector passed through to device access functions.
    383  * @param *mem Pointer to memory location where the read values from the Block RAM read should be stored
    384  * @param addr Starting Address of RAM block to be read
    385  * @param cnt Number of byte locations to be read from the block
    386  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    387  */
    388 err_code_t merlin16_rdblk_uc_ram(srds_access_t *sa__, uint8_t *mem, uint16_t addr, uint16_t cnt);
    389 
    390 /*-----------------------*/
    391 /*  Temperature reading  */
    392 /*-----------------------*/
    393 
    394 /** Read die temperature in degrees Ceisius (as integer)
    395  * @param sa__ is an opaque state vector passed through to device access functions.
    396  * @param *die_temp  Die temperature in degrees Celsius
    397  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    398  */
    399 err_code_t merlin16_read_die_temperature (srds_access_t *sa__, int16_t *die_temp);
    400 
    401 /** Read die temperature in degrees Ceisius (as double)
    402  * @param sa__ is an opaque state vector passed through to device access functions.
    403  * @param *die_temp  Die temperature in degrees Celsius (as double)
    404  * @return Error Code generated by API (returns ERR_CODE_NONE if no errors)
    405  */
    406 err_code_t merlin16_read_die_temperature_double (srds_access_t *sa__, USR_DOUBLE *die_temp);
    407 
    408 #endif