Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4743 → Rev 4756

/branches/network/uspace/srv/net/netif/netif_module.h
52,9 → 52,9
int netif_initialize( void );
 
/** Probes the existence of the device.
* @param device_id The device identifier. Input parameter.
* @param irq The device interrupt number. Input parameter.
* @param io The device input/output address. Input parameter.
* @param[in] device_id The device identifier.
* @param[in] irq The device interrupt number.
* @param[in] io The device input/output address.
* @returns EOK on success.
* @returns Other error codes as defined for the find_device() function.
* @returns Other error codes as defined for the specific module message implementation.
62,9 → 62,9
int netif_probe_message( device_id_t device_id, int irq, int io );
 
/** Sends the packet queue.
* @param device_id The device identifier. Input parameter.
* @param packet The packet queue. Input parameter.
* @param sender The sending module service. Input parameter.
* @param[in] device_id The device identifier.
* @param[in] packet The packet queue.
* @param[in] sender The sending module service.
* @returns EOK on success.
* @returns EFORWARD if the device is not active (in the NETIF_ACTIVE state).
* @returns Other error codes as defined for the find_device() function.
73,7 → 73,7
int netif_send_message( device_id_t device_id, packet_t packet, services_t sender );
 
/** Starts the device.
* @param device The device structure. Input parameter.
* @param[in] device The device structure.
* @returns EOK on success.
* @returns Other error codes as defined for the find_device() function.
* @returns Other error codes as defined for the specific module message implementation.
81,7 → 81,7
int netif_start_message( device_ref device );
 
/** Stops the device.
* @param device The device structure. Input parameter.
* @param[in] device The device structure.
* @returns EOK on success.
* @returns Other error codes as defined for the find_device() function.
* @returns Other error codes as defined for the specific module message implementation.
89,8 → 89,8
int netif_stop_message( device_ref device );
 
/** Returns the device local hardware address.
* @param device_id The device identifier. Input parameter.
* @param address The device local hardware address. Output parameter.
* @param[in] device_id The device identifier.
* @param[out] address The device local hardware address.
* @returns EOK on success.
* @returns EBADMEM if the address parameter is NULL.
* @returns ENOENT if there no such device.
101,10 → 101,10
 
/** Processes the netif driver specific message.
* This function is called for uncommon messages received by the netif skeleton.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @returns Other error codes as defined for the specific module message implementation.
112,8 → 112,8
int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
 
/** Returns the device usage statistics.
* @param device_id The device identifier. Input parameter.
* @param stats The device usage statistics. Output parameter.
* @param[in] device_id The device identifier.
* @param[out] stats The device usage statistics.
* @returns EOK on success.
* @returns Other error codes as defined for the find_device() function.
* @returns Other error codes as defined for the specific module message implementation.
/branches/network/uspace/srv/net/netif/netif_nil_bundle.c
52,10 → 52,10
extern netif_globals_t netif_globals;
 
/** Distributes the messages between the module parts.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @returns Other error codes as defined for each specific module message function.
64,7 → 64,7
 
/** Starts the bundle network interface module.
* Initializes the client connection serving function, initializes both module parts, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on success.
* @returns Other error codes as defined for each specific module message function.
*/
/branches/network/uspace/srv/net/netif/netif_messages.h
76,12 → 76,12
/*@{*/
 
/** Returns the interrupt number message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define NETIF_GET_IRQ( call ) ( int ) IPC_GET_ARG2( * call )
 
/** Returns the input/output address message parameter.
* @param call The message call structure. Input parameter.
* @param[in] call The message call structure.
*/
#define NETIF_GET_IO( call ) ( int ) IPC_GET_ARG3( * call )
 
/branches/network/uspace/srv/net/netif/netif.c
70,8 → 70,8
/*@{*/
 
/** Registers the device notification receiver, the network interface layer module.
* @param device_id The device identifier. Input parameter.
* @param phone The network interface layer module phone. Input parameter.
* @param[in] device_id The device identifier.
* @param[in] phone The network interface layer module phone.
* @returns EOK on success.
* @returns ENOENT if there is no such device.
* @returns ELIMIT if there is another module registered.
/branches/network/uspace/srv/net/netif/dp8390/local.h
21,7 → 21,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes:
* 2009 Lukas Mejdrech ported to HelenOS
* 2009 ported to HelenOS, Lukas Mejdrech
*/
 
