码迷,mamicode.com
首页 > 其他好文 > 详细

关于enc28j60格式过滤的理解之一

时间:2014-09-05 19:40:31      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:style   color   io   ar   for   sp   on   c   ad   

    // do bank 1 stuff, packet filter:
    // For broadcast packets we allow only ARP packtets
    // All other packets should be unicast only for our mac (MAADR)
    //
    // The pattern to match on is therefore
    // Type     ETH.DST
    // ARP      BROADCAST
    // 06 08 -- ff ff ff ff ff ff -> ip checksum for theses bytes=f7f9
  // 0x0806:地址解析协议(ARP:Address Resolution Protocol)

  // [06 08 ff ff ff ff ff ff] 的 TCP/IP校验和 = F9F7
    // in binary these poitions are:11 0000 0011 1111
    // This is hex 303F->EPMM0=0x3f,EPMM1=0x30
   
    enc28j60Write(ERXFCON, ERXFCON_UCEN|ERXFCON_CRCEN|ERXFCON_PMEN);
    enc28j60Write(EPMM0, 0x3f);   // 格式匹配: 目标MAC地址(后6个字节)+来源MAC地址(前2个字节)
    enc28j60Write(EPMM1, 0x30);  // 格式匹配: 来源MAC地址(后4个字节)+ARP格式(前2个字节)+保留(另外2个字节)
    enc28j60Write(EPMCSL, 0xf9);
    enc28j60Write(EPMCSH, 0xf7);   
    enc28j60Write(MACON1, MACON1_MARXEN|MACON1_TXPAUS|MACON1_RXPAUS);
    // bring MAC out of reset
    enc28j60Write(MACON2, 0x00);

关于enc28j60格式过滤的理解之一

标签:style   color   io   ar   for   sp   on   c   ad   

原文地址:http://www.cnblogs.com/yuwl26/p/3958493.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!