summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/smc91c9x.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/smc91c9x.h')
-rw-r--r--src/devices/machine/smc91c9x.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/devices/machine/smc91c9x.h b/src/devices/machine/smc91c9x.h
index 78627fb58d3..9ff6229d466 100644
--- a/src/devices/machine/smc91c9x.h
+++ b/src/devices/machine/smc91c9x.h
@@ -4,7 +4,7 @@
SMC91C9X ethernet controller implementation
- by Aaron Giles
+ by Aaron Giles, Jean-François DEL NERO
**************************************************************************/
@@ -15,7 +15,7 @@
TYPE DEFINITIONS
***************************************************************************/
-class smc91c9x_device : public device_t
+class smc91c9x_device : public device_t,public device_network_interface
{
public:
template <class Object> static devcb_base &set_irq_callback(device_t &device, Object &&cb) { return downcast<smc91c9x_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
@@ -23,6 +23,8 @@ public:
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER( write );
+ virtual void recv_cb(uint8_t *data, int length) override;
+
protected:
smc91c9x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -32,7 +34,9 @@ protected:
private:
static constexpr unsigned ETHER_BUFFER_SIZE = 2048;
- static constexpr unsigned ETHER_RX_BUFFERS = 4;
+ static constexpr unsigned ETHER_RX_BUFFERS = 16;
+ static constexpr unsigned ETHER_TX_BUFFERS = 16;
+ static constexpr unsigned ETHERNET_ADDR_SIZE = 6;
// internal state
devcb_write_line m_irq_handler;
@@ -51,19 +55,29 @@ private:
uint8_t m_alloc_count;
/* transmit/receive FIFOs */
- uint8_t m_fifo_count;
+ uint32_t rx_fifo_out;
+ uint32_t rx_fifo_in;
uint8_t m_rx[ETHER_BUFFER_SIZE * ETHER_RX_BUFFERS];
- uint8_t m_tx[ETHER_BUFFER_SIZE];
+
+ uint32_t tx_fifo_out;
+ uint32_t tx_fifo_in;
+ uint8_t m_tx[ETHER_BUFFER_SIZE * ETHER_TX_BUFFERS];
/* counters */
uint32_t m_sent;
uint32_t m_recd;
+ int ethernet_packet_is_for_me(const uint8_t mac_address[]);
+ int is_broadcast(uint8_t mac_address[]);
+
void update_ethernet_irq();
void update_stats();
- TIMER_CALLBACK_MEMBER(finish_enqueue);
+
void process_command(uint16_t data);
- emu_timer* m_tx_timer;
+ void clear_tx_fifo();
+ void clear_rx_fifo();
+
+ int send_frame();
};