nicrtl.c File Reference

Go to the source code of this file.

Defines

#define NUT_THREAD_NICRXSTACK   640
#define RTL_EESK_PIN   PINB
#define RTL_EESK_DDR   DDRB
#define RTL_EEDO_PORT   PORTB
#define RTL_EEDO_DDR   DDRB
#define RTL_EEMU_PORT   PORTB
#define RTL_EEMU_DDR   DDRB
#define RTL_RESET_PORT   PORTB
#define RTL_RESET_DDR   DDRB
#define RTL_SIGNAL   sig_INTERRUPT0
 Interrupt used.
#define RTL_RISING_EDGE_MODE()   sbi(EICRA, ISC00); sbi(EICRA, ISC01)
#define NIC_PAGE_SIZE   0x100
 Size of a single ring buffer page.
#define NIC_START_PAGE   0x40
 First ring buffer page address.
#define NIC_STOP_PAGE   0x60
 Last ring buffer page address plus 1.
#define NIC_TX_PAGES   6
 Number of pages in a single transmit buffer.
#define NIC_TX_BUFFERS   1
 Number of transmit buffers.
#define NIC_FIRST_TX_PAGE   NIC_START_PAGE
#define NIC_FIRST_RX_PAGE   (NIC_FIRST_TX_PAGE + NIC_TX_PAGES * NIC_TX_BUFFERS)
#define NIC_CR_PAGE0   (0)
#define NIC_CR_PAGE1   (NIC_CR_PS0)
#define NIC_CR_PAGE2   (NIC_CR_PS1)
#define NIC_CR_PAGE3   (NIC_CR_PS1 | NIC_CR_PS0)
#define NICINB(reg)   (*((volatile uint8_t *)RTL_BASE_ADDR + reg))
#define NICOUTB(reg, val)   (*((volatile uint8_t *)RTL_BASE_ADDR + reg) = val)

Functions

void NicRx (void *arg)
 NIC receiver thread.
int NicOutput (NUTDEVICE *dev, NETBUF *nb)
 Send Ethernet packet.
int NicInit (NUTDEVICE *dev)
 Initialize Ethernet hardware.


Define Documentation

#define NUT_THREAD_NICRXSTACK   640

Definition at line 138 of file nicrtl.c.

Referenced by DmInit(), EmacInit(), and NicInit().

#define RTL_EESK_PIN   PINB

Definition at line 145 of file nicrtl.c.

#define RTL_EESK_DDR   DDRB

Definition at line 146 of file nicrtl.c.

#define RTL_EEDO_PORT   PORTB

Definition at line 168 of file nicrtl.c.

#define RTL_EEDO_DDR   DDRB

Definition at line 169 of file nicrtl.c.

#define RTL_EEMU_PORT   PORTB

Definition at line 191 of file nicrtl.c.

#define RTL_EEMU_DDR   DDRB

Definition at line 192 of file nicrtl.c.

#define RTL_RESET_PORT   PORTB

Definition at line 214 of file nicrtl.c.

#define RTL_RESET_DDR   DDRB

Definition at line 215 of file nicrtl.c.

#define RTL_SIGNAL   sig_INTERRUPT0

Interrupt used.

Definition at line 236 of file nicrtl.c.

 
#define RTL_RISING_EDGE_MODE (  )     sbi(EICRA, ISC00); sbi(EICRA, ISC01)

Definition at line 238 of file nicrtl.c.

Referenced by NicInit().

#define NIC_PAGE_SIZE   0x100

Size of a single ring buffer page.

Definition at line 289 of file nicrtl.c.

#define NIC_START_PAGE   0x40

First ring buffer page address.

Definition at line 294 of file nicrtl.c.

#define NIC_STOP_PAGE   0x60

Last ring buffer page address plus 1.

Definition at line 299 of file nicrtl.c.

#define NIC_TX_PAGES   6

Number of pages in a single transmit buffer.

This should be at least the MTU size.

Definition at line 306 of file nicrtl.c.

#define NIC_TX_BUFFERS   1

Number of transmit buffers.

The initial value had been 2. The idea was to use two alternating buffers. However, this had never been implemented and we took over Bengt Florin's change, defining 1 transmit buffer only and give more buffer space to the receiver.

The controller memory layout is now

The routines are still not using the buffers in an optimal way, as transmission is limited to 1 packet at a time. In fact several smaller packets would fit into the 1.5 kByte buffer. On the other hand, filling the buffer with more than one transmission packet may result in other bad effects, like pulling the IORDY line more often.

Definition at line 328 of file nicrtl.c.

#define NIC_FIRST_TX_PAGE   NIC_START_PAGE

Definition at line 330 of file nicrtl.c.

#define NIC_FIRST_RX_PAGE   (NIC_FIRST_TX_PAGE + NIC_TX_PAGES * NIC_TX_BUFFERS)

Definition at line 331 of file nicrtl.c.

#define NIC_CR_PAGE0   (0)

Definition at line 333 of file nicrtl.c.

#define NIC_CR_PAGE1   (NIC_CR_PS0)

Definition at line 334 of file nicrtl.c.

#define NIC_CR_PAGE2   (NIC_CR_PS1)

Definition at line 335 of file nicrtl.c.

#define NIC_CR_PAGE3   (NIC_CR_PS1 | NIC_CR_PS0)

Definition at line 336 of file nicrtl.c.


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/