/** @addtogroup dp8390
28,6 → 28,10
* @{
*/
 
/** @file
* Network interface probe functions.
*/
 
#ifndef __NET_NETIF_DP8390_CONFIG_H__
#define __NET_NETIF_DP8390_CONFIG_H__
 
37,25 → 41,57
local.h
*/
 
/** WDETH switch.
*/
#define ENABLE_WDETH 0
 
/** NE2000 switch.
*/
#define ENABLE_NE2000 1
 
/** 3C503 switch.
*/
#define ENABLE_3C503 0
 
/** PCI support switch.
*/
#define ENABLE_PCI 0
 
struct dpeth;
 
/* 3c503.c */
_PROTOTYPE( int el2_probe, (struct dpeth* dep) );
/* * Probes a 3C503 network interface.
* @param[in] dep The network interface structure.
* @returns 1 if the NE2000 network interface is present.
* @returns 0 otherwise.
*/
//_PROTOTYPE( int el2_probe, (struct dpeth* dep) );
 
/* ne2000.c */
_PROTOTYPE( int ne_probe, (struct dpeth *dep) );
/** Probes a NE2000 or NE1000 network interface.
* @param[in] dep The network interface structure.
* @returns 1 if the NE2000 network interface is present.
* @returns 0 otherwise.
*/
int ne_probe( struct dpeth * dep );
//_PROTOTYPE( int ne_probe, (struct dpeth *dep) );
//_PROTOTYPE( void ne_init, (struct dpeth *dep) );
 
/* rtl8029.c */
_PROTOTYPE( int rtl_probe, (struct dpeth *dep) );
/* * Probes a RTL8029 network interface.
* @param[in] dep The network interface structure.
* @returns 1 if the NE2000 network interface is present.
* @returns 0 otherwise.
*/
//_PROTOTYPE( int rtl_probe, (struct dpeth *dep) );
 
/* wdeth.c */
_PROTOTYPE( int wdeth_probe, (struct dpeth* dep) );
/* * Probes a WDETH network interface.
* @param[in] dep The network interface structure.
* @returns 1 if the NE2000 network interface is present.
* @returns 0 otherwise.
*/
//_PROTOTYPE( int wdeth_probe, (struct dpeth* dep) );
 
#endif
 
/branches/network/uspace/srv/net/netif/dp8390/dp8390_port.h
31,7 → 31,7
*/
 
/** @file
* \todo
* DP8390 network interface types and structures ports.
*/
 
#ifndef __NET_NETIF_DP8390_PORT_H__
43,26 → 43,105
#include <libarch/ddi.h>
#include <sys/types.h>
 
/** Macro for difining functions.
* @param[in] function The function type and name definition.
* @param[in] params The function parameters definition.
*/
#define _PROTOTYPE( function, params ) function params
 
/** Success error code.
*/
#define OK EOK
 
/** Type definition of the unsigned byte.
*/
typedef uint8_t u8_t;
 
/** Type definition of the unsigned short.
*/
typedef uint16_t u16_t;
 
/** Compares two memory blocks.
* @param[in] first The first memory block.
* @param[in] second The second memory block.
* @param[in] size The blocks size in bytes.
* @returns 0 if equeal.
* @returns -1 if the first is greater than the second.
* @returns 1 if the second is greater than the first.
*/
#define memcmp( first, second, size ) bcmp(( char * ) ( first ), ( char * ) ( second ), ( size ))
 
/** Reads 1 byte.
* @param[in] port The address to be read.
* @returns The read value.
*/
#define inb( port ) pio_read_8(( ioport8_t * ) ( port ))
 
/** Reads 1 word (2 bytes).
* @param[in] port The address to be read.
* @returns The read value.
*/
#define inw( port ) pio_read_16(( ioport16_t * ) ( port ))
 
/** Writes 1 byte.
* @param[in] port The address to be written.
* @param[in] value The value to be written.
*/
#define outb( port, value ) pio_write_8(( ioport8_t * ) ( port ), ( value ))
 
/** Writes 1 word (2 bytes).
* @param[in] port The address to be written.
* @param[in] value The value to be written.
*/
#define outw( port, value ) pio_write_16(( ioport16_t * ) ( port ), ( value ))
 
