1 #ifndef KSZ8851_H_INCLUDED 2 #define KSZ8851_H_INCLUDED 56 enum ksz8851_opstate_t {
63 enum ksz8851_leds_mode_t {
64 KSZ8851_LEDS_MODE_LINK_ACT_100BT,
65 KSZ8851_LEDS_MODE_LINK_ACT,
66 KSZ8851_LEDS_MODE_OFF,
69 enum ksz8851_leds_test_t {
71 KSZ8851_LEDS_TEST_OFF,
72 KSZ8851_LEDS_TEST_GREEN,
73 KSZ8851_LEDS_TEST_BOTH,
76 struct ksz8851_xfer_t {
82 struct ksz8851_events_t {
83 struct process *MonitorProcess;
84 process_event_t EventMedia;
87 struct ksz8851_state_t {
89 struct process Process;
92 const struct ksz8851_t *Module;
93 const struct ksz8851_events_t *Events;
94 enum ksz8851_opstate_t Opstate;
95 struct ksz8851_xfer_t RxXfer;
96 struct ksz8851_xfer_t TxXfer;
97 uint16_t RxFrameCount;
103 struct ksz8851_state_t *State;
104 const struct spi_t *Spi;
106 uint32_t SpiBaudrate;
109 bool ResetActiveHigh;
110 bool PowerSaveDefault;
113 void EthInit(
const struct ksz8851_t *Module,
const struct ksz8851_events_t *Events);
114 void EthPowerSave(
const struct ksz8851_t *Module,
bool IsOn);
115 void EthSetLedsMode(
const struct ksz8851_t *Module,
enum ksz8851_leds_mode_t
Mode);
116 void EthDoLedsTest(
const struct ksz8851_t *Module,
enum ksz8851_leds_test_t Test);
117 void EthRead(
struct process *Process,
void *Data,
int ByteCount,
ep_if_xfer_cb_t Callback);
118 void EthWrite(
struct process *Process,
void *Data,
int ByteCount,
ep_if_xfer_cb_t Callback);
119 void EthAbortTransfer(
struct process *Process);
120 void EthInterruptCb(
const struct ksz8851_t *Module);
122 static inline bool EthCableConnected(
const struct ksz8851_t *Module)
124 return (Module->State->Opstate == KSZ8851_ON);
Header file for the EVE millisecond-scale work scheduling.
Driver for the MCU's SPI blocks.
ep_xfer_status_t(* ep_if_xfer_cb_t)(ep_xfer_status_t status, uint32_t xferred, uint32_t remaining)