If you want to use an Ethernet card on the Atari other than the RIEBL card, you should make the necessary changes to PKTDRV.PRG to get started. The source code of the packet driver is included in the file tuwtcpsr.zip : "pktdrv.c" and "pktdrv.h".
256 bytes stack are sufficient for this version (RIEBL CARD PLUS). Turn off stack-checking.
I used PURE-C to develop this driver, see the .prj file how to link allbjects.
PKTDRV.PRG adds a cookie named '_PKT', its value is a pointer to jumptable. All functions use the PURE-C register parameter passingonvention, that is, integer types in D0,D1 , pointers in A0,A1 rom first parameter to last respectively.
Supported functions are:
int net_info(int length_of_buffer, char *buffer);
Gives information about traffic on the node. This function is not developed to its final state and is subject tohange in the future. return: negative errorcode or length of copied data.
int net_open(int protocol, int (*handler)(int length,char *pkt));
Tells the driver the address of a packet handler, which wants toeceive packets of a specific ethernet protocol. Up to 5 different protocols are allowed at the moment, only 2 (ARP and IP) are used by our apps. Return: negative errorcode or 0 if succesful.
The protocol-handler function gets the length (in D0) and the address (in A0) of a newly arrived packet. If the handler accepts the packett returns a nonzero value, otherwise it returns zero and the packet driver discards the packet. Accepted
packets must be freed usinget_pktfree after processing. The protocol-handler runs on interruptevel, therefore no stack-checking is allowed.
int net_release(int protocol);
Removes a protocol from the protocoltable. Any further incomingackets of this protocol are discarded by the packet driver. Return: negative errorcode or 0 if successful.
int net_send(int length, char *pkt);
Send a packet. The packet is sent as it is, any headers (inclusive ethernet header) must be filled by the caller. This function wait stil the packet is sent or an error is returned from the chip. Only packets allocated by net_pktalloc or got from the protocol-pcall should be handed to this function. Return: negative errorcode or length of sent packet, if successful. (Note: The length of the sent packet may be greater than the original packet, since the minimum length of a ethernet packet is 60 bytes).
int net_getadr(int length_of_buffer,char *addr_buffer);
Fills addr_buffer with the local hardware address. Return: number of copied bytes or negative errorcode.
Reset the packet driver to a state like after startup, any active protocol is aborted. Return: 0 if successful or negative errorcode
PKTBUF *net_pktalloc(u_short length_of_packet);
Allocates a block of memory to hold a packet. If the interface provides onboard memory, it is strongly recommended to allocate this block onboard to avoid unneccessary copying of data. Return: pointer to new allocated packet or NULL if out of mem.
int net_pktfree(PKTBUF *);
Free a packet allocated by net_pktalloc or handed by the protocol-andler upcall.
Return: 0 if successful or negative errorcode.
Indices to the jumptable are provided in pktdrv.h
Any suggestions would be appreciated.
Support for other Ethernet cards:
The packet driver forms the interface to any Ethernet card applied to our ATARI.
So if you would like to use any other card than the RIEBL card you simply have to change this program. We did this for a D-Link DE 600 pocket adaptor usually fitted to the parallel port of an IBM-PC. Since the ATARI does not provide all of the required signals on its parallel port, we did some simple interface hardware for the cartridge port. The file "newadapt.img" (see D-Link pocket adaptor page) shows the principle of this piece. The packet driver for the DE 600 you can find in the file tuwtcp10.zip : "dlinkdrv.prg".
The sources for packet drivers are provided in sources/de600src.zip and sources/pktlance.zip.