/***************************************************************************** 函 数 名 : dmac_board_init 功能描述 : 在hmac和dmac中调用时,分别直接对全局变量赋值 输入参数 : board对象指针 输出参数 : 无 返 回 值 : 成功或失败 调用函数 : mac_chip_init、oal_bit_set_bit_one_byte、mac_board_register_table_instance 被调函数 : 修改历史 : 1.日 期 : 2012年10月19日 作 者 : huxiaotong 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 dmac_board_init(mac_board_stru *pst_board) { oal_uint8 uc_chip; oal_uint32 ul_ret; if (OAL_UNLIKELY(OAL_PTR_NULL == pst_board)) { OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_board_init::pst_board null.}"); return OAL_ERR_CODE_PTR_NULL; } /*公共部分初始化*/ mac_board_init(pst_board); /* chip支持的最大数由PCIe总线处理提供; */ for (uc_chip = 0; uc_chip < oal_bus_get_chip_num(); uc_chip++) { ul_ret = dmac_chip_init(&pst_board->ast_chip[uc_chip], uc_chip); if (OAL_SUCC != ul_ret) { OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_board_init::dmac_chip_init failed[%d].}", ul_ret); return ul_ret; } oal_bit_set_bit_one_byte(&pst_board->uc_chip_id_bitmap, uc_chip); } return OAL_SUCC; }
oal_uint32 hmac_res_exit(mac_board_stru *pst_hmac_board) { oal_uint8 uc_chip; oal_uint8 uc_device_max; oal_uint8 uc_device; oal_uint16 ul_chip_max_num; mac_chip_stru *pst_chip; /* chip支持的最大数由PCIe总线处理提供; */ ul_chip_max_num = oal_bus_get_chip_num(); for (uc_chip = 0; uc_chip < ul_chip_max_num; uc_chip++) { pst_chip = &pst_hmac_board->ast_chip[uc_chip]; /* OAL接口获取支持device个数 */ uc_device_max = oal_chip_get_device_num(pst_chip->ul_chip_ver); for (uc_device = 0; uc_device < uc_device_max; uc_device++) { /* 释放hmac res资源 */ hmac_res_free_mac_dev(pst_chip->auc_device_id[uc_device]); } } return OAL_SUCC; }