merlin16_tx_analog_functions.h (5577B)
1 /******************************************************************************************* 2 ******************************************************************************************* 3 * File Name : merlin16_tx_analog_functions.h * 4 * Created On : 04/20/2015 * 5 * Created By : Kiran Divakar * 6 * Description : Functions to Configure Merlin16 TXFIR * 7 * Revision : * 8 * * 9 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 10 * 11 * Copyright 2007-2019 Broadcom Inc. All rights reserved. * 12 * No portions of this material may be reproduced in any form without * 13 * the written permission of: * 14 * Broadcom Corporation * 15 * 5300 California Avenue * 16 * Irvine, CA 92617 * 17 * * 18 * All information contained in this document is Broadcom Corporation * 19 * company private proprietary, and trade secret. * 20 */ 21 22 /** @file merlin16_tx_analog_functions.h 23 * Functions to configure Merlin16 TX 24 */ 25 26 #ifndef MERLI16_TX_ANALOG_FUNCTIONS_H 27 #define MERLI16_TX_ANALOG_FUNCTIONS_H 28 29 #ifdef __KERNEL__ 30 #include <linux/types.h> 31 #else 32 #ifndef EXCLUDE_STD_HEADERS 33 #include <stdint.h> 34 #endif 35 #endif 36 37 #include "merlin16_pcieg3_dependencies.h" 38 39 /* Structs required for M16 TXFIR AFE slicer controls */ 40 41 /** Post2 Slicer Register Field Struct */ 42 struct p2sr_regfield_st { 43 uint16_t post2_1x_0 ; 44 uint16_t dc_level_post2_1x_0; 45 uint16_t post2_1x_1 ; 46 uint16_t dc_level_post2_1x_1; 47 uint16_t post2_2x_0 ; 48 uint16_t dc_level_post2_2x_0; 49 uint16_t post2_2x_1 ; 50 uint16_t dc_level_post2_2x_1; 51 uint16_t reserved0 ; 52 }; 53 54 /** Post1 Slicer Register Field Struct */ 55 struct p1sr_regfield_st { 56 uint16_t post1_1x_0 ; 57 uint16_t dc_level_post1_1x_0 ; 58 uint16_t post1_1x_1 ; 59 uint16_t dc_level_post1_1x_1 ; 60 uint16_t post1_2x_0 ; 61 uint16_t dc_level_post1_2x_0 ; 62 uint16_t post1_2x_1 ; 63 uint16_t dc_level_post1_2x_1 ; 64 uint16_t post1_2x_2 ; 65 uint16_t dc_level_post1_2x_2 ; 66 uint16_t reserved0 ; 67 uint16_t pre_post1pre_1x_0 ; 68 uint16_t post1_post1pre_1x_0 ; 69 uint16_t dc_level_post1pre_1x_0; 70 uint16_t reserved1 ; 71 }; 72 73 /** Post1Pre Slicer Register Field Struct */ 74 struct presr_regfield_st { 75 uint16_t pre_post1pre_1x_1 ; 76 uint16_t post1_post1pre_1x_1 ; 77 uint16_t dc_level_post1pre_1x_1; 78 uint16_t pre_post1pre_2x_0 ; 79 uint16_t post1_post1pre_2x_0 ; 80 uint16_t dc_level_post1pre_2x_0; 81 uint16_t pre_post1pre_2x_1 ; 82 uint16_t post1_post1pre_2x_1 ; 83 uint16_t dc_level_post1pre_2x_1; 84 uint16_t pre_post1pre_2x_2 ; 85 uint16_t post1_post1pre_2x_2 ; 86 uint16_t dc_level_post1pre_2x_2; 87 uint16_t pre_post1pre_2x_3 ; 88 uint16_t post1_post1pre_2x_3 ; 89 uint16_t dc_level_post1pre_2x_3; 90 uint16_t reserved0 ; 91 }; 92 93 /** Main Slicer Register Field Struct */ 94 struct mssr_regfield_st { 95 uint16_t dc_level_0p5x ; 96 uint16_t dc_level_main_1x ; 97 uint16_t dc_level_main_2x_0; 98 uint16_t dc_level_main_2x_1; 99 uint16_t reserved0 ; 100 }; 101 102 /** Post2 Slicer Register Struct */ 103 struct p2sr_reg_st { 104 struct p2sr_regfield_st field; 105 uint16_t word; 106 }; 107 108 /** Post1 Slicer Register Struct */ 109 struct p1sr_reg_st { 110 struct p1sr_regfield_st field; 111 uint16_t word; 112 }; 113 114 /** Post1Pre Slicer Register Struct */ 115 struct presr_reg_st { 116 struct presr_regfield_st field; 117 uint16_t word; 118 }; 119 120 /** Main Slicer Register Struct */ 121 struct mssr_reg_st { 122 struct mssr_regfield_st field; 123 uint16_t word; 124 }; 125 126 /** Converts the input TXFIR tap values to the required analog tap slicer settings 127 * @param sa__ is an opaque state vector passed through to device access functions. 128 * @param pre TXFIR pre tap value (0..10) in 1/60 Vpp 129 * @param main TXFIR main tap value (1..60) in 1/60 Vpp 130 * @param post1 TXFIR post1 tap value (0..24) in 1/60 Vpp 131 * @param post2 TXFIR post2 tap value (0..6) in 1/60 Vpp 132 * @return Error Code generated by API (returns ERR_CODE_NONE if no errors) 133 */ 134 static err_code_t _txfir_tap_mapping(srds_access_t *sa__, int8_t pre, int8_t main, int8_t post1, int8_t post2); 135 136 /* Update Merlin16 TXFIR Slicer Structs */ 137 static err_code_t _update_p1sr_reg_word(struct p1sr_reg_st *st); 138 static err_code_t _update_p2sr_reg_word(struct p2sr_reg_st *st); 139 static err_code_t _update_mssr_reg_word(struct mssr_reg_st *st); 140 static err_code_t _update_presr_reg_word(struct presr_reg_st *st); 141 142 /** Write to Analog Slicer Control Registers */ 143 static err_code_t _write_txfir_slicer_controls(srds_access_t *sa__, 144 struct p1sr_reg_st p1_st, struct p2sr_reg_st p2_st, 145 struct mssr_reg_st ms_st, struct presr_reg_st pre_st); 146 #endif