研究生
最后登录1970-1-1
在线时间 小时
注册时间2013-3-25
|
楼主 |
发表于 2013-5-7 08:58:12
|
显示全部楼层
本帖最后由 飞鸟 于 2013-5-7 08:59 编辑
尝试中断方式,代码这样写的
int EVB_WF3_NetCheck(void)
{
int value = 0;
if (EXTI_GetITStatus(EXTI_Line13) != RESET)
{
EXTI_ClearITPendingBit(EXTI_Line13);
value = 1;
}
return value;
}
static void EVB_NET_ISR(TVector vector)
{
EVB_WF3_NetCheck();
//if (enc28j60PacketRxDone()==1)
{
TclIsrReleaseSemaphore(&NetSemaphore);
}
}
void EVB_ENT_INT_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* config the extiline(PE5) clock and AFIO clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
/* config P[A|B|C|D|E]13 */
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* EXTI line gpio config(PB13) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* EXTI line(PB13) mode config */
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource13);
EXTI_InitStructure.EXTI_Line = EXTI_Line13;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
实验是成功的。版主帮确认一下这样行不行?
Pb13的每次中断都会通过信号量唤醒lwip任务,然后去调用lwip的周期处理函数(里面去掉了while(1))。上面的代码能保证都是网卡的中断吗?
担心pb13的外中断,不一定都是网口的中断。 |
|