nicrtl.c File Reference

Go to the source code of this file.

Defines

#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 RTL_EESK_PIN   PINB

Definition at line 152 of file nicrtl.c.

#define RTL_EESK_DDR   DDRB

Definition at line 153 of file nicrtl.c.

#define RTL_EEDO_PORT   PORTB

Definition at line 175 of file nicrtl.c.

#define RTL_EEDO_DDR   DDRB

Definition at line 176 of file nicrtl.c.

#define RTL_EEMU_PORT   PORTB

Definition at line 198 of file nicrtl.c.

#define RTL_EEMU_DDR   DDRB

Definition at line 199 of file nicrtl.c.

#define RTL_RESET_PORT   PORTB

Definition at line 221 of file nicrtl.c.

#define RTL_RESET_DDR   DDRB

Definition at line 222 of file nicrtl.c.

#define RTL_SIGNAL   sig_INTERRUPT0

Interrupt used.

Definition at line 243 of file nicrtl.c.

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

Definition at line 245 of file nicrtl.c.

Referenced by NicInit().

#define NIC_PAGE_SIZE   0x100

Size of a single ring buffer page.

Definition at line 296 of file nicrtl.c.

#define NIC_START_PAGE   0x40

First ring buffer page address.

Definition at line 301 of file nicrtl.c.

#define NIC_STOP_PAGE   0x60

Last ring buffer page address plus 1.

Definition at line 306 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 313 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

  • 0x4000..0x45ff 1.5K bytes transmit buffer
  • 0x4600..0x5fff 6.5K bytes receive buffer

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 335 of file nicrtl.c.

#define NIC_FIRST_TX_PAGE   NIC_START_PAGE

Definition at line 337 of file nicrtl.c.

#define NIC_FIRST_RX_PAGE   (NIC_FIRST_TX_PAGE + NIC_TX_PAGES * NIC_TX_BUFFERS)

Definition at line 338 of file nicrtl.c.

#define NIC_CR_PAGE0   (0)

Definition at line 340 of file nicrtl.c.

#define NIC_CR_PAGE1   (NIC_CR_PS0)

Definition at line 341 of file nicrtl.c.

#define NIC_CR_PAGE2   (NIC_CR_PS1)

Definition at line 342 of file nicrtl.c.

#define NIC_CR_PAGE3   (NIC_CR_PS1 | NIC_CR_PS0)

Definition at line 343 of file nicrtl.c.


© 2000-2010 by contributors - visit http://www.ethernut.de/