mos_msg_ces.h (5207B)
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 * File: ces.h 8 */ 9 #ifndef CES_H_ 10 #define CES_H_ 11 12 #ifdef BCM_UKERNEL 13 /* Build for uKernel not SDK */ 14 #include "sdk_typedefs.h" 15 #endif 16 17 18 #ifdef BCM_UKERNEL 19 20 /* 21 22 from nd_hw.h 23 */ 24 typedef enum 25 { 26 AG_ND_TDM_PROTOCOL_E1 = 0x00, 27 AG_ND_TDM_PROTOCOL_T1 = 0x01 28 29 } AgNdTdmProto; 30 31 typedef enum 32 { 33 AG_ND_CCLK_SELECT_REF_CLK_1 = 0x00, 34 AG_ND_CCLK_SELECT_REF_CLK_2 = 0x01, 35 AG_ND_CCLK_SELECT_EXTERNAL_CLK = 0x02 36 37 } AgNdCClkSelect; 38 39 40 typedef enum 41 { 42 AG_ND_REF_CLK_SELECT_RCLK = 0x00, 43 AG_ND_REF_CLK_SELECT_REF_INPUT_1 = 0x01, 44 AG_ND_REF_CLK_SELECT_REF_INPUT_2 = 0x02, 45 AG_ND_REF_CLK_SELECT_NOMAD_BRG = 0x03, 46 AG_ND_REF_CLK_SELECT_PORT_BRG = 0x04, 47 AG_ND_REF_CLK_SELECT_PTP = 0x07 48 49 } AgNdRefClkSelect; 50 51 /* */ 52 /* */ 53 /* channel/circuit id stuff */ 54 /* */ 55 typedef uint8 AgNdCircuit; 56 typedef uint8 AgNdPort; 57 typedef uint8 AgNdSlot; 58 typedef uint8 AgNdChannel; 59 typedef uint8 AgNdPtpIdx; 60 61 #endif 62 63 /***************************************************************************************/ 64 65 66 67 /*********************************/ 68 /* 69 * CRM messages 70 */ 71 #define _CES_INIT_RETRIES 2 72 #define _CES_NUM_CMICM 2 73 #define _CES_UC_MSG_TIMEOUT_USECS 1000000 74 75 #define BCM_CES_CRM_FLAG_NONE 0x00 /* */ 76 #define BCM_CES_CRM_FLAG_INIT 0x01 /* The host has just (re)started */ 77 #define BCM_CES_CRM_FLAG_WB 0x02 /* Warm boot */ 78 79 /* 80 * Enumerations for values to set rcovery type 81 */ 82 typedef enum t_AgClockSource 83 { 84 CLOCK_SOURCE_ADAPTIVE = 4, 85 CLOCK_SOURCE_DIFFERENTIAL = 6, 86 CLOCK_SOURCE_DIRECT = 8, 87 CLOCK_SOURCE_PTP = 9 88 } AgClockSource; 89 90 91 /* 92 * Enumerations for values returend by get status 93 */ 94 typedef enum AgRcrStates_E 95 { 96 RCR_STATE_FREE_RUNNING, /* 0 */ 97 RCR_STATE_ACQUISITION, /* 1 */ 98 RCR_STATE_NORMAL, /* 2 */ 99 RCR_STATE_HOLDOVER, /* 3 */ 100 RCR_STATE_QUALIFICATION_PERIOD, /* 4 */ 101 RCR_STATE_FAST_ACQUISITION /* 5 */ 102 } AgRcrStates; 103 104 /* 105 * CRM locate message 106 * MOS_MSG_SUBCLASS_CES_CRM_INIT 107 */ 108 typedef struct { 109 uint8 flags; 110 } bcm_ces_crm_init_msg_t; 111 112 /* 113 * Comon configuration message 114 * MOS_MSG_SUBCLASS_CES_CRM_CONFIG 115 */ 116 typedef struct { 117 uint8 flags; 118 uint8 e_cclk_select; /* AgNdCClkSelect: ref1/ref2/external*/ 119 uint8 e_ref_clk_1_select; /* AgNdRefClkSelect */ 120 uint8 e_ref_clk_2_select; /* AgNdRefClkSelect */ 121 uint32 n_ref_clk_1_port; 122 uint32 n_ref_clk_2_port; 123 uint8 e_protocol; /* AgNdTdmProto: T1/E1*/ 124 } bcm_ces_crm_cclk_config_msg_t; 125 126 /* 127 * RClock configuration message 128 * MOS_MSG_SUBCLASS_CES_CRM_RCLOCK_CONFIG 129 */ 130 typedef struct { 131 uint8 flags; /* Used exclusively for system status */ 132 uint8 b_enable; 133 uint8 e_protocol; /* AgNdTdmProto: T1/E1*/ 134 uint8 b_structured; /* Boolean 0 = unstructured, 1 = structured */ 135 uint8 output_brg; /* , 0=port's brg 1=system brg 1 2=system brg 2 */ 136 uint8 rclock; /*Recovery algorithm instance 0-n (n=3)*/ 137 uint8 port; /* Brg of this port will be set, if flags selected port's BRG */ 138 uint8 recovery_type; /* 00 = adaptive / differential = 01 */ 139 uint16 tdm_clocks_per_packet; 140 uint8 service; /*Any service AgNdChannel */ 141 uint8 rcr_flags; /*bit 0 (low bit) = 1 use ho_q_count / bit 1 = 1 use ho_x_threshold*/ 142 uint32 ho_q_count; 143 uint32 ho_a_threshold; 144 uint32 ho_b_threshold; 145 uint32 ho_c_threshold; 146 147 } bcm_ces_crm_rclock_config_msg_t; 148 149 /* 150 * Status message 151 * MOS_MSG_SUBCLASS_CES_CRM_STATUS_REPLY 152 */ 153 #define CES_RCR_FRACTION_DECIMAL_POINTS_PRECISION 10000000 154 typedef struct { 155 uint8 rclock; /*Recovery algorithm instance 0-n (n=3)*/ 156 uint8 clock_state; /*AgRcrStates accuistion, normal ,,*/ 157 uint32 seconds_locked; 158 uint32 seconds_active; 159 uint32 calculated_frequency_w; /*Whole part of frequence*/ 160 uint32 calculated_frequency_f; /*Fraction part of freq*CES_RCR_FRACTION_DECIMAL_POINTS_PRECISION */ 161 } bcm_ces_crm_status_msg_t; 162 /* 163 * CES control message 164 */ 165 typedef struct ces_msg_ctrl_s { 166 union { 167 bcm_ces_crm_init_msg_t init; 168 bcm_ces_crm_cclk_config_msg_t config ; 169 bcm_ces_crm_rclock_config_msg_t rclock; 170 bcm_ces_crm_status_msg_t status; 171 } u; 172 }ces_msg_ctrl_t; 173 #define CES_CONTROL_MESSAGE_MAX_SIZE ( ((sizeof(ces_msg_ctrl_t)+3)/4)*4 ) 174 175 /* 176 * CES Error codes 177 */ 178 typedef enum uc_ces_error_e { 179 UC_CES_E_NONE = 0, 180 UC_CES_E_INTERNAL, 181 UC_CES_E_MEMORY, 182 UC_CES_E_PARAM, 183 UC_CES_E_RESOURCE, 184 UC_CES_E_EXISTS, 185 UC_CES_E_NOT_FOUND, 186 UC_CES_E_INIT 187 } _uc_fd_error_t; 188 #endif /* CES_H_ */