mikroSDK Reference Manual
f28m35x_eth_driver.h
Go to the documentation of this file.
1
31#ifndef _F28M35X_ETH_DRIVER_H
32#define _F28M35X_ETH_DRIVER_H
33
34//Dependencies
35#include "core/nic.h"
36
37//Interrupt priority grouping
38#ifndef F28M35X_ETH_IRQ_PRIORITY_GROUPING
39 #define F28M35X_ETH_IRQ_PRIORITY_GROUPING 3
40#elif (F28M35X_ETH_IRQ_PRIORITY_GROUPING < 0)
41 #error F28M35X_ETH_IRQ_PRIORITY_GROUPING parameter is not valid
42#endif
43
44//Ethernet interrupt priority
45#ifndef F28M35X_ETH_IRQ_PRIORITY
46 #define F28M35X_ETH_IRQ_PRIORITY 192
47#elif (F28M35X_ETH_IRQ_PRIORITY < 0)
48 #error F28M35X_ETH_IRQ_PRIORITY parameter is not valid
49#endif
50
51//F28M35x Ethernet MAC registers
52#define MAC_RIS_R HWREG(ETH_BASE + MAC_O_RIS)
53#define MAC_IACK_R HWREG(ETH_BASE + MAC_O_IACK)
54#define MAC_IM_R HWREG(ETH_BASE + MAC_O_IM)
55#define MAC_RCTL_R HWREG(ETH_BASE + MAC_O_RCTL)
56#define MAC_TCTL_R HWREG(ETH_BASE + MAC_O_TCTL)
57#define MAC_DATA_R HWREG(ETH_BASE + MAC_O_DATA)
58#define MAC_IA0_R HWREG(ETH_BASE + MAC_O_IA0)
59#define MAC_IA1_R HWREG(ETH_BASE + MAC_O_IA1)
60#define MAC_THR_R HWREG(ETH_BASE + MAC_O_THR)
61#define MAC_MCTL_R HWREG(ETH_BASE + MAC_O_MCTL)
62#define MAC_MDV_R HWREG(ETH_BASE + MAC_O_MDV)
63#define MAC_MAR_R HWREG(ETH_BASE + 0x28)
64#define MAC_MTXD_R HWREG(ETH_BASE + MAC_O_MTXD)
65#define MAC_MRXD_R HWREG(ETH_BASE + MAC_O_MRXD)
66#define MAC_NP_R HWREG(ETH_BASE + MAC_O_NP)
67#define MAC_TR_R HWREG(ETH_BASE + MAC_O_TR)
68#define MAC_TS_R HWREG(ETH_BASE + MAC_O_TS)
69
70//C++ guard
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75//F28M35x Ethernet MAC driver
76extern const NicDriver f28m35xEthDriver;
77
78//F28M35x Ethernet MAC related functions
79error_t f28m35xEthInit(NetInterface *interface);
80void f28m35xEthInitGpio(NetInterface *interface);
81
82void f28m35xEthTick(NetInterface *interface);
83
84void f28m35xEthEnableIrq(NetInterface *interface);
85void f28m35xEthDisableIrq(NetInterface *interface);
86void f28m35xEthIrqHandler(void);
87void f28m35xEthEventHandler(NetInterface *interface);
88
89error_t f28m35xEthSendPacket(NetInterface *interface,
90 const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary);
91
92error_t f28m35xEthReceivePacket(NetInterface *interface);
93
94error_t f28m35xEthUpdateMacAddrFilter(NetInterface *interface);
95error_t f28m35xEthUpdateMacConfig(NetInterface *interface);
96
97void f28m35xEthWritePhyReg(uint8_t opcode, uint8_t phyAddr,
98 uint8_t regAddr, uint16_t data);
99
100uint16_t f28m35xEthReadPhyReg(uint8_t opcode, uint8_t phyAddr,
101 uint8_t regAddr);
102
103//C++ guard
104#ifdef __cplusplus
105}
106#endif
107
108#endif
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283