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

Subversion Repositories openrisc

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

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
#include <stdint.h>
24
 
25
/******************************************************************************
26
Typedef definitions
27
******************************************************************************/
28
struct Descriptor
29
{
30
        __evenaccess uint32_t   status;
31
#if __LIT                               
32
/* Little endian */
33
        __evenaccess uint16_t   size;
34
        __evenaccess uint16_t   bufsize;
35
#else                                   
36
/* Big endian */
37
        __evenaccess uint16_t   bufsize;
38
        __evenaccess uint16_t   size;
39
 
40
#endif
41
        int8_t                                  *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
int32_t R_Ether_Open(uint32_t ch, uint8_t mac_addr[]);
107
int32_t R_Ether_Close(uint32_t ch);
108
int32_t R_Ether_Write(uint32_t ch, void *buf, uint32_t len);
109
int32_t R_Ether_Read(uint32_t 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
  uint32_t  rx_packets;      /* total packets received    */
144
  uint32_t  tx_packets;      /* total packets transmitted  */
145
  uint32_t  rx_errors;       /* bad packets received      */
146
  uint32_t  tx_errors;       /* packet transmit problems    */
147
  uint32_t  rx_dropped;      /* no space in buffers      */
148
  uint32_t  tx_dropped;      /* no space available      */
149
  uint32_t  multicast;       /* multicast packets received  */
150
  uint32_t  collisions;
151
 
152
  /* detailed rx_errors: */
153
  uint32_t  rx_length_errors;
154
  uint32_t  rx_over_errors;    /* receiver ring buffer overflow  */
155
  uint32_t  rx_crc_errors;     /* recved pkt with crc error  */
156
  uint32_t  rx_frame_errors;   /* recv'd frame alignment error  */
157
  uint32_t  rx_fifo_errors;    /* recv'r fifo overrun      */
158
  uint32_t  rx_missed_errors;  /* receiver missed packet    */
159
 
160
  /* detailed tx_errors */
161
  uint32_t  tx_aborted_errors;
162
  uint32_t  tx_carrier_errors;
163
  uint32_t  tx_fifo_errors;
164
  uint32_t  tx_heartbeat_errors;
165
  uint32_t  tx_window_errors;
166
};
167
 
168
struct ei_device
169
{
170
  const int8_t      *name;
171
  uint8_t           open;
172
  uint8_t           Tx_act;
173
  uint8_t           Rx_act;
174
  uint8_t           txing;        /* Transmit Active */
175
  uint8_t           irqlock;      /* EDMAC's interrupt disabled when '1'. */
176
  uint8_t           dmaing;       /* EDMAC Active */
177
  ethfifo           *rxcurrent;   /* current receive discripter */
178
  ethfifo           *txcurrent;   /* current transmit discripter */
179
  uint8_t           save_irq;     /* Original dev->irq value. */
180
  struct enet_stats stat;
181
  uint8_t           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.