OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [RX600_RX62N-RDK_GNURX/] [RTOSDemo/] [webserver/] [r_ether.h] - Blame information for rev 675

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 585 jeremybenn
/******************************************************************************
2
* DISCLAIMER
3
* Please refer to http://www.renesas.com/disclaimer
4
******************************************************************************
5
  Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved.
6
*******************************************************************************
7
* File Name    : r_ether.h
8
* Version      : 1.02
9
* Description  : Ethernet module device driver
10
******************************************************************************
11
* History : DD.MM.YYYY Version Description
12
*         : 15.02.2010 1.00    First Release
13
*         : 03.03.2010 1.01    Buffer size is aligned on the 32-byte boundary.
14
*         : 04.06.2010 1.02    RX62N changes
15
******************************************************************************/
16
 
17
#ifndef R_ETHER_H
18
#define R_ETHER_H
19
 
20
/******************************************************************************
21
Includes   <System Includes> , "Project Includes"
22
******************************************************************************/
23
 
24
 
25
/******************************************************************************
26
Typedef definitions
27
******************************************************************************/
28
struct Descriptor
29
{
30
         unsigned long  status;
31
#if __RX_LITTLE_ENDIAN__ == 1
32
/* Little endian */
33
         unsigned short size;
34
         unsigned short bufsize;
35
#else
36
/* Big endian */
37
         unsigned short bufsize;
38
         unsigned short size;
39
 
40
#endif
41
        char                                    *buf_p;
42
        struct Descriptor               *next;
43
};
44
 
45
typedef struct Descriptor ethfifo;
46
 
47
typedef enum _NETLNK
48
{
49
    PHY_NO_LINK = 0,
50
    PHY_LINK_10H,
51
    PHY_LINK_10F,
52
    PHY_LINK_100H,
53
    PHY_LINK_100F
54
 
55
} NETLNK;
56
 
57
/******************************************************************************
58
Macro definitions
59
******************************************************************************/
60
#define BUFSIZE   256                   /* Must be 32-bit aligned */
61
#define ENTRY     8                     /* Number of RX and TX buffers */
62
 
63
#define  ACT      0x80000000
64
#define  DL       0x40000000
65
#define  FP1      0x20000000
66
#define  FP0      0x10000000
67
#define  FE       0x08000000
68
 
69
#define  RFOVER   0x00000200
70
#define  RAD      0x00000100
71
#define  RMAF     0x00000080
72
#define  RRF      0x00000010
73
#define  RTLF     0x00000008
74
#define  RTSF     0x00000004
75
#define  PRE      0x00000002
76
#define  CERF     0x00000001
77
 
78
#define  TAD      0x00000100
79
#define  CND      0x00000008
80
#define  DLC      0x00000004
81
#define  CD       0x00000002
82
#define  TRO      0x00000001
83
 
84
/**
85
 * Renesas Ethernet API return defines
86
 **/
87
#define R_ETHER_OK          0
88
#define R_ETHER_ERROR       -1
89
 
90
/*      Ether Interface definitions     */
91
#define ETH_RMII_MODE   0
92
#define ETH_MII_MODE    1
93
/*      Select Ether Interface Mode     */
94
#define ETH_MODE_SEL    ETH_MII_MODE
95
 
96
/******************************************************************************
97
Variable Externs
98
******************************************************************************/
99
 
100
/******************************************************************************
101
Functions Prototypes
102
******************************************************************************/
103
/**
104
 * Renesas Ethernet API prototypes
105
 **/
106
long R_Ether_Open(unsigned long ch, unsigned char mac_addr[]);
107
long R_Ether_Close(unsigned long ch);
108
long R_Ether_Write(unsigned long ch, void *buf, unsigned long len);
109
long R_Ether_Read(unsigned long ch, void *buf);
110
 
111
/**
112
 * FreeRTOS Ethernet API prototypes.
113
 */
114
 
115
/*
116
 * Configure all the ethernet components (MAC, DMA, PHY) ready for communication.
117
 */
118
void vInitEmac( void );
119
 
120
/*
121
 * Auto negotiate the link, returning pass or fail depending on whether a link
122
 * was established or not.
123
 */
124
long lEMACWaitForLink( void );
125
 
126
/*
127
 * Check the Rx status, and return the number of bytes received if any.
128
 */
129
unsigned long ulEMACRead( void );
130
 
131
/*
132
 * Send uip_len bytes from uip_buf to the Tx descriptors and initiate a Tx.
133
 */
134
void vEMACWrite( void );
135
 
136
 
137
 
138
 
139
/****************************************************/
140
/* Ethernet statistic collection data */
141
struct enet_stats
142
{
143
  unsigned long  rx_packets;      /* total packets received    */
144
  unsigned long  tx_packets;      /* total packets transmitted  */
145
  unsigned long  rx_errors;       /* bad packets received      */
146
  unsigned long  tx_errors;       /* packet transmit problems    */
147
  unsigned long  rx_dropped;      /* no space in buffers      */
148
  unsigned long  tx_dropped;      /* no space available      */
149
  unsigned long  multicast;       /* multicast packets received  */
150
  unsigned long  collisions;
151
 
152
  /* detailed rx_errors: */
153
  unsigned long  rx_length_errors;
154
  unsigned long  rx_over_errors;    /* receiver ring buffer overflow  */
155
  unsigned long  rx_crc_errors;     /* recved pkt with crc error  */
156
  unsigned long  rx_frame_errors;   /* recv'd frame alignment error  */
157
  unsigned long  rx_fifo_errors;    /* recv'r fifo overrun      */
158
  unsigned long  rx_missed_errors;  /* receiver missed packet    */
159
 
160
  /* detailed tx_errors */
161
  unsigned long  tx_aborted_errors;
162
  unsigned long  tx_carrier_errors;
163
  unsigned long  tx_fifo_errors;
164
  unsigned long  tx_heartbeat_errors;
165
  unsigned long  tx_window_errors;
166
};
167
 
168
struct ei_device
169
{
170
  const char      *name;
171
  unsigned char   open;
172
  unsigned char   Tx_act;
173
  unsigned char   Rx_act;
174
  unsigned char   txing;        /* Transmit Active */
175
  unsigned char   irqlock;      /* EDMAC's interrupt disabled when '1'. */
176
  unsigned char   dmaing;       /* EDMAC Active */
177
  ethfifo         *rxcurrent;   /* current receive discripter */
178
  ethfifo         *txcurrent;   /* current transmit discripter */
179
  unsigned char   save_irq;     /* Original dev->irq value. */
180
  struct enet_stats stat;
181
  unsigned char   mac_addr[6];
182
};
183
 
184
#endif /* R_ETHER_H */
185
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.