Atmel Software Framework

macb.c File Reference
#include <stdio.h>
#include <string.h>
#include <avr32/io.h>
#include "compiler.h"
#include "gpio.h"
#include "macb.h"
#include "conf_eth.h"
#include "intc.h"
#include "ethernet_phy.h"

Macros

#define ADDRESS_MASK   ( ( unsigned long ) 0xFFFFFFFC )
 
#define BUFFER_WAIT_DELAY   ( 2 )
 
#define ETHERNET_CONF_USE_RMII_INTERFACE   0
 
#define portENTER_CRITICAL   Disable_global_interrupt
 
#define portENTER_SWITCHING_ISR()
 
#define portEXIT_CRITICAL   Enable_global_interrupt
 
#define portEXIT_SWITCHING_ISR()
 
#define RX_BUFFER_SIZE   128
 
#define RX_WRAP_BIT   ( ( unsigned long ) 0x02 )
 

Functions

unsigned long lMACBSend (volatile avr32_macb_t *macb, const void *pvFrom, unsigned long ulLength, long lEndOfFrame)
 Send ulLength bytes from pcFrom. More...
 
static long prvMACB_ISR_NonNakedBehaviour (void)
 
static bool prvProbePHY (volatile avr32_macb_t *macb)
 
static void prvSetupDescriptors (volatile avr32_macb_t *macb)
 
static void prvSetupMACAddress (volatile avr32_macb_t *macb)
 
static void prvSetupMACBInterrupt (volatile avr32_macb_t *macb)
 
unsigned long ulMACBInputLength (void)
 Function to get length of the next frame in the receive buffers. More...
 
unsigned long ulReadMDIO (volatile avr32_macb_t *macb, unsigned short usAddress)
 
void vClearMACBTxBuffer (void)
 Called by the Tx interrupt, this function traverses the buffers used to hold the frame that has just completed transmission and marks each as free again. More...
 
void vDisableMACBOperations (volatile avr32_macb_t *macb)
 Disable MACB operations (Tx and Rx). More...
 
void vMACB_ISR (void)
 
void vMACBRead (void *pvTo, unsigned long ulSectionLength, unsigned long ulTotalFrameLength)
 Frames can be read from the MACB in multiple sections. More...
 
void vMACBSetMACAddress (const unsigned char *MACAddress)
 Set the MACB Physical address (SA1B & SA1T registers). More...
 
bool vMACBWaitForInput (unsigned long ulTimeOut)
 Wait for new Ethernet data. More...
 
static void vResetMacbRxFrames (void)
 Restore ownership of all Rx buffers to the MACB. More...
 
void vWriteMDIO (volatile avr32_macb_t *macb, unsigned short usAddress, unsigned short usValue)
 
bool xMACBInit (volatile avr32_macb_t *macb)
 initialize the MACB driver. More...
 

Variables

unsigned char cMACAddress [6] = { ETHERNET_CONF_ETHADDR0,ETHERNET_CONF_ETHADDR1,ETHERNET_CONF_ETHADDR2,ETHERNET_CONF_ETHADDR3,ETHERNET_CONF_ETHADDR4,ETHERNET_CONF_ETHADDR5 }
 
static volatile int DataToRead = 0
 
static volatile char pcRxBuffer [ETHERNET_CONF_NB_RX_BUFFERS *RX_BUFFER_SIZE]
 
static volatile char pcTxBuffer [ETHERNET_CONF_NB_TX_BUFFERS *ETHERNET_CONF_TX_BUFFER_SIZE]
 
volatile unsigned long ulNextRxBuffer = 0
 
static volatile
AVR32_RxTdDescriptor 
xRxDescriptors [ETHERNET_CONF_NB_RX_BUFFERS]
 
static volatile
AVR32_TxTdDescriptor 
xTxDescriptors [ETHERNET_CONF_NB_TX_BUFFERS]
 

#define ADDRESS_MASK   ( ( unsigned long ) 0xFFFFFFFC )

Referenced by vMACBRead().

#define BUFFER_WAIT_DELAY   ( 2 )

Referenced by lMACBSend().

#define ETHERNET_CONF_USE_RMII_INTERFACE   0
#define portENTER_SWITCHING_ISR ( )
#define portEXIT_SWITCHING_ISR ( )
#define RX_BUFFER_SIZE   128

Referenced by prvSetupDescriptors(), and vMACBRead().

#define RX_WRAP_BIT   ( ( unsigned long ) 0x02 )

Referenced by prvSetupDescriptors().

static long prvMACB_ISR_NonNakedBehaviour ( void  )
static
static void prvSetupMACAddress ( volatile avr32_macb_t *  macb)
static

Referenced by xMACBInit().

static void prvSetupMACBInterrupt ( volatile avr32_macb_t *  macb)
static
static void vResetMacbRxFrames ( void  )
static

Restore ownership of all Rx buffers to the MACB.

References _AVR32_RxTdDescriptor::addr, AVR32_OWNERSHIP_BIT, and ETHERNET_CONF_NB_RX_BUFFERS.

Referenced by ulMACBInputLength().

volatile int DataToRead = 0
static
volatile char pcRxBuffer[ETHERNET_CONF_NB_RX_BUFFERS *RX_BUFFER_SIZE]
static
volatile char pcTxBuffer[ETHERNET_CONF_NB_TX_BUFFERS *ETHERNET_CONF_TX_BUFFER_SIZE]
static
volatile unsigned long ulNextRxBuffer = 0

Referenced by ulMACBInputLength(), and vMACBRead().

volatile AVR32_RxTdDescriptor xRxDescriptors[ETHERNET_CONF_NB_RX_BUFFERS]
static
volatile AVR32_TxTdDescriptor xTxDescriptors[ETHERNET_CONF_NB_TX_BUFFERS]
static