Autor Thema: MiNT SMC_TT XIF Treiber ...  (Gelesen 9358 mal)

0 Mitglieder und 1 Gast betrachten dieses Thema.

Offline Lukas Frank

  • Benutzer
  • Beiträge: 13.424
  • fancy Atari Musik anDA Dance "Agare Hinu Harukana"
MiNT SMC_TT XIF Treiber ...
« am: Do 16.02.2017, 13:36:49 »
Ist hier im Forum jemand der auf Basis der riebl.xif Quellen einen Treiber für die SMC_TT VME Bus Ethernet Karte schreiben kann ?

Adresslage und alles weitere sind in den SMC_TT Quellen vorhanden ...

Offline Lukas Frank

  • Benutzer
  • Beiträge: 13.424
  • fancy Atari Musik anDA Dance "Agare Hinu Harukana"
Re: MiNT SMC_TT XIF Treiber ...
« Antwort #1 am: Do 23.11.2017, 14:29:09 »
Izumi Tsutsui hat mir einige Hinweise gegeben. Ich persönlich kann das aber nicht umsetzen da ich kein Programmierer bin und null die Ahnung habe ...


NetBSD sources are split to common (called machine independent) sources
and port (including atari specific, called machine dependent) sources
so it's a bit hard to check one specific device.

For SMC_TT, following files are used:
src/sys/arch/atari/vme/if_we_vme.c   (SMC_TT specific part)
src/sys/dev/ic/we.c         (SMC Elite Ultra chip specific)
src/sys/dev/ic/dp8390.c      (common DP8390 specific)

bus_space_read_1() and bus_space_write_1() functions are
something like inb() and outb() on x86.

You can see which address should be used to access
ISA SMC Elite Ultra chip registers in if_we_vme.c comments:
https://nxr.netbsd.org/xref/src/sys/arch/atari/vme/if_we_vme.c?r=1.4#90

ISA I/O / SMC_TT address (8bit access)
0x280  / 0xFE200280
0x281  / 0xFE300280
0x282  / 0xFE200282
0x283  / 0xFE300282
0x284  / 0xFE200284
0x285  / 0xFE300284
 :

ISA MEM / SMC_TT address (16bit access)
0xD0000 / 0xFE0D0000
0xD0002 / 0xFE0D0002

The orignal SMC_TT documents also help:
http://cd.textfiles.com/atarilibrary/atari_cd09/TOOLS/UTILS/SMC_TT1/LANCE.TXT
It looks OCR'ed so several words are incomplete (and annoying for
machine translations), but I guess no problem for German people :-)

---

To port drivers to other OS, it might be easier to check
Linux and other OS drivers:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/8390/smc-ultra.c?h=v4.14

---------------------------------------------------------------------

->   https://github.com/freemint/freemint/tree/master/sys/sockets/xif

Hmm. It looks freemint drivers are similar to Linux one.

In general NIC drivers have the following funcionts:
- initialization (probe, reset, setup, getting MAC address etc.)
- TX packets
- RX packets
- interrupt handling

On the other hand, freemit xif seem to require the following interfaces:
- xxx_open()   - reset and setup device
- xxx_close()   - reset chip to stop all packets
- xxx_output()   - transmit packets passed from network layer
- xxx_config()   - OS specific for network layer, maybe not necessary at debug phase

RX packets seem handled in the interrupt routine.

The following ones looks device specific
- xxx_probe()   - checking if the device exists; not necessary at debug phase (you can assume it's always there)
- xxx_reset()   - chip specific; sequence of write registers, setup shared memory etc.
- xxx_install_ints() - interrupt setup; maybe chip and OS specific so it's better to ask freemint guys
- xxx_int   - interrupt handler; receiving packets and TX packet completion are notified via interrupt

To check TX/RX packet functions, the following NetBSD bootloader sources might help to check differences LANCE (am7990) and WD80x3 with DP8390:
https://nxr.netbsd.org/xref/src/sys/arch/i386/stand/lib/netif/