Skip to content

natfeats nfapi ethernet

Thorsten Otto edited this page May 22, 2021 · 2 revisions

"ETHERNET"

This is an interface that allows the emulated OS to use the network of the host. Communication is done through a driver for the various network stacks, and therefor intended to be called from supervisor mode only, eg. by nfeth.xif for MiNT. It is implemented by ARAnyM (and maybe in the meantime by Hatari).

Up to 4 virtual interfaces may be configured this way.

  sub-ID 0 - supervisor allowed
  int32 nf_ethernet_version(void);

Returns the interface version number, currently 5.

  sub-ID 1 - supervisor allowed
  int32 nf_ethernet_get_interrupt(void);

Returns the (autovector) interrupt level that is used to signal incoming data to the driver. The driver is responsible to install an appropriate interrupt handler for this. Typically, this will be either #3 or #5.

  sub-ID 2 - supervisor allowed
  int32 nf_ethernet_irq_acknowledge(int32 bitmask);

Query the interface which caused the interrupt, and acknowledge it. In the interrupt handler, the driver should query which interface caused the interrupt (by using a bitmask of 0). After reading and processing the packet, the driver must acknowldge the interrupt by specifying the corresponding bitmask.

  sub-ID 3 - supervisor allowed
  int32 nf_ethernet_start(int32 ethX);

Start the reception thread for the specified interface. Typically caused by an "ifconfig up" on that interface.

  sub-ID 4 - supervisor allowed
  int32 nf_ethernet_stop(int32 ethX);

Start the reception thread for the specified interface. Typically caused by an "ifconfig down" on that interface.

  sub-ID 5 - supervisor allowed
  int32 nf_ethernet_read_length(int32 ethX);

Returns the length of the packet that is ready to be read. Used by the driver in the interrupt handler.

  sub-ID 6 - supervisor allowed
  int32 nf_ethernet_read_block(int32 ethX, void *buffer, uint32 length);

Read the packet that was announced to be available. Also used by the driver in the interrupt handler, after determining the packet size. Returns 0 on success, a negative error code otherwise.

  sub-ID 7 - supervisor allowed
  int32 nf_ethernet_write_block(int32 ethX, void *buffer, uint32 length);

Write a packet of the specifified size. Returns 0 on success, a negative error code otherwise.

  sub-ID 8 - supervisor allowed
  int32 nf_ethernet_get_mac(int32 ethX, void *buffer, uint32 length);

Returns the HW MAC address (6 bytes for ethernet). This is a virtual address that has to be configured in the emulator.

In Hatari, this function can also be called from user mode.

Returns 1 on success, 0 on error.

  sub-ID 9 - supervisor allowed
  int32 nf_ethernet_get_iphost(int32 ethX, void *buffer, uint32 length);

Returns the IPv4 address of the host for this interface. The returned value is in ascii format. Returns the number of bytes written to buffer.

In Hatari, this function can also be called from user mode.

  sub-ID 10 - supervisor allowed
  int32 nf_ethernet_get_ipatari(int32 ethX, void *buffer, uint32 length);

Returns the IPv4 address of the emulated OS for this interface. The returned value is in ascii format. Returns the number of bytes written to buffer.

In Hatari, this function can also be called from user mode.

  sub-ID 11 - supervisor allowed
  int32 nf_ethernet_get_netmask(int32 ethX, void *buffer, uint32 length);

Returns the IPv4 netmask for this interface. The returned value is in ascii format. Returns the number of bytes written to buffer.

In Hatari, this function can also be called from user mode.

Clone this wiki locally