Ethernet Rx Thread */
| 909 | #ifndef LWIP_NO_RX_THREAD |
| 910 | /* Ethernet Rx Thread */ |
| 911 | static void eth_rx_thread_entry(void* parameter) |
| 912 | { |
| 913 | struct eth_device* device; |
| 914 | |
| 915 | while (1) |
| 916 | { |
| 917 | if (rt_mb_recv(ð_rx_thread_mb, (rt_ubase_t *)&device, RT_WAITING_FOREVER) == RT_EOK) |
| 918 | { |
| 919 | rt_base_t level; |
| 920 | struct pbuf *p; |
| 921 | |
| 922 | /* check link status */ |
| 923 | if (device->link_changed) |
| 924 | { |
| 925 | int status; |
| 926 | |
| 927 | level = rt_spin_lock_irqsave(&(device->spinlock)); |
| 928 | status = device->link_status; |
| 929 | device->link_changed = 0x00; |
| 930 | rt_spin_unlock_irqrestore(&(device->spinlock), level); |
| 931 | |
| 932 | if (status) |
| 933 | netifapi_netif_set_link_up(device->netif); |
| 934 | else |
| 935 | netifapi_netif_set_link_down(device->netif); |
| 936 | } |
| 937 | |
| 938 | level = rt_spin_lock_irqsave(&(device->spinlock)); |
| 939 | /* 'rx_notice' will be modify in the interrupt or here */ |
| 940 | device->rx_notice = RT_FALSE; |
| 941 | rt_spin_unlock_irqrestore(&(device->spinlock), level); |
| 942 | |
| 943 | /* receive all of buffer */ |
| 944 | while (1) |
| 945 | { |
| 946 | if(device->eth_rx == RT_NULL) break; |
| 947 | |
| 948 | p = device->eth_rx(&(device->parent)); |
| 949 | if (p != RT_NULL) |
| 950 | { |
| 951 | /* notify to upper layer */ |
| 952 | if( device->netif->input(p, device->netif) != ERR_OK ) |
| 953 | { |
| 954 | LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: Input error\n")); |
| 955 | pbuf_free(p); |
| 956 | p = NULL; |
| 957 | } |
| 958 | } |
| 959 | else break; |
| 960 | } |
| 961 | } |
| 962 | else |
| 963 | { |
| 964 | LWIP_ASSERT("Should not happen!\n",0); |
| 965 | } |
| 966 | } |
| 967 | } |
| 968 | #endif |
nothing calls this directly
no test coverage detected