EFM32 Giant Gecko Software Documentation  efm32gg-doc-5.1.2
ksz8851snl.h
Go to the documentation of this file.
1 /**************************************************************************/
15 #ifndef KSZ8851SNL_H__
16 #define KSZ8851SNL_H__
17 
18 /**************************************************************************/
23 /**************************************************************************/
33 #include <stdint.h>
34 #include <stdbool.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
41 /* Interrupt Enable Register Options */
43 #define KSZ8851SNL_INT_LINK_CHANGE 0x8000
44 
45 #define KSZ8851SNL_INT_TX_DONE 0x4000
46 
47 #define KSZ8851SNL_INT_RX_DONE 0x2000
48 
49 #define KSZ8851SNL_INT_RX_OVERRUN 0x0800
50 
51 #define KSZ8851SNL_INT_TX_STOPPED 0x0200
52 
53 #define KSZ8851SNL_INT_RX_STOPPED 0x0100
54 
55 #define KSZ8851SNL_INT_TX_SPACE 0x0040
56 
57 #define KSZ8851SNL_INT_RX_WOL_FRAME 0x0020
58 
59 #define KSZ8851SNL_INT_MAGIC 0x0010
60 
61 #define KSZ8851SNL_INT_LINKUP 0x0008
62 
63 #define KSZ8851SNL_INT_ENERGY 0x0004
64 
65 #define KSZ8851SNL_INT_SPI_ERROR 0x0002
66 
68 #define KSZ8851SNL_INT_ENABLE_MASK (KSZ8851SNL_INT_RX_DONE | \
69  KSZ8851SNL_INT_RX_STOPPED | \
70  KSZ8851SNL_INT_TX_STOPPED | \
71  KSZ8851SNL_INT_LINK_CHANGE | \
72  KSZ8851SNL_INT_SPI_ERROR)
73 
79 typedef struct KSZ8851SLN_mib_s
80 {
82  uint32_t RxByteCnt;
86  uint32_t RxFragmentsCnt;
88  uint32_t RxOversizeCnt;
91  uint32_t RxJabbersCnt;
93  uint32_t RxSymbolErrorCnt;
96  uint32_t RxCRCErrorCnt;
98  uint32_t RxPausePktsCnt;
100  uint32_t RxBroadcastCnt;
102  uint32_t RxMulticastCnt;
104  uint32_t RxUnicastCnt;
106  uint32_t TxByteCnt;
108  uint32_t TxPausePktsCnt;
117  uint32_t TxDeferredCnt;
121 
122 
123 void KSZ8851SNL_Init(void);
124 void KSZ8851SNL_Enable(void);
125 uint16_t KSZ8851SNL_Receive(uint16_t length, uint8_t *buffer);
126 bool KSZ8851SNL_TransmitBegin(uint16_t length);
127 void KSZ8851SNL_Transmit(uint16_t length, const uint8_t *buffer);
128 void KSZ8851SNL_TransmitEnd(uint16_t length);
129 
130 void KSZ8851SNL_MacAddressGet(uint8_t *macAddress);
131 void KSZ8851SNL_PMECRStatusClear(uint16_t flags);
132 void KSZ8851SNL_FrameCounterSet(void);
133 uint16_t KSZ8851SNL_FrameCounterGet(void);
134 void KSZ8851SNL_IntEnable(void);
135 void KSZ8851SNL_IntDisable(void);
136 void KSZ8851SNL_IntClear(uint16_t flags);
137 uint16_t KSZ8851SNL_IntGet(void);
138 uint16_t KSZ8851SNL_RXQCRGet(void);
139 uint16_t KSZ8851SNL_PHYStatusGet(void);
140 void KSZ8851SNL_TxQueueReset(void);
141 void KSZ8851SNL_RxQueueReset(void);
142 
143 void KSZ8851SNL_RegistersDump(void);
144 void KSZ8851SNL_AllRegistersDump(void);
145 void KSZ8851SNL_MIBCountersDump(void);
147 uint16_t KSZ8851SNL_FrameCounterGet(void);
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
156 #endif
uint32_t RxFragmentsCnt
Definition: ksz8851snl.h:86
void KSZ8851SNL_Enable(void)
Enable RX and TX.
Definition: ksz8851snl.c:715
void KSZ8851SNL_IntDisable(void)
disables the chip interrupts
Definition: ksz8851snl.c:511
uint32_t RxUnicastCnt
Definition: ksz8851snl.h:104
void KSZ8851SNL_MacAddressGet(uint8_t *macAddress)
Get the MAC address of the current board.
Definition: ksz8851snl.c:957
void KSZ8851SNL_IntClear(uint16_t flags)
Clear interrupt flags.
Definition: ksz8851snl.c:524
uint32_t TxMulticastPktsCnt
Definition: ksz8851snl.h:112
uint32_t RxCRCErrorCnt
Definition: ksz8851snl.h:96
void KSZ8851SNL_RxQueueReset(void)
Reset RxQueue.
Definition: ksz8851snl.c:594
void KSZ8851SNL_Init(void)
Initialize the registers of the ethernet controller.
Definition: ksz8851snl.c:623
void KSZ8851SNL_TxQueueReset(void)
Reset TxQueue.
Definition: ksz8851snl.c:572
void KSZ8851SNL_AllRegistersDump(void)
Prints the value of the registers of the ethernet controller.
Definition: ksz8851snl.c:440
uint32_t RxUndersizePktCnt
Definition: ksz8851snl.h:84
uint32_t TxBroadcastPktsCnt
Definition: ksz8851snl.h:110
uint32_t RxPausePktsCnt
Definition: ksz8851snl.h:98
uint16_t KSZ8851SNL_PHYStatusGet(void)
Get the PHY status.
Definition: ksz8851snl.c:978
uint32_t RxJabbersCnt
Definition: ksz8851snl.h:91
void KSZ8851SNL_FrameCounterSet(void)
FrameCounter.
Definition: ksz8851snl.c:561
uint32_t TxUnicastPktsCnt
Definition: ksz8851snl.h:114
bool KSZ8851SNL_TransmitBegin(uint16_t length)
Prepares for a transmission of an ethernet frame over the network.
Definition: ksz8851snl.c:744
uint16_t KSZ8851SNL_FrameCounterGet(void)
FrameCounter.
Definition: ksz8851snl.c:615
struct KSZ8851SLN_mib_s KSZ8851SLN_mib_t
The MIB (Management Information Base) Counters that the ksz8851snl device expose to the host...
void KSZ8851SNL_MIBCountersDump(void)
Dumps the Management Information Base Counters.
Definition: ksz8851snl.c:412
void KSZ8851SNL_RegistersDump(void)
Prints the value of the registers of the ethernet controller.
Definition: ksz8851snl.c:460
void KSZ8851SNL_MIBCountersUpdate(void)
Update the Management Information Base Counters.
Definition: ksz8851snl.c:385
void KSZ8851SNL_TransmitEnd(uint16_t length)
Ends a transmission of an ethernet frame to the ethernet controller.
Definition: ksz8851snl.c:826
uint32_t RxOversizeCnt
Definition: ksz8851snl.h:88
uint32_t RxBroadcastCnt
Definition: ksz8851snl.h:100
uint16_t KSZ8851SNL_Receive(uint16_t length, uint8_t *buffer)
Performs the actual receive of a raw frame over the network.
Definition: ksz8851snl.c:882
uint32_t RxSymbolErrorCnt
Definition: ksz8851snl.h:93
void KSZ8851SNL_Transmit(uint16_t length, const uint8_t *buffer)
Transmit a chunk of data to the ethernet controller. The chunk can be either a full ethernet frame or...
Definition: ksz8851snl.c:808
uint16_t KSZ8851SNL_RXQCRGet(void)
Get RXQCR register.
Definition: ksz8851snl.c:553
void KSZ8851SNL_IntEnable(void)
enables the chip interrupts
Definition: ksz8851snl.c:495
uint32_t TxTotalCollisionCnt
Definition: ksz8851snl.h:119
uint32_t RxMulticastCnt
Definition: ksz8851snl.h:102
void KSZ8851SNL_PMECRStatusClear(uint16_t flags)
Clear PMECR (Power Management Event Control Register) flags.
Definition: ksz8851snl.c:544
uint32_t TxPausePktsCnt
Definition: ksz8851snl.h:108
uint16_t KSZ8851SNL_IntGet(void)
Get interrupt flags.
Definition: ksz8851snl.c:532
uint32_t TxByteCnt
Definition: ksz8851snl.h:106
The MIB (Management Information Base) Counters that the ksz8851snl device expose to the host...
Definition: ksz8851snl.h:79
uint32_t RxByteCnt
Definition: ksz8851snl.h:82
uint32_t TxDeferredCnt
Definition: ksz8851snl.h:117