Contiki 3.x
Functions | Variables
XgNicLanc111

Functions

static uint16_t NicPhyRead (uint8_t reg)
 Read contents of PHY register. More...
 
static void NicPhyWrite (uint8_t reg, uint16_t val)
 Write value to PHY register. More...
 
static int NicPhyConfig (void)
 Configure the internal PHY. More...
 
static INLINE int NicMmuWait (uint16_t tmo)
 Wait until MMU is ready. More...
 
static int NicReset (void)
 Reset the Ethernet controller. More...
 
static NETBUF * NicGetPacket (void)
 Fetch the next packet out of the receive ring buffer. More...
 

Variables

static struct etimer et
 NIC receiver thread.
 

Detailed Description

Function Documentation

static NETBUF* NicGetPacket ( void  )
static

Fetch the next packet out of the receive ring buffer.

Nic interrupts must be disabled when calling this funtion.

Returns
Pointer to an allocated NETBUF. If there is no no data available, then the function returns a null pointer. If the NIC's buffer seems to be corrupted, a pointer to 0xFFFF is returned.

Definition at line 960 of file lanc111.c.

References NIC_DATA, NIC_FIFO, NIC_MMUCR, and NIC_PTR.

static INLINE int NicMmuWait ( uint16_t  tmo)
static

Wait until MMU is ready.

Poll the MMU command register until MMUCR_BUSY is cleared.

Parameters
tmoTimeout in milliseconds.
Returns
0 on success or -1 on timeout.

Definition at line 742 of file lanc111.c.

References MMUCR_BUSY, and NIC_MMUCR.

Referenced by NicReset().

static int NicPhyConfig ( void  )
static
static uint16_t NicPhyRead ( uint8_t  reg)
static

Read contents of PHY register.

Note
NIC interrupts must have been disabled before calling this routine.
Parameters
regPHY register number.
Returns
Contents of the specified register.

Definition at line 580 of file lanc111.c.

References MGMT_MCLK, MGMT_MDI, MGMT_MDOE, NIC_MGMT, and NicPhyRegSelect().

Referenced by NicPhyConfig().

static void NicPhyWrite ( uint8_t  reg,
uint16_t  val 
)
static

Write value to PHY register.

Note
NIC interrupts must have been disabled before calling this routine.
Parameters
regPHY register number.
valValue to write.

Definition at line 616 of file lanc111.c.

References MGMT_MCLK, MGMT_MDO, MGMT_MDOE, NIC_MGMT, and NicPhyRegSelect().

Referenced by NicPhyConfig().

static int NicReset ( void  )
static

Reset the Ethernet controller.

Returns
0 on success, -1 otherwise.

Definition at line 757 of file lanc111.c.

References CR_EPH_EN, CTR_AUTO_RELEASE, NIC_CR, NIC_CTR, NIC_MMUCR, NIC_MSK, NIC_RCR, NIC_TCR, NicMmuWait(), and RCR_SOFT_RST.