1 /**\r
2 * @file nimu_icssEth.h\r
3 * @brief\r
4 * Include file for NDK NIMU transport driver interface for ICSS\r
5 */\r
6 \r
7 /* Copyright (C) 2015-2018 Texas Instruments Incorporated - http://www.ti.com/\r
8 *\r
9 * Redistribution and use in source and binary forms, with or without \r
10 * modification, are permitted provided that the following conditions \r
11 * are met:\r
12 *\r
13 * Redistributions of source code must retain the above copyright \r
14 * notice, this list of conditions and the following disclaimer.\r
15 *\r
16 * Redistributions in binary form must reproduce the above copyright\r
17 * notice, this list of conditions and the following disclaimer in the \r
18 * documentation and/or other materials provided with the \r
19 * distribution.\r
20 *\r
21 * Neither the name of Texas Instruments Incorporated nor the names of\r
22 * its contributors may be used to endorse or promote products derived\r
23 * from this software without specific prior written permission.\r
24 *\r
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
36 *\r
37 */\r
38 \r
39 #ifndef ICSS_NIMU_ETH_H_\r
40 #define ICSS_NIMU_ETH_H_\r
41 \r
42 #include <stdint.h>\r
43 #include "ti/ndk/inc/stkmain.h"\r
44 #include "ti/ndk/inc/os/osif.h"\r
45 #include "ti/drv/icss_emac/icss_emacDrv.h"\r
46 \r
47 #ifdef __cplusplus\r
48 extern "C" {\r
49 #endif\r
50 \r
51 /**\r
52 * @def NIMU_ICSS_PKT_PREPAD\r
53 * Pre-Pad Packet Data Offset\r
54 * The TCP/IP stack library requires that every packet device\r
55 * include enough L2 header room for all supported headers. In\r
56 * order to support PPPoE, this requires a 22 byte L2 header.\r
57 * Thus, since standard Ethernet is only 14 bytes, we must add\r
58 * on an additional 8 byte offset, or PPPoE can not function\r
59 * with our driver.\r
60 */\r
61 #define NIMU_ICSS_PKT_PREPAD ((uint32_t)0U)\r
62 \r
63 /**\r
64 * @def NIMU_ICSS_MAX_MCAST\r
65 * Multicast Address List Size\r
66 */\r
67 #define NIMU_ICSS_MAX_MCAST ((uint32_t)31U)\r
68 \r
69 \r
70 \r
71 \r
72 /**\r
73 * @brief NIMU_ICSS Driver Status\r
74 */\r
75 typedef enum NIMU_IcssStatus_e {\r
76 NIMU_STAT_UNKNOWN=0, /**< Unknown status */\r
77 NIMU_STAT_DOWN, /**< NDK driver is not up */\r
78 NIMU_STAT_UP, /**< NDK driver is up */\r
79 NIMU_STAT_PROGRESS /**< Driver init in progress */\r
80 } NIMU_IcssStatus;\r
81 \r
82 /** \r
83 * @brief \r
84 * Packet device information\r
85 *\r
86 * @details\r
87 * Packet device information\r
88 */\r
89 typedef struct NIMU_IcssPdInfo_s \r
90 {\r
91 \r
92 uint32_t PhysIdx; /**< Physical index of this device (0 to n-1) */\r
93 void* hEther; /**< Handle to logical driver */\r
94 STKEVENT_Handle hEvent; /**< Semaphore handle used by NDK stack and driver to communicate any\r
95 pending Rx events that need to be serviced by NDK ethernet stack */\r
96 uint8_t bMacAddr[6U]; /**< MAC Address*/\r
97 uint32_t Filter; /**< Current RX filter */\r
98 uint32_t OldMCastCnt; /**< Previous MCast Address Countr */\r
99 uint8_t bOldMCast[6U*NIMU_ICSS_MAX_MCAST]; /**< Previous Multicast list configured by the Application */\r
100 uint32_t MCastCnt; /**< Current MCast Address Countr */\r
101 uint8_t bMCast[6U*NIMU_ICSS_MAX_MCAST]; /**< Multicast list configured by the Application */\r
102 uint32_t TxFree; /**< Transmitter "free" flag */\r
103 PBMQ PBMQ_tx; /**< Tx queue (one for each PKT device) */\r
104 PBMQ PBMQ_rx; /**< Rx queue (one for each PKT device) */\r
105 ICSS_EmacHandle nimuDrvHandle; /**< Stores any PRU sepecific data prussMemoryHandle_t */\r
106 } NIMU_IcssPdInfo;\r
107 \r
108 \r
109 /**\r
110 * @brief The EMAC Initialization Function\r
111 * @details The function is used to initialize and register the EMAC\r
112 * with the Network Interface Management Unit (NIMU)\r
113 *\r
114 * @internal\r
115 *\r
116 * @param[in] hEvent Stack Event Handle.\r
117 *\r
118 * @retval Success - 0\r
119 * Error - <0\r
120 */\r
121 int32_t NIMU_ICSS_EmacInit (STKEVENT_Handle hEvent);\r
122 \r
123 /* For backward compatibility */\r
124 #define EmacInit (NIMU_ICSS_EmacInit)\r
125 \r
126 \r
127 /**\r
128 * @brief The function is used to get the status of ndk driver\r
129 *\r
130 * @param[in] instID Stack Driver instance(0 in the implementation)\r
131 *\r
132 * @retval ndk driver status\r
133 */\r
134 uint32_t NIMU_ICSS_getNdkStatus(uint8_t instID);\r
135 \r
136 /* For backward compatibility */\r
137 #define GetNdkStatus (NIMU_ICSS_getNdkStatus)\r
138 \r
139 #ifdef __cplusplus\r
140 }\r
141 #endif\r
142 \r
143 #endif /* ICSS_NIMU_ETH_H_ */\r
144 \r