⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shutdown.c

📁 qnx powerpc MPC8245的 BSP源文件
💻 C
字号:
/* * $QNXLicenseC:  * Copyright 2007, QNX Software Systems.   *   * Licensed under the Apache License, Version 2.0 (the "License"). You   * may not reproduce, modify or distribute this software except in   * compliance with the License. You may obtain a copy of the License   * at: http://www.apache.org/licenses/LICENSE-2.0   *   * Unless required by applicable law or agreed to in writing, software   * distributed under the License is distributed on an "AS IS" basis,   * WITHOUT WARRANTIES OF ANY KIND, either express or implied.  *  * This file may contain contributions from others, either as   * contributors under the License or as licensors under other terms.    * Please review this entire file for other proprietary rights or license   * notices, as well as the QNX Development Suite License Guide at   * http://licensing.qnx.com/license-guide/ for other information.  * $  */ #include <mpc85xx.h> /***************************************************************************//*                                                                         *//***************************************************************************/int 	mpc_shutdown1(int reg_hdl, void *func_hdl){	mpc85xx_t	*ext = (mpc85xx_t *) func_hdl;	if (ext->cfg.verbose) {		nic_slogf (_SLOGC_NETWORK, _SLOG_INFO, "devn-mpc85xx: shutdown1() starting");	}	InterruptDetach (ext->iid [0]);	InterruptDetach (ext->iid [1]);	InterruptDetach (ext->iid [2]);	ConnectDetach (ext->coid);	ChannelDestroy (ext->chid);	if (ext->mdi) {		MDI_DisableMonitor (ext->mdi);		MDI_DeRegister (&ext->mdi);	}	if (ext->cfg.verbose) {		nic_slogf (_SLOGC_NETWORK, _SLOG_INFO, "devn-mpc85xx: shutdown1() done");	}	return (0);}/***************************************************************************//*                                                                         *//***************************************************************************/int		mpc_shutdown2 (int reg_hdl, void *func_hdl){	mpc85xx_t		*ext = (mpc85xx_t *) func_hdl;	npkt_t			*npkt;	uint32_t		*base = ext->reg;	mpc85xx_pool_t  *p;		if (ext->cfg.verbose) {		nic_slogf (_SLOGC_NETWORK, _SLOG_INFO, "devn-mpc85xx: shutdown2() starting");	}	pthread_cancel (ext->tid);		pthread_join (ext->tid, NULL);	mpc_flush (ext->reg_hdl, ext);	*(base + MPC_IMASK) = 0;	mpc_reset(ext);	/* Clear the GRS / GTS bits set during the reset process. */	*(base + MPC_DMACTRL) &= ~(DMACTRL_GRS | DMACTRL_GTS);		for( ; npkt = ext->rx_free_pkt_q; ) {		ext->rx_free_pkt_q = npkt->next;		if (npkt->org_data != NULL) {			p = (mpc85xx_pool_t *)npkt->org_data;			if (p->ref > 0) {				if (atomic_sub_value(&(p->ref), 1) == 1) {				  ion_free (p->buf_head);				}			}		}		ion_free (npkt);	}	munmap ((void *) ext->rx_bd, sizeof (mpc_bd_t) * ext->num_rx_descriptors);	munmap ((void *) ext->tx_bd, sizeof (mpc_bd_t) * ext->num_tx_descriptors);	free (ext->rx_pktq);	free (ext->tx_pktq);//	free (ext->tx_addr_table);			pthread_mutex_destroy (&ext->tx_mutex);	pthread_mutex_destroy (&ext->rx_free_pkt_q_mutex);	if (ext->cfg.verbose) {		nic_slogf (_SLOGC_NETWORK, _SLOG_INFO, "devn-mpc85xx: shutdown2() done");	}	free (ext);	return (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -