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

tdm_th_shim.c (2274B)


      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  * $All Rights Reserved.$
      7  *
      8  * TDM chip to core API shim layer
      9  */
     10 #ifdef _TDM_STANDALONE
     11 	#include <tdm_top.h>
     12 #else
     13 	#include <soc/tdm/core/tdm_top.h>
     14 #endif
     15 
     16 
     17 /**
     18 @name: tdm_chip_th_shim__check_ethernet_d
     19 @param:
     20 
     21 Upward abstraction layer between TDM.4 and TDM.5 API
     22  */
     23 tdm_mod_t*
     24 tdm_chip_th_shim__check_ethernet_d( int port, enum port_speed_e speed[TH_NUM_EXT_PORTS], enum port_state_e state[TH_NUM_EXT_PORTS], int **tsc, int traffic[TH_NUM_PM_MOD] )
     25 {
     26 	int idx1, idx2;
     27 	tdm_mod_t *_tdm_s;
     28 	
     29 	_tdm_s = TDM_ALLOC(sizeof(tdm_mod_t),"TDM shim allocation");
     30 	if (!_tdm_s) {
     31 		return NULL;
     32 	}
     33 	
     34 	_tdm_s->_chip_data.soc_pkg.speed=TDM_ALLOC(TH_NUM_EXT_PORTS*sizeof(int), "port speed list");
     35 	for (idx1=0; idx1<TH_NUM_EXT_PORTS; idx1++) {
     36 		_tdm_s->_chip_data.soc_pkg.speed[idx1] = speed[idx1];
     37 	}
     38 	_tdm_s->_chip_data.soc_pkg.state=TDM_ALLOC(TH_NUM_EXT_PORTS*sizeof(int), "port state list");
     39 	for (idx1=0; idx1<TH_NUM_EXT_PORTS; idx1++) {
     40 		_tdm_s->_chip_data.soc_pkg.state[idx1] = state[idx1];
     41 	}
     42 	_tdm_s->_chip_data.soc_pkg.pmap_num_modules = TH_NUM_PHY_PM;
     43 	_tdm_s->_chip_data.soc_pkg.pmap_num_lanes = TH_NUM_PM_LNS;
     44 	_tdm_s->_chip_data.soc_pkg.pmap=(int **) TDM_ALLOC((_tdm_s->_chip_data.soc_pkg.pmap_num_modules)*sizeof(int *), "portmod_map_l1");
     45 	for (idx1=0; idx1<(_tdm_s->_chip_data.soc_pkg.pmap_num_modules); idx1++) {
     46 		_tdm_s->_chip_data.soc_pkg.pmap[idx1]=(int *) TDM_ALLOC((_tdm_s->_chip_data.soc_pkg.pmap_num_lanes)*sizeof(int), "portmod_map_l2");
     47 		TDM_MSET(_tdm_s->_chip_data.soc_pkg.pmap[idx1],(_tdm_s->_chip_data.soc_pkg.num_ext_ports),_tdm_s->_chip_data.soc_pkg.pmap_num_lanes);
     48 	}
     49 	for (idx1=0; idx1<TH_NUM_PHY_PM; idx1++) {
     50 		for (idx2=0; idx2<TH_NUM_PM_LNS; idx2++) {
     51 			_tdm_s->_chip_data.soc_pkg.pmap[idx1][idx2] = tsc[idx1][idx2];
     52 		}
     53 	}
     54 	/* _tdm_s->_chip_data.soc_pkg.soc_vars.th.pm_encap_type=sal_alloc(TH_NUM_PM_MOD*sizeof(int *), "traffic encap"); */	
     55 	for (idx1=0; idx1<TH_NUM_PM_MOD; idx1++) {
     56 		_tdm_s->_chip_data.soc_pkg.soc_vars.th.pm_encap_type[idx1] = traffic[idx1];
     57 	}	
     58 	
     59 	_tdm_s->_core_data.vars_pkg.port = port;
     60 	return _tdm_s;
     61 	
     62 }