00001
00051 #ifndef IXETHACCCODELET_P_H
00052 #define IXETHACCCODELET_P_H
00053
00054 #include "IxTypes.h"
00055 #include "IxEthAcc.h"
00056
00058 #define IX_ETHACC_CODELET_QMR_PRIORITY 150
00059
00061 #define IX_ETHACC_CODELET_DB_PRIORITY 91
00062
00063
00064 #ifdef __linux
00065 #define IX_ETHACC_CODELET_USER_INSTRUCTION \
00066 "Unload the codelet module to stop the operation ... \n"
00067 #else
00068 #define IX_ETHACC_CODELET_USER_INSTRUCTION \
00069 "Press ESC at any time to stop the operation ... \n"
00070 #endif
00071
00072
00073
00074
00075
00077 #define IX_ETHACC_CODELET_IS_Q_EMPTY(mbuf_list) (mbuf_list == NULL)
00078
00079
00082 #define IX_ETHACC_CODELET_ADD_MBUF_TO_Q_TAIL(mbuf_list,mbuf_to_add) \
00083 { \
00084 int lockVal = ixOsServIntLock(); \
00085 IX_MBUF* mBufptr; \
00086 mBufptr = mbuf_list; \
00087 if ((mbuf_list) != NULL) \
00088 { \
00089 while(IX_MBUF_NEXT_PKT_IN_CHAIN_PTR((mBufptr)) != NULL) \
00090 { \
00091 mBufptr = (IX_MBUF_NEXT_PKT_IN_CHAIN_PTR((mBufptr))); \
00092 } \
00093 IX_MBUF_NEXT_PKT_IN_CHAIN_PTR((mBufptr)) = (mbuf_to_add); \
00094 IX_MBUF_NEXT_PKT_IN_CHAIN_PTR((mbuf_to_add)) = NULL; \
00095 } \
00096 else \
00097 { \
00098 (mbuf_list) = (mbuf_to_add); \
00099 IX_MBUF_NEXT_PKT_IN_CHAIN_PTR((mbuf_to_add)) = NULL; \
00100 } \
00101 ixOsServIntUnlock(lockVal); \
00102 }
00103
00104
00106 #define IX_ETHACC_CODELET_REMOVE_MBUF_FROM_Q_HEAD(mbuf_list,mbuf_to_rem)\
00107 { \
00108 int lockVal = ixOsServIntLock(); \
00109 if ((mbuf_list) != NULL ) \
00110 { \
00111 (mbuf_to_rem) = (mbuf_list); \
00112 (mbuf_list) = (IX_MBUF_NEXT_PKT_IN_CHAIN_PTR((mbuf_to_rem))); \
00113 } \
00114 else \
00115 { \
00116 (mbuf_to_rem) = NULL; \
00117 } \
00118 ixOsServIntUnlock(lockVal); \
00119 }
00120
00121
00123 #define IX_ETHACC_IS_CODELET_INITIALISED() \
00124 { \
00125 if(!ixEthAccCodeletInitialised) \
00126 { \
00127 printf("Ethernet Access Codelet not yet initialised!\n"); \
00128 return (IX_FAIL); \
00129 } \
00130 }
00131
00132
00134 #define IX_ETHACC_CODELET_DATAGEN(compPtr) \
00135 { \
00136 int i = 0; \
00137 srand(ixOsServTimestampGet()); \
00138 for(i=0; i<IX_ETHACC_CODELET_TXGEN_PCK_LEN; i++) \
00139 { \
00140 compPtr[i] = rand(); \
00141 } \
00142 }
00143
00144
00146 #define IX_ETHACC_CODELET_DATA_VERIFY(m_data, compPtr) \
00147 { \
00148 if(memcmp(&compPtr[0], m_data, IX_ETHACC_CODELET_TXGEN_PCK_LEN) != 0) \
00149 { \
00150 ixOsServLog(LOG_ERROR, "Mbuf data verification failed\n", \
00151 0, 0, 0, 0, 0, 0); \
00152 } \
00153 }
00154
00155
00157 typedef enum
00158 {
00159 IX_ETHACC_CODELET_RX_SINK = 1,
00161 IX_ETHACC_CODELET_SW_LOOPBACK,
00163 IX_ETHACC_CODELET_TXGEN_RXSINK,
00166 IX_ETHACC_CODELET_PHY_LOOPBACK,
00168 IX_ETHACC_CODELET_BRIDGE,
00170 IX_ETHACC_CODELET_ETH_LEARNING
00173 } IxEthAccCodeletOperation;
00174
00175
00177 typedef struct
00178 {
00179 BOOL speed100;
00180 BOOL fullDuplex;
00181 BOOL autonegotiate;
00182 } IxEthAccCodeletPhyConf;
00183
00212 IX_STATUS
00213 ixEthAccCodeletInit(BOOL phyLoopback);
00214
00223 IX_STATUS
00224 ixEthAccCodeletUninit(void);
00225
00237 IX_STATUS
00238 ixEthAccCodeletRxSink(void);
00239
00251 IX_STATUS
00252 ixEthAccCodeletSwLoopback(void);
00253
00254
00269 IX_STATUS
00270 ixEthAccCodeletTxGenRxSinkLoopback(void);
00271
00283 IX_STATUS
00284 ixEthAccCodeletPhyLoopback(void);
00285
00297 IX_STATUS
00298 ixEthAccCodeletBridge(void);
00299
00300
00312 IX_STATUS
00313 ixEthAccCodeletDBLearning(void);
00314
00315
00323 void
00324 ixEthAccCodeletShow(void);
00325
00326 #endif