iPXE
Data Structures | Macros | 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...
 

Macros

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

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. More...
 
static int dm96xx_read_register (struct dm96xx_device *dm96xx, unsigned int offset)
 Read register. More...
 
static int dm96xx_write_registers (struct dm96xx_device *dm96xx, unsigned int offset, void *data, size_t len)
 Write registers. More...
 
static int dm96xx_write_register (struct dm96xx_device *dm96xx, unsigned int offset, uint8_t value)
 Write register. More...
 

Detailed Description

Davicom DM96xx USB Ethernet driver.

Definition in file dm96xx.h.

Macro Definition Documentation

◆ DM96XX_READ_REGISTER

#define DM96XX_READ_REGISTER
Value:
USB_REQUEST_TYPE ( 0x00 ) )
#define USB_TYPE_VENDOR
Vendor-specific request type.
Definition: usb.h:92
#define USB_DIR_IN
Data transfer is from device to host.
Definition: usb.h:83
#define USB_RECIP_DEVICE
Request recipient is the device.
Definition: usb.h:98

Read register(s)

Definition at line 17 of file dm96xx.h.

◆ DM96XX_WRITE_REGISTER

#define DM96XX_WRITE_REGISTER
Value:
USB_REQUEST_TYPE ( 0x01 ) )
#define USB_DIR_OUT
Data transfer is from host to device.
Definition: usb.h:80
#define USB_TYPE_VENDOR
Vendor-specific request type.
Definition: usb.h:92
#define USB_RECIP_DEVICE
Request recipient is the device.
Definition: usb.h:98

Write register(s)

Definition at line 22 of file dm96xx.h.

◆ DM96XX_WRITE1_REGISTER

#define DM96XX_WRITE1_REGISTER
Value:
USB_REQUEST_TYPE ( 0x03 ) )
#define USB_DIR_OUT
Data transfer is from host to device.
Definition: usb.h:80
#define USB_TYPE_VENDOR
Vendor-specific request type.
Definition: usb.h:92
#define USB_RECIP_DEVICE
Request recipient is the device.
Definition: usb.h:98

Write single register.

Definition at line 27 of file dm96xx.h.

◆ DM96XX_NCR

#define DM96XX_NCR   0x00

Network control register.

Definition at line 32 of file dm96xx.h.

◆ DM96XX_NCR_RST

#define DM96XX_NCR_RST   0x01

Software reset.

Definition at line 33 of file dm96xx.h.

◆ DM96XX_NSR

#define DM96XX_NSR   0x01

Network status register.

Definition at line 36 of file dm96xx.h.

◆ DM96XX_NSR_LINKST

#define DM96XX_NSR_LINKST   0x40

Link status.

Definition at line 37 of file dm96xx.h.

◆ DM96XX_RCR

#define DM96XX_RCR   0x05

Receive control register.

Definition at line 40 of file dm96xx.h.

◆ DM96XX_RCR_ALL

#define DM96XX_RCR_ALL   0x08

Pass all multicast.

Definition at line 41 of file dm96xx.h.

◆ DM96XX_RCR_RUNT

#define DM96XX_RCR_RUNT   0x04

Pass runt packet.

Definition at line 42 of file dm96xx.h.

◆ DM96XX_RCR_PRMSC

#define DM96XX_RCR_PRMSC   0x02

Promiscuous mode.

Definition at line 43 of file dm96xx.h.

◆ DM96XX_RCR_RXEN

#define DM96XX_RCR_RXEN   0x01

RX enable.

Definition at line 44 of file dm96xx.h.

◆ DM96XX_RSR

#define DM96XX_RSR   0x06

Receive status register.

Definition at line 47 of file dm96xx.h.

◆ DM96XX_RSR_MF

#define DM96XX_RSR_MF   0x40

Multicast frame.

Definition at line 48 of file dm96xx.h.

◆ DM96XX_PAR

#define DM96XX_PAR   0x10

PHY address registers.

Definition at line 51 of file dm96xx.h.

◆ DM96XX_CHIPR

#define DM96XX_CHIPR   0x2c

Chip revision register.

Definition at line 54 of file dm96xx.h.

◆ DM96XX_CHIPR_9601

#define DM96XX_CHIPR_9601   0x00

DM9601.

Definition at line 55 of file dm96xx.h.

◆ DM96XX_CHIPR_9620

#define DM96XX_CHIPR_9620   0x01

DM9620.

Definition at line 56 of file dm96xx.h.

◆ DM96XX_MODE_CTL