/** Prints out the driver critical error.
* Does not call the system panic().
*/
#define panic( ... ) printf( "%s%s%d", __VA_ARGS__ )
 
/** Copies a memory block.
* @param proc The source process. Ignored parameter.
* @param src_s Ignored parameter.
* @param[in] src The source address.
* @param me The current proces. Ignored parameter.
* @param dst_s Ignored parameter.
* @param[in] dst The destination address.
* @param[in] bytes The block size in bytes.
* @returns EOK.
*/
#define sys_vircopy( proc, src_s, src, me, dst_s, dst, bytes ) ({ memcpy(( void * )( dst ), ( void * )( src ), ( bytes )); EOK; })
#define do_vir_insb( port, proc, src, bytes ) insb(( port ), ( void * )( src ), ( bytes ))
#define do_vir_insw( port, proc, src, bytes ) insw(( port ), ( void * )( src ), ( bytes ))
 
/** Reads a memory block byte by byte.
* @param[in] port The address to be written.
* @param proc The source process. Ignored parameter.
* @param[in] dst The destination address.
* @param[in] bytes The block size in bytes.
*/
#define do_vir_insb( port, proc, dst, bytes ) insb(( port ), ( void * )( dst ), ( bytes ))
 
/** Reads a memory block word by word (2 bytes).
* @param[in] port The address to be written.
* @param proc The source process. Ignored parameter.
* @param[in] dst The destination address.
* @param[in] bytes The block size in bytes.
*/
#define do_vir_insw( port, proc, dst, bytes ) insw(( port ), ( void * )( dst ), ( bytes ))
 
/** Writes a memory block byte by byte.
* @param[in] port The address to be written.
* @param proc The source process. Ignored parameter.
* @param[in] src The source address.
* @param[in] bytes The block size in bytes.
*/
#define do_vir_outsb( port, proc, src, bytes ) outsb(( port ), ( void * )( src ), ( bytes ))
 
/** Writes a memory block word by word (2 bytes).
* @param[in] port The address to be written.
* @param proc The source process. Ignored parameter.
* @param[in] src The source address.
* @param[in] bytes The block size in bytes.
*/
#define do_vir_outsw( port, proc, src, bytes ) outsw(( port ), ( void * )( src ), ( bytes ))
 
/* com.h */
73,54 → 152,120
# define DL_BROAD_REQ 0x8
 
/* const.h */
/** True value.
*/
#define TRUE 1 /* used for turning integers into Booleans */
 
/** False value.
*/
#define FALSE 0 /* used for turning integers into Booleans */
 
/** No number value.
*/
#define NO_NUM 0x8000 /* used as numerical argument to panic() */
 
/* devio.h */
//typedef u16_t port_t;
/** Type definition of a port.
*/
typedef int port_t;
 
/* dl_eth.h */
/** Ethernet statistics.
*/
typedef struct eth_stat
{
unsigned long ets_recvErr, /* # receive errors */
ets_sendErr, /* # send error */
ets_OVW, /* # buffer overwrite warnings */
ets_CRCerr, /* # crc errors of read */
ets_frameAll, /* # frames not alligned (# bits % 8 != 0) */
ets_missedP, /* # packets missed due to slow processing */
ets_packetR, /* # packets received */
ets_packetT, /* # packets transmitted */
ets_transDef, /* # transmission defered (Tx was busy) */
ets_collision, /* # collissions */
ets_transAb, /* # Tx aborted due to excess collisions */
ets_carrSense, /* # carrier sense lost */
ets_fifoUnder, /* # FIFO underruns (processor too busy) */
ets_fifoOver, /* # FIFO overruns (processor too busy) */
ets_CDheartbeat, /* # times unable to transmit collision sig*/
ets_OWC; /* # times out of window collision */
/** Number of receive errors.
*/
unsigned long ets_recvErr;
/** Number of send error.
*/
unsigned long ets_sendErr;
/** Number of buffer overwrite warnings.
*/
unsigned long ets_OVW;
/** Number of crc errors of read.
*/
unsigned long ets_CRCerr;
/** Number of frames not alligned (number of bits % 8 != 0).
*/
unsigned long ets_frameAll;
/** Number of packets missed due to slow processing.
*/
unsigned long ets_missedP;
/** Number of packets received.
*/
unsigned long ets_packetR;
/** Number of packets transmitted.
*/
unsigned long ets_packetT;
/** Number of transmission defered (Tx was busy).
*/
unsigned long ets_transDef;
/** Number of collissions.
*/
unsigned long ets_collision;
/** Number of Tx aborted due to excess collisions.
*/
unsigned long ets_transAb;
/** Number of carrier sense lost.
*/
unsigned long ets_carrSense;
/** Number of FIFO underruns (processor too busy).
*/
unsigned long ets_fifoUnder;
/** Number of FIFO overruns (processor too busy).
*/
unsigned long ets_fifoOver;
/** Number of times unable to transmit collision sig.
*/
unsigned long ets_CDheartbeat;
/** Number of times out of window collision.
*/
unsigned long ets_OWC;
} eth_stat_t;
 
