helper2416_lwip_移植小结(转)(3)
- UID
- 1029342
- 性别
- 男
|
helper2416_lwip_移植小结(转)(3)
IRQ配置使能中断
接收状态---FIFO达到指定的深度中断
3)以太网低级别初始化
- /**
- * @brief low_level_init
- * @note 低级别初始化
- * @param netif---Lwip网络接口
- * @retval none
- */
- static void low_level_init(struct netif *netif)
- {
- struct lan9220_emac* LAN_EMAC;
- LAN_EMAC = (struct lan9220_emac*) (netif->state);
- /* 设置MAC地址长度 */
- netif->hwaddr_len = ETHARP_HWADDR_LEN;
- if (LAN_EMAC == &lan9220_emac_dev) {
- /* 设置MAC物理地址 */
- netif->hwaddr[0] = MACaddr[0];
- netif->hwaddr[1] = MACaddr[1];
- netif->hwaddr[2] = MACaddr[2];
- netif->hwaddr[3] = MACaddr[3];
- netif->hwaddr[4] = MACaddr[4];
- netif->hwaddr[5] = MACaddr[5];
- }
- /* 最大传输单元 */
- netif->mtu = ETHERNET_MTU;
- s_pxNetIf = netif;
- /* 创建信号量用于通知网络接口帧接收 */
- if (s_RxSemaphore == NULL) {
- s_RxSemaphore = OSSemCreate(1);
- }
- if (s_TxSemaphore == NULL) {
- s_TxSemaphore = OSSemCreate(1);
- }
- /* 以太网设备能力定义 --- ARP基本能力 */
- /* 如果设备不是以太网设备请不要设置NETIF_FLAG_ETHARP */
- netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
- ETH_SYSTEM_DEV_INIT();
- /* 创建ETH_MAC处理任务---接收 */
- OSTaskCreateExt(ethernetif_input, (void *)0,
- &NETIF_RX_TASK_STK[netifINTERFACE_RX_TASK_STACK_SIZE-1],
- netifINTERFACE_RX_TASK_PRIORITY,
- netifINTERFACE_RX_TASK_PRIORITY,
- &NETIF_RX_TASK_STK[0],
- netifINTERFACE_RX_TASK_STACK_SIZE,
- (void *)0,
- OS_TASK_OPT_STK_CHK + OS_TASK_OPT_STK_CLR);
- #if (OS_TASK_NAME_SIZE > 5)
- INT8U err;
- OSTaskNameSet(netifINTERFACE_RX_TASK_PRIORITY, "ETH_RX", &err);
- #endif
- }
复制代码
好吧,基本上是通了,还是有很多问题,需要花时间去规划一下,不能太着急,问题多多。 |
|
|
|
|
|