#define DM96XX_MODE_CTL   0x91

RX header control/status register (DM9620+ only)

Definition at line 59 of file dm96xx.h.

◆ DM96XX_MODE_CTL_MODE

#define DM96XX_MODE_CTL_MODE   0x80

4-byte header mode

Definition at line 60 of file dm96xx.h.

◆ DM96XX_RESET_DELAY_US

#define DM96XX_RESET_DELAY_US   10

Reset delay (in microseconds)

Definition at line 175 of file dm96xx.h.

◆ DM96XX_INTR_MAX_FILL

#define DM96XX_INTR_MAX_FILL   2

Interrupt maximum fill level.

This is a policy decision.

Definition at line 181 of file dm96xx.h.

◆ DM96XX_IN_MAX_FILL

#define DM96XX_IN_MAX_FILL   8

Bulk IN maximum fill level.

This is a policy decision.

Definition at line 187 of file dm96xx.h.

◆ DM96XX_IN_MTU

#define DM96XX_IN_MTU
Value:
( 4 /* DM96xx header */ + ETH_FRAME_LEN + \
4 /* possible VLAN header */ + 4 /* CRC */ )
#define ETH_FRAME_LEN
Definition: if_ether.h:11

Bulk IN buffer size.

Definition at line 190 of file dm96xx.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ dm96xx_read_registers()

static int dm96xx_read_registers ( struct dm96xx_device dm96xx,
unsigned int  offset,
void *  data,
size_t  len 
)
inlinestatic

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.

117  {
118 
119  return usb_control ( dm96xx->usb, DM96XX_READ_REGISTER, 0, offset,
120  data, len );
121 }
struct usb_device * usb
USB device.
Definition: dm96xx.h:97
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.
Definition: usb.c:753
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
uint32_t len
Length.
Definition: ena.h:14
#define DM96XX_READ_REGISTER
Read register(s)
Definition: dm96xx.h:17
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

References data, DM96XX_READ_REGISTER, len, offset, dm96xx_device::usb, and usb_control().

Referenced by dm96xx_read_mac(), and dm96xx_read_register().

◆ dm96xx_read_register()

static int dm96xx_read_register ( struct dm96xx_device dm96xx,
unsigned int  offset 
)
inlinestatic

Read register.

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

Definition at line 131 of file dm96xx.h.

131  {
132  uint8_t value;
133  int rc;
134 
135  if ( ( rc = dm96xx_read_registers ( dm96xx, offset, &value,
136  sizeof ( value ) ) ) != 0 )
137  return rc;
138  return value;
139 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
unsigned char uint8_t
Definition: stdint.h:10
static int dm96xx_read_registers(struct dm96xx_device *dm96xx, unsigned int offset, void *data, size_t len)
Read registers.
Definition: dm96xx.h:116

References dm96xx_read_registers(), offset, rc, and value.

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

◆ dm96xx_write_registers()

static int dm96xx_write_registers ( struct dm96xx_device dm96xx,
unsigned int  offset,
void *  data,
size_t  len 
)
inlinestatic

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.

152  {
153 
154  return usb_control ( dm96xx->usb, DM96XX_WRITE_REGISTER, 0, offset,
155  data, len );
156 }
struct usb_device * usb
USB device.
Definition: dm96xx.h:97
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.
Definition: usb.c:753
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
#define DM96XX_WRITE_REGISTER
Write register(s)
Definition: dm96xx.h:22
uint32_t len
Length.
Definition: ena.h:14
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

References data, DM96XX_WRITE_REGISTER, len, offset, dm96xx_device::usb, and usb_control().

Referenced by dm96xx_write_mac().

◆ dm96xx_write_register()

static int dm96xx_write_register ( struct dm96xx_device dm96xx,
unsigned int  offset,
uint8_t  value 
)
inlinestatic

Write register.

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

Definition at line 167 of file dm96xx.h.

168  {
169 
170  return usb_control ( dm96xx->usb, DM96XX_WRITE1_REGISTER, value,
171  offset, NULL, 0 );
172 }
struct usb_device * usb
USB device.
Definition: dm96xx.h:97
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.
Definition: usb.c:753
static userptr_t size_t offset
Offset of the first segment within the content.
Definition: deflate.h:259
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
#define DM96XX_WRITE1_REGISTER
Write single register.
Definition: dm96xx.h:27
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References DM96XX_WRITE1_REGISTER, NULL, offset, dm96xx_device::usb, usb_control(), and value.

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