#include <stdio.h>
#include <string.h>
#include <avr32/io.h>
#include "compiler.h"
#include "gpio.h"
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.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 | 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 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 xSemaphoreHandle | xSemaphore = NULL |
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 RX_BUFFER_SIZE 128 |
Referenced by prvSetupDescriptors(), and vMACBRead().
#define RX_WRAP_BIT ( ( unsigned long ) 0x02 ) |
Referenced by prvSetupDescriptors().
|
static |
References vClearMACBTxBuffer(), and xSemaphoreGiveFromISR.
Referenced by vMACB_ISR().
|
static |
References ADVERTISE_100FULL, ADVERTISE_100HALF, ADVERTISE_10FULL, ADVERTISE_10HALF, ADVERTISE_ALL, ADVERTISE_CSMA, AVR32_MACB_SPD_MASK, BMSR_LSTATUS, ethernet_phy_setup_auto_negotiation(), ethernet_phy_setup_rmii(), EXTPHY_PHY_ID, LPA_100FULL, LPA_100HALF, LPA_10FULL, PHY_ADVERTISE, PHY_BMCR, PHY_BMSR, PHY_LPA, PHY_PHYSID1, PHY_PHYSID2, ulReadMDIO(), and vWriteMDIO().
Referenced by xMACBInit().
|
static |
References _AVR32_RxTdDescriptor::addr, _AVR32_TxTdDescriptor::addr, AVR32_TRANSMIT_OK, AVR32_TRANSMIT_WRAP, ETHERNET_CONF_NB_RX_BUFFERS, ETHERNET_CONF_NB_TX_BUFFERS, ETHERNET_CONF_TX_BUFFER_SIZE, RX_BUFFER_SIZE, RX_WRAP_BIT, _AVR32_TxTdDescriptor::status, and _AVR32_TxTdDescriptor::U_Status.
Referenced by xMACBInit().
|
static |
Referenced by xMACBInit().
|
static |
References EXTPHY_MACB_INTERRUPT_PIN, gpio_enable_pin_interrupt(), GPIO_FALLING_EDGE, INTC_register_interrupt(), MICR_INTEN, MICR_INTOE, MISR_LINK_INT_EN, NULL, PHY_MICR, PHY_MISR, vMACB_ISR(), vSemaphoreCreateBinary, vWriteMDIO(), and xSemaphoreTake.
Referenced by xMACBInit().
References prvMACB_ISR_NonNakedBehaviour().
Referenced by prvSetupMACBInterrupt().
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().
unsigned char cMACAddress[6] = { ETHERNET_CONF_ETHADDR0,ETHERNET_CONF_ETHADDR1,ETHERNET_CONF_ETHADDR2,ETHERNET_CONF_ETHADDR3,ETHERNET_CONF_ETHADDR4,ETHERNET_CONF_ETHADDR5 } |
Referenced by low_level_init().
|
static |
|
static |
volatile unsigned long ulNextRxBuffer = 0 |
Referenced by ulMACBInputLength(), and vMACBRead().
|
static |
|
static |
|
static |