phymod_access_cint_data.c (3150B)
1 /* 2 * 3 * 4 * 5 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 6 * 7 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 8 */ 9 #if defined(INCLUDE_LIB_CINT) 10 11 #if defined(PHYMOD_SUPPORT) 12 13 #include <cint_config.h> 14 #include <cint_types.h> 15 #include <cint_porting.h> 16 #include <soc/types.h> 17 #include <soc/error.h> 18 #include <soc/phy/phyctrl.h> 19 #include <soc/phy/phymod_ctrl.h> 20 21 int 22 port_cores_access_get(int unit, soc_port_t port, uint32 array_size, phymod_core_access_t *cores, uint32 *nof_cores){ 23 phy_ctrl_t *pc; 24 soc_phymod_ctrl_t *pmc; 25 int i; 26 27 pc = INT_PHY_SW_STATE(unit, port); 28 pmc = &pc->phymod_ctrl; 29 30 *nof_cores = 0; 31 if(pmc->num_phys > array_size){ 32 return SOC_E_PARAM; 33 } 34 for(i = 0 ; i < pmc->num_phys; i++){ 35 if( pmc->phy[i] == NULL ){ 36 return SOC_E_INTERNAL; 37 } 38 if (pmc->phy[i]->core == NULL) { 39 return SOC_E_INTERNAL; 40 } 41 cores[i] = pmc->phy[i]->core->pm_core; 42 *nof_cores += 1; 43 } 44 return SOC_E_NONE; 45 } 46 47 int 48 port_phys_access_get(int unit, soc_port_t port, uint32 array_size, phymod_phy_access_t *phys, uint32 *nof_cores){ 49 phy_ctrl_t *pc; 50 soc_phymod_ctrl_t *pmc; 51 int i; 52 53 pc = INT_PHY_SW_STATE(unit, port); 54 pmc = &pc->phymod_ctrl; 55 56 *nof_cores = 0; 57 if(pmc->num_phys > array_size){ 58 return SOC_E_PARAM; 59 } 60 for(i = 0 ; i < pmc->num_phys; i++){ 61 if( pmc->phy[i] == NULL ){ 62 return SOC_E_INTERNAL; 63 } 64 phys[i] = pmc->phy[i]->pm_phy; 65 *nof_cores += 1; 66 } 67 return SOC_E_NONE; 68 } 69 70 71 CINT_FWRAPPER_CREATE_RP5(int, int, 0, 0, 72 port_cores_access_get, 73 int, int, unit, 0, 0, 74 soc_port_t, soc_port_t, port, 0, 0, 75 uint32, uint32, array_size, 0, 0, 76 phymod_core_access_t*, phymod_core_access_t, cores, 1, 0, 77 uint32*, uint32, nof_cores, 1, 0 78 ); 79 80 CINT_FWRAPPER_CREATE_RP5(int, int, 0, 0, 81 port_phys_access_get, 82 int, int, unit, 0, 0, 83 soc_port_t, soc_port_t, port, 0, 0, 84 uint32, uint32, array_size, 0, 0, 85 phymod_phy_access_t*, phymod_phy_access_t, phys, 1, 0, 86 uint32*, uint32, nof_cores, 1, 0 87 ); 88 89 90 static cint_function_t __cint_functions[] = 91 { 92 CINT_FWRAPPER_ENTRY(port_cores_access_get), 93 CINT_FWRAPPER_ENTRY(port_phys_access_get), 94 { NULL } 95 }; 96 97 98 static cint_parameter_desc_t __cint_typedefs[] = 99 { 100 { 101 "uint32", 102 "uint32_t", 103 0, 104 0 105 }, 106 { NULL } 107 }; 108 109 110 111 cint_data_t phymod_access_cint_data = 112 { 113 NULL, 114 __cint_functions, 115 NULL, 116 NULL, 117 __cint_typedefs, 118 NULL, 119 NULL, 120 }; 121 122 #endif /* defined(PHYMOD_SUPPORT) */ 123 124 #endif /* defined(INCLUDE_LIB_CINT) */ 125 126 int _phymod_access_cint_data_not_empty;