/* vim: set filetype=c:
 *
 **************************************************************************
 *
 * Boot-ROM-Code to load an operating system across a TCP/IP network.
 *
 * Module:  undi.h86
 * Purpose: Definitions for the UNDI interface
 * Entries: none
 *
 **************************************************************************
 *
 * Copyright (C) 2003-2007 Gero Kuhlmann <gero@gkminix.han.de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: undi.h86,v 1.7 2007/01/06 18:30:47 gkminix Exp $
 */

#ifndef KERNEL_NET_UNDI_H86
#define KERNEL_NET_UNDI_H86



/*
 **************************************************************************
 *
 * This file can only get included into target C source files
 */
#if defined(_ASSEMBLY_) || !defined(_TARGET_) || !defined(_BOOTROM_)
# error This file can only get included into target C source files
#endif



/*
 **************************************************************************
 *
 * We need some includes before we can include this file
 */
#include <common.h86>
#include <net/ethernet.h86>
#include <net/in.h86>



/*
 **************************************************************************
 * 
 * Layout of receive buffer
 */
#define RECVBUF_SIZE	ETH_DATA_MAX

struct iobuf {
	short protocol;
	__u8  buf[RECVBUF_SIZE];
};

extern struct iobuf readbuf;		/* Global read buffer		*/



/*
 **************************************************************************
 *
 * Public routines of the UNDI module:
 */

/* Open UNDI */
extern short undi_open(void);

/* Close UNDI */
extern short undi_close(void);

/* Get multicast hardware address */
extern short undi_get_mcast(const t_ipaddr maddr, __u8 *hw);

/* Set multicast address */
extern short undi_set_mcast(const t_ipaddr *maddr, short count);

/* Send packet using UNDI */
extern short undi_send(__u8 *dest, short proto, short num,
				size_t sizes[], __fptr bufs[]);

/* Receive packet using UNDI */
extern size_t undi_recv(void);

/* Set a new ISR */
extern void set_isr(unsigned short intnum, size_t bufsize, __u8 *bufptr);

/* Remove the ISR */
extern bool_t rst_isr(void);


/* Read data from ISR */
extern size_t read_isr(void);


#endif

