lm3s_eth_driver.h
Go to the documentation of this file.
1 /**
2  * @file lm3s_eth_driver.h
3  * @brief Luminary Stellaris LM3S Ethernet controller
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _LM3S_ETH_DRIVER_H
32 #define _LM3S_ETH_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //Interrupt priority grouping
38 #ifndef LM3S_ETH_IRQ_PRIORITY_GROUPING
39  #define LM3S_ETH_IRQ_PRIORITY_GROUPING 3
40 #elif (LM3S_ETH_IRQ_PRIORITY_GROUPING < 0)
41  #error LM3S_ETH_IRQ_PRIORITY_GROUPING parameter is not valid
42 #endif
43 
44 //Ethernet interrupt priority
45 #ifndef LM3S_ETH_IRQ_PRIORITY
46  #define LM3S_ETH_IRQ_PRIORITY 192
47 #elif (LM3S_ETH_IRQ_PRIORITY < 0)
48  #error LM3S_ETH_IRQ_PRIORITY parameter is not valid
49 #endif
50 
51 //C++ guard
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 //Stellaris LM3S Ethernet driver
57 extern const NicDriver lm3sEthDriver;
58 
59 //Stellaris LM3S Ethernet related functions
60 error_t lm3sEthInit(NetInterface *interface);
61 void lm3sEthInitGpio(NetInterface *interface);
62 
63 void lm3sEthTick(NetInterface *interface);
64 
65 void lm3sEthEnableIrq(NetInterface *interface);
66 void lm3sEthDisableIrq(NetInterface *interface);
67 void lm3sEthEventHandler(NetInterface *interface);
68 
70  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary);
71 
73 
75 
76 void lm3sEthWritePhyReg(uint8_t address, uint16_t data);
77 uint16_t lm3sEthReadPhyReg(uint8_t address);
78 
79 void lm3sEthDumpPhyReg(void);
80 
81 //C++ guard
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif
error_t
Error codes.
Definition: error.h:43
uint8_t data[]
Definition: ethernet.h:222
Ipv6Addr address[]
Definition: ipv6.h:316
void lm3sEthEventHandler(NetInterface *interface)
Stellaris LM3S Ethernet event handler.
uint16_t lm3sEthReadPhyReg(uint8_t address)
Read PHY register.
void lm3sEthDumpPhyReg(void)
Dump PHY registers for debugging purpose.
error_t lm3sEthSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
void lm3sEthTick(NetInterface *interface)
Stellaris LM3S Ethernet timer handler.
void lm3sEthEnableIrq(NetInterface *interface)
Enable interrupts.
error_t lm3sEthUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
error_t lm3sEthReceivePacket(NetInterface *interface)
Receive a packet.
void lm3sEthDisableIrq(NetInterface *interface)
Disable interrupts.
error_t lm3sEthInit(NetInterface *interface)
Stellaris LM3S Ethernet controller initialization.
void lm3sEthWritePhyReg(uint8_t address, uint16_t data)
Write PHY register.
const NicDriver lm3sEthDriver
Stellaris LM3S Ethernet driver.
void lm3sEthInitGpio(NetInterface *interface)
GPIO configuration.
#define NetInterface
Definition: net.h:36
#define NetTxAncillary
Definition: net_misc.h:36
Network interface controller abstraction layer.
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
NIC driver.
Definition: nic.h:283