/* Copyright (c) 2015 Broadcom Corporation All Rights Reserved <:label-BRCM:2015:DUAL/GPL:standard Unless you and Broadcom execute a separate written software license agreement governing use of this software, this software is licensed to you under the terms of the GNU General Public License version 2 (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, with the following added to such license: As a special exception, the copyright holders of this software give you permission to link this software with independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from this software. The special exception does not apply to any modifications of the software. Not withstanding the above, under no circumstances may you combine this software in any way with any other Broadcom software provided under a license other than the GPL, without Broadcom's express prior written consent. :> */ #ifndef MERLIN16_SHORTFIN_DEBUG_FUNCTIONS_H #define MERLIN16_SHORTFIN_DEBUG_FUNCTIONS_H #include "merlin16_shortfin_ipconfig.h" #include "common/srds_api_enum.h" #include "common/srds_api_err_code.h" #include "common/srds_api_uc_common.h" #include "merlin16_shortfin_dependencies.h" #include "merlin16_shortfin_types.h" #include "merlin16_shortfin_usr_includes.h" /** Print triage info * One function to collect all the triage info in case of errors. * @param sa__ is an opaque state vector passed through to device access functions. * @param err_code error code ex. ERR_CODE_POLLING_TIMEOUT * @param print_header A flag to control header print. * @param print_data A flag to control data print * @param line __LINE__ */ void merlin16_shortfin_INTERNAL_print_triage_info(srds_access_t *sa__, err_code_t err_code, uint8_t print_header, uint8_t print_data, uint16_t line); /** Isolate Control pins. * Can be used for debug to avoid any interference from inputs coming through pins. * @param sa__ is an opaque state vector passed through to device access functions. * @param enable Isolate pins enable (1 = Isolate pins; 0 = Pins not isolated) * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_isolate_ctrl_pins(srds_access_t *sa__, uint8_t enable); /** Isolate Lane Control pins. * Can be used for debug to avoid any interference from inputs coming through pins. * @param sa__ is an opaque state vector passed through to device access functions. * @param enable Isolate pins enable (1 = Isolate pins; 0 = Pins not isolated) * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_isolate_lane_ctrl_pins(srds_access_t *sa__, uint8_t enable); /** Isolate Core Control pins. * Can be used for debug to avoid any interference from inputs coming through pins. * @param sa__ is an opaque state vector passed through to device access functions. * @param enable Isolate pins enable (1 = Isolate pins; 0 = Pins not isolated) * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_isolate_core_ctrl_pins(srds_access_t *sa__, uint8_t enable); /*-----------------------*/ /* Stop/Resume uC Lane */ /*-----------------------*/ /** Stop/Resume Micro operations on a Lane (Graceful Stop). * @param sa__ is an opaque state vector passed through to device access functions. * @param enable Enable micro lane stop (1 = Stop Micro opetarions on lane; 0 = Resume Micro operations on lane) * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_stop_uc_lane(srds_access_t *sa__, uint8_t enable); /** Status of whether Micro is stopped on a lane. * @param sa__ is an opaque state vector passed through to device access functions. * @param *uc_lane_stopped Micro lane stopped status returned by API * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_stop_uc_lane_status(srds_access_t *sa__, uint8_t *uc_lane_stopped); /** Write to lane user control disable startup function uC RAM variable. * Note: This function should be used only during configuration under dp_reset. * @param sa__ is an opaque state vector passed through to device access functions. * @param set_val Value to be written into lane user control disable startup function RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_set_usr_ctrl_disable_startup(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_functions_st set_val); /** Write to lane user control disable startup dfe function uC RAM variable. * Note: This function should be used only during configuration under dp_reset. * @param sa__ is an opaque state vector passed through to device access functions. * @param set_val Value to be written into lane user control disable startup dfe function RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_set_usr_ctrl_disable_startup_dfe(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_dfe_functions_st set_val); /** Write to lane user control disable steady-state function uC RAM variable. * Note: This function should be used only during configuration under dp_reset. * @param sa__ is an opaque state vector passed through to device access functions. * @param set_val Value to be written into lane user control disable steady-state function RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_set_usr_ctrl_disable_steady_state(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_functions_st set_val); /** Write to lane user control disable steady-state dfe function uC RAM variable. * Note: This function should be used only during configuration under dp_reset. * @param sa__ is an opaque state vector passed through to device access functions. * @param set_val Value to be written into lane user control disable steady-state dfe function RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_set_usr_ctrl_disable_steady_state_dfe(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_dfe_functions_st set_val); /** Read value of lane user control disable startup uC RAM variable. * @param sa__ is an opaque state vector passed through to device access functions. * @param *get_val Value read from lane user control disable startup RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_get_usr_ctrl_disable_startup(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_functions_st *get_val); /** Read value of lane user control disable startup dfe uC RAM variable. * @param sa__ is an opaque state vector passed through to device access functions. * @param *get_val Value read from lane user control disable startup dfe RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_get_usr_ctrl_disable_startup_dfe(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_dfe_functions_st *get_val); /** Read value of lane user control disable steady-state uC RAM variable. * @param sa__ is an opaque state vector passed through to device access functions. * @param *get_val Value read from lane user control disable steady-state RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_get_usr_ctrl_disable_steady_state(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_functions_st *get_val); /** Read value of lane user control disable steady-state dfe uC RAM variable. * @param sa__ is an opaque state vector passed through to device access functions. * @param *get_val Value read from lane user control disable steady-state dfe RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_get_usr_ctrl_disable_steady_state_dfe(srds_access_t *sa__, struct merlin16_shortfin_usr_ctrl_disable_dfe_functions_st *get_val); /*-------------------------------------------*/ /* Registers and Core uC RAM Variable Dump */ /*-------------------------------------------*/ /** Display values of both Core level and (currently selected) Lane level Registers. * @param sa__ is an opaque state vector passed through to device access functions. * @param core is current core number. * @param lane is the current lane number. * @param reg_buffer is a buffer passed through to device access functions. * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_reg_dump(srds_access_t *sa__, uint8_t core, uint8_t lane, char reg_buffer[][250]); /** Display values of all Core uC RAM Variables (Core RAM Variable Dump). * @param sa__ is an opaque state vector passed through to device access functions. * @param core is current core number. * @param ram_buffer is a buffer passed through to device access functions. * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_uc_core_var_dump(srds_access_t *sa__, uint8_t core, char ram_buffer[][250]); /*-----------------------------*/ /* uC RAM Lane Variable Dump */ /*-----------------------------*/ /** Display values of all Lane uC RAM Variables (Lane RAM Variable Dump). * @param sa__ is an opaque state vector passed through to device access functions. * @param core is current core number. * @param lane is the current lane number. * @param ram_buffer is a buffer passed through to device access functions. * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_uc_lane_var_dump(srds_access_t *sa__, uint8_t core, uint8_t lane, char ram_buffer[][250]); /*--------------------------*/ /* TX_PI Jitter Generation */ /*--------------------------*/ /** Generate TX_PI Sinusoidal or Spread-Spectrum (SSC) jitter. * @param sa__ is an opaque state vector passed through to device access functions. * @param enable Enable/Disable jitter generation (1 = Enable; 0 = Disable) * @param freq_override_val Fixed Frequency Override value (-8192 to + 8192) * @param jit_type Jitter generation mode * @param tx_pi_jit_freq_idx Jitter generation frequency index (0 to 63) [see spec for more details] * @param tx_pi_jit_amp Jitter generation amplification factor (0 to 63) [max value of this register depends on tx_pi_jit_freq_idx and freq_override values] * @return Error Code generated by invalid TX_PI settings (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_tx_pi_jitt_gen(srds_access_t *sa__, uint8_t enable, int16_t freq_override_val, enum srds_tx_pi_freq_jit_gen_enum jit_type, uint8_t tx_pi_jit_freq_idx, uint8_t tx_pi_jit_amp); /*-------------*/ /* Event Log */ /*-------------*/ /** Get Event Log from uC. * Dump uC events from core memory. * @param sa__ is an opaque state vector passed through to device access functions. * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_read_event_log(srds_access_t *sa__); /** Write to usr_ctrl_lane_event_log_level uC RAM variable. * Note: This function should be used only during configuration under dp_reset. * @param sa__ is an opaque state vector passed through to device access functions. * @param lane_event_log_level Value to be written into usr_ctrl_lane_event_log_level RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_set_usr_ctrl_lane_event_log_level(srds_access_t *sa__, uint8_t lane_event_log_level); /** Read value of usr_ctrl_lane_event_log_level uC RAM variable. * @param sa__ is an opaque state vector passed through to device access functions. * @param *lane_event_log_level Value read from usr_ctrl_lane_event_log_level RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_get_usr_ctrl_lane_event_log_level(srds_access_t *sa__, uint8_t *lane_event_log_level); /** Write to usr_ctrl_core_event_log_level uC RAM variable. * @param sa__ is an opaque state vector passed through to device access functions. * @param core_event_log_level Value to be written into the usr_ctrl_core_event_log_level RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_set_usr_ctrl_core_event_log_level(srds_access_t *sa__, uint8_t core_event_log_level); /** Read value of usr_ctrl_core_event_log_level uC RAM variable. * @param sa__ is an opaque state vector passed through to device access functions. * @param *core_event_log_level Value read from usr_ctrl_core_event_log_level RAM variable * @return Error Code, if generated (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_get_usr_ctrl_core_event_log_level(srds_access_t *sa__, uint8_t *core_event_log_level); /*------------------------------*/ /* Digital Loopback Functions */ /*------------------------------*/ /** Enable/Disable Digital Loopback. * @param sa__ is an opaque state vector passed through to device access functions. * @param enable Enable Digital Loopback (1 = Enable dig_lpbk; 0 = Disable dig_lpbk) * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) */ err_code_t merlin16_shortfin_dig_lpbk(srds_access_t *sa__, uint8_t enable); #endif