Select one of the symbols to view example projects that use it.
 
Outline
...
...
#define NX_STM32_ETH_DRIVER_H
#include "tx_api.h"
#include "nx_api.h"
#include "nx_stm32_eth_config.h"
#define NX_DRIVER_ETHERNET_IP
#define NX_DRIVER_ETHERNET_IPV6
#define NX_DRIVER_ETHERNET_ARP
#define NX_DRIVER_ETHERNET_RARP
#define NX_DRIVER_ETHERNET_MTU
#define NX_DRIVER_ETHERNET_FRAME_SIZE
#define NX_DRIVER_DEFERRED_PACKET_RECEIVED
#define NX_DRIVER_DEFERRED_DEVICE_RESET
#define NX_DRIVER_DEFERRED_PACKET_TRANSMITTED
#define NX_DRIVER_STATE_NOT_INITIALIZED
#define NX_DRIVER_STATE_INITIALIZE_FAILED
#define NX_DRIVER_STATE_INITIALIZED
#define NX_DRIVER_STATE_LINK_ENABLED
#define NX_DRIVER_ERROR
#define NX_DRIVER_TX_DESCRIPTORS
#define NX_DRIVER_RX_DESCRIPTORS
NX_DRIVER_INFORMATION_STRUCT
nx_stm32_eth_driver(NX_IP_DRIVER *);
Files
loading...
CodeScopeSTM32 Libraries and Samplesnetxduocommon/drivers/ethernet/nx_stm32_eth_driver.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ #ifndef NX_STM32_ETH_DRIVER_H #define NX_STM32_ETH_DRIVER_H #ifdef __cplusplus /* Yes, C++ compiler is present. Use standard C. */ extern "C" { #endif /* Include ThreadX header file, if not already. */ #ifndef TX_API_H #include "tx_api.h" #endif /* Include NetX header file, if not already. */ #ifndef NX_API_H #include "nx_api.h" #endif /* Determine if the driver's source file is being compiled. The constants and typdefs are only valid within the driver's source file compilation. *//* ... */ #ifdef NX_DRIVER_SOURCE /****** DRIVER SPECIFIC ****** Start of part/vendor specific include area. Include any such files here! */ #include "nx_stm32_eth_config.h" /****** DRIVER SPECIFIC ****** End of part/vendor specific include file area! */ /* Define generic constants and macros for all NetX Ethernet drivers. */ #define NX_DRIVER_ETHERNET_IP 0x0800 #define NX_DRIVER_ETHERNET_IPV6 0x86dd #define NX_DRIVER_ETHERNET_ARP 0x0806 #define NX_DRIVER_ETHERNET_RARP 0x8035 #define NX_DRIVER_ETHERNET_MTU 1514 #define NX_DRIVER_ETHERNET_FRAME_SIZE 14 #define NX_DRIVER_DEFERRED_PACKET_RECEIVED 1 #define NX_DRIVER_DEFERRED_DEVICE_RESET 2 #define NX_DRIVER_DEFERRED_PACKET_TRANSMITTED 4 #define NX_DRIVER_STATE_NOT_INITIALIZED 1 #define NX_DRIVER_STATE_INITIALIZE_FAILED 2 #define NX_DRIVER_STATE_INITIALIZED 3 #define NX_DRIVER_STATE_LINK_ENABLED 4 #define NX_DRIVER_ERROR 90 #define NX_DRIVER_ETHERNET_HEADER_REMOVE(p) \ { \ p -> nx_packet_prepend_ptr = p -> nx_packet_prepend_ptr + NX_DRIVER_ETHERNET_FRAME_SIZE; \ p -> nx_packet_length = p -> nx_packet_length - NX_DRIVER_ETHERNET_FRAME_SIZE; \ ...}... 15 defines /****** DRIVER SPECIFIC ****** Start of part/vendor specific constants area. Include any such constants here! */ /* Define the number of descriptors and attached packets for transmit and receive operations. */ #ifndef NX_DRIVER_TX_DESCRIPTORS #define NX_DRIVER_TX_DESCRIPTORS ETH_TX_DESC_CNT #endif #ifndef NX_DRIVER_RX_DESCRIPTORS #define NX_DRIVER_RX_DESCRIPTORS ETH_RX_DESC_CNT #endif /****** DRIVER SPECIFIC ****** End of part/vendor specific constant area! */ #define NX_DRIVER_CAPABILITY ( NX_INTERFACE_CAPABILITY_IPV4_TX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_IPV4_RX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_TCP_TX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_TCP_RX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_UDP_TX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_UDP_RX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_ICMPV4_TX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_ICMPV4_RX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_ICMPV6_TX_CHECKSUM | \ NX_INTERFACE_CAPABILITY_ICMPV6_RX_CHECKSUM )... /* Define basic Ethernet driver information typedef. Note that this typedefs is designed to be used only in the driver's C file. *//* ... */ typedef struct NX_DRIVER_INFORMATION_STRUCT { /* NetX IP instance that this driver is attached to. */ NX_IP *nx_driver_information_ip_ptr; /* Driver's current state. */ ULONG nx_driver_information_state ; /* Packet pool used for receiving packets. */ NX_PACKET_POOL *nx_driver_information_packet_pool_ptr; /* Define the driver interface association. */ NX_INTERFACE *nx_driver_information_interface; /* Define the deferred event field. This will contain bits representing events deferred from the ISR for processing in the thread context. *//* ... */ ULONG nx_driver_information_deferred_events; /****** DRIVER SPECIFIC ****** Start of part/vendor specific driver information area. Include any such constants here! */ /* Indices to current receive/transmit descriptors. */ UINT nx_driver_information_receive_current_index; UINT nx_driver_information_transmit_current_index; /* Transmit release index. */ UINT nx_driver_information_transmit_release_index; /* Define the number of transmit buffers in use. */ UINT nx_driver_information_number_of_transmit_buffers_in_use; /* Define the association between buffer descriptors and NetX packets. */ NX_PACKET *nx_driver_information_transmit_packets[NX_DRIVER_TX_DESCRIPTORS]; NX_PACKET *nx_driver_information_receive_packets[NX_DRIVER_RX_DESCRIPTORS]; /* Define the size of a rx buffer size. */ ULONG nx_driver_information_rx_buffer_size; ULONG nx_driver_information_multicast_count; /****** DRIVER SPECIFIC ****** End of part/vendor specific driver information area. */ ...} NX_DRIVER_INFORMATION; /* ... */ #endif /****** DRIVER SPECIFIC ****** Start of part/vendor specific external function prototypes. A typical NetX Ethernet driver should expose its entry function as well as its interrupt handling function(s) here. All other functions in the driver should have local scope, i.e., defined as static. *//* ... */ /* Define global driver entry function. */ VOID nx_stm32_eth_driver(NX_IP_DRIVER *driver_req_ptr); /****** DRIVER SPECIFIC ****** End of part/vendor specific external function prototypes. */ #ifdef __cplusplus /* Yes, C++ compiler is present. Use standard C. */ }/* ... */ extern "C" { ... }#endif/* ... */ ...#endif /* NX_STM32_ETH_DRIVER_H */