/* errno.h */
/** Generic error.
*/
#define EGENERIC EINVAL
 
/* ether.h */
/** Minimum Ethernet packet size in bytes.
*/
#define ETH_MIN_PACK_SIZE 60
 
/** Maximum Ethernet packet size in bytes.
*/
#define ETH_MAX_PACK_SIZE_TAGGED 1518
 
/** Ethernet address type definition.
*/
typedef struct ether_addr
{
/** Address data.
*/
u8_t ea_addr[6];
} ether_addr_t;
 
/* type.h */
typedef unsigned long phys_bytes; /* physical addr/length in bytes */
typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */
/** Type definition of the physical addresses and lengths in bytes.
*/
typedef unsigned long phys_bytes;
 
/** Type definition of the virtual addresses and lengths in bytes.
*/
typedef unsigned int vir_bytes;
 
/** Type definition of the input/output vector.
*/
typedef struct {
vir_bytes iov_addr; /* address of an I/O buffer */
vir_bytes iov_size; /* sizeof an I/O buffer */
/** Address of an I/O buffer.
*/
vir_bytes iov_addr;
/** Sizeof an I/O buffer.
*/
vir_bytes iov_size;
} iovec_t;
 
#endif
/branches/network/uspace/srv/net/netif/dp8390/ne2000.c
21,7 → 21,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes:
* 2009 Lukas Mejdrech ported to HelenOS
* 2009 ported to HelenOS, Lukas Mejdrech
*/
 
/** @addtogroup ne2k
29,7 → 29,7
*/
 
/** @file
* \todo
* NE1000 and NE2000 network interface initialization and probe functions implementation.
*/
 
#include <stdio.h>
60,26 → 60,66
 
#if ENABLE_NE2000
 
/** Number of bytes to transfer.
*/
#define N 100
 
//#define MILLIS_TO_TICKS(m) (((m)*HZ/1000)+1)
 
/** Sleeps for the defined millicesonds.
* @param[in] millis The number of milliseconds to sleep.
*/
#define milli_delay( millis ) usleep(( millis ) * 1000 )
 
/** Type definition of the testing function.
*/
_PROTOTYPE( typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat) );
 
/** First data pattern.
*/
u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 };
 
/** Second data pattern.
*/
u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF };
 
/** Third data pattern.
*/
u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 };
 
/** Fourth data pattern.
*/
u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 };
 
_PROTOTYPE( static int test_8, (dpeth_t *dep, int pos, u8_t *pat) );
_PROTOTYPE( static int test_16, (dpeth_t *dep, int pos, u8_t *pat) );
_PROTOTYPE( static void ne_stop, (dpeth_t *dep) );
/** Tests 8 bit NE2000 network interface.
* @param[in,out] dep The network interface structure.
* @param[in] pos The starting position.
* @param[in] pat The data pattern to be written.
* @returns True on success.
* @returns FALSE otherwise.
*/
static int test_8(dpeth_t *dep, int pos, u8_t *pat);
 
/** Tests 16 bit NE2000 network interface.
* @param[in,out] dep The network interface structure.
* @param[in] pos The starting position.
* @param[in] pat The data pattern to be written.
* @returns True on success.
* @returns FALSE otherwise.
*/
static int test_16(dpeth_t *dep, int pos, u8_t *pat);
 
