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

📄 tcpip_main.c

📁 周立功ARM9 2410试验平台的uCOS-II基础实验代码
💻 C
📖 第 1 页 / 共 2 页
字号:
**
** Descriptions:			time1 interrupt server function     
**
** input parameters:		None						  
** Returned value:			None 
**         
** Used global variables:	ttl_flag
** Calling modules:			None
**
** Created by:				Yehaoben
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
volatile uint16	testOSIntNesting = 0;

/*********************************************************************************************************
** Function name:			RTCIni
**
** Descriptions:			REAL TIME CLOCK INITIAL
**
** input parameters:		None
** Returned value:			None					
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Yehaoben
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void  RTCIni(void)
{  
	/*
	PREINT = Fpclk / 32768 - 1;	// 设置基准时钟分频器
   	PREFRAC = Fpclk - (Fpclk / 32768) * 32768;
   
   	YEAR = 2004;				    // 初始化年
   	MONTH = 2;				    // 初始化月
   	DOM = 19;				    // 初始化日
   
   	CIIR = 0x01;				    // 设置秒值的增量产生一次中断
   
   	CCR = 0x01;				    // 启动RTC
   	*/
}   


void SetNetPort(void)

{
	uint8 i;

#if MAC_FORM_EEPROM==0
/************** GET IP FORM PROGRAM DEFINE ***************/	
	for(i=0;i<4;i++)
	{
		NetPort[0].My_Ip[i]=My_Ip_1ID[i];
		NetPort[0].My_Gateway[i]=My_Gateway_1ID[i];
		NetPort[0].My_Ip_Mark[i]=MY_IP_MARK_1ID[i];
#if MAX_NET_PORT>=2
		NetPort[1].My_Ip[i]=My_Ip_2ID[i];
		NetPort[1].My_Gateway[i]=My_Gateway_2ID[i];
		NetPort[1].My_Ip_Mark[i]=MY_IP_MARK_2ID[i];
#endif
	}
	for(i=0;i<6;i++)
	{
		NetPort[0].My_Mac[i]=MY_MAC_1ID[i];
#if MAX_NET_PORT>=2
		NetPort[1].My_Mac[i]=MY_MAC_2ID[i];
#endif
	}
/************** GET IP FORM EEPROM ***************/	
#else
	RestoreFromStorege(54,&i,1);//check for dhcp 
	if(i==0)
	{ 
		RestoreFromStorege(26,NetPort[0].My_Ip,4); 
		RestoreFromStorege(32,NetPort[0].My_Gateway,4);
		RestoreFromStorege(36,NetPort[0].My_Ip_Mark,4); 
#if MAX_NET_PORT>=2
		RestoreFromStorege(128+26,NetPort[1].My_Ip,4); 
		RestoreFromStorege(128+32,NetPort[1].My_Gateway,4);
		RestoreFromStorege(128+36,NetPort[1].My_Ip_Mark,4); 
#endif
	}
	else
	{
		RTCIni();
		for(i=0;i<4;i++)
		{
			NetPort[0].My_Ip[i]=0;
			NetPort[0].My_Gateway[i]=0;
			NetPort[0].My_Ip_Mark[i]=0;
#if MAX_NET_PORT>=2
			NetPort[1].My_Ip[i]=0;
			NetPort[1].My_Gateway[i]=0;
			NetPort[1].My_Ip_Mark[i]=0;
#endif
		}
	}
	RestoreFromStorege(20,NetPort[0].My_Mac,6); 
#if MAX_NET_PORT>=2
	RestoreFromStorege(128+20,NetPort[1].My_Mac,6); 
#endif
#endif
	
}

/*
*********************************************************************************************************
*                                       OS INITIALIZATION HOOK
*                                            (BEGINNING)
*
* Description: This function is called by OSInit() at the beginning of OSInit().
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts should be disabled during this call.
*********************************************************************************************************
*/
#if OS_VERSION > 203
void OSInitHookBegin (void)
{
}
#endif

/*
*********************************************************************************************************
*                                       OS INITIALIZATION HOOK
*                                               (END)
*
* Description: This function is called by OSInit() at the end of OSInit().
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts should be disabled during this call.
*********************************************************************************************************
*/
#if OS_VERSION > 203
void OSInitHookEnd (void)
{
}
#endif


/*
*********************************************************************************************************
*                                          TASK CREATION HOOK
*
* Description: This function is called when a task is created.
*
* Arguments  : ptcb   is a pointer to the task control block of the task being created.
*
* Note(s)    : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskCreateHook (OS_TCB *ptcb)
{
    ptcb = ptcb;                       /* Prevent compiler warning                                     */
}


/*
*********************************************************************************************************
*                                           TASK DELETION HOOK
*
* Description: This function is called when a task is deleted.
*
* Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
*
* Note(s)    : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskDelHook (OS_TCB *ptcb)
{
    ptcb = ptcb;                       /* Prevent compiler warning                                     */
}

/*
*********************************************************************************************************
*                                           TASK SWITCH HOOK
*
* Description: This function is called when a task switch is performed.  This allows you to perform other
*              operations during a context switch.
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts are disabled during this call.
*              2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
*                 will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the 
*                 task being switched out (i.e. the preempted task).
*********************************************************************************************************
*/
void OSTaskSwHook (void)
{
}

/*
*********************************************************************************************************
*                                           STATISTIC TASK HOOK
*
* Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
*              application to add functionality to the statistics task.
*
* Arguments  : none
*********************************************************************************************************
*/
void OSTaskStatHook (void)
{
}

/*
*********************************************************************************************************
*                                           OSTCBInit() HOOK
*
* Description: This function is called by OSTCBInit() after setting up most of the TCB.
*
* Arguments  : ptcb    is a pointer to the TCB of the task being created.
*
* Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
#if OS_VERSION > 203
void OSTCBInitHook (OS_TCB *ptcb)
{
    ptcb = ptcb;                                           /* Prevent Compiler warning                 */
}
#endif


/*
*********************************************************************************************************
*                                               TICK HOOK
*
* Description: This function is called every tick.
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
void OSTimeTickHook (void)
{
	extern void TCP_RETR_TIMECOUT(void);
	extern void TimeRecBufTTL(void);
	TCP_RETR_TIMECOUT();
	TimeRecBufTTL();//for hardware
}


/*
*********************************************************************************************************
*                                             IDLE TASK HOOK
*
* Description: This function is called by the idle task.  This hook has been added to allow you to do  
*              such things as STOP the CPU to conserve power.
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts are enabled during this call.
*********************************************************************************************************
*/
#if OS_VERSION >= 251
void OSTaskIdleHook (void)
{
}
#endif
/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

⌨️ 快捷键说明

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