+++ /dev/null
-/******************************************************************************\r
-* DISCLAIMER\r
-* Please refer to http://www.renesas.com/disclaimer\r
-******************************************************************************\r
- Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved.\r
-*******************************************************************************\r
-* File Name : r_ether.h\r
-* Version : 1.02\r
-* Description : Ethernet module device driver\r
-******************************************************************************\r
-* History : DD.MM.YYYY Version Description\r
-* : 15.02.2010 1.00 First Release\r
-* : 03.03.2010 1.01 Buffer size is aligned on the 32-byte boundary.\r
-* : 04.06.2010 1.02 RX62N changes\r
-******************************************************************************/\r
-\r
-#ifndef R_ETHER_H\r
-#define R_ETHER_H\r
-\r
-/******************************************************************************\r
-Includes <System Includes> , "Project Includes"\r
-******************************************************************************/\r
-#include <stdint.h>\r
-\r
-/******************************************************************************\r
-Typedef definitions\r
-******************************************************************************/\r
-struct Descriptor\r
-{\r
- __evenaccess uint32_t status;\r
-#if __LIT \r
-/* Little endian */\r
- __evenaccess uint16_t size;\r
- __evenaccess uint16_t bufsize;\r
-#else \r
-/* Big endian */\r
- __evenaccess uint16_t bufsize;\r
- __evenaccess uint16_t size;\r
-\r
-#endif\r
- int8_t *buf_p;\r
- struct Descriptor *next;\r
-};\r
-\r
-typedef struct Descriptor ethfifo;\r
-\r
-typedef enum _NETLNK\r
-{\r
- PHY_NO_LINK = 0,\r
- PHY_LINK_10H,\r
- PHY_LINK_10F,\r
- PHY_LINK_100H,\r
- PHY_LINK_100F\r
- \r
-} NETLNK;\r
-\r
-/******************************************************************************\r
-Macro definitions\r
-******************************************************************************/\r
-#define BUFSIZE 256 /* Must be 32-bit aligned */\r
-#define ENTRY 8 /* Number of RX and TX buffers */\r
-\r
-#define ACT 0x80000000\r
-#define DL 0x40000000\r
-#define FP1 0x20000000\r
-#define FP0 0x10000000\r
-#define FE 0x08000000\r
-\r
-#define RFOVER 0x00000200\r
-#define RAD 0x00000100\r
-#define RMAF 0x00000080\r
-#define RRF 0x00000010\r
-#define RTLF 0x00000008\r
-#define RTSF 0x00000004\r
-#define PRE 0x00000002\r
-#define CERF 0x00000001\r
-\r
-#define TAD 0x00000100\r
-#define CND 0x00000008\r
-#define DLC 0x00000004\r
-#define CD 0x00000002\r
-#define TRO 0x00000001\r
-\r
-/** \r
- * Renesas Ethernet API return defines\r
- **/\r
-#define R_ETHER_OK 0\r
-#define R_ETHER_ERROR -1\r
-\r
-/* Ether Interface definitions */\r
-#define ETH_RMII_MODE 0\r
-#define ETH_MII_MODE 1\r
-/* Select Ether Interface Mode */\r
-#define ETH_MODE_SEL ETH_MII_MODE\r
-\r
-/******************************************************************************\r
-Variable Externs\r
-******************************************************************************/\r
-\r
-/******************************************************************************\r
-Functions Prototypes\r
-******************************************************************************/\r
-/** \r
- * Renesas Ethernet API prototypes\r
- **/\r
-int32_t R_Ether_Open(uint32_t ch, uint8_t mac_addr[]);\r
-int32_t R_Ether_Close(uint32_t ch);\r
-int32_t R_Ether_Write(uint32_t ch, void *buf, uint32_t len);\r
-int32_t R_Ether_Read(uint32_t ch, void *buf);\r
-\r
-/**\r
- * FreeRTOS Ethernet API prototypes.\r
- */\r
-\r
-/*\r
- * Configure all the ethernet components (MAC, DMA, PHY) ready for communication.\r
- */\r
-void vInitEmac( void );\r
-\r
-/*\r
- * Auto negotiate the link, returning pass or fail depending on whether a link\r
- * was established or not.\r
- */\r
-long lEMACWaitForLink( void );\r
-\r
-/*\r
- * Check the Rx status, and return the number of bytes received if any.\r
- */\r
-unsigned long ulEMACRead( void );\r
-\r
-/*\r
- * Send uip_len bytes from uip_buf to the Tx descriptors and initiate a Tx.\r
- */\r
-void vEMACWrite( void );\r
-\r
-\r
-\r
-\r
-/****************************************************/\r
-/* Ethernet statistic collection data */\r
-struct enet_stats\r
-{\r
- uint32_t rx_packets; /* total packets received */\r
- uint32_t tx_packets; /* total packets transmitted */\r
- uint32_t rx_errors; /* bad packets received */\r
- uint32_t tx_errors; /* packet transmit problems */\r
- uint32_t rx_dropped; /* no space in buffers */\r
- uint32_t tx_dropped; /* no space available */\r
- uint32_t multicast; /* multicast packets received */\r
- uint32_t collisions;\r
-\r
- /* detailed rx_errors: */\r
- uint32_t rx_length_errors;\r
- uint32_t rx_over_errors; /* receiver ring buffer overflow */\r
- uint32_t rx_crc_errors; /* recved pkt with crc error */\r
- uint32_t rx_frame_errors; /* recv'd frame alignment error */\r
- uint32_t rx_fifo_errors; /* recv'r fifo overrun */\r
- uint32_t rx_missed_errors; /* receiver missed packet */\r
-\r
- /* detailed tx_errors */\r
- uint32_t tx_aborted_errors;\r
- uint32_t tx_carrier_errors;\r
- uint32_t tx_fifo_errors;\r
- uint32_t tx_heartbeat_errors;\r
- uint32_t tx_window_errors;\r
-};\r
-\r
-struct ei_device\r
-{\r
- const int8_t *name;\r
- uint8_t open;\r
- uint8_t Tx_act;\r
- uint8_t Rx_act;\r
- uint8_t txing; /* Transmit Active */\r
- uint8_t irqlock; /* EDMAC's interrupt disabled when '1'. */\r
- uint8_t dmaing; /* EDMAC Active */\r
- ethfifo *rxcurrent; /* current receive discripter */\r
- ethfifo *txcurrent; /* current transmit discripter */\r
- uint8_t save_irq; /* Original dev->irq value. */\r
- struct enet_stats stat;\r
- uint8_t mac_addr[6];\r
-};\r
-\r
-#endif /* R_ETHER_H */\r
-\r