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

📄 mac_template.c

📁 zilog z80f91单片机的网络接口函数
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * File			:	cs8900.c
 *
 * Description	:	Driver file for the crystal ethernet controller.
 *					
 * Copyright 2004, ZiLOG Inc.
 * All Rights Reserved
 *
 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ZiLOG Inc., and might
 * contain proprietary, confidential and trade secret information of
 * ZiLOG, our partners and parties from which this code has been licensed.
 * 
 * The contents of this file may not be disclosed to third parties, copied or
 * duplicated in any form, in whole or in part, without the prior written
 * permission of ZiLOG Inc.
 */


#include <stdio.h>
#include <string.h>
#include "ZSysgen.h"
#include "ZTypes.h"
#include "ZThread.h"
#include "ZTimer.h"
#include "ZMessageQ.h"
#include "ZInterrupt.h"
#include "ZDevice.h"
#include "_ez80.h"
#include "EtherMgr.h"

// Include header files specific to your hardware here


// Configurable parameters related to the EMAC interrupt thread.
// The stack size and thread priority can be configured in emac_conf.c file
extern UINT8 EMAC_Task_Stack[] ;	// 
extern UINT8 EMAC_TASK_PRIO ;
extern UINT EMAC_THD_STACK_SIZE ;
extern void* (*rxnotifyfunc)(void);

void F91EmacTask( void ) ;

ETH_DEV_STRUCT_t       	emac[1];
INT8					bRxCount = 0; /* Received packet count */
RZK_THREADHANDLE_t		emacInterruptThdHdl ;


/*
 ******************************************************************************
 *                               EthMAddFunc                                  *
 *                                                                            *
 *	Ethernet Multicast Add function.                                           *
 *                                                                            *
 * Description:  This function is called to add the given Multicast address   *
 * to the multicast table mantained within the MAC.                           *
 *                                                                            *
 * Input:                                                                     *
 * 	pAddr -		   Pointer to the 48-bit MAC address to be added to the       *
 *                 multicast table.  The address should be checked for        *
 *                 validity and uniqueness in the table before being added.   *
 *                 If the MAC table is full or the HW is not able to support  *
 *                 multicast addresses this routine will silently discard the * 
 *                 the given address.                                         *
 * Output:                                                                    *
 *		<none>                                                                  *
 *                                                                            *
 * Notes:                                                                     *
 * - Even if the HW is unable to support Multicast filtering the MAC writer   *
 * may choose to implement the multicast table filtering in software. (I.e.   *
 * the HW can be placed in promiscuous mode and the Rx routine in this module *
 * can filter packets based on the 48-bit DA field.)  However, this may cause *
 * a severe degradation in performance on busy networks and is not advised.   *
 * - Many Ethernet controllers use a hash function (typically the CRC-32      *
 * algorithm) to set a particular bit in a HW register that will allow the    *
 * reception of any multicast addresses with the same hash code.  Consult the *
 * documentation for your Ethernet Controller for more information.           *
 * - This function is accessible through the Ethernet driver's control() API  *
 * using a control code of EPC_MADD.                                          *
 ******************************************************************************
 */

void EthMAddFunc
(
	INT8 *							pAddr
)
{
	/*
	 * The sample driver does not maintain a multicast table.
	 */
}



/*
 ******************************************************************************
 *                               EthMDelFunc                                  *
 *                                                                            *
 *	Ethernet Multicast Add function.                                           *
 *                                                                            *
 * Description:  This function is called to remove the given Multicast address*
 * to the multicast table mantained within the MAC.                           *
 *                                                                            *
 * Input:                                                                     *
 * 	pAddr - Pointer to the 48-bit MAC address to be removed from the   *
 *                 multicast table.                                           *
 *                 If the MAC is not accepting fromes from the indicated      *
 *                 multicast address, this routine will silently discard the  *
 *                 address.                                                   *
 * Output:                                                                    *
 *		<none>                                                                  *
 *                                                                            *
 * Notes:                                                                     *
 * - Even if the HW is unable to support Multicast filtering the MAC writer   *
 * may choose to implement the multicast table filtering in software. (I.e.   *
 * the HW can be placed in promiscuous mode and the Rx routine in this module *
 * can filter packets based on the 48-bit DA field.)  However, this may cause *
 * a severe degradation in performance on busy networks and is not advised.   *
 * - Many Ethernet controllers use a hash function (typically the CRC-32      *
 * algorithm) to set a particular bit in a HW register that will allow the    *
 * reception of any multicast addresses with the same hash code.  Consult the *
 * documentation for your Ethernet Controller for more information.           *
 * - This function is accessible through the Ethernet driver's control() API  *
 * using a control code of EPC_MDEL.                                          *
 ******************************************************************************
 */