/** Stops the NE2000 network interface.
* @param[in,out] dep The network interface structure.
*/
static void ne_stop(dpeth_t *dep);
//_PROTOTYPE( static void milli_delay, (unsigned long millis) );
 
#define milli_delay( millis ) usleep(( millis ) * 1000 )
/** Initializes the NE2000 network interface.
* @param[in,out] dep The network interface structure.
*/
void ne_init(struct dpeth *dep);
 
_PROTOTYPE( void ne_init, (struct dpeth *dep) );
 
/*===========================================================================*
* ne_probe *
*===========================================================================*/
/branches/network/uspace/srv/net/netif/dp8390/dp8390.c
21,7 → 21,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes:
* 2009 Lukas Mejdrech ported to HelenOS
* 2009 ported to HelenOS, Lukas Mejdrech
*/
 
/** @addtogroup dp8390
29,7 → 29,7
*/
 
/** @file
* \todo
* DP8390 network interface core implementation.
*/
 
#include <assert.h>
60,8 → 60,26
#include "local.h"
#include "dp8390.h"
 
/** Queues the outgoing packet.
* @param[in] dep The network interface structure.
* @param[in] packet The outgoing packet.
* @returns EOK on success.
* @returns EINVAL
*/
int queue_packet( dpeth_t * dep, packet_t packet );
 
/** Reads a memory block byte by byte.
* @param[in] port The source address.
* @param[out] buf The destination buffer.
* @param[in] size The memory block size in bytes.
*/
static void outsb( port_t port, void * buf, size_t size );
 
/** Reads a memory block word by word.
* @param[in] port The source address.
* @param[out] buf The destination buffer.
* @param[in] size The memory block size in bytes.
*/
static void outsw( port_t port, void * buf, size_t size );
 
//static u16_t eth_ign_proto;
/branches/network/uspace/srv/net/netif/dp8390/dp8390_drv.h
31,7 → 31,7
*/
 
/** @file
* \todo
* DP8390 network interface driver interface.
*/
 
#ifndef __NET_NETIF_DP8390_DRIVER_H__
39,11 → 39,43
 
#include "dp8390.h"
 
_PROTOTYPE( int do_init, (dpeth_t *dep, int mode) );
_PROTOTYPE( void do_stop, (dpeth_t *dep) );
_PROTOTYPE( void dp_check_ints, (dpeth_t *dep, int isr) );
/** Initializes and/or starts the network interface.
* @param[in,out] dep The network interface structure.
* @param[in] mode The state mode.
* @returns EOK on success.
* @returns EXDEV if the network interface is disabled.
*/
int do_init(dpeth_t *dep, int mode);
 
/** Stops the network interface.
* @param[in,out] dep The network interface structure.
*/
void do_stop(dpeth_t *dep);
 
/** Processes the interrupt.
* @param[in,out] dep The network interface structure.
* @param[in] isr The interrupt status register.
*/
void dp_check_ints(dpeth_t *dep, int isr);
 
/** Probes and initializes the network interface.
* @param[in,out] dep The network interface structure.
* @returns EOK on success.
* @returns EXDEV if the network interface was not recognized.
*/
int do_probe( dpeth_t * dep );
 
/** Sends a packet.
* @param[in,out] dep The network interface structure.
* @param[in] packet The packet t be sent.
* @param[in] from_int The value indicating whether the sending is initialized from the interrupt handler.
* @returns
*/
int do_pwrite( dpeth_t * dep, packet_t packet, int from_int );
 
/** Prints out network interface information.
* @param[in] dep The network interface structure.
*/
void dp8390_dump( dpeth_t * dep );
 
#endif
/branches/network/uspace/srv/net/netif/dp8390/ne2000.h
21,7 → 21,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes:
* 2009 Lukas Mejdrech ported to HelenOS
* 2009 ported to HelenOS, Lukas Mejdrech
*/
 
/*
35,7 → 35,7
*/
 
/** @file
* \todo
* NE1000 and NE2000 network interface definitions.
*/
 
#ifndef __NET_NETIF_NE2000_H__
45,18 → 45,60
 
#include "dp8390_port.h"
 
/** DP8390 register offset.
*/
#define NE_DP8390 0x00
 
/** Data register.
*/
#define NE_DATA 0x10
 
/** Reset register.
*/
#define NE_RESET 0x1F
 
