iPXE
Data Structures | Defines | Functions
dm96xx.h File Reference

Davicom DM96xx USB Ethernet driver. More...

#include <ipxe/usb.h>
#include <ipxe/usbnet.h>
#include <ipxe/if_ether.h>

Go to the source code of this file.

Data Structures

struct  dm96xx_interrupt
 DM96xx interrupt data. More...
struct  dm96xx_rx_header
 DM96xx receive header. More...
struct  dm96xx_tx_header
 DM96xx transmit header. More...
struct  dm96xx_device
 A DM96xx network device. More...

Defines

#define DM96XX_READ_REGISTER
 Read register(s)
#define DM96XX_WRITE_REGISTER
 Write register(s)
#define DM96XX_WRITE1_REGISTER
 Write single register.
#define DM96XX_NCR   0x00
 Network control register.
#define DM96XX_NCR_RST   0x01
 Software reset.
#define DM96XX_NSR   0x01
 Network status register.
#define DM96XX_NSR_LINKST   0x40
 Link status.
#define DM96XX_RCR   0x05
 Receive control register.
#define DM96XX_RCR_ALL   0x08
 Pass all multicast.
#define DM96XX_RCR_RUNT   0x04
 Pass runt packet.
#define DM96XX_RCR_PRMSC   0x02
 Promiscuous mode.
#define DM96XX_RCR_RXEN   0x01
 RX enable.
#define DM96XX_RSR   0x06
 Receive status register.
#define DM96XX_RSR_MF   0x40
 Multicast frame.
#define DM96XX_PAR   0x10
 PHY address registers.
#define DM96XX_CHIPR   0x2c
 Chip revision register.
#define DM96XX_CHIPR_9601   0x00
 DM9601.
#define DM96XX_CHIPR_9620   0x01
 DM9620.
#define DM96XX_MODE_CTL   0x91
 RX header control/status register (DM9620+ only)
#define DM96XX_MODE_CTL_MODE   0x80
 4-byte header mode
#define DM96XX_RESET_DELAY_US   10
 Reset delay (in microseconds)
#define DM96XX_INTR_MAX_FILL   2
 Interrupt maximum fill level.
#define DM96XX_IN_MAX_FILL   8
 Bulk IN maximum fill level.
#define DM96XX_IN_MTU
 Bulk IN buffer size.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static int dm96xx_read_registers (struct dm96xx_device *dm96xx, unsigned int offset, void *data, size_t len)
 Read registers.
static int dm96xx_read_register (struct dm96xx_device *dm96xx, unsigned int offset)
 Read register.
static int dm96xx_write_registers (struct dm96xx_device *dm96xx, unsigned int offset, void *data, size_t len)
 Write registers.
static int dm96xx_write_register (struct dm96xx_device *dm96xx, unsigned int offset, uint8_t value)
 Write register.

Detailed Description

Davicom DM96xx USB Ethernet driver.

Definition in file dm96xx.h.


Define Documentation

Value:
( USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE |     \
          USB_REQUEST_TYPE ( 0x00 ) )

Read register(s)

Definition at line 17 of file dm96xx.h.

Referenced by dm96xx_read_registers().

Value:
( USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE |    \
          USB_REQUEST_TYPE ( 0x01 ) )

Write register(s)

Definition at line 22 of file dm96xx.h.

Referenced by dm96xx_write_registers().

Value:
( USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE |    \
          USB_REQUEST_TYPE ( 0x03 ) )

Write single register.

Definition at line 27 of file dm96xx.h.

Referenced by dm96xx_write_register().

#define DM96XX_NCR   0x00

Network control register.

Definition at line 32 of file dm96xx.h.

Referenced by dm96xx_reset().

#define DM96XX_NCR_RST   0x01

Software reset.

Definition at line 33 of file dm96xx.h.

Referenced by dm96xx_reset().

#define DM96XX_NSR   0x01

Network status register.

Definition at line 36 of file dm96xx.h.

Referenced by dm96xx_check_link().

#define DM96XX_NSR_LINKST   0x40

Link status.

Definition at line 37 of file dm96xx.h.

Referenced by dm96xx_link_nsr().

#define DM96XX_RCR   0x05

Receive control register.

Definition at line 40 of file dm96xx.h.

Referenced by dm96xx_open().

#define DM96XX_RCR_ALL   0x08

Pass all multicast.

Definition at line 41 of file dm96xx.h.

Referenced by dm96xx_open().

#define DM96XX_RCR_RUNT   0x04

Pass runt packet.

Definition at line 42 of file dm96xx.h.

Referenced by dm96xx_open().

#define DM96XX_RCR_PRMSC   0x02

Promiscuous mode.

Definition at line 43 of file dm96xx.h.

Referenced by dm96xx_open().

