1 /******************************************************************************
\r
3 * Please refer to http://www.renesas.com/disclaimer
\r
4 ******************************************************************************
\r
5 Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved.
\r
6 *******************************************************************************
\r
7 * File Name : hwEthernet.h
\r
9 * Description : Ethernet module device driver
\r
10 ******************************************************************************
\r
11 * History : DD.MM.YYYY Version Description
\r
12 * : 06.10.2009 1.00 First Release
\r
13 ******************************************************************************/
\r
15 #ifndef HWETHERNET_H_INCLUDED
\r
16 #define HWETHERNET_H_INCLUDED
\r
18 /******************************************************************************
\r
19 Includes <System Includes> , "Project Includes"
\r
20 ******************************************************************************/
\r
22 #include "typedefine.h"
\r
24 /******************************************************************************
\r
26 ******************************************************************************/
\r
27 typedef struct Discript
\r
33 struct Discript *next;
\r
36 /******************************************************************************
\r
38 ******************************************************************************/
\r
42 #define ACT 0x80000000
\r
43 #define DL 0x40000000
\r
44 #define FP1 0x20000000
\r
45 #define FP0 0x10000000
\r
46 #define FE 0x08000000
\r
48 #define RFOVER 0x00000200
\r
49 #define RMAF 0x00000080
\r
50 #define RRF 0x00000010
\r
51 #define RTLF 0x00000008
\r
52 #define RTSF 0x00000004
\r
53 #define PRE 0x00000002
\r
54 #define CERF 0x00000001
\r
56 #define ITF 0x00000010
\r
57 #define CND 0x00000008
\r
58 #define DLC 0x00000004
\r
59 #define CD 0x00000002
\r
60 #define TRO 0x00000001
\r
63 * Renesas Ethernet API return defines
\r
65 #define R_ETHER_OK 0
\r
66 #define R_ETHER_ERROR -1
\r
69 /******************************************************************************
\r
71 ******************************************************************************/
\r
73 /******************************************************************************
\r
74 Functions Prototypes
\r
75 ******************************************************************************/
\r
77 * Renesas Ethernet API prototypes
\r
84 extern int32_t R_Ether_Open(uint32_t ch, uint8_t mac_addr[]);
\r
85 extern int32_t R_Ether_Close(uint32_t ch);
\r
86 extern int32_t R_Ether_Write(uint32_t ch, void *buf, uint32_t len);
\r
87 extern int32_t R_Ether_Read(uint32_t ch, void *buf);
\r
89 /* Added for the FreeRTOS demo project. */
\r
90 unsigned long ulEMACRead( void );
\r
91 void vEMACWrite( void );
\r
92 void vInitEmac( void );
\r
93 long lEMACWaitForLink( void );
\r
95 /* Extension of the API functions added to allow PnP link */
\r
97 /* R_Ether_OpenEx opens irrispective of link status */
\r
98 extern int32_t R_Ether_OpenEx(uint32_t ch, uint8_t mac_addr[]);
\r
99 /* Enables/disables operation for the current link */
\r
100 extern int32_t R_Ether_EnableEx(uint32_t ch, int iEnable);
\r
106 /****************************************************/
\r
107 /* Ethernet statistic collection data */
\r
110 uint32_t rx_packets; /* total packets received */
\r
111 uint32_t tx_packets; /* total packets transmitted */
\r
112 uint32_t rx_errors; /* bad packets received */
\r
113 uint32_t tx_errors; /* packet transmit problems */
\r
114 uint32_t rx_dropped; /* no space in buffers */
\r
115 uint32_t tx_dropped; /* no space available */
\r
116 uint32_t multicast; /* multicast packets received */
\r
117 uint32_t collisions;
\r
119 /* detailed rx_errors: */
\r
120 uint32_t rx_length_errors;
\r
121 uint32_t rx_over_errors; /* receiver ring buffer overflow */
\r
122 uint32_t rx_crc_errors; /* recved pkt with crc error */
\r
123 uint32_t rx_frame_errors; /* recv'd frame alignment error */
\r
124 uint32_t rx_fifo_errors; /* recv'r fifo overrun */
\r
125 uint32_t rx_missed_errors; /* receiver missed packet */
\r
127 /* detailed tx_errors */
\r
128 uint32_t tx_aborted_errors;
\r
129 uint32_t tx_carrier_errors;
\r
130 uint32_t tx_fifo_errors;
\r
131 uint32_t tx_heartbeat_errors;
\r
132 uint32_t tx_window_errors;
\r
137 const char8_t *name;
\r
141 uchar8_t txing; /* Transmit Active */
\r
142 uchar8_t irqlock; /* EDMAC's interrupt disabled when '1'. */
\r
143 uchar8_t dmaing; /* EDMAC Active */
\r
144 ethfifo *rxcurrent; /* current receive discriptor */
\r
145 ethfifo *txcurrent; /* current transmit discriptor */
\r
146 uchar8_t save_irq; /* Original dev->irq value. */
\r
147 struct enet_stats stat;
\r
148 uchar8_t mac_addr[6];
\r
151 #endif /* HWETHERNET_H_INCLUDED */
\r