/** NE1000 data start.
*/
#define NE1000_START 0x2000
 
/** NE1000 data size.
*/
#define NE1000_SIZE 0x2000
 
/** NE2000 data start.
*/
#define NE2000_START 0x4000
 
/** NE2000 data size.
*/
#define NE2000_SIZE 0x4000
 
/** Reads 1 byte register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @returns The read value.
*/
#define inb_ne(dep, reg) (inb(dep->de_base_port+reg))
 
/** Writes 1 byte register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @param[in] data The value to be written.
*/
#define outb_ne(dep, reg, data) (outb(dep->de_base_port+reg, data))
 
/** Reads 1 word (2 bytes) register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @returns The read value.
*/
#define inw_ne(dep, reg) (inw(dep->de_base_port+reg))
 
/** Writes 1 word (2 bytes) register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @param[in] data The value to be written.
*/
#define outw_ne(dep, reg, data) (outw(dep->de_base_port+reg, data))
 
#endif /* __NET_NETIF_NE2000_H__ */
/branches/network/uspace/srv/net/netif/dp8390/dp8390.h
21,7 → 21,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes:
* 2009 Lukas Mejdrech ported to HelenOS
* 2009 ported to HelenOS, Lukas Mejdrech
*/
 
/** @addtogroup dp8390
29,7 → 29,7
*/
 
/** @file
* \todo
* DP8390 network interface definitions.
*/
 
#ifndef __NET_NETIF_DP8390_H__
40,6 → 40,8
#include "dp8390_port.h"
#include "local.h"
 
/** Input/output size.
*/
#define DP8390_IO_SIZE 0x01f
 
/*
196,21 → 198,55
#define RSR_DIS 0x40 /* Receiver Disabled */
#define RSR_DFR 0x80 /* In later manuals: Deferring */
 
 
/** Type definition of the receive header.
*/
typedef struct dp_rcvhdr
{
u8_t dr_status; /* Copy of rsr */
u8_t dr_next; /* Pointer to next packet */
u8_t dr_rbcl; /* Receive Byte Count Low */
u8_t dr_rbch; /* Receive Byte Count High */
/** Copy of rsr.
*/
u8_t dr_status;
/** Pointer to next packet.
*/
u8_t dr_next;
/** Receive Byte Count Low.
*/
u8_t dr_rbcl;
/** Receive Byte Count High.
*/
u8_t dr_rbch;
} dp_rcvhdr_t;
 
/** Page size.
*/
#define DP_PAGESIZE 256
 
/* Some macros to simplify accessing the dp8390 */
/** Reads 1 byte from the zero page register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @returns The read value.
*/
#define inb_reg0(dep, reg) (inb(dep->de_dp8390_port+reg))
 
/** Writes 1 byte zero page register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @param[in] data The value to be written.
*/
#define outb_reg0(dep, reg, data) (outb(dep->de_dp8390_port+reg, data))
 
/** Reads 1 byte from the first page register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @returns The read value.
*/
#define inb_reg1(dep, reg) (inb(dep->de_dp8390_port+reg))
 
/** Writes 1 byte first page register.
* @param[in] dep The network interface structure.
* @param[in] reg The register offset.
* @param[in] data The value to be written.
*/
#define outb_reg1(dep, reg, data) (outb(dep->de_dp8390_port+reg, data))
 
/* Software interface to the dp8390 driver */
274,14 → 310,18
 
