- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# Emac.h

    00001 //*----------------------------------------------------------------------------
    00002 //*         ATMEL Microcontroller Software Support  -  ROUSSET  -
    00003 //*----------------------------------------------------------------------------
    00004 //* The software is delivered "AS IS" without warranty or condition of any
    00005 //* kind, either express, implied or statutory. This includes without
    00006 //* limitation any warranty or condition with respect to merchantability or
    00007 //* fitness for any particular purpose, or against the infringements of
    00008 //* intellectual property rights of others.
    00009 //*----------------------------------------------------------------------------
    00010 //* File Name           : Emac.h
    00011 //* Object              : Emac header file
    00012 //* Creation            : Hi   11/18/2002
    00013 //*
    00014 //*----------------------------------------------------------------------------
    00015 #ifndef AT91C_EMAC_H
    00016 #define AT91C_EMAC_H
    00017
    00018 #include "lwipopts.h"
    00019
    00020
    00021 /* Number of receive buffers */
    00022 #define NB_RX_BUFFERS     50
    00023
    00024 /* Size of each receive buffer - DO NOT CHANGE. */
    00025 #define ETH_RX_BUFFER_SIZE    128
    00026
    00027 /* Number of Transmit buffers */
    00028 #define NB_TX_BUFFERS     ( MEMP_NUM_PBUF / 2 )
    00029
    00030 /* Size of each Transmit buffer. */
    00031 #define ETH_TX_BUFFER_SIZE    ( PBUF_POOL_BUFSIZE  )
    00032
    00033 /* Receive Transfer descriptor structure */
    00034 typedef struct  _AT91S_RxTdDescriptor {
    00035   unsigned int addr;
    00036   union
    00037   {
    00038     unsigned int status;
    00039     struct {
    00040       unsigned int Length:11;
    00041       unsigned int Res0:1;
    00042       unsigned int Rxbuf_off:2;
    00043       unsigned int StartOfFrame:1;
    00044       unsigned int EndOfFrame:1;
    00045       unsigned int Cfi:1;
    00046       unsigned int VlanPriority:3;
    00047       unsigned int PriorityTag:1;
    00048       unsigned int VlanTag:1;
    00049       unsigned int TypeID:1;
    00050       unsigned int Sa4Match:1;
    00051       unsigned int Sa3Match:1;
    00052       unsigned int Sa2Match:1;
    00053       unsigned int Sa1Match:1;
    00054       unsigned int Res1:1;
    00055       unsigned int ExternalAdd:1;
    00056       unsigned int UniCast:1;
    00057       unsigned int MultiCast:1;
    00058       unsigned int BroadCast:1;
    00059     }S_Status;
    00060   }U_Status;
    00061 }AT91S_RxTdDescriptor, *AT91PS_RxTdDescriptor;
    00062
    00063
    00064 /* Transmit Transfer descriptor structure */
    00065 typedef struct _AT91S_TxTdDescriptor {
    00066   unsigned int addr;
    00067   union
    00068   {
    00069     unsigned int status;
    00070     struct {
    00071       unsigned int Length:11;
    00072       unsigned int Res0:4;
    00073       unsigned int LastBuff:1;
    00074       unsigned int NoCrc:1;
    00075       unsigned int Res1:10;
    00076       unsigned int BufExhausted:1;
    00077       unsigned int TransmitUnderrun:1;
    00078       unsigned int TransmitError:1;
    00079       unsigned int Wrap:1;
    00080       unsigned int BuffUsed:1;
    00081     }S_Status;
    00082   }U_Status;
    00083 }AT91S_TxTdDescriptor, *AT91PS_TxTdDescriptor;
    00084
    00085 #define AT91C_OWNERSHIP_BIT   0x00000001
    00086
    00087 /* Receive status defintion */
    00088 #define AT91C_BROADCAST_ADDR  ((unsigned int) (1 << 31))  //* Broadcat address detected
    00089 #define AT91C_MULTICAST_HASH  ((unsigned int) (1 << 30))  //* MultiCast hash match
    00090 #define AT91C_UNICAST_HASH      ((unsigned int) (1 << 29))  //* UniCast hash match
    00091 #define AT91C_EXTERNAL_ADDR     ((unsigned int) (1 << 28))  //* External Address match
    00092 #define AT91C_SA1_ADDR        ((unsigned int) (1 << 26))  //* Specific address 1 match
    00093 #define AT91C_SA2_ADDR        ((unsigned int) (1 << 25))  //* Specific address 2 match
    00094 #define AT91C_SA3_ADDR        ((unsigned int) (1 << 24))  //* Specific address 3 match
    00095 #define AT91C_SA4_ADDR        ((unsigned int) (1 << 23))  //* Specific address 4 match
    00096 #define AT91C_TYPE_ID       ((unsigned int) (1 << 22))  //* Type ID match
    00097 #define AT91C_VLAN_TAG        ((unsigned int) (1 << 21))  //* VLAN tag detected
    00098 #define AT91C_PRIORITY_TAG      ((unsigned int) (1 << 20))  //* PRIORITY tag detected
    00099 #define AT91C_VLAN_PRIORITY     ((unsigned int) (7 << 17))  //* PRIORITY Mask
    00100 #define AT91C_CFI_IND         ((unsigned int) (1 << 16))  //* CFI indicator
    00101 #define AT91C_EOF             ((unsigned int) (1 << 15))  //* EOF
    00102 #define AT91C_SOF             ((unsigned int) (1 << 14))  //* SOF
    00103 #define AT91C_RBF_OFFSET      ((unsigned int) (3 << 12))  //* Receive Buffer Offset Mask
    00104 #define AT91C_LENGTH_FRAME      ((unsigned int) 0x07FF)     //* Length of frame
    00105
    00106 /* Transmit Status definition */
    00107 #define AT91C_TRANSMIT_OK   ((unsigned int) (1 << 31))  //*
    00108 #define AT91C_TRANSMIT_WRAP   ((unsigned int) (1 << 30))  //* Wrap bit: mark the last descriptor
    00109 #define AT91C_TRANSMIT_ERR    ((unsigned int) (1 << 29))  //* RLE:transmit error
    00110 #define AT91C_TRANSMIT_UND    ((unsigned int) (1 << 28))  //* Transmit Underrun
    00111 #define AT91C_BUF_EX        ((unsigned int) (1 << 27))  //* Buffers exhausted in mid frame
    00112 #define AT91C_TRANSMIT_NO_CRC ((unsigned int) (1 << 16))  //* No CRC will be appended to the current frame
    00113 #define AT91C_LAST_BUFFER     ((unsigned int) (1 << 15))  //*
    00114
    00115 #define AT91C_EMAC_CLKEN 0x2
    00116
    00117 #endif //* AT91C_EMAC_H

The Make Controller Kit is an open source project maintained by MakingThings.
MakingThings code is released under the Apache 2.0 license.
Bug tracker, development wiki and status can be found at http://dev.makingthings.com.
This document was last updated on 18 May 2009.