OSTaskCreateExt(TaskD, //接受数据和发送数据
(void *)0,
&task3_stack[999],
TASK_3_PRIO,
TASK_3_ID,
&task3_stack[0],
1000,
(void *)0,
0);
SetNetPort();
InitNic(0); //RTL8019芯片初始化,在global.c中定义
Initial_arp();
Tcp_Initial();
Udp_Initial();
while(1)
{
OSTimeDly(4);
do
{
iii=Rec_Packet();
}
while(iii!=0);
}
}
void Uart_SendChar(INT8U data)
{
while((U0LSR & 0x00000020) == 0);
U0THR = data;
}
4.2.5 主程序
程序清单 8 主程序
int main (void)
毕业论文http://www.751com.cn/
OSTaskCreateExt(task0,
(void *)0,
&task0_stack[2999],
TASK_START_PRIO,
TASK_START_ID,
&task0_stack[0],
3000,
(void *)0,
0);
RecPackedFlag= OSSemCreate(0);
RecBufOverFlowFlag= OSSemCreate(0);
RecTcpPackedFlag= OSSemCreate(0);
RecPingPackedFlag= OSSemCreate(0);
SendFlag= OSSemCreate(1);
RecIcmpQFlag= OSQCreate(&RecIcmpQ[0],Q_Max_Size);
RecTcpQFlag= OSQCreate(&RecTcpQ[0],Q_Max_Size);
RecUdpQFlag= OSQCreate(&RecUdpQ[0],Q_Max_Size);
OSStart();
}
4.2.6 定时器本文源自辣文论文网中断控制
程序清单 9 中断控制
void Timer1_Init(void)
{
OS_ENTER_CRITICAL();
T1IR = 0xffffffff;
T1TC = 0;
T1TCR = 0x01;
T1MCR = 0x03;
T1MR0 = 0xffffff;
上一页 [1] [2] [3] [4] [5] [6] 下一页