void EthMDelFunc
(
	INT8 *							pAddr
)
{


}


/*
 ******************************************************************************
 *                               EmacReset                                    *
 *                                                                            *
 *	Ethernet Reset function.                                                  *
 *                                                                            *
 * Description:  This function is called during system initialization.  The   *
 * EmacReset function should place the Ethernet hardware into a known state   *
 * and ensure that the ethernet controller will not generate any interrupts   *
 * until the system calls the EthInitFunc.                                    *
 *                                                                            *
 * Input:                                                                     *
 *		<none>                                                                *
 * Output:                                                                    *
 *		<none>                                                                *
 *                                                                            *
 * Notes:                                                                     *
 * - Many Ethernet controllers include a a hardwrae reset function that can   *
 * be used to implement this routine.                                         *
 * - This function is accessible through the Ethernet driver's control() API  *
 * using a control code of EPV_RESET.                                         *
 ******************************************************************************
 */
void EmacReset( void )
{

	/*
	 * Disable interrupt generation from the Ethernet Controller.
	 */

	/*
	 * Perform a Hardware reset if the controller supports this function.
	 * Otherwise set the Controller's register's into a valid initial state.
	 */

}

/*
 ******************************************************************************
 *                               EmacEnableIrq								  *
 *                                                                            *
 *	Ethernet Interrupt Enable function                                        *
 *                                                                            *
 * Description:  When called, this function should enable interrupt           *
 * genereation by the Ethernet controller.  Please consult the controller's   *
 * register set for information on how this is accomplished.                  *
 *                                                                            *
 * Input:                                                                     *
 *		<none>                                                                *
 * Output:                                                                    *
 *		<none>                                                                *
 *                                                                            *
 * Notes:                                                                     *
 * - This function is accessible through the Ethernet driver's control() API  *
 * using a control code of EPV_IRQ_ENABLE.                                    *
 * - If you are not using interrupts, this function should return without     *
 * performing any processing.                                                 *
 ******************************************************************************
 */

void EmacEnableIrq( void )
{
	/*
	 * Allow the Ethernet Controller to generate receive and transmit interrupts.
	 */
}


/*
 ******************************************************************************
 *                               EmacDisableIrq	                              *
 *                                                                            *
 *	Ethernet Interrupt Disable function                                       *
 *                                                                            *
 * Description:  When called, this function should prevent interrupt          *
 * genereation by the Ethernet controller.  Please consult the controller's   *
 * register set for information on how this is accomplished.                  *
 *                                                                            *
 * Input:                                                                     *
 *		<none>                                                                *
 * Output:                                                                    *
 *		<none>                                                                *
 *                                                                            *
 * Notes:                                                                     *
 * - This function is accessible through the Ethernet driver's control() API  *
 * using a control code of EPV_IRQ_DISABLE.                                   *
 * - If you are not using interrupts, this function should return without     *
 * performing any processing.                                                 *
 ******************************************************************************
 */
void EmacDisableIrq( void )
{
	/*
	 * Prevent the Ethernet controller from generating any interrupts.
	 */
}

/*
 ******************************************************************************
 *                               EthInitFunc                                  *
 *                                                                            *
 *	Ethernet Innit function.                                                  *
 *                                                                            *
 * Description:  This function should verify the presence of the expected HW  *
 * controller and claim the appropriate system resources (interrupt vector    *
 * DMA, I/O pins, timers, etc) and initialize the HW/ SW to a known state.    *
 * If interrupts will be used to interface with the controller, interrupt     *
 * generation should be enabled on the controller after calling				  *
 *	RZKInstallInterruptHandler to install the interrupt handler in the system.*
 *                                                                            *
 * Input:                                                                     *
 * 	ieeeaddr - Pointer to the 48-bit MAC address that this driver should      *
 *               use for uniicast frame reception.  This address should be    *
 *               programmed into the controller.  Initially the MAC should    *
 *               only enable resecption of unicast and broadcast frames.      *
 *		rxnotify - The MAC should call this function every time a packet has  *
 *               been successfully received by the HW to allow the upper      *

⌨️ 快捷键说明

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