genode/repos/dde_ipxe/include/dde_ipxe/nic.h
Josef Söntgen 9606abc146 dde_ipxe: remove dde_kit
A long long time ago, in a galaxy^W^W^W we used DDE kit to ease the
porting of purely C based drivers. By now it became clear, that we
do not gain that much by following this approach. DDE kit contains
much generic functionality, which is not used or rather not needed
by most ported drivers. Hence, we implement a slim C wrapper on top
of Genode's C++ APIs, that is especially tailored to the driver.

In addition to removing the dependency on DDE kit, the iPXE driver
now uses the server framework and the newly introduced signal based
IRQ handling.

Issue #1456.
2015-04-23 16:47:58 +02:00

92 lines
2.2 KiB
C

/*
* \brief DDE iPXE NIC API
* \author Christian Helmuth
* \date 2010-09-05
*
*/
/*
* Copyright (C) 2010-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _DDE_IPXE__NIC_H_
#define _DDE_IPXE__NIC_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* Link-state change callback
*/
typedef void (*dde_ipxe_nic_link_cb)(void);
/**
* Packet reception callback
*
* \param if_index index of the receiving network interface
* \param packet buffer containing the packet
* \param packet_len packet length
*/
typedef void (*dde_ipxe_nic_rx_cb)(unsigned if_index, const char *packet, unsigned packet_len);
/**
* Register packet reception callback
*
* \param rx_cb packet-reception callback function
* \param link_cb link-state change callback function
*
* This registers a function pointer as rx callback. Incoming ethernet packets
* are passed to this function.
*/
extern void dde_ipxe_nic_register_callbacks(dde_ipxe_nic_rx_cb rx_cb,
dde_ipxe_nic_link_cb link_cb);
/**
* Send packet
*
* \param if_index index of the network interface to be used for sending
* \param packet buffer containing the packet
* \param packet_len packet length
*
* \return 0 on success, -1 otherwise
*/
extern int dde_ipxe_nic_tx(unsigned if_index, const char *packet, unsigned packet_len);
/**
* Get MAC address of device
*
* \param if_index index of the network interface
* \param out_mac_addr buffer for MAC address (buffer size must be 6 byte)
*
* \return 0 on success, -1 otherwise
*/
extern int dde_ipxe_nic_get_mac_addr(unsigned if_index, char *out_mac_addr);
/**
* Get current link-state of device
*
* \param if_index index of the receiving network interface
*
* \return 1 if link is up, 0 if no link is detected
*/
extern int dde_ipxe_nic_link_state(unsigned if_index);
/**
* Initialize network sub-system
*
* \param ep pointer to Server::Entrypoint
*
* \return number of network devices
*/
extern int dde_ipxe_nic_init(void *ep);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _DDE_IPXE__NIC_H_ */