]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp/lib/rpp/include/sys/ti_drv_emac.h
Yet another place to fix
[pes-rpp/rpp-test-sw.git] / rpp / lib / rpp / include / sys / ti_drv_emac.h
1 /**
2  *  \file   emac.h
3  *
4  *  \brief  EMAC APIs and macros.
5  *
6  *   This file contains the driver API prototypes and macro definitions.
7  */
8
9 /* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
10  * ALL RIGHTS RESERVED
11  */
12 #ifndef __EMAC_H__
13 #define __EMAC_H__
14
15 #include "sys/hw_emac.h"
16 #include "types.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 /*****************************************************************************/
23 /*
24 ** Macros which can be used as speed parameter to the API EMACRMIISpeedSet
25 */
26 #define EMAC_RMIISPEED_10MBPS                 (0x00000000u)
27 #define EMAC_RMIISPEED_100MBPS                (0x00008000u)
28
29 /*
30 ** Macros which can be used as duplexMode parameter to the API
31 ** EMACDuplexSet
32 */
33 #define EMAC_DUPLEX_FULL                      (0x00000001u)
34 #define EMAC_DUPLEX_HALF                      (0x00000000u)
35
36 /*
37 ** Macros which can be used as matchFilt  parameters to the API
38 ** EMACMACAddrSet
39 */
40 /* Address not used to match/filter incoming packets */
41 #define EMAC_MACADDR_NO_MATCH_NO_FILTER       (0x00000000u)
42
43 /* Address will be used to filter incoming packets */
44 #define EMAC_MACADDR_FILTER                   (0x00100000u)
45
46 /* Address will be used to match incoming packets */
47 #define EMAC_MACADDR_MATCH                    (0x00180000u)
48
49 /*
50 ** Macros which can be passed as eoiFlag to EMACRxIntAckToClear API
51 */
52 #define EMAC_INT_CORE0_RX                     (0x1u)
53 #define EMAC_INT_CORE1_RX                     (0x5u)
54 #define EMAC_INT_CORE2_RX                     (0x9u)
55
56 /*
57 ** Macros which can be passed as eoiFlag to EMACTxIntAckToClear API
58 */
59 #define EMAC_INT_CORE0_TX                     (0x2u)
60 #define EMAC_INT_CORE1_TX                     (0x6u)
61 #define EMAC_INT_CORE2_TX                     (0xAu)
62
63 /*****************************************************************************/
64 /*
65 ** Prototypes for the APIs
66 */
67 extern void EMACTxIntPulseEnable(unsigned int emacBase, unsigned int emacCtrlBase,
68                                  unsigned int ctrlCore, unsigned int channel);
69 extern void EMACTxIntPulseDisable(unsigned int emacBase, unsigned int emacCtrlBase,
70                                   unsigned int ctrlCore, unsigned int channel);
71 extern void EMACRxIntPulseEnable(unsigned int emacBase, unsigned int emacCtrlBase,
72                                  unsigned int ctrlCore, unsigned int channel);
73 extern void EMACRxIntPulseDisable(unsigned int emacBase, unsigned int emacCtrlBase,
74                                    unsigned int ctrlCore, unsigned int channel);
75 extern void EMACRMIISpeedSet(unsigned int emacBase, unsigned int speed);
76 extern void EMACDuplexSet(unsigned int emacBase, unsigned int duplexMode);
77 extern void EMACTxEnable(unsigned int emacBase);
78 extern void EMACRxEnable(unsigned int emacBase);
79 extern void EMACTxHdrDescPtrWrite(unsigned int emacBase, unsigned int descHdr,
80                                   unsigned int channel);
81 extern void EMACRxHdrDescPtrWrite(unsigned int emacBase, unsigned int descHdr,
82                                   unsigned int channel);
83 extern void EMACInit(unsigned int emacCtrlBase, unsigned int emacBase);
84 extern void EMACMACSrcAddrSet(unsigned int emacBase, unsigned char *macAddr);
85 extern void EMACMACAddrSet(unsigned int emacBase, unsigned int channel,
86                            unsigned char *macAddr, unsigned int matchFilt);
87 extern void EMACMIIEnable(unsigned int emacBase);
88 extern void EMACRxUnicastSet(unsigned int emacBase, unsigned int channel);
89 extern void EMACCoreIntAck(unsigned int emacBase, unsigned int eoiFlag);
90 extern void EMACTxCPWrite(unsigned int emacBase, unsigned int channel,
91                           unsigned int comPtr);
92 extern uint32_t EMACTxCPRead(unsigned int emacBase, unsigned int channel);
93
94 extern void EMACRxCPWrite(unsigned int emacBase, unsigned int channel,
95                           unsigned int comPtr);
96 extern void EMACRxBroadCastEnable(unsigned int emacBase, unsigned int channel);
97 extern void EMACRxPromiscEnable(unsigned int emacBase, unsigned int channel);
98 extern void EMACNumFreeBufSet(unsigned int emacBase, unsigned int channel,
99                               unsigned int nBuf);
100 extern unsigned int EMACIntVectorGet(unsigned int emacBase);
101 unsigned int EMACIntVectorRawGet(unsigned int emacBase);
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif /* __EMAC_H__ */