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

📄 ixtimesyncacccodelet.h

📁 有关ARM开发板上的IXP400网络驱动程序的源码以。
💻 H
📖 第 1 页 / 共 2 页
字号:
/** * @file IxTimeSyncAccCodelet.h * * @author Intel Corporation * * @date 23 December 2004 * * @brief This is the header file for Intel (R) IXP400 Software Time Sync Access Codelet * * @par  * IXP400 SW Release version 2.1 *  * -- Copyright Notice -- *  * @par * Copyright (c) 2001-2005, Intel Corporation. * All rights reserved. *  * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. *  *  * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  *  * @par * -- End of Copyright Notice -- */#ifndef IXTIMESYNCACCCODELET_H#define IXTIMESYNCACCCODELET_H#ifdef __ixp46X/** * @ingroup Codelets * * @defgroup IxTimeSyncAccCodelet Intel (R) IXP400 Software Time Sync Access Codelet   * * @brief Intel (R) IXP400 Software Time Sync Access Codelet  * * <PRE> * This codelet shows how to use some of Time Sync Access (timeSyncAcc)  * API functions. It demonstrates the followings:  * *  	- how to configure Time Sync channel to operate in master or slave mode    *	 *	- how to set frequency scale value (fsv) * *	- how to set and get system time * *	- how to set target time *	 *	- how to setup target time in interrupt mode  *	 *	- how to enable and disable target time interrupt * * Basically, Time Sync Access codelet supports three configurations as * follow: * *	configuration 0: NPE A - Slave,  NPE B - Slave,  NPE C - Master (default) *	configuration 1: NPE A - Slave,  NPE B - Master, NPE C - Slave *	configuration 2: NPE A - Master, NPE B - Slave,  NPE C - Slave *  * User provides his/her choice of configuration when executing Time Sync * Access codelet. Based on the selected user configuration, each NPE will  * be configured to operate in the desired operating mode - master or slave. * In addition, all NPEs and ethernet ports will be setup to transmit one  * PTP message using UDP protocol every 2 seconds. PTP Sync message will be * transmitted at port where NPE is configured to operate in master mode. * Conversely, PTP Delay_Req message will be transmitted from slave mode * operating port. The transmission and reception of PTP Sync or Delay_Req * messages can be demonstrated if the user connects master operating port  * to slave operating port. The following table summarizes the activities * between the two connecting master port and slave port: * *	master port			slave port *	transmit Sync message		receive Sync message *	receive Delay_Req message	transmit Delay_Req message  *   * Time Sync Access codelet sets tick rate to 1000 ticks per second.  * In other word, the system time will tick every one millisecond. * For demonstration purpose, the target time is configured to hit system * time every one second. For example, target time is set to one second * ahead of current system time. When system time reaches target time,  * interrupt will occur. Corresponding ISR will be invoked to be processed. * Two main things will be performed during ISR. First, the codelet will * check if any NPE channel has detected PTP's Sync or Delay_Req message. * If yes, the captured system time at RECV/XMIT snapshot registers will * be read and printed along with the PTP message information. Then, the  * codelet will set new target time to a second later. This process will * be repeated until the user terminates the Time Sync Access codelet * execution.  *  * * <B> VxWorks* User Guide </B><BR> * (1) <B> ixTimeSyncAccCodeletMain </B><BR> * This function is the main function for timeSyncAcc codelet. * This function will perform the followings: * *	- configure all Time Sync Channels to operate in the mode  *	  specified in the user selected configuration.  * *	- set tick rate to get system time to start ticking *  *	- setup target time to hit every one second (in interrupt mode) * *	- setup and enable all NPEs and all ethernet components. *	 *	- spawn a thread to transmit Sync message from master port  *	  and Delay_Req message from slave port every 2 seconds. * * <I> Usage : * *	(a) connect slave port to any master port * *	(b) run timeSyncAcc codelet: * *	    -> ixTimeSyncAccCodeletMain x * *	    where x = * 		0 -> NPE A - Slave,  NPE B - Slave,  NPE C - Master (default)   *		1 -> NPE A - Slave,  NPE B - Master, NPE C - Slave   *		2 -> NPE A - Master, NPE B - Slave,  NPE C - Slave   * * </I>  * * (2) <B> ixTimeSyncAccCodeletQuit </B><BR> * This function gracefully terminates timeSyncAcc codelet execution. * *  <I> Usage : * 	-> ixTimeSyncAccCodeletQuit * *  </I> * * * <B> Linux* User Guide </B><BR> * (1) <B> ixTimeSyncAccCodeletMain </B><BR> * This function is the main function for timeSyncAcc codelet. * This function will perform the followings: * *	- configure all Time Sync Channels to operate in the mode  *	  specified in the user selected configuration.  * *	- set tick rate to get system time to start ticking *  *	- setup target time to hit every one second (in interrupt mode) * *	- setup and enable all NPEs and all ethernet components. *	 *	- spawn a thread to transmit Sync message from master port  *	  and Delay_Req message from slave port every 2 seconds. * * This function will be invoked and executed when the user loads the * timeSyncAcc codelet module using 'insmod' command. *  *  <I> Usage : * *	(a) connect slave port to any master port * *	(b) run timeSyncAcc codelet: * *	    prompt> insmod ixp400_codelets_timeSyncAcc.o config=x * *	    where x = * 		0 -> NPE A - Slave,  NPE B - Slave,  NPE C - Master (default)   *		1 -> NPE A - Slave,  NPE B - Master, NPE C - Slave   *		2 -> NPE A - Master, NPE B - Slave,  NPE C - Slave   * *  </I> * * (2) <B> ixTimeSyncAccCodeletQuit </B><BR> * This function terminates timeSyncAcc codelet execution. * It will be invoked when 'rmmod' command is executed. *  *  <I> Usage : * 	prompt> rmmod ixp400_codelets_timeSyncAcc * *  </I> * </PRE> * * * @{ *//********************************************************************* *	Include files *********************************************************************/#include "IxOsal.h"#include "IxTimeSyncAcc.h"#include "IxEthAcc.h"#include "IxEthDB.h"#include "IxFeatureCtrl.h"#include "IxQMgr.h"#include "IxNpeDl.h"#include "IxNpeMh.h"/********************************************************************* *	Macro constants and function definition  *********************************************************************//** * @def IX_TIMESYNCACC_CODELET_ROLLOVER_VALUE * * @brief rollover value  */#define IX_TIMESYNCACC_CODELET_ROLLOVER_VALUE (0xFFFFFFFF) /** * @def IX_TIMESYNCACC_CODELET_APB_CLOCK_FREQUENCY * * @brief APB clock frequency in MHz (66 MHz)  */#define	IX_TIMESYNCACC_CODELET_APB_CLOCK_FREQUENCY (66666666)/** * @def IX_TIMESYNCACC_CODELET_FSV_DEFAULT * * @brief define default value for frequency scale value or tick rate. *	  With this default tick rate, system time would tick   *	  approximately every milli-second. */#define	IX_TIMESYNCACC_CODELET_FSV_DEFAULT (0xFFFFFFFF / (IX_TIMESYNCACC_CODELET_APB_CLOCK_FREQUENCY / 1000))/** * @def IX_TIMESYNCACC_CODELET_TARGET_TIME_HIT_INTERVAL * * @brief define default value for target time interval. With default  * tick rate, default interval is approximately 1 second. 

⌨️ 快捷键说明

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