#define DM96XX_RCR_RXEN   0x01

RX enable.

Definition at line 44 of file dm96xx.h.

Referenced by dm96xx_open().

#define DM96XX_RSR   0x06

Receive status register.

Definition at line 47 of file dm96xx.h.

#define DM96XX_RSR_MF   0x40

Multicast frame.

Definition at line 48 of file dm96xx.h.

Referenced by dm96xx_in_complete().

#define DM96XX_PAR   0x10

PHY address registers.

Definition at line 51 of file dm96xx.h.

Referenced by dm96xx_read_mac(), and dm96xx_write_mac().

#define DM96XX_CHIPR   0x2c

Chip revision register.

Definition at line 54 of file dm96xx.h.

Referenced by dm96xx_rx_mode().

#define DM96XX_CHIPR_9601   0x00

DM9601.

Definition at line 55 of file dm96xx.h.

Referenced by dm96xx_rx_mode().

#define DM96XX_CHIPR_9620   0x01

DM9620.

Definition at line 56 of file dm96xx.h.

#define DM96XX_MODE_CTL   0x91

RX header control/status register (DM9620+ only)

Definition at line 59 of file dm96xx.h.

Referenced by dm96xx_rx_mode().

#define DM96XX_MODE_CTL_MODE   0x80

4-byte header mode

Definition at line 60 of file dm96xx.h.

Referenced by dm96xx_rx_mode().

#define DM96XX_RESET_DELAY_US   10

Reset delay (in microseconds)

Definition at line 175 of file dm96xx.h.

Referenced by dm96xx_reset().

#define DM96XX_INTR_MAX_FILL   2

Interrupt maximum fill level.

This is a policy decision.

Definition at line 181 of file dm96xx.h.

Referenced by dm96xx_probe().

#define DM96XX_IN_MAX_FILL   8

Bulk IN maximum fill level.

This is a policy decision.

Definition at line 187 of file dm96xx.h.

Referenced by dm96xx_probe().

#define DM96XX_IN_MTU
Value:
( 4 /* DM96xx header */ + ETH_FRAME_LEN +       \
          4 /* possible VLAN header */ + 4 /* CRC */ )

Bulk IN buffer size.

Definition at line 190 of file dm96xx.h.

Referenced by dm96xx_probe().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int dm96xx_read_registers ( struct dm96xx_device dm96xx,
unsigned int  offset,
void *  data,
size_t  len 
) [inline, static]

Read registers.

Parameters:
dm96xxDM96xx device
offsetRegister offset
dataData buffer
lenLength of data
Return values:
rcReturn status code

Definition at line 116 of file dm96xx.h.

References DM96XX_READ_REGISTER, and usb_control().

Referenced by dm96xx_read_mac(), and dm96xx_read_register().

                                                 {

        return usb_control ( dm96xx->usb, DM96XX_READ_REGISTER, 0, offset,
                             data, len );
}
static int dm96xx_read_register ( struct dm96xx_device dm96xx,
unsigned int  offset 
) [inline, static]

Read register.

Parameters:
dm96xxDM96xx device
offsetRegister offset
Return values:
valueRegister value, or negative error

Definition at line 131 of file dm96xx.h.

References dm96xx_read_registers(), rc, and value.

Referenced by dm96xx_check_link(), dm96xx_reset(), and dm96xx_rx_mode().

                                                                           {
        uint8_t value;
        int rc;

        if ( ( rc = dm96xx_read_registers ( dm96xx, offset, &value,
                                            sizeof ( value ) ) ) != 0 )
                return rc;
        return value;
}
static int dm96xx_write_registers ( struct dm96xx_device dm96xx,
unsigned int  offset,
void *  data,
size_t  len 
) [inline, static]

Write registers.

Parameters:
dm96xxDM96xx device
offsetRegister offset
dataData buffer
lenLength of data
Return values:
rcReturn status code

Definition at line 151 of file dm96xx.h.

References DM96XX_WRITE_REGISTER, and usb_control().

Referenced by dm96xx_write_mac().

                                                  {

        return usb_control ( dm96xx->usb, DM96XX_WRITE_REGISTER, 0, offset,
                             data, len );
}
static int dm96xx_write_register ( struct dm96xx_device dm96xx,
unsigned int  offset,
uint8_t  value 
) [inline, static]

Write register.

Parameters:
dm96xxDM96xx device
offsetRegister offset
valueRegister value
Return values:
rcReturn status code

Definition at line 167 of file dm96xx.h.

References DM96XX_WRITE1_REGISTER, NULL, and usb_control().

Referenced by dm96xx_open(), dm96xx_reset(), and dm96xx_rx_mode().

                                        {

        return usb_control ( dm96xx->usb, DM96XX_WRITE1_REGISTER, value,
                             offset, NULL, 0 );
}