00001 /**************************************************************************/ 00015 #ifndef KSZ8851SNL_H__ 00016 #define KSZ8851SNL_H__ 00017 00018 /**************************************************************************/ 00023 /**************************************************************************/ 00033 #include <stdint.h> 00034 #include <stdbool.h> 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 00041 /* Interrupt Enable Register Options */ 00043 #define KSZ8851SNL_INT_LINK_CHANGE 0x8000 00044 00045 #define KSZ8851SNL_INT_TX_DONE 0x4000 00046 00047 #define KSZ8851SNL_INT_RX_DONE 0x2000 00048 00049 #define KSZ8851SNL_INT_RX_OVERRUN 0x0800 00050 00051 #define KSZ8851SNL_INT_TX_STOPPED 0x0200 00052 00053 #define KSZ8851SNL_INT_RX_STOPPED 0x0100 00054 00055 #define KSZ8851SNL_INT_TX_SPACE 0x0040 00056 00057 #define KSZ8851SNL_INT_RX_WOL_FRAME 0x0020 00058 00059 #define KSZ8851SNL_INT_MAGIC 0x0010 00060 00061 #define KSZ8851SNL_INT_LINKUP 0x0008 00062 00063 #define KSZ8851SNL_INT_ENERGY 0x0004 00064 00065 #define KSZ8851SNL_INT_SPI_ERROR 0x0002 00066 00068 #define KSZ8851SNL_INT_ENABLE_MASK (KSZ8851SNL_INT_RX_DONE | \ 00069 KSZ8851SNL_INT_RX_STOPPED | \ 00070 KSZ8851SNL_INT_TX_STOPPED | \ 00071 KSZ8851SNL_INT_LINK_CHANGE | \ 00072 KSZ8851SNL_INT_SPI_ERROR) 00073 00079 typedef struct KSZ8851SLN_mib_s 00080 { 00082 uint32_t RxByteCnt; 00084 uint32_t RxUndersizePktCnt; 00086 uint32_t RxFragmentsCnt; 00088 uint32_t RxOversizeCnt; 00091 uint32_t RxJabbersCnt; 00093 uint32_t RxSymbolErrorCnt; 00096 uint32_t RxCRCErrorCnt; 00098 uint32_t RxPausePktsCnt; 00100 uint32_t RxBroadcastCnt; 00102 uint32_t RxMulticastCnt; 00104 uint32_t RxUnicastCnt; 00106 uint32_t TxByteCnt; 00108 uint32_t TxPausePktsCnt; 00110 uint32_t TxBroadcastPktsCnt; 00112 uint32_t TxMulticastPktsCnt; 00114 uint32_t TxUnicastPktsCnt; 00117 uint32_t TxDeferredCnt; 00119 uint32_t TxTotalCollisionCnt; 00120 } KSZ8851SLN_mib_t; 00121 00122 00123 void KSZ8851SNL_Init(void); 00124 void KSZ8851SNL_Enable(void); 00125 uint16_t KSZ8851SNL_Receive(uint16_t length, uint8_t *buffer); 00126 bool KSZ8851SNL_TransmitBegin(uint16_t length); 00127 void KSZ8851SNL_Transmit(uint16_t length, const uint8_t *buffer); 00128 void KSZ8851SNL_TransmitEnd(uint16_t length); 00129 00130 void KSZ8851SNL_MacAddressGet(uint8_t *macAddress); 00131 void KSZ8851SNL_PMECRStatusClear(uint16_t flags); 00132 void KSZ8851SNL_FrameCounterSet(void); 00133 uint16_t KSZ8851SNL_FrameCounterGet(void); 00134 void KSZ8851SNL_IntEnable(void); 00135 void KSZ8851SNL_IntDisable(void); 00136 void KSZ8851SNL_IntClear(uint16_t flags); 00137 uint16_t KSZ8851SNL_IntGet(void); 00138 uint16_t KSZ8851SNL_RXQCRGet(void); 00139 uint16_t KSZ8851SNL_PHYStatusGet(void); 00140 void KSZ8851SNL_TxQueueReset(void); 00141 void KSZ8851SNL_RxQueueReset(void); 00142 00143 void KSZ8851SNL_RegistersDump(void); 00144 void KSZ8851SNL_AllRegistersDump(void); 00145 void KSZ8851SNL_MIBCountersDump(void); 00146 void KSZ8851SNL_MIBCountersUpdate(void); 00147 uint16_t KSZ8851SNL_FrameCounterGet(void); 00148 00149 #ifdef __cplusplus 00150 } 00151 #endif 00152 00156 #endif