| Previous | 199869 Revisions | Next |
| r21532 Saturday 2nd March, 2013 at 03:29:47 UTC by Carl |
|---|
| dinetwork: remove mcast_chk and check for multicast in recv (nw) netdev_tap: do mac filtering (nw) |
| [src/emu] | dinetwork.c dinetwork.h |
| [src/mess/machine] | 3c505.c 3c505.h dp8390.c dp8390.h mb8795.c mb8795.h |
| [src/osd/sdl] | netdev_tap.c |
| r21531 | r21532 | |
|---|---|---|
| 81 | 81 | { |
| 82 | 82 | int len; |
| 83 | 83 | if(m_fd == -1) return 0; |
| 84 | len = read(m_fd, m_buf, sizeof(m_buf)); | |
| 84 | do { | |
| 85 | len = read(m_fd, m_buf, sizeof(m_buf)); | |
| 86 | } while(!get_promisc() && memcmp(get_mac(), m_buf, 6)); | |
| 85 | 87 | *buf = m_buf; |
| 86 | 88 | return (len == -1)?0:len; |
| 87 | 89 | } |
| r21531 | r21532 | |
|---|---|---|
| 26 | 26 | { |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | bool device_network_interface::mcast_chk(const UINT8 *buf, int len) | |
| 30 | { | |
| 31 | // reject multicast packets | |
| 32 | return false; | |
| 33 | } | |
| 34 | ||
| 35 | 29 | void device_network_interface::set_promisc(bool promisc) |
| 36 | 30 | { |
| 37 | 31 | m_promisc = promisc; |
| r21531 | r21532 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | int send(UINT8 *buf, int len); |
| 21 | 21 | virtual void recv_cb(UINT8 *buf, int len); |
| 22 | virtual bool mcast_chk(const UINT8 *buf, int len); | |
| 23 | 22 | |
| 24 | 23 | protected: |
| 25 | 24 | bool m_promisc; |
| r21531 | r21532 | |
|---|---|---|
| 855 | 855 | return 1; |
| 856 | 856 | } |
| 857 | 857 | } |
| 858 | for (i = 0; i + ETHERNET_ADDR_SIZE < sizeof(m_multicast_list); i += ETHERNET_ADDR_SIZE) | |
| 859 | { | |
| 860 | if (memcmp(mac_address, m_multicast_list + i, ETHERNET_ADDR_SIZE) == 0) | |
| 861 | { | |
| 862 | return 1; | |
| 863 | } | |
| 864 | } | |
| 858 | 865 | return 0; |
| 859 | 866 | } |
| 860 | 867 | |
| r21531 | r21532 | |
| 896 | 903 | } |
| 897 | 904 | } |
| 898 | 905 | |
| 899 | bool threecom3c505_device::mcast_chk(const UINT8 *buf, int len) { | |
| 900 | int i; | |
| 901 | for (i = 0; i + ETHERNET_ADDR_SIZE < sizeof(m_multicast_list); i += ETHERNET_ADDR_SIZE) | |
| 902 | { | |
| 903 | if (memcmp(buf, m_multicast_list + i, ETHERNET_ADDR_SIZE) == 0) | |
| 904 | { | |
| 905 | LOG2(("threecom3c505_device::mcast_chk: true (len=%d)", len)); | |
| 906 | return true; | |
| 907 | } | |
| 908 | } | |
| 909 | return false; | |
| 910 | } | |
| 911 | ||
| 912 | 906 | void threecom3c505_device::write_command_port( UINT8 data) |
| 913 | 907 | { |
| 914 | 908 | LOG2(("writing 3C505 command port %02x - m_status=%02x m_control=%02x m_command_index=%02x", data, m_status, m_control, m_command_index)); |
| r21531 | r21532 | |
|---|---|---|
| 163 | 163 | static void static_set_interface(device_t &device, const threecom3c505_interface &interface); |
| 164 | 164 | |
| 165 | 165 | void recv_cb(UINT8 *buf, int len); |
| 166 | bool mcast_chk(const UINT8 *buf, int len); | |
| 167 | 166 | |
| 168 | 167 | // device register I/O |
| 169 | 168 | UINT8 read_port(offs_t offset); |
| r21531 | r21532 | |
|---|---|---|
| 132 | 132 | offset = start + 4; |
| 133 | 133 | high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0; |
| 134 | 134 | if(buf[0] & 1) { |
| 135 | if(!(m_regs.rcr & 4) && !memcmp((const char *)buf, "\xff\xff\xff\xff\xff\xff", 6)) return; | |
| 135 | if(!memcmp((const char *)buf, "\xff\xff\xff\xff\xff\xff", 6)) { | |
| 136 | if(!(m_regs.rcr & 4)) return; | |
| 137 | } else return; // multicast | |
| 136 | 138 | m_regs.rsr = 0x20; |
| 137 | 139 | } else m_regs.rsr = 0; |
| 138 | 140 | len &= 0xffff; |
| r21531 | r21532 | |
| 161 | 163 | if(!LOOPBACK) recv(buf, len); |
| 162 | 164 | } |
| 163 | 165 | |
| 164 | bool dp8390_device::mcast_chk(const UINT8 *buf, int len) { | |
| 165 | if(!(m_regs.rcr & 8)) return false; | |
| 166 | ||
| 167 | return false; // TODO: multicast | |
| 168 | } | |
| 169 | ||
| 170 | 166 | WRITE_LINE_MEMBER(dp8390_device::dp8390_cs) { |
| 171 | 167 | m_cs = state; |
| 172 | 168 | } |
| r21531 | r21532 | |
|---|---|---|
| 33 | 33 | DECLARE_WRITE_LINE_MEMBER( dp8390_cs ); |
| 34 | 34 | DECLARE_WRITE_LINE_MEMBER( dp8390_reset ); |
| 35 | 35 | void recv_cb(UINT8 *buf, int len); |
| 36 | bool mcast_chk(const UINT8* buf, int len); | |
| 37 | 36 | |
| 38 | 37 | protected: |
| 39 | 38 | // device-level overrides |
| r21531 | r21532 | |
|---|---|---|
| 79 | 79 | receive(); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | bool mb8795_device::mcast_chk(const UINT8 *buf, int len) | |
| 83 | { | |
| 84 | return true; | |
| 85 | } | |
| 86 | ||
| 87 | 82 | READ8_MEMBER(mb8795_device::txstat_r) |
| 88 | 83 | { |
| 89 | 84 | // fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, space.device().safe_pc()); |
| r21531 | r21532 | |
|---|---|---|
| 43 | 43 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 44 | 44 | |
| 45 | 45 | virtual void recv_cb(UINT8 *buf, int len); |
| 46 | virtual bool mcast_chk(const UINT8* buf, int len); | |
| 47 | 46 | |
| 48 | 47 | private: |
| 49 | 48 | enum { TIMER_TX, TIMER_RX }; |
| Previous | 199869 Revisions | Next |