typedef struct dpeth
{
/* Packet send queue.
*/
/** Outgoing packets queue.
*/
packet_t packet_queue;
/** Outgoing packets count.
*/
int packet_count;
 
/* Packet receive queue.
*/
/** Received packets queue.
*/
packet_t received_queue;
/** Received packets count.
*/
int received_count;
 
/* The de_base_port field is the starting point of the probe.
/branches/network/uspace/srv/net/netif/dp8390/dp8390_module.c
31,7 → 31,7
*/
 
/** @file
* \todo
* DP8390 network interface implementation.
*/
 
#include <assert.h>
60,11 → 60,22
#include "dp8390_drv.h"
#include "dp8390_port.h"
 
/** DP8390 module name.
*/
#define NAME "dp8390 network interface"
 
/** Returns the device from the interrupt call.
* @param[in] call The interrupt call.
*/
#define IRQ_GET_DEVICE( call ) ( device_id_t ) IPC_GET_METHOD( * call )
 
/** Returns the interrupt status register from the interrupt call.
* @param[in] call The interrupt call.
*/
#define IPC_GET_ISR( call ) ( int ) IPC_GET_ARG2( * call )
 
/** DP8390 kernel interrupt command sequence.
*/
static irq_cmd_t dp8390_cmds[] = {
{ .cmd = CMD_PIO_READ_8,
.addr = NULL,
80,16 → 91,34
}
};
 
/** DP8390 kernel interrupt code.
*/
static irq_code_t dp8390_code = {
sizeof( dp8390_cmds ) / sizeof( irq_cmd_t ),
dp8390_cmds
};
 
/** Network interface module global data.
*/
netif_globals_t netif_globals;
 
/** Prints the module name.
* @see NAME
*/
void module_print_name( void );
 
/** Handles the interrupt messages.
* This is the interrupt handler callback function.
* @param[in] iid The interrupt message identifier.
* @param[in] call The interrupt message.
*/
void irq_handler( ipc_callid_t iid, ipc_call_t * call );
 
/** Changes the network interface state.
* @param[in,out] device The network interface.
* @param[in] state The new state.
* @returns The new state.
*/
int change_state( device_ref device, device_state_t state );
 
int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
/branches/network/uspace/srv/net/netif/lo/lo.c
74,8 → 74,8
netif_globals_t netif_globals;
 
/** Changes the loopback state.
* @param device The device structure. Input parameter.
* @param state The new device state. Input parameter.
* @param[in] device The device structure.
* @param[in] state The new device state.
* @returns The new state if changed.
* @returns EOK otherwise.
*/
82,8 → 82,8
int change_state_message( device_ref device, device_state_t state );
 
/** Creates and returns the loopback network interface structure.
* @param device_id The new devce identifier. Input parameter.
* @param device The device structure. Output parameter.
* @param[in] device_id The new devce identifier.
* @param[out] device The device structure.
* @returns EOK on success.
* @returns EXDEV if one loopback network interface already exists.
* @returns ENOMEM if there is not enough memory left.
/branches/network/uspace/srv/net/netif/netif.h
102,8 → 102,8
};
 
/** Finds the device specific data.
* @param device_id The device identifier. Input parameter.
* @param device The device specific data. Output parameter.
* @param[in] device_id The device identifier.
* @param[out] device The device specific data.
* @returns EOK on success.
* @returns ENOENT if device is not found.
* @returns EPERM if the device is not initialized.
111,18 → 111,18
int find_device( device_id_t device_id, device_ref * device );
 
/** Clears the usage statistics.
* @param stats The usage statistics. Input parameter.
* @param[in] stats The usage statistics.
*/
void null_device_stats( device_stats_ref stats );
 
// prepared for future optimalizations
/** Releases the given packet.
* @param packet_id The packet identifier. Input parameter.
* @param[in] packet_id The packet identifier.
*/
void netif_pq_release( packet_id_t packet_id );
 
/** Allocates new packet to handle the given content size.
* @param content The minimum content size. Input parameter.
* @param[in] content The minimum content size.
* @returns The allocated packet.
* @returns NULL if there is an error.
*/
129,10 → 129,10
packet_t netif_packet_get_1( size_t content );
 
/** Processes the netif module messages.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @returns Other error codes as defined for each specific module message function.
143,7 → 143,7
 
/** Initializes the netif module.
* The function has to be defined in each module.
* @param client_connection The client connection functio to be registered. Input parameter.
* @param[in] client_connection The client connection functio to be registered.
* @returns EOK on success.
* @returns Other error codes as defined for each specific module message function.
*/
/branches/network/uspace/srv/net/netif/netif_standalone.c
41,10 → 41,10
#include "netif.h"
 
/** Delegates the messages to the netif_message() function.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @param[in] callid The message identifier.
* @param[in] call The message parameters.
* @param[out] answer The message answer parameters.
* @param[out] answer_count The last parameter for the actual answer in the answer parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @returns Other error codes as defined for each specific module message function.
53,7 → 53,7
 
/** Starts the network interface module.
* Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
* @returns EOK on success.
* @returns Other error codes as defined for each specific module message function.
*/