Network Component  Version 7.13.1
MDK Middleware for IPv4 and IPv6 Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
net_evr.h
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2  * MDK Middleware - Component ::Network
3  * Copyright (c) 2004-2020 Arm Limited (or its affiliates). All rights reserved.
4  *------------------------------------------------------------------------------
5  * Name: net_evr.h
6  * Purpose: Network definitions for Event Recorder
7  * Rev.: V7.13.0
8  *----------------------------------------------------------------------------*/
9 
10 #ifdef DEBUG_EVR
11 #include <string.h>
12 #include "EventRecorder.h"
13 
14 #ifndef __STATIC_INLINE
15  #define __STATIC_INLINE static __inline __attribute__((always_inline))
16 #endif
17 
18 extern uint32_t net_dbg_buf[9]; ///< Buffer for complex debug structures
19 
20 /// Union for accessing the debug parameters.
21 union evr_access {
22  uint32_t u32[9]; ///< 4-byte access
23  uint16_t u16[18]; ///< 2-byte access
24  uint8_t u8 [36]; ///< 1-byte access
25 };
26 #define evr_buf (*(union evr_access *)&net_dbg_buf)
27 
28 // Local definition of NET_ADDR structure.
29 typedef struct evr_addr {
30  int16_t type;
31  uint16_t port;
32  uint8_t addr[16];
33 } EVR_ADDR;
34 
35 // Network components ----------------------------------------------------------
36 #define EvtNetSYS 0xC0 ///< System Core
37 #define EvtNetMEM 0xC1 ///< Memory Management
38 #define EvtNetETH 0xC2 ///< ETH Interface
39 #define EvtNetWiFi 0xDD ///< WiFi Interface
40 #define EvtNetPPP 0xC3 ///< PPP Interface
41 #define EvtNetSLIP 0xC4 ///< SLIP Interface
42 #define EvtNetLOOP 0xC5 ///< Loopback Interface
43 
44 #define EvtNetIP4 0xC6 ///< IPv4 Core
45 #define EvtNetICMP 0xC7 ///< ICMP Control
46 #define EvtNetIGMP 0xC8 ///< IGMP Group Management
47 #define EvtNetNBNS 0xC9 ///< NetBIOS Name Service Client
48 #define EvtNetDHCP 0xCA ///< Dynamic Host Configuration Client
49 #define EvtNetARP 0xCB ///< Ethernet Address Resolution
50 
51 #define EvtNetIP6 0xCC ///< IPv6 Core
52 #define EvtNetICMP6 0xCD ///< ICMPv6 Control
53 #define EvtNetDHCP6 0xCE ///< Dynamic Host Configuration Client for IPv6
54 #define EvtNetNDP 0xCF ///< Neighbor Discovery for IPv6
55 
56 #define EvtNetUDP 0xD0 ///< Socket UDP
57 #define EvtNetTCP 0xD1 ///< Socket TCP
58 #define EvtNetBSD 0xD2 ///< Socket BSD
59 
60 #define EvtNetHTTPs 0xD3 ///< Web Server
61 #define EvtNetFTPs 0xD4 ///< File Transfer Server
62 #define EvtNetFTPc 0xD5 ///< File Transfer Client
63 #define EvtNetTeln 0xD6 ///< Telnet Server
64 #define EvtNetTFTPs 0xD7 ///< Trivial File Transfer Server
65 #define EvtNetTFTPc 0xD8 ///< Trivial File Transfer Client
66 #define EvtNetSMTP 0xD9 ///< Simple Mail Transfer Client
67 #define EvtNetDNS 0xDA ///< Domain Name Service Client
68 #define EvtNetSNMP 0xDB ///< Simple Network Management Agent
69 #define EvtNetSNTP 0xDC ///< Simple Network Time Client
70 #endif
71 
72 
73 // NetSYS event identifiers ----------------------------------------------------
74 #ifdef DEBUG_EVR
75 #define EvtNetSYS_InitSystem EventID (EventLevelOp, EvtNetSYS, 0)
76 #define EvtNetSYS_ThreadCreateFailed EventID (EventLevelError, EvtNetSYS, 1)
77 #define EvtNetSYS_TimerCreateFailed EventID (EventLevelError, EvtNetSYS, 2)
78 #define EvtNetSYS_InitComplete EventID (EventLevelOp, EvtNetSYS, 3)
79 #define EvtNetSYS_GetOption EventID (EventLevelAPI, EvtNetSYS, 4)
80 #define EvtNetSYS_SetOption EventID (EventLevelAPI, EvtNetSYS, 5)
81 #define EvtNetSYS_SetDefault EventID (EventLevelAPI, EvtNetSYS, 6)
82 #define EvtNetSYS_SetHostName EventID (EventLevelAPI, EvtNetSYS, 7)
83 #define EvtNetSYS_UninitSystem EventID (EventLevelOp, EvtNetSYS, 8)
84 #define EvtNetSYS_UninitComplete EventID (EventLevelOp, EvtNetSYS, 9)
85 #endif
86 
87 /**
88  \brief Event on network initialize start (Op)
89  \param lib_version encoded library version BCD (MMmmbbbb)
90  - MM: Major
91  - mm: minor
92  - bbbb: build
93  */
94 #ifdef DEBUG_EVR
95  __STATIC_INLINE void EvrNetSYS_InitSystem(uint32_t lib_version) {
96  uint16_t version = (uint16_t)(lib_version >> 16);
97  uint16_t build = (uint16_t)(lib_version);
98  EventRecord2 (EvtNetSYS_InitSystem, version, build);
99  }
100 #else
101  #define EvrNetSYS_InitSystem(lib_version)
102 #endif
103 
104 /**
105  \brief Event on failure to create network core thread (Error)
106  */
107 #ifdef DEBUG_EVR
109  EventRecord2 (EvtNetSYS_ThreadCreateFailed, 0, 0);
110  }
111 #else
112  #define EvrNetSYS_ThreadCreateFailed()
113 #endif
114 
115 /**
116  \brief Event on failure to create network interval timer (Error)
117  */
118 #ifdef DEBUG_EVR
120  EventRecord2 (EvtNetSYS_TimerCreateFailed, 0, 0);
121  }
122 #else
123  #define EvrNetSYS_TimerCreateFailed()
124 #endif
125 
126 /**
127  \brief Event on network initialize complete (Op)
128  */
129 #ifdef DEBUG_EVR
131  EventRecord2 (EvtNetSYS_InitComplete, 0, 0);
132  }
133 #else
134  #define EvrNetSYS_InitComplete()
135 #endif
136 
137 /**
138  \brief Event on set interface option (API)
139  \param if_id network interface identifier
140  \param option interface option to set
141  */
142 #ifdef DEBUG_EVR
143  __STATIC_INLINE void EvrNetSYS_SetOption(uint16_t if_id, int32_t option) {
144  EventRecord2 (EvtNetSYS_SetOption, if_id, (uint32_t)option);
145  }
146 #else
147  #define EvrNetSYS_SetOption(if_id, option)
148 #endif
149 
150 /**
151  \brief Event on get interface option (API)
152  \param if_id network interface identifier
153  \param option interface option to get
154  */
155 #ifdef DEBUG_EVR
156  __STATIC_INLINE void EvrNetSYS_GetOption(uint16_t if_id, int32_t option) {
157  EventRecord2 (EvtNetSYS_GetOption, if_id, (uint32_t)option);
158  }
159 #else
160  #define EvrNetSYS_GetOption(if_id, option)
161 #endif
162 
163 /**
164  \brief Event on set default interface (API)
165  \param if_id network interface identifier
166  \param ip_version internet protocol version to use
167  */
168 #ifdef DEBUG_EVR
169  __STATIC_INLINE void EvrNetSYS_SetDefault(uint16_t if_id, int32_t ip_version) {
170  EventRecord2 (EvtNetSYS_SetDefault, if_id, (uint32_t)ip_version);
171  }
172 #else
173  #define EvrNetSYS_SetDefault(if_id, ip_version)
174 #endif
175 
176 /**
177  \brief Event on set local host name (API)
178  \param name pointer to host name string
179  \param length length of host name string
180  */
181 #ifdef DEBUG_EVR
182  __STATIC_INLINE void EvrNetSYS_SetHostName(const char *name, uint32_t length) {
183  EventRecordData (EvtNetSYS_SetHostName, name, length);
184  }
185 #else
186  #define EvrNetSYS_SetHostName(name, length)
187 #endif
188 
189 /**
190  \brief Event on network uninitialize start (Op)
191  */
192 #ifdef DEBUG_EVR
194  EventRecord2 (EvtNetSYS_UninitSystem, 0, 0);
195  }
196 #else
197  #define EvrNetSYS_UninitSystem()
198 #endif
199 
200 /**
201  \brief Event on network uninitialize complete (Op)
202  */
203 #ifdef DEBUG_EVR
205  EventRecord2 (EvtNetSYS_UninitComplete, 0, 0);
206  }
207 #else
208  #define EvrNetSYS_UninitComplete()
209 #endif
210 
211 
212 // NetMEM event identifiers ----------------------------------------------------
213 #ifdef DEBUG_EVR
214 #define EvtNetMEM_InitMemory EventID (EventLevelOp, EvtNetMEM, 0)
215 #define EvtNetMEM_AllocMemory EventID (EventLevelOp, EvtNetMEM, 1)
216 #define EvtNetMEM_AllocLimitExceeded EventID (EventLevelOp, EvtNetMEM, 2)
217 #define EvtNetMEM_AllocOutOfMemory EventID (EventLevelError, EvtNetMEM, 3)
218 #define EvtNetMEM_ShrinkMemory EventID (EventLevelOp, EvtNetMEM, 4)
219 #define EvtNetMEM_FreeMemory EventID (EventLevelOp, EvtNetMEM, 5)
220 #define EvtNetMEM_FreeInvalidBlock EventID (EventLevelError, EvtNetMEM, 6)
221 #define EvtNetMEM_FreeLinkCorrupted EventID (EventLevelError, EvtNetMEM, 7)
222 #define EvtNetMEM_UninitMemory EventID (EventLevelOp, EvtNetMEM, 8)
223 #endif
224 
225 /**
226  \brief Event on initialize memory management (Op)
227  \param pool_size size of the memory pool
228  \param limit0 usage limit 0 (limit for ethernet and BSD receive buffering)
229  \param limit1 usage limit 1 (limit for TCP send buffering)
230  */
231 #ifdef DEBUG_EVR
232  __STATIC_INLINE void EvrNetMEM_InitMemory(uint32_t pool_size, uint32_t limit0, uint32_t limit1) {
233  EventRecord4 (EvtNetMEM_InitMemory, pool_size, limit0, limit1, 0);
234  }
235 #else
236  #define EvrNetMEM_InitMemory(pool_size, limit0, limit1)
237 #endif
238 
239 /**
240  \brief Event on request to allocate memory (Op)
241  \param size requested memory size in bytes
242  \param used used memory status in bytes
243  \param blocks number of used blocks status
244  */
245 #ifdef DEBUG_EVR
246  __STATIC_INLINE void EvrNetMEM_AllocMemory(uint32_t size, uint32_t used, uint32_t blocks) {
247  EventRecord4 (EvtNetMEM_AllocMemory, size, used, blocks, 0);
248  }
249 #else
250  #define EvrNetMEM_AllocMemory(size, used, blocks)
251 #endif
252 
253 /**
254  \brief Event on memory allocation limit exceeded (Op)
255  \param size requested memory size in bytes
256  \param used used memory status in bytes
257  \param blocks number of used blocks status
258  */
259 #ifdef DEBUG_EVR
260  __STATIC_INLINE void EvrNetMEM_AllocLimitExceeded(uint32_t size, uint32_t used, uint32_t blocks) {
261  EventRecord4 (EvtNetMEM_AllocLimitExceeded, size, used, blocks, 0);
262  }
263 #else
264  #define EvrNetMEM_AllocLimitExceeded(size, used, blocks)
265 #endif
266 
267 /**
268  \brief Event on out of memory error (Error)
269  \param size requested memory size in bytes
270  \param used used memory status in bytes
271  \param blocks number of used blocks status
272  */
273 #ifdef DEBUG_EVR
274  __STATIC_INLINE void EvrNetMEM_AllocOutOfMemory(uint32_t size, uint32_t used, uint32_t blocks) {
275  EventRecord4 (EvtNetMEM_AllocOutOfMemory, size, used, blocks, 0);
276  }
277 #else
278  #define EvrNetMEM_AllocOutOfMemory(size, used, blocks)
279 #endif
280 
281 /**
282  \brief Event on shrink memory block request (Op)
283  \param new_size new block size
284  \param old_size current block size
285  */
286 #ifdef DEBUG_EVR
287  __STATIC_INLINE void EvrNetMEM_ShrinkMemory(uint32_t new_size, uint32_t old_size) {
288  EventRecord2 (EvtNetMEM_ShrinkMemory, new_size, old_size);
289  }
290 #else
291  #define EvrNetMEM_ShrinkMemory(new_size, old_size)
292 #endif
293 
294 /**
295  \brief Event on request to free memory (Op)
296  \param size size of the memory block to free
297  \param used used memory status in bytes
298  \param blocks number of used blocks status
299  */
300 #ifdef DEBUG_EVR
301  __STATIC_INLINE void EvrNetMEM_FreeMemory(uint32_t size, uint32_t used, uint32_t blocks) {
302  EventRecord4 (EvtNetMEM_FreeMemory, size, used, blocks, 0);
303  }
304 #else
305  #define EvrNetMEM_FreeMemory(size, used, blocks)
306 #endif
307 
308 /**
309  \brief Event on attempt to free an invalid memory (Error)
310  \param size size of the memory block to free
311  */
312 #ifdef DEBUG_EVR
314  EventRecord2 (EvtNetMEM_FreeInvalidBlock, size, 0);
315  }
316 #else
317  #define EvrNetMEM_FreeInvalidBlock(size)
318 #endif
319 
320 /**
321  \brief Event on corrupted internal memory link (Error)
322  \param size size of the memory block to free
323  */
324 #ifdef DEBUG_EVR
326  EventRecord2 (EvtNetMEM_FreeLinkCorrupted, size, 0);
327  }
328 #else
329  #define EvrNetMEM_FreeLinkCorrupted(size)
330 #endif
331 
332 /**
333  \brief Event on de-initialize memory management (Op)
334  */
335 #ifdef DEBUG_EVR
337  EventRecord2 (EvtNetMEM_UninitMemory, 0, 0);
338  }
339 #else
340  #define EvrNetMEM_UninitMemory()
341 #endif
342 
343 
344 // NetETH event identifiers ----------------------------------------------------
345 #ifdef DEBUG_EVR
346 #define EvtNetETH_InitInterface EventID (EventLevelOp, EvtNetETH, 0)
347 #define EvtNetETH_MacAddressConfigError EventID (EventLevelError, EvtNetETH, 1)
348 #define EvtNetETH_VlanConfigError EventID (EventLevelError, EvtNetETH, 43)
349 #define EvtNetETH_VlanInitError EventID (EventLevelError, EvtNetETH, 44)
350 #define EvtNetETH_PhyDriverConfigError EventID (EventLevelError, EvtNetETH, 2)
351 #define EvtNetETH_PhyDriverInitError EventID (EventLevelError, EvtNetETH, 3)
352 #define EvtNetETH_Ip4ConfigError EventID (EventLevelError, EvtNetETH, 4)
353 #define EvtNetETH_Ip6ConfigError EventID (EventLevelError, EvtNetETH, 5)
354 #define EvtNetETH_ThreadCreateFailed EventID (EventLevelError, EvtNetETH, 6)
355 #define EvtNetETH_GetOptionInvalidParameter EventID (EventLevelError, EvtNetETH, 7)
356 #define EvtNetETH_SetOptionInvalidParameter EventID (EventLevelError, EvtNetETH, 8)
357 #define EvtNetETH_SetMacAddress EventID (EventLevelOp, EvtNetETH, 9)
358 #define EvtNetETH_SetVlanIdentifier EventID (EventLevelOp, EvtNetETH, 10)
359 #define EvtNetETH_SetIp4Address EventID (EventLevelOp, EvtNetETH, 11)
360 #define EvtNetETH_SetIp4SubnetMask EventID (EventLevelOp, EvtNetETH, 12)
361 #define EvtNetETH_SetIp4DefaultGateway EventID (EventLevelOp, EvtNetETH, 13)
362 #define EvtNetETH_SetIp4PrimaryDNS EventID (EventLevelOp, EvtNetETH, 14)
363 #define EvtNetETH_SetIp4SecondaryDNS EventID (EventLevelOp, EvtNetETH, 15)
364 #define EvtNetETH_SetIp4Mtu EventID (EventLevelOp, EvtNetETH, 16)
365 #define EvtNetETH_SetIp6Address EventID (EventLevelOp, EvtNetETH, 17)
366 #define EvtNetETH_SetIp6DefaultGateway EventID (EventLevelOp, EvtNetETH, 18)
367 #define EvtNetETH_SetIp6PrimaryDNS EventID (EventLevelOp, EvtNetETH, 19)
368 #define EvtNetETH_SetIp6SecondaryDNS EventID (EventLevelOp, EvtNetETH, 20)
369 #define EvtNetETH_SetIp6PrefixLength EventID (EventLevelOp, EvtNetETH, 21)
370 #define EvtNetETH_SendFrame EventID (EventLevelOp, EvtNetETH, 22)
371 #define EvtNetETH_LinkDownError EventID (EventLevelError, EvtNetETH, 23)
372 #define EvtNetETH_SendDataTooLarge EventID (EventLevelError, EvtNetETH, 24)
373 #define EvtNetETH_SendIp4Disabled EventID (EventLevelError, EvtNetETH, 45)
374 #define EvtNetETH_Ip4LocalAddressUndefined EventID (EventLevelError, EvtNetETH, 25)
375 #define EvtNetETH_Ip4MacAddressUnresolved EventID (EventLevelError, EvtNetETH, 26)
376 #define EvtNetETH_EnqueueFrame EventID (EventLevelOp, EvtNetETH, 27)
377 #define EvtNetETH_SendIp6Disabled EventID (EventLevelError, EvtNetETH, 45) // Max
378 #define EvtNetETH_Ip6LocalAddressUndefined EventID (EventLevelError, EvtNetETH, 28)
379 #define EvtNetETH_Ip6MacAddressUnresolved EventID (EventLevelError, EvtNetETH, 29)
380 #define EvtNetETH_InvalidIpVersion EventID (EventLevelError, EvtNetETH, 30)
381 #define EvtNetETH_ShowFrameHeader EventID (EventLevelDetail,EvtNetETH, 31)
382 #define EvtNetETH_LinkDownStatus EventID (EventLevelOp, EvtNetETH, 32)
383 #define EvtNetETH_LinkUpStatus EventID (EventLevelOp, EvtNetETH, 33)
384 #define EvtNetETH_ReceiveFrame EventID (EventLevelOp, EvtNetETH, 34)
385 #define EvtNetETH_VlanInvalid EventID (EventLevelOp, EvtNetETH, 35)
386 #define EvtNetETH_Ip4Disabled EventID (EventLevelOp, EvtNetETH, 36)
387 #define EvtNetETH_Ip6Disabled EventID (EventLevelOp, EvtNetETH, 37)
388 #define EvtNetETH_ProtocolUnknown EventID (EventLevelOp, EvtNetETH, 38)
389 #define EvtNetETH_SendRawFrame EventID (EventLevelAPI, EvtNetETH, 39)
390 #define EvtNetETH_SendRawInvalidParameter EventID (EventLevelError, EvtNetETH, 40)
391 #define EvtNetETH_OutputLowLevel EventID (EventLevelOp, EvtNetETH, 41)
392 #define EvtNetETH_UninitInterface EventID (EventLevelOp, EvtNetETH, 42)
393 #endif
394 
395 /**
396  \brief Event on Ethernet interface initialize (Op)
397  \param if_num interface number
398  */
399 #ifdef DEBUG_EVR
401  EventRecord2 (EvtNetETH_InitInterface, if_num, 0);
402  }
403 #else
404  #define EvrNetETH_InitInterface(if_num)
405 #endif
406 
407 /**
408  \brief Event on Ethernet MAC address configuration error (Error)
409  \param if_num interface number
410  */
411 #ifdef DEBUG_EVR
413  EventRecord2 (EvtNetETH_MacAddressConfigError, if_num, 0);
414  }
415 #else
416  #define EvrNetETH_MacAddressConfigError(if_num)
417 #endif
418 
419 /**
420  \brief Event on Ethernet VLAN configuration error (Error)
421  \param if_num interface number
422  */
423 #ifdef DEBUG_EVR
425  EventRecord2 (EvtNetETH_VlanConfigError, if_num, 0);
426  }
427 #else
428  #define EvrNetETH_VlanConfigError(if_num)
429 #endif
430 
431 /**
432  \brief Event on Ethernet VLAN initialization error (Error)
433  \param if_num interface number
434  */
435 #ifdef DEBUG_EVR
437  EventRecord2 (EvtNetETH_VlanInitError, if_num, 0);
438  }
439 #else
440  #define EvrNetETH_VlanInitError(if_num)
441 #endif
442 
443 /**
444  \brief Event on Ethernet PHY configuration error (Error)
445  \param if_num interface number
446  */
447 #ifdef DEBUG_EVR
449  EventRecord2 (EvtNetETH_PhyDriverConfigError, if_num, 0);
450  }
451 #else
452  #define EvrNetETH_PhyDriverConfigError(if_num)
453 #endif
454 
455 /**
456  \brief Event on Ethernet PHY initialization error (Error)
457  \param if_num interface number
458  */
459 #ifdef DEBUG_EVR
461  EventRecord2 (EvtNetETH_PhyDriverInitError, if_num, 0);
462  }
463 #else
464  #define EvrNetETH_PhyDriverInitError(if_num)
465 #endif
466 
467 /**
468  \brief Event on Ethernet IPv4 configuration error (Error)
469  \param if_num interface number
470  */
471 #ifdef DEBUG_EVR
473  EventRecord2 (EvtNetETH_Ip4ConfigError, if_num, 0);
474  }
475 #else
476  #define EvrNetETH_Ip4ConfigError(if_num)
477 #endif
478 
479 /**
480  \brief Event on Ethernet IPv6 configuration error (Error)
481  \param if_num interface number
482  */
483 #ifdef DEBUG_EVR
485  EventRecord2 (EvtNetETH_Ip6ConfigError, if_num, 0);
486  }
487 #else
488  #define EvrNetETH_Ip6ConfigError(if_num)
489 #endif
490 
491 /**
492  \brief Event on Ethernet thread create failed (Error)
493  \param if_num interface number
494  */
495 #ifdef DEBUG_EVR
497  EventRecord2 (EvtNetETH_ThreadCreateFailed, if_num, 0);
498  }
499 #else
500  #define EvrNetETH_ThreadCreateFailed(if_num)
501 #endif
502 
503 /**
504  \brief Event on Ethernet get_option invalid parameter (Error)
505  \param if_num interface number
506  */
507 #ifdef DEBUG_EVR
509  EventRecord2 (EvtNetETH_GetOptionInvalidParameter, if_num, 0);
510  }
511 #else
512  #define EvrNetETH_GetOptionInvalidParameter(if_num)
513 #endif
514 
515 /**
516  \brief Event on Ethernet set_option invalid parameter (Error)
517  \param if_num interface number
518  */
519 #ifdef DEBUG_EVR
521  EventRecord2 (EvtNetETH_SetOptionInvalidParameter, if_num, 0);
522  }
523 #else
524  #define EvrNetETH_SetOptionInvalidParameter(if_num)
525 #endif
526 
527 /**
528  \brief Event on Ethernet set interface MAC address (Op)
529  \param if_num interface number
530  \param mac_addr pointer to MAC address
531  */
532 #ifdef DEBUG_EVR
533  __STATIC_INLINE void EvrNetETH_SetMacAddress(uint8_t if_num, const uint8_t *mac_addr) {
534  evr_buf.u16[0] = if_num;
535  memcpy (&evr_buf.u16[1], mac_addr, 6);
536  EventRecordData (EvtNetETH_SetMacAddress, &evr_buf, 8);
537  }
538 #else
539  #define EvrNetETH_SetMacAddress(if_num, mac_addr)
540 #endif
541 
542 /**
543  \brief Event on Ethernet set VLAN identifier (Op)
544  \param if_num interface number
545  \param vlan_id VLAN identifier
546  - 0: VLAN tagging disabled
547  \remark VLAN identifier is limited in the range from 1 to 4093.
548  */
549 #ifdef DEBUG_EVR
550  __STATIC_INLINE void EvrNetETH_SetVlanIdentifier(uint8_t if_num, uint16_t vlan_id) {
551  EventRecord2 (EvtNetETH_SetVlanIdentifier, if_num, vlan_id);
552  }
553 #else
554  #define EvrNetETH_SetVlanIdentifier(if_num, vlan_id)
555 #endif
556 
557 /**
558  \brief Event on Ethernet set interface IPv4 address (Op)
559  \param if_num interface number
560  \param ip4_addr pointer to IPv4 address
561  */
562 #ifdef DEBUG_EVR
563  __STATIC_INLINE void EvrNetETH_SetIp4Address(uint8_t if_num, const uint8_t *ip4_addr) {
564  memcpy (&evr_buf.u32[0], ip4_addr, 4);
565  EventRecord2 (EvtNetETH_SetIp4Address, if_num, evr_buf.u32[0]);
566  }
567 #else
568  #define EvrNetETH_SetIp4Address(if_num, ip4_addr)
569 #endif
570 
571 /**
572  \brief Event on Ethernet set interface IPv4 subnet mask (Op)
573  \param if_num interface number
574  \param net_mask pointer to IPv4 subnet mask
575  */
576 #ifdef DEBUG_EVR
577  __STATIC_INLINE void EvrNetETH_SetIp4SubnetMask(uint8_t if_num, const uint8_t *net_mask) {
578  memcpy (&evr_buf.u32[0], net_mask, 4);
579  EventRecord2 (EvtNetETH_SetIp4SubnetMask, if_num, evr_buf.u32[0]);
580  }
581 #else
582  #define EvrNetETH_SetIp4SubnetMask(if_num, net_mask)
583 #endif
584 
585 /**
586  \brief Event on Ethernet set interface IPv4 default gateway (Op)
587  \param if_num interface number
588  \param ip4_addr pointer to IPv4 address of a gateway
589  */
590 #ifdef DEBUG_EVR
591  __STATIC_INLINE void EvrNetETH_SetIp4DefaultGateway(uint8_t if_num, const uint8_t *ip4_addr) {
592  memcpy (&evr_buf.u32[0], ip4_addr, 4);
593  EventRecord2 (EvtNetETH_SetIp4DefaultGateway, if_num, evr_buf.u32[0]);
594  }
595 #else
596  #define EvrNetETH_SetIp4DefaultGateway(if_num, ip4_addr)
597 #endif
598 
599 /**
600  \brief Event on Ethernet set interface primary DNS server (Op)
601  \param if_num interface number
602  \param ip4_addr pointer to IPv4 address of a DNS server
603  */
604 #ifdef DEBUG_EVR
605  __STATIC_INLINE void EvrNetETH_SetIp4PrimaryDNS(uint8_t if_num, const uint8_t *ip4_addr) {
606  memcpy (&evr_buf.u32[0], ip4_addr, 4);
607  EventRecord2 (EvtNetETH_SetIp4PrimaryDNS, if_num, evr_buf.u32[0]);
608  }
609 #else
610  #define EvrNetETH_SetIp4PrimaryDNS(if_num, ip4_addr)
611 #endif
612 
613 /**
614  \brief Event on Ethernet set interface secondary DNS server (Op)
615  \param if_num interface number
616  \param ip4_addr pointer to IPv4 address of a DNS server
617  */
618 #ifdef DEBUG_EVR
619  __STATIC_INLINE void EvrNetETH_SetIp4SecondaryDNS(uint8_t if_num, const uint8_t *ip4_addr) {
620  memcpy (&evr_buf.u32[0], ip4_addr, 4);
621  EventRecord2 (EvtNetETH_SetIp4SecondaryDNS, if_num, evr_buf.u32[0]);
622  }
623 #else
624  #define EvrNetETH_SetIp4SecondaryDNS(if_num, ip4_addr)
625 #endif
626 
627 /**
628  \brief Event on Ethernet set interface MTU (Op)
629  \param if_num interface number
630  \param mtu maximum transmission unit
631  - 0: fragmentation disabled
632  \remark MTU is limited in the range from 576 to 1500 bytes.
633  */
634 #ifdef DEBUG_EVR
635  __STATIC_INLINE void EvrNetETH_SetIp4Mtu(uint8_t if_num, uint16_t mtu) {
636  EventRecord2 (EvtNetETH_SetIp4Mtu, if_num, mtu);
637  }
638 #else
639  #define EvrNetETH_SetIp4Mtu(if_num, mtu)
640 #endif
641 
642 /**
643  \brief Event on Ethernet set interface IPv6 static address (Op)
644  \param if_num interface number
645  \param ip6_addr pointer to IPv6 address
646  */
647 #ifdef DEBUG_EVR
648  __STATIC_INLINE void EvrNetETH_SetIp6Address(uint8_t if_num, const uint8_t *ip6_addr) {
649  evr_buf.u32[0] = if_num;
650  memcpy (&evr_buf.u32[1], ip6_addr, 16);
651  EventRecordData (EvtNetETH_SetIp6Address, &evr_buf, 20);
652  }
653 #else
654  #define EvrNetETH_SetIp6Address(if_num, ip6_addr)
655 #endif
656 
657 /**
658  \brief Event on Ethernet set interface IPv6 default gateway (Op)
659  \param if_num interface number
660  \param ip6_addr pointer to IPv6 address of a gateway
661  */
662 #ifdef DEBUG_EVR
663  __STATIC_INLINE void EvrNetETH_SetIp6DefaultGateway(uint8_t if_num, const uint8_t *ip6_addr) {
664  evr_buf.u32[0] = if_num;
665  memcpy (&evr_buf.u32[1], ip6_addr, 16);
666  EventRecordData (EvtNetETH_SetIp6DefaultGateway, &evr_buf, 20);
667  }
668 #else
669  #define EvrNetETH_SetIp6DefaultGateway(if_num, ip6_addr)
670 #endif
671 
672 /**
673  \brief Event on Ethernet set interface primary DNS server (Op)
674  \param if_num interface number
675  \param ip6_addr pointer to IPv6 address of a DNS server
676  */
677 #ifdef DEBUG_EVR
678  __STATIC_INLINE void EvrNetETH_SetIp6PrimaryDNS(uint8_t if_num, const uint8_t *ip6_addr) {
679  evr_buf.u32[0] = if_num;
680  memcpy (&evr_buf.u32[1], ip6_addr, 16);
681  EventRecordData (EvtNetETH_SetIp6PrimaryDNS, &evr_buf, 20);
682  }
683 #else
684  #define EvrNetETH_SetIp6PrimaryDNS(if_num, ip6_addr)
685 #endif
686 
687 /**
688  \brief Event on Ethernet set interface secondary DNS server (Op)
689  \param if_num interface number
690  \param ip6_addr pointer to IPv6 address of a DNS server
691  */
692 #ifdef DEBUG_EVR
693  __STATIC_INLINE void EvrNetETH_SetIp6SecondaryDNS(uint8_t if_num, const uint8_t *ip6_addr) {
694  evr_buf.u32[0] = if_num;
695  memcpy (&evr_buf.u32[1], ip6_addr, 16);
696  EventRecordData (EvtNetETH_SetIp6SecondaryDNS, &evr_buf, 20);
697  }
698 #else
699  #define EvrNetETH_SetIp6SecondaryDNS(if_num, ip6_addr)
700 #endif
701 
702 /**
703  \brief Event on Ethernet set interface IPv6 subnet prefix length (Op)
704  \param if_num interface number
705  \param pref_len subnet prefix length
706  */
707 #ifdef DEBUG_EVR
708  __STATIC_INLINE void EvrNetETH_SetIp6PrefixLength(uint8_t if_num, uint8_t pref_len) {
709  EventRecord2 (EvtNetETH_SetIp6PrefixLength, if_num, pref_len);
710  }
711 #else
712  #define EvrNetETH_SetIp6PrefixLength(if_num, pref_len)
713 #endif
714 
715 /**
716  \brief Event on Ethernet send frame (Op)
717  \param if_num interface number
718  \param length frame length in bytes
719  \param ip_version internet protocol version
720  - 0: IPv4
721  - 1: IPv6
722  */
723 #ifdef DEBUG_EVR
724  __STATIC_INLINE void EvrNetETH_SendFrame(uint8_t if_num, uint32_t length, uint8_t ip_version) {
725  uint32_t val2 = ((uint32_t)ip_version << 16) | length;
726  EventRecord2 (EvtNetETH_SendFrame, if_num, val2);
727  }
728 #else
729  #define EvrNetETH_SendFrame(if_num, length, ip_version)
730 #endif
731 
732 /**
733  \brief Event on Ethernet link down error (Error)
734  \param if_num interface number
735  */
736 #ifdef DEBUG_EVR
738  EventRecord2 (EvtNetETH_LinkDownError, if_num, 0);
739  }
740 #else
741  #define EvrNetETH_LinkDownError(if_num)
742 #endif
743 
744 /**
745  \brief Event on Ethernet send payload too large error (Error)
746  \param if_num interface number
747  \param length data length in bytes
748  \param max_length maximum length of data in bytes
749  */
750 #ifdef DEBUG_EVR
751  __STATIC_INLINE void EvrNetETH_SendDataTooLarge(uint8_t if_num, uint32_t length, uint32_t max_length) {
752  uint32_t val2 = (max_length << 16) | length;
753  EventRecord2 (EvtNetETH_SendDataTooLarge, if_num, val2);
754  }
755 #else
756  #define EvrNetETH_SendDataTooLarge(if_num, length, max_length)
757 #endif
758 
759 /**
760  \brief Event on Ethernet send IPv4 disabled error (Error)
761  \param if_num interface number
762  */
763 #ifdef DEBUG_EVR
765  EventRecord2 (EvtNetETH_SendIp4Disabled, if_num, 0);
766  }
767 #else
768  #define EvrNetETH_SendIp4Disabled(if_num)
769 #endif
770 
771 /**
772  \brief Event on Ethernet local IPv4 address undefined (Error)
773  \param if_num interface number
774  */
775 #ifdef DEBUG_EVR
777  EventRecord2 (EvtNetETH_Ip4LocalAddressUndefined, if_num, 0);
778  }
779 #else
780  #define EvrNetETH_Ip4LocalAddressUndefined(if_num)
781 #endif
782 
783 /**
784  \brief Event on Ethernet MAC address unresolved (Error)
785  \param if_num interface number
786  \param ip4_addr pointer to IPv4 destination address
787  */
788 #ifdef DEBUG_EVR
789  __STATIC_INLINE void EvrNetETH_Ip4MacAddressUnresolved(uint8_t if_num, const uint8_t *ip4_addr) {
790  memcpy (&evr_buf.u32[0], ip4_addr, 4);
791  EventRecord2 (EvtNetETH_Ip4MacAddressUnresolved, if_num, evr_buf.u32[0]);
792  }
793 #else
794  #define EvrNetETH_Ip4MacAddressUnresolved(if_num, ip4_addr)
795 #endif
796 
797 /**
798  \brief Event on enqueued Ethernet frame for unresolved MAC address (Op)
799  \param if_num interface number
800  \param ca_entry cache entry identifier
801  \param length frame length in bytes
802  */
803 #ifdef DEBUG_EVR
804  __STATIC_INLINE void EvrNetETH_EnqueueFrame(uint8_t if_num, uint8_t ca_entry, uint32_t length) {
805  uint32_t val2 = ((uint32_t)ca_entry << 16) | length;
806  EventRecord2 (EvtNetETH_EnqueueFrame, if_num, val2);
807  }
808 #else
809  #define EvrNetETH_EnqueueFrame(if_num, ca_entry, length)
810 #endif
811 
812 /**
813  \brief Event on Ethernet send IPv6 disabled error (Error)
814  \param if_num interface number
815  */
816 #ifdef DEBUG_EVR
818  EventRecord2 (EvtNetETH_SendIp6Disabled, if_num, 0);
819  }
820 #else
821  #define EvrNetETH_SendIp6Disabled(if_num)
822 #endif
823 
824 /**
825  \brief Event on Ethernet local IPv6 address undefined (Error)
826  \param if_num interface number
827  */
828 #ifdef DEBUG_EVR
830  EventRecord2 (EvtNetETH_Ip6LocalAddressUndefined, if_num, 0);
831  }
832 #else
833  #define EvrNetETH_Ip6LocalAddressUndefined(if_num)
834 #endif
835 
836 /**
837  \brief Event on Ethernet MAC address unresolved (Error)
838  \param if_num interface number
839  \param ip6_addr pointer to IPv6 destination address
840  */
841 #ifdef DEBUG_EVR
842  __STATIC_INLINE void EvrNetETH_Ip6MacAddressUnresolved(uint8_t if_num, const uint8_t *ip6_addr) {
843  evr_buf.u32[0] = if_num;
844  memcpy (&evr_buf.u32[1], ip6_addr, 16);
845  EventRecordData (EvtNetETH_Ip6MacAddressUnresolved, &evr_buf, 20);
846  }
847 #else
848  #define EvrNetETH_Ip6MacAddressUnresolved(if_num, ip6_addr)
849 #endif
850 
851 /**
852  \brief Event on Ethernet invalid IP version (Error)
853  \param if_num interface number
854  \param ip_version invalid IP protocol version value
855  - 0: IPv4
856  - 1: IPv6
857  */
858 #ifdef DEBUG_EVR
859  __STATIC_INLINE void EvrNetETH_InvalidIpVersion(uint8_t if_num, uint8_t ip_version) {
860  EventRecord2 (EvtNetETH_InvalidIpVersion, if_num, ip_version);
861  }
862 #else
863  #define EvrNetETH_InvalidIpVersion(if_num, ip_version)
864 #endif
865 
866 /**
867  \brief Event on Ethernet display send/receive frame header (Detail)
868  \param eth_header pointer to ethernet frame header of 14 bytes
869  - DstAddr (6 bytes)
870  - SrcAddr (6 bytes)
871  - Protocol (2 bytes)
872  */
873 #ifdef DEBUG_EVR
874  __STATIC_INLINE void EvrNetETH_ShowFrameHeader(const void *eth_header) {
875  EventRecordData (EvtNetETH_ShowFrameHeader, eth_header, 14);
876  }
877 #else
878  #define EvrNetETH_ShowFrameHeader(eth_header)
879 #endif
880 
881 /**
882  \brief Event on Ethernet link down status (Op)
883  \param if_num interface number
884  */
885 #ifdef DEBUG_EVR
887  EventRecord2 (EvtNetETH_LinkDownStatus, if_num, 0);
888  }
889 #else
890  #define EvrNetETH_LinkDownStatus(if_num)
891 #endif
892 
893 /**
894  \brief Event on Ethernet link up status (Op)
895  \param if_num interface number
896  \param link_info link information:
897  - duplex (bit 2)
898  - speed (bit 1,0)
899  */
900 #ifdef DEBUG_EVR
901  __STATIC_INLINE void EvrNetETH_LinkUpStatus(uint8_t if_num, uint8_t link_info) {
902  EventRecord2 (EvtNetETH_LinkUpStatus, if_num, link_info);
903  }
904 #else
905  #define EvrNetETH_LinkUpStatus(if_num, link_info)
906 #endif
907 
908 /**
909  \brief Event on Ethernet receive frame (Op)
910  \param if_num interface number
911  \param length frame length in bytes
912  */
913 #ifdef DEBUG_EVR
914  __STATIC_INLINE void EvrNetETH_ReceiveFrame(uint8_t if_num, uint32_t length) {
915  EventRecord2 (EvtNetETH_ReceiveFrame, if_num, length);
916  }
917 #else
918  #define EvrNetETH_ReceiveFrame(if_num, length)
919 #endif
920 
921 /**
922  \brief Event on Ethernet receive VLAN invalid (Op)
923  \param if_num interface number
924  */
925 #ifdef DEBUG_EVR
926  __STATIC_INLINE void EvrNetETH_VlanInvalid(uint8_t if_num) {
927  EventRecord2 (EvtNetETH_VlanInvalid, if_num, 0);
928  }
929 #else
930  #define EvrNetETH_VlanInvalid(if_num)
931 #endif
932 
933 /**
934  \brief Event on Ethernet receive IPv4 disabled (Op)
935  \param if_num interface number
936  */
937 #ifdef DEBUG_EVR
938  __STATIC_INLINE void EvrNetETH_Ip4Disabled(uint8_t if_num) {
939  EventRecord2 (EvtNetETH_Ip4Disabled, if_num, 0);
940  }
941 #else
942  #define EvrNetETH_Ip4Disabled(if_num)
943 #endif
944 
945 /**
946  \brief Event on Ethernet receive IPv6 disabled (Op)
947  \param if_num interface number
948  */
949 #ifdef DEBUG_EVR
950  __STATIC_INLINE void EvrNetETH_Ip6Disabled(uint8_t if_num) {
951  EventRecord2 (EvtNetETH_Ip6Disabled, if_num, 0);
952  }
953 #else
954  #define EvrNetETH_Ip6Disabled(if_num)
955 #endif
956 
957 /**
958  \brief Event on Ethernet receive protocol unknown (Op)
959  \param if_num interface number
960  \param protocol unknown ethernet protocol type
961  */
962 #ifdef DEBUG_EVR
963  __STATIC_INLINE void EvrNetETH_ProtocolUnknown(uint8_t if_num, uint16_t protocol) {
964  EventRecord2 (EvtNetETH_ProtocolUnknown, if_num, protocol);
965  }
966 #else
967  #define EvrNetETH_ProtocolUnknown(if_num, protocol)
968 #endif
969 
970 /**
971  \brief Event on Ethernet send raw frame (API)
972  \param if_num interface number
973  \param length frame length in bytes
974  */
975 #ifdef DEBUG_EVR
976  __STATIC_INLINE void EvrNetETH_SendRawFrame(uint8_t if_num, uint32_t length) {
977  EventRecord2 (EvtNetETH_SendRawFrame, if_num, length);
978  }
979 #else
980  #define EvrNetETH_SendRawFrame(if_num, length)
981 #endif
982 
983 /**
984  \brief Event on Ethernet send raw frame invalid parameter (Error)
985  \param if_num interface number
986  */
987 #ifdef DEBUG_EVR
989  EventRecord2 (EvtNetETH_SendRawInvalidParameter, if_num, 0);
990  }
991 #else
992  #define EvrNetETH_SendRawInvalidParameter(if_num)
993 #endif
994 
995 /**
996  \brief Event on output Ethernet frame (Op)
997  \param if_num interface number
998  \param length frame length in bytes
999  */
1000 #ifdef DEBUG_EVR
1001  __STATIC_INLINE void EvrNetETH_OutputLowLevel(uint8_t if_num, uint32_t length) {
1002  EventRecord2 (EvtNetETH_OutputLowLevel, if_num, length);
1003  }
1004 #else
1005  #define EvrNetETH_OutputLowLevel(if_num, length)
1006 #endif
1007 
1008 /**
1009  \brief Event on Ethernet interface de-initialize (Op)
1010  \param if_num interface number
1011  */
1012 #ifdef DEBUG_EVR
1014  EventRecord2 (EvtNetETH_UninitInterface, if_num, 0);
1015  }
1016 #else
1017  #define EvrNetETH_UninitInterface(if_num)
1018 #endif
1019 
1020 
1021 // NetWiFi event identifiers ----------------------------------------------------
1022 #ifdef DEBUG_EVR
1023 #define EvtNetWiFi_InitInterface EventID (EventLevelOp, EvtNetWiFi, 0)
1024 #define EvtNetWiFi_DriverInitFailed EventID (EventLevelError, EvtNetWiFi, 1)
1025 #define EvtNetWiFi_SetBypassModeFailed EventID (EventLevelError, EvtNetWiFi, 2)
1026 #define EvtNetWiFi_GetMacAddressFailed EventID (EventLevelError, EvtNetWiFi, 3)
1027 #define EvtNetWiFi_DriverMacAddress EventID (EventLevelOp, EvtNetWiFi, 4)
1028 #define EvtNetWiFi_MacAddressConfigError EventID (EventLevelError, EvtNetWiFi, 5)
1029 #define EvtNetWiFi_SetMacAddressFailed EventID (EventLevelError, EvtNetWiFi, 6)
1030 #define EvtNetWiFi_Ip4ConfigError EventID (EventLevelError, EvtNetWiFi, 7)
1031 #define EvtNetWiFi_Ip6ConfigError EventID (EventLevelError, EvtNetWiFi, 8)
1032 #define EvtNetWiFi_ThreadCreateFailed EventID (EventLevelError, EvtNetWiFi, 9)
1033 #define EvtNetWiFi_GetOptionInvalidParameter EventID (EventLevelError, EvtNetWiFi, 10)
1034 #define EvtNetWiFi_SetOptionInvalidParameter EventID (EventLevelError, EvtNetWiFi, 11)
1035 #define EvtNetWiFi_SetMacAddress EventID (EventLevelOp, EvtNetWiFi, 12)
1036 #define EvtNetWiFi_SetIp4Address EventID (EventLevelOp, EvtNetWiFi, 13)
1037 #define EvtNetWiFi_SetIp4SubnetMask EventID (EventLevelOp, EvtNetWiFi, 14)
1038 #define EvtNetWiFi_SetIp4DefaultGateway EventID (EventLevelOp, EvtNetWiFi, 15)
1039 #define EvtNetWiFi_SetIp4PrimaryDNS EventID (EventLevelOp, EvtNetWiFi, 16)
1040 #define EvtNetWiFi_SetIp4SecondaryDNS EventID (EventLevelOp, EvtNetWiFi, 17)
1041 #define EvtNetWiFi_SetIp4Mtu EventID (EventLevelOp, EvtNetWiFi, 18)
1042 #define EvtNetWiFi_SetIp6Address EventID (EventLevelOp, EvtNetWiFi, 19)
1043 #define EvtNetWiFi_SetIp6DefaultGateway EventID (EventLevelOp, EvtNetWiFi, 20)
1044 #define EvtNetWiFi_SetIp6PrimaryDNS EventID (EventLevelOp, EvtNetWiFi, 21)
1045 #define EvtNetWiFi_SetIp6SecondaryDNS EventID (EventLevelOp, EvtNetWiFi, 22)
1046 #define EvtNetWiFi_SetIp6PrefixLength EventID (EventLevelOp, EvtNetWiFi, 23)
1047 #define EvtNetWiFi_Scan EventID (EventLevelAPI, EvtNetWiFi, 24)
1048 #define EvtNetWiFi_ScanWrongMode EventID (EventLevelError, EvtNetWiFi, 25)
1049 #define EvtNetWiFi_ScanInvalidParameter EventID (EventLevelError, EvtNetWiFi, 26)
1050 #define EvtNetWiFi_ScanComplete EventID (EventLevelOp, EvtNetWiFi, 27)
1051 #define EvtNetWiFi_GetOption EventID (EventLevelAPI, EvtNetWiFi, 28)
1052 #define EvtNetWiFi_SetOption EventID (EventLevelAPI, EvtNetWiFi, 29)
1053 #define EvtNetWiFi_Activate EventID (EventLevelAPI, EvtNetWiFi, 30)
1054 #define EvtNetWiFi_ActivateInvalidParameter EventID (EventLevelError, EvtNetWiFi, 31)
1055 #define EvtNetWiFi_Deactivate EventID (EventLevelAPI, EvtNetWiFi, 32)
1056 #define EvtNetWiFi_DeactivateInvalidParam EventID (EventLevelError, EvtNetWiFi, 33)
1057 #define EvtNetWiFi_GetNetInfo EventID (EventLevelAPI, EvtNetWiFi, 34)
1058 #define EvtNetWiFi_GetNetInfoWrongMode EventID (EventLevelError, EvtNetWiFi, 35)
1059 #define EvtNetWiFi_GetNetInfoInvalidParam EventID (EventLevelError, EvtNetWiFi, 36)
1060 #define EvtNetWiFi_SendFrame EventID (EventLevelOp, EvtNetWiFi, 37)
1061 #define EvtNetWiFi_NotConnected EventID (EventLevelError, EvtNetWiFi, 38)
1062 #define EvtNetWiFi_SendDataTooLarge EventID (EventLevelError, EvtNetWiFi, 39)
1063 #define EvtNetWiFi_SendIp4Disabled EventID (EventLevelError, EvtNetWiFi, 56)
1064 #define EvtNetWiFi_Ip4LocalAddressUndefined EventID (EventLevelError, EvtNetWiFi, 40)
1065 #define EvtNetWiFi_Ip4MacAddressUnresolved EventID (EventLevelError, EvtNetWiFi, 41)
1066 #define EvtNetWiFi_EnqueueFrame EventID (EventLevelOp, EvtNetWiFi, 42)
1067 #define EvtNetWiFi_SendIp6Disabled EventID (EventLevelError, EvtNetWiFi, 57) // Max
1068 #define EvtNetWiFi_Ip6LocalAddressUndefined EventID (EventLevelError, EvtNetWiFi, 43)
1069 #define EvtNetWiFi_Ip6MacAddressUnresolved EventID (EventLevelError, EvtNetWiFi, 44)
1070 #define EvtNetWiFi_InvalidIpVersion EventID (EventLevelError, EvtNetWiFi, 45)
1071 #define EvtNetWiFi_ShowFrameHeader EventID (EventLevelDetail,EvtNetWiFi, 46)
1072 #define EvtNetWiFi_LinkStateChange EventID (EventLevelOp, EvtNetWiFi, 47)
1073 #define EvtNetWiFi_ReceiveFrame EventID (EventLevelOp, EvtNetWiFi, 48)
1074 #define EvtNetWiFi_Ip4Disabled EventID (EventLevelOp, EvtNetWiFi, 49)
1075 #define EvtNetWiFi_Ip6Disabled EventID (EventLevelOp, EvtNetWiFi, 50)
1076 #define EvtNetWiFi_ProtocolUnknown EventID (EventLevelOp, EvtNetWiFi, 51)
1077 #define EvtNetWiFi_OutputLowLevel EventID (EventLevelOp, EvtNetWiFi, 52)
1078 #define EvtNetWiFi_TxQueueOverflow EventID (EventLevelError, EvtNetWiFi, 53)
1079 #define EvtNetWiFi_OutputNoMemory EventID (EventLevelError, EvtNetWiFi, 54)
1080 #define EvtNetWiFi_UninitInterface EventID (EventLevelOp, EvtNetWiFi, 55)
1081 #endif
1082 
1083 /**
1084  \brief Event on WiFi interface initialize (Op)
1085  \param if_num interface number
1086  */
1087 #ifdef DEBUG_EVR
1089  EventRecord2 (EvtNetWiFi_InitInterface, if_num, 0);
1090  }
1091 #else
1092  #define EvrNetWiFi_InitInterface(if_num)
1093 #endif
1094 
1095 /**
1096  \brief Event on WiFi failed to initialize the driver (Error)
1097  \param if_num interface number
1098  */
1099 #ifdef DEBUG_EVR
1101  EventRecord2 (EvtNetWiFi_DriverInitFailed, if_num, 0);
1102  }
1103 #else
1104  #define EvrNetWiFi_DriverInitFailed(if_num)
1105 #endif
1106 
1107 /**
1108  \brief Event on WiFi failed to activate bypass mode (Error)
1109  \param if_num interface number
1110  */
1111 #ifdef DEBUG_EVR
1113  EventRecord2 (EvtNetWiFi_SetBypassModeFailed, if_num, 0);
1114  }
1115 #else
1116  #define EvrNetWiFi_SetBypassModeFailed(if_num)
1117 #endif
1118 
1119 /**
1120  \brief Event on WiFi driver get MAC address failed (Error)
1121  \param if_num interface number
1122  */
1123 #ifdef DEBUG_EVR
1125  EventRecord2 (EvtNetWiFi_GetMacAddressFailed, if_num, 0);
1126  }
1127 #else
1128  #define EvrNetWiFi_GetMacAddressFailed(if_num)
1129 #endif
1130 
1131 /**
1132  \brief Event on WiFi driver provided MAC address (Op)
1133  \param if_num interface number
1134  \param mac_addr pointer to MAC address
1135  */
1136 #ifdef DEBUG_EVR
1137  __STATIC_INLINE void EvrNetWiFi_DriverMacAddress(uint8_t if_num, const uint8_t *mac_addr) {
1138  evr_buf.u16[0] = if_num;
1139  memcpy (&evr_buf.u16[1], mac_addr, 6);
1140  EventRecordData (EvtNetWiFi_DriverMacAddress, &evr_buf, 8);
1141  }
1142 #else
1143  #define EvrNetWiFi_DriverMacAddress(if_num, mac_addr)
1144 #endif
1145 
1146 /**
1147  \brief Event on WiFi MAC address configuration error (Error)
1148  \param if_num interface number
1149  */
1150 #ifdef DEBUG_EVR
1152  EventRecord2 (EvtNetWiFi_MacAddressConfigError, if_num, 0);
1153  }
1154 #else
1155  #define EvrNetWiFi_MacAddressConfigError(if_num)
1156 #endif
1157 
1158 /**
1159  \brief Event on WiFi driver failed to set MAC address (Op)
1160  \param if_num interface number
1161  */
1162 #ifdef DEBUG_EVR
1164  EventRecord2 (EvtNetWiFi_SetMacAddressFailed, if_num, 0);
1165  }
1166 #else
1167  #define EvrNetWiFi_SetMacAddressFailed(if_num)
1168 #endif
1169 
1170 /**
1171  \brief Event on WiFi IPv4 configuration error (Error)
1172  \param if_num interface number
1173  */
1174 #ifdef DEBUG_EVR
1176  EventRecord2 (EvtNetWiFi_Ip4ConfigError, if_num, 0);
1177  }
1178 #else
1179  #define EvrNetWiFi_Ip4ConfigError(if_num)
1180 #endif
1181 
1182 /**
1183  \brief Event on WiFi IPv6 configuration error (Error)
1184  \param if_num interface number
1185  */
1186 #ifdef DEBUG_EVR
1188  EventRecord2 (EvtNetWiFi_Ip6ConfigError, if_num, 0);
1189  }
1190 #else
1191  #define EvrNetWiFi_Ip6ConfigError(if_num)
1192 #endif
1193 
1194 /**
1195  \brief Event on WiFi thread create failed (Error)
1196  \param if_num interface number
1197  */
1198 #ifdef DEBUG_EVR
1200  EventRecord2 (EvtNetWiFi_ThreadCreateFailed, if_num, 0);
1201  }
1202 #else
1203  #define EvrNetWiFi_ThreadCreateFailed(if_num)
1204 #endif
1205 
1206 /**
1207  \brief Event on WiFi get_option invalid parameter (Error)
1208  \param if_num interface number
1209  */
1210 #ifdef DEBUG_EVR
1212  EventRecord2 (EvtNetWiFi_GetOptionInvalidParameter, if_num, 0);
1213  }
1214 #else
1215  #define EvrNetWiFi_GetOptionInvalidParameter(if_num)
1216 #endif
1217 
1218 /**
1219  \brief Event on WiFi set_option invalid parameter (Error)
1220  \param if_num interface number
1221  */
1222 #ifdef DEBUG_EVR
1224  EventRecord2 (EvtNetWiFi_SetOptionInvalidParameter, if_num, 0);
1225  }
1226 #else
1227  #define EvrNetWiFi_SetOptionInvalidParameter(if_num)
1228 #endif
1229 
1230 /**
1231  \brief Event on WiFi set interface MAC address (Op)
1232  \param if_num interface number
1233  \param mac_addr pointer to MAC address
1234  */
1235 #ifdef DEBUG_EVR
1236  __STATIC_INLINE void EvrNetWiFi_SetMacAddress(uint8_t if_num, const uint8_t *mac_addr) {
1237  evr_buf.u16[0] = if_num;
1238  memcpy (&evr_buf.u16[1], mac_addr, 6);
1239  EventRecordData (EvtNetWiFi_SetMacAddress, &evr_buf, 8);
1240  }
1241 #else
1242  #define EvrNetWiFi_SetMacAddress(if_num, mac_addr)
1243 #endif
1244 
1245 /**
1246  \brief Event on WiFi set interface IPv4 address (Op)
1247  \param if_num interface number
1248  \param ip4_addr pointer to IPv4 address
1249  */
1250 #ifdef DEBUG_EVR
1251  __STATIC_INLINE void EvrNetWiFi_SetIp4Address(uint8_t if_num, const uint8_t *ip4_addr) {
1252  memcpy (&evr_buf.u32[0], ip4_addr, 4);
1253  EventRecord2 (EvtNetWiFi_SetIp4Address, if_num, evr_buf.u32[0]);
1254  }
1255 #else
1256  #define EvrNetWiFi_SetIp4Address(if_num, ip4_addr)
1257 #endif
1258 
1259 /**
1260  \brief Event on WiFi set interface IPv4 subnet mask (Op)
1261  \param if_num interface number
1262  \param net_mask pointer to IPv4 subnet mask
1263  */
1264 #ifdef DEBUG_EVR
1265  __STATIC_INLINE void EvrNetWiFi_SetIp4SubnetMask(uint8_t if_num, const uint8_t *net_mask) {
1266  memcpy (&evr_buf.u32[0], net_mask, 4);
1267  EventRecord2 (EvtNetWiFi_SetIp4SubnetMask, if_num, evr_buf.u32[0]);
1268  }
1269 #else
1270  #define EvrNetWiFi_SetIp4SubnetMask(if_num, net_mask)
1271 #endif
1272 
1273 /**
1274  \brief Event on WiFi set interface IPv4 default gateway (Op)
1275  \param if_num interface number
1276  \param ip4_addr pointer to IPv4 address of a gateway
1277  */
1278 #ifdef DEBUG_EVR
1279  __STATIC_INLINE void EvrNetWiFi_SetIp4DefaultGateway(uint8_t if_num, const uint8_t *ip4_addr) {
1280  memcpy (&evr_buf.u32[0], ip4_addr, 4);
1281  EventRecord2 (EvtNetWiFi_SetIp4DefaultGateway, if_num, evr_buf.u32[0]);
1282  }
1283 #else
1284  #define EvrNetWiFi_SetIp4DefaultGateway(if_num, ip4_addr)
1285 #endif
1286 
1287 /**
1288  \brief Event on WiFi set interface primary DNS server (Op)
1289  \param if_num interface number
1290  \param ip4_addr pointer to IPv4 address of a DNS server
1291  */
1292 #ifdef DEBUG_EVR
1293  __STATIC_INLINE void EvrNetWiFi_SetIp4PrimaryDNS(uint8_t if_num, const uint8_t *ip4_addr) {
1294  memcpy (&evr_buf.u32[0], ip4_addr, 4);
1295  EventRecord2 (EvtNetWiFi_SetIp4PrimaryDNS, if_num, evr_buf.u32[0]);
1296  }
1297 #else
1298  #define EvrNetWiFi_SetIp4PrimaryDNS(if_num, ip4_addr)
1299 #endif
1300 
1301 /**
1302  \brief Event on WiFi set interface secondary DNS server (Op)
1303  \param if_num interface number
1304  \param ip4_addr pointer to IPv4 address of a DNS server
1305  */
1306 #ifdef DEBUG_EVR
1307  __STATIC_INLINE void EvrNetWiFi_SetIp4SecondaryDNS(uint8_t if_num, const uint8_t *ip4_addr) {
1308  memcpy (&evr_buf.u32[0], ip4_addr, 4);
1309  EventRecord2 (EvtNetWiFi_SetIp4SecondaryDNS, if_num, evr_buf.u32[0]);
1310  }
1311 #else
1312  #define EvrNetWiFi_SetIp4SecondaryDNS(if_num, ip4_addr)
1313 #endif
1314 
1315 /**
1316  \brief Event on WiFi set interface MTU (Op)
1317  \param if_num interface number
1318  \param mtu maximum transmission unit
1319  - 0: fragmentation disabled
1320  \remark MTU is limited in the range from 576 to 1500 bytes.
1321  */
1322 #ifdef DEBUG_EVR
1323  __STATIC_INLINE void EvrNetWiFi_SetIp4Mtu(uint8_t if_num, uint16_t mtu) {
1324  EventRecord2 (EvtNetWiFi_SetIp4Mtu, if_num, mtu);
1325  }
1326 #else
1327  #define EvrNetWiFi_SetIp4Mtu(if_num, mtu)
1328 #endif
1329 
1330 /**
1331  \brief Event on WiFi set interface IPv6 static address (Op)
1332  \param if_num interface number
1333  \param ip6_addr pointer to IPv6 address
1334  */
1335 #ifdef DEBUG_EVR
1336  __STATIC_INLINE void EvrNetWiFi_SetIp6Address(uint8_t if_num, const uint8_t *ip6_addr) {
1337  evr_buf.u32[0] = if_num;
1338  memcpy (&evr_buf.u32[1], ip6_addr, 16);
1339  EventRecordData (EvtNetWiFi_SetIp6Address, &evr_buf, 20);
1340  }
1341 #else
1342  #define EvrNetWiFi_SetIp6Address(if_num, ip6_addr)
1343 #endif
1344 
1345 /**
1346  \brief Event on WiFi set interface IPv6 default gateway (Op)
1347  \param if_num interface number
1348  \param ip6_addr pointer to IPv6 address of a gateway
1349  */
1350 #ifdef DEBUG_EVR
1351  __STATIC_INLINE void EvrNetWiFi_SetIp6DefaultGateway(uint8_t if_num, const uint8_t *ip6_addr) {
1352  evr_buf.u32[0] = if_num;
1353  memcpy (&evr_buf.u32[1], ip6_addr, 16);
1354  EventRecordData (EvtNetWiFi_SetIp6DefaultGateway, &evr_buf, 20);
1355  }
1356 #else
1357  #define EvrNetWiFi_SetIp6DefaultGateway(if_num, ip6_addr)
1358 #endif
1359 
1360 /**
1361  \brief Event on WiFi set interface primary DNS server (Op)
1362  \param if_num interface number
1363  \param ip6_addr pointer to IPv6 address of a DNS server
1364  */
1365 #ifdef DEBUG_EVR
1366  __STATIC_INLINE void EvrNetWiFi_SetIp6PrimaryDNS(uint8_t if_num, const uint8_t *ip6_addr) {
1367  evr_buf.u32[0] = if_num;
1368  memcpy (&evr_buf.u32[1], ip6_addr, 16);
1369  EventRecordData (EvtNetWiFi_SetIp6PrimaryDNS, &evr_buf, 20);
1370  }
1371 #else
1372  #define EvrNetWiFi_SetIp6PrimaryDNS(if_num, ip6_addr)
1373 #endif
1374 
1375 /**
1376  \brief Event on WiFi set interface secondary DNS server (Op)
1377  \param if_num interface number
1378  \param ip6_addr pointer to IPv6 address of a DNS server
1379  */
1380 #ifdef DEBUG_EVR
1381  __STATIC_INLINE void EvrNetWiFi_SetIp6SecondaryDNS(uint8_t if_num, const uint8_t *ip6_addr) {
1382  evr_buf.u32[0] = if_num;
1383  memcpy (&evr_buf.u32[1], ip6_addr, 16);
1384  EventRecordData (EvtNetWiFi_SetIp6SecondaryDNS, &evr_buf, 20);
1385  }
1386 #else
1387  #define EvrNetWiFi_SetIp6SecondaryDNS(if_num, ip6_addr)
1388 #endif
1389 
1390 /**
1391  \brief Event on WiFi set interface IPv6 subnet prefix length (Op)
1392  \param if_num interface number
1393  \param pref_len subnet prefix length
1394  */
1395 #ifdef DEBUG_EVR
1396  __STATIC_INLINE void EvrNetWiFi_SetIp6PrefixLength(uint8_t if_num, uint8_t pref_len) {
1397  EventRecord2 (EvtNetWiFi_SetIp6PrefixLength, if_num, pref_len);
1398  }
1399 #else
1400  #define EvrNetWiFi_SetIp6PrefixLength(if_num, pref_len)
1401 #endif
1402 
1403 /**
1404  \brief Event on WiFi scan wireless networks (API)
1405  \param if_num interface number
1406  \param max_num maximum number of networks to scan
1407  */
1408 #ifdef DEBUG_EVR
1409  __STATIC_INLINE void EvrNetWiFi_Scan(uint8_t if_num, uint32_t max_num) {
1410  EventRecord2 (EvtNetWiFi_Scan, if_num, max_num);
1411  }
1412 #else
1413  #define EvrNetWiFi_Scan(if_num, max_num)
1414 #endif
1415 
1416 /**
1417  \brief Event on WiFi scan in wrong mode (Error)
1418  \param if_num interface number
1419  \param mode WiFi interface mode
1420  - 0: Station
1421  - 1: Access Point
1422  */
1423 #ifdef DEBUG_EVR
1424  __STATIC_INLINE void EvrNetWiFi_ScanWrongMode(uint8_t if_num, uint32_t mode) {
1425  EventRecord2 (EvtNetWiFi_ScanWrongMode, if_num, mode);
1426  }
1427 #else
1428  #define EvrNetWiFi_ScanWrongMode(if_num, mode)
1429 #endif
1430 
1431 /**
1432  \brief Event on WiFi scan invalid parameter (Error)
1433  \param if_num interface number
1434  */
1435 #ifdef DEBUG_EVR
1437  EventRecord2 (EvtNetWiFi_ScanInvalidParameter, if_num, 0);
1438  }
1439 #else
1440  #define EvrNetWiFi_ScanInvalidParameter(if_num)
1441 #endif
1442 
1443 /**
1444  \brief Event on WiFi scan wireless networks complete (Op)
1445  \param if_num interface number
1446  \param num number of wireless networks found
1447  */
1448 #ifdef DEBUG_EVR
1449  __STATIC_INLINE void EvrNetWiFi_ScanComplete(uint8_t if_num, uint32_t num) {
1450  EventRecord2 (EvtNetWiFi_ScanComplete, if_num, num);
1451  }
1452 #else
1453  #define EvrNetWiFi_ScanComplete(if_num, num)
1454 #endif
1455 
1456 /**
1457  \brief Event on WiFi get driver option (API)
1458  \param if_num interface number
1459  \param opt WiFi driver option to get
1460  */
1461 #ifdef DEBUG_EVR
1462  __STATIC_INLINE void EvrNetWiFi_GetOption(uint8_t if_num, uint32_t opt) {
1463  EventRecord2 (EvtNetWiFi_GetOption, if_num, opt);
1464  }
1465 #else
1466  #define EvrNetWiFi_GetOption(if_num, opt)
1467 #endif
1468 
1469 /**
1470  \brief Event on WiFi set driver option (API)
1471  \param if_num interface number
1472  \param opt WiFi driver option to set
1473  */
1474 #ifdef DEBUG_EVR
1475  __STATIC_INLINE void EvrNetWiFi_SetOption(uint8_t if_num, uint32_t opt) {
1476  EventRecord2 (EvtNetWiFi_SetOption, if_num, opt);
1477  }
1478 #else
1479  #define EvrNetWiFi_SetOption(if_num, opt)
1480 #endif
1481 
1482 /**
1483  \brief Event on WiFi interface activate (API)
1484  \param if_num interface number
1485  \param mode WiFi interface mode
1486  - 0: Station
1487  - 1: Access Point
1488  */
1489 #ifdef DEBUG_EVR
1490  __STATIC_INLINE void EvrNetWiFi_Activate(uint8_t if_num, uint32_t mode) {
1491  EventRecord2 (EvtNetWiFi_Activate, if_num, mode);
1492  }
1493 #else
1494  #define EvrNetWiFi_Activate(if_num, mode)
1495 #endif
1496 
1497 /**
1498  \brief Event on WiFi activate invalid parameter (Error)
1499  \param if_num interface number
1500  */
1501 #ifdef DEBUG_EVR
1503  EventRecord2 (EvtNetWiFi_ActivateInvalidParameter, if_num, 0);
1504  }
1505 #else
1506  #define EvrNetWiFi_ActivateInvalidParameter(if_num)
1507 #endif
1508 
1509 /**
1510  \brief Event on WiFi interface deactivate (API)
1511  \param if_num interface number
1512  \param mode WiFi interface mode
1513  - 0: Station
1514  - 1: Access Point
1515  */
1516 #ifdef DEBUG_EVR
1517  __STATIC_INLINE void EvrNetWiFi_Deactivate(uint8_t if_num, uint32_t mode) {
1518  EventRecord2 (EvtNetWiFi_Deactivate, if_num, mode);
1519  }
1520 #else
1521  #define EvrNetWiFi_Deactivate(if_num, mode)
1522 #endif
1523 
1524 /**
1525  \brief Event on WiFi deactivate invalid parameter (Error)
1526  \param if_num interface number
1527  */
1528 #ifdef DEBUG_EVR
1530  EventRecord2 (EvtNetWiFi_DeactivateInvalidParam, if_num, 0);
1531  }
1532 #else
1533  #define EvrNetWiFi_DeactivateInvalidParam(if_num)
1534 #endif
1535 
1536 /**
1537  \brief Event on WiFi get network information (API)
1538  \param if_num interface number
1539  */
1540 #ifdef DEBUG_EVR
1542  EventRecord2 (EvtNetWiFi_GetNetInfo, if_num, 0);
1543  }
1544 #else
1545  #define EvrNetWiFi_GetNetInfo(if_num)
1546 #endif
1547 
1548 /**
1549  \brief Event on WiFi get network information in wrong mode (Error)
1550  \param if_num interface number
1551  \param mode WiFi interface mode
1552  - 0: Station
1553  - 1: Access Point
1554  */
1555 #ifdef DEBUG_EVR
1556  __STATIC_INLINE void EvrNetWiFi_GetNetInfoWrongMode(uint8_t if_num, uint32_t mode) {
1557  EventRecord2 (EvtNetWiFi_GetNetInfoWrongMode, if_num, mode);
1558  }
1559 #else
1560  #define EvrNetWiFi_GetNetInfoWrongMode(if_num, mode)
1561 #endif
1562 
1563 /**
1564  \brief Event on WiFi get network information invalid parameter (Error)
1565  \param if_num interface number
1566  */
1567 #ifdef DEBUG_EVR
1569  EventRecord2 (EvtNetWiFi_GetNetInfoInvalidParam, if_num, 0);
1570  }
1571 #else
1572  #define EvrNetWiFi_GetNetInfoInvalidParam(if_num)
1573 #endif
1574 
1575 /**
1576  \brief Event on WiFi send frame (Op)
1577  \param if_num interface number
1578  \param length frame length in bytes
1579  \param ip_version internet protocol version
1580  - 0: IPv4
1581  - 1: IPv6
1582  */
1583 #ifdef DEBUG_EVR
1584  __STATIC_INLINE void EvrNetWiFi_SendFrame(uint8_t if_num, uint32_t length, uint8_t ip_version) {
1585  uint32_t val2 = ((uint32_t)ip_version << 16) | length;
1586  EventRecord2 (EvtNetWiFi_SendFrame, if_num, val2);
1587  }
1588 #else
1589  #define EvrNetWiFi_SendFrame(if_num, length, ip_version)
1590 #endif
1591 
1592 /**
1593  \brief Event on WiFi station not connected (Error)
1594  \param if_num interface number
1595  */
1596 #ifdef DEBUG_EVR
1598  EventRecord2 (EvtNetWiFi_NotConnected, if_num, 0);
1599  }
1600 #else
1601  #define EvrNetWiFi_NotConnected(if_num)
1602 #endif
1603 
1604 /**
1605  \brief Event on WiFi send payload too large error (Error)
1606  \param if_num interface number
1607  \param length data length in bytes
1608  \param max_length maximum length of data in bytes
1609  */
1610 #ifdef DEBUG_EVR
1611  __STATIC_INLINE void EvrNetWiFi_SendDataTooLarge(uint8_t if_num, uint32_t length, uint32_t max_length) {
1612  uint32_t val2 = (max_length << 16) | length;
1613  EventRecord2 (EvtNetWiFi_SendDataTooLarge, if_num, val2);
1614  }
1615 #else
1616  #define EvrNetWiFi_SendDataTooLarge(if_num, length, max_length)
1617 #endif
1618 
1619 /**
1620  \brief Event on WiFi send IPv4 disabled error (Error)
1621  \param if_num interface number
1622  */
1623 #ifdef DEBUG_EVR
1625  EventRecord2 (EvtNetWiFi_SendIp4Disabled, if_num, 0);
1626  }
1627 #else
1628  #define EvrNetWiFi_SendIp4Disabled(if_num)
1629 #endif
1630 
1631 /**
1632  \brief Event on WiFi local IPv4 address undefined (Error)
1633  \param if_num interface number
1634  */
1635 #ifdef DEBUG_EVR
1637  EventRecord2 (EvtNetWiFi_Ip4LocalAddressUndefined, if_num, 0);
1638  }
1639 #else
1640  #define EvrNetWiFi_Ip4LocalAddressUndefined(if_num)
1641 #endif
1642 
1643 /**
1644  \brief Event on WiFi MAC address unresolved (Error)
1645  \param if_num interface number
1646  \param ip4_addr pointer to IPv4 destination address
1647  */
1648 #ifdef DEBUG_EVR
1649  __STATIC_INLINE void EvrNetWiFi_Ip4MacAddressUnresolved(uint8_t if_num, const uint8_t *ip4_addr) {
1650  memcpy (&evr_buf.u32[0], ip4_addr, 4);
1651  EventRecord2 (EvtNetWiFi_Ip4MacAddressUnresolved, if_num, evr_buf.u32[0]);
1652  }
1653 #else
1654  #define EvrNetWiFi_Ip4MacAddressUnresolved(if_num, ip4_addr)
1655 #endif
1656 
1657 /**
1658  \brief Event on enqueued WiFi frame for unresolved MAC address (Op)
1659  \param if_num interface number
1660  \param ca_entry cache entry identifier
1661  \param length frame length in bytes
1662  */
1663 #ifdef DEBUG_EVR
1664  __STATIC_INLINE void EvrNetWiFi_EnqueueFrame(uint8_t if_num, uint32_t ca_entry, uint32_t length) {
1665  uint32_t val2 = ((uint32_t)ca_entry << 16) | length;
1666  EventRecord2 (EvtNetWiFi_EnqueueFrame, if_num, val2);
1667  }
1668 #else
1669  #define EvrNetWiFi_EnqueueFrame(if_num, ca_entry, length)
1670 #endif
1671 
1672 /**
1673  \brief Event on WiFi send IPv6 disabled error (Error)
1674  \param if_num interface number
1675  */
1676 #ifdef DEBUG_EVR
1678  EventRecord2 (EvtNetWiFi_SendIp6Disabled, if_num, 0);
1679  }
1680 #else
1681  #define EvrNetWiFi_SendIp6Disabled(if_num)
1682 #endif
1683 
1684 /**
1685  \brief Event on WiFi local IPv6 address undefined (Error)
1686  \param if_num interface number
1687  */
1688 #ifdef DEBUG_EVR
1690  EventRecord2 (EvtNetWiFi_Ip6LocalAddressUndefined, if_num, 0);
1691  }
1692 #else
1693  #define EvrNetWiFi_Ip6LocalAddressUndefined(if_num)
1694 #endif
1695 
1696 /**
1697  \brief Event on WiFi MAC address unresolved (Error)
1698  \param if_num interface number
1699  \param ip6_addr pointer to IPv6 destination address
1700  */
1701 #ifdef DEBUG_EVR
1702  __STATIC_INLINE void EvrNetWiFi_Ip6MacAddressUnresolved(uint8_t if_num, const uint8_t *ip6_addr) {
1703  evr_buf.u32[0] = if_num;
1704  memcpy (&evr_buf.u32[1], ip6_addr, 16);
1705  EventRecordData (EvtNetWiFi_Ip6MacAddressUnresolved, &evr_buf, 20);
1706  }
1707 #else
1708  #define EvrNetWiFi_Ip6MacAddressUnresolved(if_num, ip6_addr)
1709 #endif
1710 
1711 /**
1712  \brief Event on WiFi invalid IP version (Error)
1713  \param if_num interface number
1714  \param ip_version invalid IP protocol version value
1715  - 0: IPv4
1716  - 1: IPv6
1717  */
1718 #ifdef DEBUG_EVR
1719  __STATIC_INLINE void EvrNetWiFi_InvalidIpVersion(uint8_t if_num, uint8_t ip_version) {
1720  EventRecord2 (EvtNetWiFi_InvalidIpVersion, if_num, ip_version);
1721  }
1722 #else
1723  #define EvrNetWiFi_InvalidIpVersion(if_num, ip_version)
1724 #endif
1725 
1726 /**
1727  \brief Event on WiFi display send/receive frame header (Detail)
1728  \param eth_header pointer to ethernet frame header of 14 bytes
1729  - DstAddr (6 bytes)
1730  - SrcAddr (6 bytes)
1731  - Protocol (2 bytes)
1732  */
1733 #ifdef DEBUG_EVR
1734  __STATIC_INLINE void EvrNetWiFi_ShowFrameHeader(const void *eth_header) {
1735  EventRecordData (EvtNetWiFi_ShowFrameHeader, eth_header, 14);
1736  }
1737 #else
1738  #define EvrNetWiFi_ShowFrameHeader(eth_header)
1739 #endif
1740 
1741 /**
1742  \brief Event on WiFi connection state change (Op)
1743  \param if_num interface number
1744  \param state wireless station connection state
1745  - 0: disconnected
1746  - 1: connected to Access Point
1747  */
1748 #ifdef DEBUG_EVR
1749  __STATIC_INLINE void EvrNetWiFi_LinkStateChange(uint8_t if_num, uint32_t state) {
1750  EventRecord2 (EvtNetWiFi_LinkStateChange, if_num, state);
1751  }
1752 #else
1753  #define EvrNetWiFi_LinkStateChange(if_num, state)
1754 #endif
1755 
1756 /**
1757  \brief Event on WiFi receive frame (Op)
1758  \param if_num interface number
1759  \param length frame length in bytes
1760  */
1761 #ifdef DEBUG_EVR
1762  __STATIC_INLINE void EvrNetWiFi_ReceiveFrame(uint8_t if_num, uint32_t length) {
1763  EventRecord2 (EvtNetWiFi_ReceiveFrame, if_num, length);
1764  }
1765 #else
1766  #define EvrNetWiFi_ReceiveFrame(if_num, length)
1767 #endif
1768 
1769 /**
1770  \brief Event on WiFi receive IPv4 disabled (Op)
1771  \param if_num interface number
1772  */
1773 #ifdef DEBUG_EVR
1775  EventRecord2 (EvtNetWiFi_Ip4Disabled, if_num, 0);
1776  }
1777 #else
1778  #define EvrNetWiFi_Ip4Disabled(if_num)
1779 #endif
1780 
1781 /**
1782  \brief Event on WiFi receive IPv6 disabled (Op)
1783  \param if_num interface number
1784  */
1785 #ifdef DEBUG_EVR
1787  EventRecord2 (EvtNetWiFi_Ip6Disabled, if_num, 0);
1788  }
1789 #else
1790  #define EvrNetWiFi_Ip6Disabled(if_num)
1791 #endif
1792 
1793 /**
1794  \brief Event on WiFi receive protocol unknown (Op)
1795  \param if_num interface number
1796  \param protocol unknown ethernet protocol type
1797  */
1798 #ifdef DEBUG_EVR
1799  __STATIC_INLINE void EvrNetWiFi_ProtocolUnknown(uint8_t if_num, uint16_t protocol) {
1800  EventRecord2 (EvtNetWiFi_ProtocolUnknown, if_num, protocol);
1801  }
1802 #else
1803  #define EvrNetWiFi_ProtocolUnknown(if_num, protocol)
1804 #endif
1805 
1806 /**
1807  \brief Event on WiFi output frame (Op)
1808  \param if_num interface number
1809  \param length frame length in bytes
1810  */
1811 #ifdef DEBUG_EVR
1812  __STATIC_INLINE void EvrNetWiFi_OutputLowLevel(uint8_t if_num, uint32_t length) {
1813  EventRecord2 (EvtNetWiFi_OutputLowLevel, if_num, length);
1814  }
1815 #else
1816  #define EvrNetWiFi_OutputLowLevel(if_num, length)
1817 #endif
1818 
1819 /**
1820  \brief Event on WiFi output queue overflow (Error)
1821  \param if_num interface number
1822  */
1823 #ifdef DEBUG_EVR
1825  EventRecord2 (EvtNetWiFi_TxQueueOverflow, if_num, 0);
1826  }
1827 #else
1828  #define EvrNetWiFi_TxQueueOverflow(if_num)
1829 #endif
1830 
1831 /**
1832  \brief Event on WIFI output out of memory (Error)
1833  \param if_num interface number
1834  */
1835 #ifdef DEBUG_EVR
1837  EventRecord2 (EvtNetWiFi_OutputNoMemory, if_num, 0);
1838  }
1839 #else
1840  #define EvrNetWiFi_OutputNoMemory(if_num)
1841 #endif
1842 
1843 /**
1844  \brief Event on WiFi interface de-initialize (Op)
1845  \param if_num interface number
1846  */
1847 #ifdef DEBUG_EVR
1849  EventRecord2 (EvtNetWiFi_UninitInterface, if_num, 0);
1850  }
1851 #else
1852  #define EvrNetWiFi_UninitInterface(if_num)
1853 #endif
1854 
1855 
1856 // NetPPP event identifiers ----------------------------------------------------
1857 #ifdef DEBUG_EVR
1858 /* PPP-Core events */
1859 #define EvtNetPPP_InitInterface EventID (EventLevelOp, EvtNetPPP, 0)
1860 #define EvtNetPPP_ThreadCreateFailed EventID (EventLevelError, EvtNetPPP, 1)
1861 #define EvtNetPPP_GetOptionInvalidParameter EventID (EventLevelError, EvtNetPPP, 2)
1862 #define EvtNetPPP_SetOptionInvalidParameter EventID (EventLevelError, EvtNetPPP, 3)
1863 #define EvtNetPPP_SetIp4Address EventID (EventLevelOp, EvtNetPPP, 4)
1864 #define EvtNetPPP_SetIp4PrimaryDNS EventID (EventLevelOp, EvtNetPPP, 5)
1865 #define EvtNetPPP_SetIp4SecondaryDNS EventID (EventLevelOp, EvtNetPPP, 6)
1866 #define EvtNetPPP_SetIp4Mtu EventID (EventLevelOp, EvtNetPPP, 7)
1867 #define EvtNetPPP_ReceiveFrame EventID (EventLevelOp, EvtNetPPP, 8)
1868 #define EvtNetPPP_FrameTooShort EventID (EventLevelOp, EvtNetPPP, 9)
1869 #define EvtNetPPP_ChecksumFailed EventID (EventLevelError, EvtNetPPP, 10)
1870 #define EvtNetPPP_CtrlByteInvalid EventID (EventLevelError, EvtNetPPP, 11)
1871 #define EvtNetPPP_SendFrame EventID (EventLevelOp, EvtNetPPP, 12)
1872 #define EvtNetPPP_InvalidIpVersion EventID (EventLevelError, EvtNetPPP, 13)
1873 #define EvtNetPPP_NetworkLayerDown EventID (EventLevelError, EvtNetPPP, 14)
1874 #define EvtNetPPP_SendDataTooLarge EventID (EventLevelError, EvtNetPPP, 15)
1875 #define EvtNetPPP_NoMemoryError EventID (EventLevelError, EvtNetPPP, 16)
1876 #define EvtNetPPP_QueueAddTransmit EventID (EventLevelOp, EvtNetPPP, 17)
1877 #define EvtNetPPP_RejectProtocol EventID (EventLevelOp, EvtNetPPP, 18)
1878 #define EvtNetPPP_RejectCode EventID (EventLevelOp, EvtNetPPP, 19)
1879 #define EvtNetPPP_Connect EventID (EventLevelAPI, EvtNetPPP, 20)
1880 #define EvtNetPPP_ConnectInvalidParameter EventID (EventLevelError, EvtNetPPP, 21)
1881 #define EvtNetPPP_ConnectWrongState EventID (EventLevelError, EvtNetPPP, 22)
1882 #define EvtNetPPP_Listen EventID (EventLevelAPI, EvtNetPPP, 23)
1883 #define EvtNetPPP_ListenInvalidParameter EventID (EventLevelError, EvtNetPPP, 24)
1884 #define EvtNetPPP_ListenWrongState EventID (EventLevelError, EvtNetPPP, 25)
1885 #define EvtNetPPP_Close EventID (EventLevelAPI, EvtNetPPP, 26)
1886 #define EvtNetPPP_ShowUsername EventID (EventLevelOp, EvtNetPPP, 27)
1887 #define EvtNetPPP_ShowPassword EventID (EventLevelOp, EvtNetPPP, 28)
1888 #define EvtNetPPP_ModemOffline EventID (EventLevelOp, EvtNetPPP, 29)
1889 #define EvtNetPPP_DataLinkDown EventID (EventLevelOp, EvtNetPPP, 30)
1890 #define EvtNetPPP_UninitInterface EventID (EventLevelOp, EvtNetPPP, 31)
1891 /* PPP-LCP events */
1892 #define EvtNetPPP_LcpInit EventID (EventLevelOp, EvtNetPPP, 32)
1893 #define EvtNetPPP_LcpSendConfigRequest EventID (EventLevelOp, EvtNetPPP, 33)
1894 #define EvtNetPPP_LcpNoRetriesLeft EventID (EventLevelError, EvtNetPPP, 34)
1895 #define EvtNetPPP_LcpOptionCharMap EventID (EventLevelDetail,EvtNetPPP, 35)
1896 #define EvtNetPPP_LcpOptionPfc EventID (EventLevelDetail,EvtNetPPP, 36)
1897 #define EvtNetPPP_LcpOptionAcfc EventID (EventLevelDetail,EvtNetPPP, 37)
1898 #define EvtNetPPP_LcpOptionMagicNumber EventID (EventLevelDetail,EvtNetPPP, 38)
1899 #define EvtNetPPP_LcpOptionAuthPap EventID (EventLevelDetail,EvtNetPPP, 39)
1900 #define EvtNetPPP_LcpOptionAuthChapMd5 EventID (EventLevelDetail,EvtNetPPP, 40)
1901 #define EvtNetPPP_LcpSendEchoRequest EventID (EventLevelOp, EvtNetPPP, 41)
1902 #define EvtNetPPP_LcpSendTerminateRequest EventID (EventLevelOp, EvtNetPPP, 42)
1903 #define EvtNetPPP_LcpSendFrame EventID (EventLevelOp, EvtNetPPP, 43)
1904 #define EvtNetPPP_LcpReceiveFrame EventID (EventLevelOp, EvtNetPPP, 44)
1905 #define EvtNetPPP_LcpDataLinkUp EventID (EventLevelOp, EvtNetPPP, 45)
1906 #define EvtNetPPP_LcpOptionMru EventID (EventLevelOp, EvtNetPPP, 46)
1907 #define EvtNetPPP_LcpOptionAuth EventID (EventLevelOp, EvtNetPPP, 47)
1908 #define EvtNetPPP_LcpOptionAuthChapNotMd5 EventID (EventLevelOp, EvtNetPPP, 48)
1909 #define EvtNetPPP_LcpOptionUnknown EventID (EventLevelOp, EvtNetPPP, 49)
1910 #define EvtNetPPP_LcpSendReject EventID (EventLevelOp, EvtNetPPP, 50)
1911 #define EvtNetPPP_LcpSendNak EventID (EventLevelOp, EvtNetPPP, 51)
1912 #define EvtNetPPP_LcpSendAck EventID (EventLevelOp, EvtNetPPP, 52)
1913 #define EvtNetPPP_LcpWrongAckReceived EventID (EventLevelOp, EvtNetPPP, 53)
1914 #define EvtNetPPP_LcpWrongNakReceived EventID (EventLevelOp, EvtNetPPP, 54)
1915 #define EvtNetPPP_LcpConfigAuthFailed EventID (EventLevelError, EvtNetPPP, 55)
1916 #define EvtNetPPP_LcpWrongRejectReceived EventID (EventLevelOp, EvtNetPPP, 56)
1917 #define EvtNetPPP_LcpEchoMagicNumber EventID (EventLevelOp, EvtNetPPP, 57)
1918 #define EvtNetPPP_LcpWrongPeerMagicNumber EventID (EventLevelOp, EvtNetPPP, 58)
1919 #define EvtNetPPP_LcpSendEchoReply EventID (EventLevelOp, EvtNetPPP, 59)
1920 #define EvtNetPPP_LcpWrongEchoReplyReceived EventID (EventLevelOp, EvtNetPPP, 60)
1921 #define EvtNetPPP_LcpSendTerminateAck EventID (EventLevelOp, EvtNetPPP, 61)
1922 #define EvtNetPPP_LcpUninit EventID (EventLevelOp, EvtNetPPP, 62)
1923 /* PPP-PAP events */
1924 #define EvtNetPPP_PapInit EventID (EventLevelOp, EvtNetPPP, 63)
1925 #define EvtNetPPP_PapSendAuthRequest EventID (EventLevelOp, EvtNetPPP, 64)
1926 #define EvtNetPPP_PapShowPassword EventID (EventLevelOp, EvtNetPPP, 65)
1927 #define EvtNetPPP_PapSendFrame EventID (EventLevelOp, EvtNetPPP, 66)
1928 #define EvtNetPPP_PapReceiveFrame EventID (EventLevelOp, EvtNetPPP, 67)
1929 #define EvtNetPPP_PapLoginSuccess EventID (EventLevelOp, EvtNetPPP, 68)
1930 #define EvtNetPPP_PapLoginFailed EventID (EventLevelError, EvtNetPPP, 69)
1931 #define EvtNetPPP_PapWrongAckReceived EventID (EventLevelOp, EvtNetPPP, 70)
1932 #define EvtNetPPP_PapWrongNakReceived EventID (EventLevelOp, EvtNetPPP, 71)
1933 #define EvtNetPPP_PapUninit EventID (EventLevelOp, EvtNetPPP, 72)
1934 /* PPP-CHAP events */
1935 #define EvtNetPPP_ChapInit EventID (EventLevelOp, EvtNetPPP, 73)
1936 #define EvtNetPPP_ChapSendChallenge EventID (EventLevelOp, EvtNetPPP, 74)
1937 #define EvtNetPPP_ChapSendFrame EventID (EventLevelOp, EvtNetPPP, 75)
1938 #define EvtNetPPP_ChapReceiveFrame EventID (EventLevelOp, EvtNetPPP, 76)
1939 #define EvtNetPPP_ChapWrongResponseReceived EventID (EventLevelOp, EvtNetPPP, 77)
1940 #define EvtNetPPP_ChapWrongSuccessReceived EventID (EventLevelOp, EvtNetPPP, 78)
1941 #define EvtNetPPP_ChapWrongFailureReceived EventID (EventLevelOp, EvtNetPPP, 79)
1942 #define EvtNetPPP_ChapLoginSuccess EventID (EventLevelOp, EvtNetPPP, 80)
1943 #define EvtNetPPP_ChapLoginFailed EventID (EventLevelError, EvtNetPPP, 81)
1944 #define EvtNetPPP_ChapUninit EventID (EventLevelOp, EvtNetPPP, 82)
1945 /* PPP-IPCP events */
1946 #define EvtNetPPP_IpcpInit EventID (EventLevelOp, EvtNetPPP, 83)
1947 #define EvtNetPPP_IpcpIp4ConfigError EventID (EventLevelError, EvtNetPPP, 84)
1948 #define EvtNetPPP_IpcpSendConfigRequest EventID (EventLevelOp, EvtNetPPP, 85)
1949 #define EvtNetPPP_IpcpOptionIpAddress EventID (EventLevelDetail,EvtNetPPP, 86)
1950 #define EvtNetPPP_IpcpOptionPrimaryDns EventID (EventLevelDetail,EvtNetPPP, 87)
1951 #define EvtNetPPP_IpcpOptionSecondaryDns EventID (EventLevelDetail,EvtNetPPP, 88)
1952 #define EvtNetPPP_IpcpSendFrame EventID (EventLevelOp, EvtNetPPP, 89)
1953 #define EvtNetPPP_IpcpReceiveFrame EventID (EventLevelOp, EvtNetPPP, 90)
1954 #define EvtNetPPP_IpcpOptionUnknown EventID (EventLevelOp, EvtNetPPP, 91)
1955 #define EvtNetPPP_IpcpSendReject EventID (EventLevelOp, EvtNetPPP, 92)
1956 #define EvtNetPPP_IpcpSendNak EventID (EventLevelOp, EvtNetPPP, 93)
1957 #define EvtNetPPP_IpcpSendAck EventID (EventLevelOp, EvtNetPPP, 94)
1958 #define EvtNetPPP_IpcpWrongAckReceived EventID (EventLevelOp, EvtNetPPP, 95)
1959 #define EvtNetPPP_IpcpNetworkLayerUp EventID (EventLevelOp, EvtNetPPP, 96)
1960 #define EvtNetPPP_IpcpWrongNakReceived EventID (EventLevelOp, EvtNetPPP, 97)
1961 #define EvtNetPPP_IpcpWrongRejectReceived EventID (EventLevelOp, EvtNetPPP, 98)
1962 #define EvtNetPPP_IpcpWrongSubnet EventID (EventLevelOp, EvtNetPPP, 99)
1963 #define EvtNetPPP_IpcpPrimaryDnsRejected EventID (EventLevelOp, EvtNetPPP,100)
1964 #define EvtNetPPP_IpcpSecondaryDnsRejected EventID (EventLevelOp, EvtNetPPP,101)
1965 #define EvtNetPPP_IpcpIpAddressRejected EventID (EventLevelError, EvtNetPPP,102)
1966 #define EvtNetPPP_IpcpNotRequestedOption EventID (EventLevelError, EvtNetPPP,103)
1967 #define EvtNetPPP_IpcpUninit EventID (EventLevelOp, EvtNetPPP,104)
1968 #endif
1969 
1970 // PPP core event recorder functions -------------------------------------------
1971 
1972 /**
1973  \brief Event on PPP interface initialize (Op)
1974  \remark Point-to-Point Protocol
1975  */
1976 #ifdef DEBUG_EVR
1978  EventRecord2 (EvtNetPPP_InitInterface, 0, 0);
1979  }
1980 #else
1981  #define EvrNetPPP_InitInterface()
1982 #endif
1983 
1984 /**
1985  \brief Event on PPP thread create failed (Error)
1986  */
1987 #ifdef DEBUG_EVR
1989  EventRecord2 (EvtNetPPP_ThreadCreateFailed, 0, 0);
1990  }
1991 #else
1992  #define EvrNetPPP_ThreadCreateFailed()
1993 #endif
1994 
1995 /**
1996  \brief Event on PPP get_option invalid parameter (Error)
1997  */
1998 #ifdef DEBUG_EVR
2000  EventRecord2 (EvtNetPPP_GetOptionInvalidParameter, 0, 0);
2001  }
2002 #else
2003  #define EvrNetPPP_GetOptionInvalidParameter()
2004 #endif
2005 
2006 /**
2007  \brief Event on PPP set_option invalid parameter (Error)
2008  */
2009 #ifdef DEBUG_EVR
2011  EventRecord2 (EvtNetPPP_SetOptionInvalidParameter, 0, 0);
2012  }
2013 #else
2014  #define EvrNetPPP_SetOptionInvalidParameter()
2015 #endif
2016 
2017 /**
2018  \brief Event on PPP set interface IPv4 address (Op)
2019  \param ip4_addr pointer to IPv4 address
2020  */
2021 #ifdef DEBUG_EVR
2022  __STATIC_INLINE void EvrNetPPP_SetIp4Address(const uint8_t *ip4_addr) {
2023  EventRecordData (EvtNetPPP_SetIp4Address, ip4_addr, 4);
2024  }
2025 #else
2026  #define EvrNetPPP_SetIp4Address(ip4_addr)
2027 #endif
2028 
2029 /**
2030  \brief Event on PPP set interface primary DNS server (Op)
2031  \param ip4_addr pointer to IPv4 address of a DNS server
2032  */
2033 #ifdef DEBUG_EVR
2034  __STATIC_INLINE void EvrNetPPP_SetIp4PrimaryDNS(const uint8_t *ip4_addr) {
2035  EventRecordData (EvtNetPPP_SetIp4PrimaryDNS, ip4_addr, 4);
2036  }
2037 #else
2038  #define EvrNetPPP_SetIp4PrimaryDNS(ip4_addr)
2039 #endif
2040 
2041 /**
2042  \brief Event on PPP set interface secondary DNS server (Op)
2043  \param ip4_addr pointer to IPv4 address of a DNS server
2044  */
2045 #ifdef DEBUG_EVR
2046  __STATIC_INLINE void EvrNetPPP_SetIp4SecondaryDNS(const uint8_t *ip4_addr) {
2047  EventRecordData (EvtNetPPP_SetIp4SecondaryDNS, ip4_addr, 4);
2048  }
2049 #else
2050  #define EvrNetPPP_SetIp4SecondaryDNS(ip4_addr)
2051 #endif
2052 
2053 /**
2054  \brief Event on PPP set interface MTU (Op)
2055  \param mtu maximum transmission unit
2056  - 0: fragmentation disabled
2057  \remark MTU is limited in the range from 576 to 1500 bytes.
2058  */
2059 #ifdef DEBUG_EVR
2061  EventRecord2 (EvtNetPPP_SetIp4Mtu, mtu, 0);
2062  }
2063 #else
2064  #define EvrNetPPP_SetIp4Mtu(mtu)
2065 #endif
2066 
2067 /**
2068  \brief Event on PPP receive frame (Op)
2069  \param protocol PPP protocol type
2070  - 0xC021: LCP
2071  - 0xC023: PAP
2072  - 0xC223: CHAP
2073  - 0x8021: IPCP
2074  - 0x0021: IP
2075  \param length frame length in bytes
2076  */
2077 #ifdef DEBUG_EVR
2078  __STATIC_INLINE void EvrNetPPP_ReceiveFrame(uint16_t protocol, uint32_t length) {
2079  EventRecord2 (EvtNetPPP_ReceiveFrame, protocol, length);
2080  }
2081 #else
2082  #define EvrNetPPP_ReceiveFrame(protocol, length)
2083 #endif
2084 
2085 /**
2086  \brief Event on PPP receive frame too short (Op)
2087  \param length frame length in bytes
2088  \param min_length minimum length of the frame
2089  */
2090 #ifdef DEBUG_EVR
2091  __STATIC_INLINE void EvrNetPPP_FrameTooShort(uint32_t length, uint32_t min_length) {
2092  if (length > 1536) length = 0;
2093  EventRecord2 (EvtNetPPP_FrameTooShort, length, min_length);
2094  }
2095 #else
2096  #define EvrNetPPP_FrameTooShort(length, min_length)
2097 #endif
2098 
2099 /**
2100  \brief Event on PPP frame checksum check failed (Error)
2101  \param length frame length in bytes
2102  */
2103 #ifdef DEBUG_EVR
2105  EventRecord2 (EvtNetPPP_ChecksumFailed, length, 0);
2106  }
2107 #else
2108  #define EvrNetPPP_ChecksumFailed(length)
2109 #endif
2110 
2111 /**
2112  \brief Event on PPP frame control byte invalid (Error)
2113  \param ctrl received control byte
2114  \param ctrl_valid valid control byte
2115  */
2116 #ifdef DEBUG_EVR
2117  __STATIC_INLINE void EvrNetPPP_CtrlByteInvalid(uint8_t ctrl, uint8_t ctrl_valid) {
2118  EventRecord2 (EvtNetPPP_CtrlByteInvalid, ctrl, ctrl_valid);
2119  }
2120 #else
2121  #define EvrNetPPP_CtrlByteInvalid(ctrl, ctrl_valid)
2122 #endif
2123 
2124 /**
2125  \brief Event on PPP send frame (Op)
2126  \param protocol PPP protocol type
2127  - 0xC021: LCP
2128  - 0xC023: PAP
2129  - 0xC223: CHAP
2130  - 0x8021: IPCP
2131  - 0x0021: IP
2132  \param length frame length in bytes
2133  */
2134 #ifdef DEBUG_EVR
2135  __STATIC_INLINE void EvrNetPPP_SendFrame(uint16_t protocol, uint32_t length) {
2136  EventRecord2 (EvtNetPPP_SendFrame, protocol, length);
2137  }
2138 #else
2139  #define EvrNetPPP_SendFrame(protocol, length)
2140 #endif
2141 
2142 /**
2143  \brief Event on PPP invalid IP version (Error)
2144  \param ip_version invalid IP protocol version value
2145  - 0: IPv4
2146  - 1: IPv6
2147  */
2148 #ifdef DEBUG_EVR
2149  __STATIC_INLINE void EvrNetPPP_InvalidIpVersion(uint8_t ip_version) {
2150  EventRecord2 (EvtNetPPP_InvalidIpVersion, ip_version, 0);
2151  }
2152 #else
2153  #define EvrNetPPP_InvalidIpVersion(ip_version)
2154 #endif
2155 
2156 /**
2157  \brief Event on PPP network layer down (Error)
2158  */
2159 #ifdef DEBUG_EVR
2161  EventRecord2 (EvtNetPPP_NetworkLayerDown, 0, 0);
2162  }
2163 #else
2164  #define EvrNetPPP_NetworkLayerDown()
2165 #endif
2166 
2167 /**
2168  \brief Event on PPP send payload too large (Error)
2169  \param length data length in bytes
2170  \param max_length maximum length of data in bytes
2171  */
2172 #ifdef DEBUG_EVR
2173  __STATIC_INLINE void EvrNetPPP_SendDataTooLarge(uint32_t length, uint32_t max_length) {
2174  EventRecord2 (EvtNetPPP_SendDataTooLarge, length, max_length);
2175  }
2176 #else
2177  #define EvrNetPPP_SendDataTooLarge(length, max_length)
2178 #endif
2179 
2180 /**
2181  \brief Event on PPP out of memory for send (Error)
2182  */
2183 #ifdef DEBUG_EVR
2185  EventRecord2 (EvtNetPPP_NoMemoryError, 0, 0);
2186  }
2187 #else
2188  #define EvrNetPPP_NoMemoryError()
2189 #endif
2190 
2191 /**
2192  \brief Event on PPP add frame to transmit queue (Op)
2193  */
2194 #ifdef DEBUG_EVR
2196  EventRecord2 (EvtNetPPP_QueueAddTransmit, 0, 0);
2197  }
2198 #else
2199  #define EvrNetPPP_QueueAddTransmit()
2200 #endif
2201 
2202 /**
2203  \brief Event on PPP reject unsupported protocol type (Op)
2204  \param protocol unsupported protocol type
2205  */
2206 #ifdef DEBUG_EVR
2207  __STATIC_INLINE void EvrNetPPP_RejectProtocol(uint16_t protocol) {
2208  EventRecord2 (EvtNetPPP_RejectProtocol, protocol, 0);
2209  }
2210 #else
2211  #define EvrNetPPP_RejectProtocol(protocol)
2212 #endif
2213 
2214 /**
2215  \brief Event on PPP reject unsupported cp code (Op)
2216  \param protocol PPP protocol type
2217  - 0xC021: LCP
2218  - 0x8021: IPCP
2219  \param code unsupported control code
2220  */
2221 #ifdef DEBUG_EVR
2222  __STATIC_INLINE void EvrNetPPP_RejectCode(uint16_t protocol, uint8_t code) {
2223  EventRecord2 (EvtNetPPP_RejectCode, protocol, code);
2224  }
2225 #else
2226  #define EvrNetPPP_RejectCode(protocol, code)
2227 #endif
2228 
2229 /**
2230  \brief Event on PPP start connecting (API)
2231  \param dial_number pointer to a dial number string
2232  \param length length of the dial number string
2233  */
2234 #ifdef DEBUG_EVR
2235  __STATIC_INLINE void EvrNetPPP_Connect(const char *dial_number, uint32_t length) {
2236  if (length > 24) length = 24;
2237  EventRecordData (EvtNetPPP_Connect, dial_number, length);
2238  }
2239 #else
2240  #define EvrNetPPP_Connect(dial_number, length)
2241 #endif
2242 
2243 /**
2244  \brief Event on PPP connect invalid parameter (Error)
2245  */
2246 #ifdef DEBUG_EVR
2248  EventRecord2 (EvtNetPPP_ConnectInvalidParameter, 0, 0);
2249  }
2250 #else
2251  #define EvrNetPPP_ConnectInvalidParameter()
2252 #endif
2253 
2254 /**
2255  \brief Event on PPP connect in wrong state (Error)
2256  */
2257 #ifdef DEBUG_EVR
2259  EventRecord2 (EvtNetPPP_ConnectWrongState, 0, 0);
2260  }
2261 #else
2262  #define EvrNetPPP_ConnectWrongState()
2263 #endif
2264 
2265 /**
2266  \brief Event on PPP start listening (API)
2267  */
2268 #ifdef DEBUG_EVR
2270  EventRecord2 (EvtNetPPP_Listen, 0, 0);
2271  }
2272 #else
2273  #define EvrNetPPP_Listen()
2274 #endif
2275 
2276 /**
2277  \brief Event on PPP listen invalid parameter (Error)
2278  */
2279 #ifdef DEBUG_EVR
2281  EventRecord2 (EvtNetPPP_ListenInvalidParameter, 0, 0);
2282  }
2283 #else
2284  #define EvrNetPPP_ListenInvalidParameter()
2285 #endif
2286 
2287 /**
2288  \brief Event on PPP listen in wrong state (Error)
2289  */
2290 #ifdef DEBUG_EVR
2292  EventRecord2 (EvtNetPPP_ListenWrongState, 0, 0);
2293  }
2294 #else
2295  #define EvrNetPPP_ListenWrongState()
2296 #endif
2297 
2298 /**
2299  \brief Event on PPP close connection (API)
2300  */
2301 #ifdef DEBUG_EVR
2303  EventRecord2 (EvtNetPPP_Close, 0, 0);
2304  }
2305 #else
2306  #define EvrNetPPP_Close()
2307 #endif
2308 
2309 /**
2310  \brief Event on PPP display username (Op)
2311  \param username pointer to a username string
2312  \param length length of the username string
2313  */
2314 #ifdef DEBUG_EVR
2315  __STATIC_INLINE void EvrNetPPP_ShowUsername(const char *username, uint32_t length) {
2316  if (length > 24) length = 24;
2317  EventRecordData (EvtNetPPP_ShowUsername, username, length);
2318  }
2319 #else
2320  #define EvrNetPPP_ShowUsername(username, length)
2321 #endif
2322 
2323 /**
2324  \brief Event on PPP display password (Op)
2325  \param password pointer to a password string
2326  \param length length of the password string
2327  */
2328 #ifdef DEBUG_EVR
2329  __STATIC_INLINE void EvrNetPPP_ShowPassword(const char *password, uint32_t length) {
2330  if (length > 24) length = 24;
2331  EventRecordData (EvtNetPPP_ShowPassword, password, length);
2332  }
2333 #else
2334  #define EvrNetPPP_ShowPassword(password, length)
2335 #endif
2336 
2337 /**
2338  \brief Event on PPP link change to modem offline (Op)
2339  */
2340 #ifdef DEBUG_EVR
2342  EventRecord2 (EvtNetPPP_ModemOffline, 0, 0);
2343  }
2344 #else
2345  #define EvrNetPPP_ModemOffline()
2346 #endif
2347 
2348 /**
2349  \brief Event on PPP data-link layer down (Op)
2350  */
2351 #ifdef DEBUG_EVR
2353  EventRecord2 (EvtNetPPP_DataLinkDown, 0, 0);
2354  }
2355 #else
2356  #define EvrNetPPP_DataLinkDown()
2357 #endif
2358 
2359 /**
2360  \brief Event on PPP interface de-initialize (Op)
2361  */
2362 #ifdef DEBUG_EVR
2364  EventRecord2 (EvtNetPPP_UninitInterface, 0, 0);
2365  }
2366 #else
2367  #define EvrNetPPP_UninitInterface()
2368 #endif
2369 
2370 // PPP-LCP event recorder functions --------------------------------------------
2371 
2372 /**
2373  \brief Event on PPP-LCP initialize (Op)
2374  \remark Point-to-Point Link Control Protocol
2375  */
2376 #ifdef DEBUG_EVR
2378  EventRecord2 (EvtNetPPP_LcpInit, 0, 0);
2379  }
2380 #else
2381  #define EvrNetPPP_LcpInit()
2382 #endif
2383 
2384 /**
2385  \brief Event on PPP-LCP send configuration request (Op)
2386  */
2387 #ifdef DEBUG_EVR
2389  EventRecord2 (EvtNetPPP_LcpSendConfigRequest, 0, 0);
2390  }
2391 #else
2392  #define EvrNetPPP_LcpSendConfigRequest()
2393 #endif
2394 
2395 /**
2396  \brief Event on PPP-LCP no retries left for LCP negotiation (Error)
2397  */
2398 #ifdef DEBUG_EVR
2400  EventRecord2 (EvtNetPPP_LcpNoRetriesLeft, 0, 0);
2401  }
2402 #else
2403  #define EvrNetPPP_LcpNoRetriesLeft()
2404 #endif
2405 
2406 /**
2407  \brief Event on PPP-LCP option character map (Detail)
2408  \param char_map character bit-map for non printable characters
2409  - bit 0: ascii character 0
2410  - bit 1: ascii character 1
2411  - bit 2: ascii character 2
2412  - ...
2413  - bit 31: ascii character 31
2414  */
2415 #ifdef DEBUG_EVR
2417  EventRecord2 (EvtNetPPP_LcpOptionCharMap, char_map, 0);
2418  }
2419 #else
2420  #define EvrNetPPP_LcpOptionCharMap(char_map)
2421 #endif
2422 
2423 /**
2424  \brief Event on PPP-LCP option PFC (Detail)
2425  */
2426 #ifdef DEBUG_EVR
2428  EventRecord2 (EvtNetPPP_LcpOptionPfc, 0, 0);
2429  }
2430 #else
2431  #define EvrNetPPP_LcpOptionPfc()
2432 #endif
2433 
2434 /**
2435  \brief Event on PPP-LCP option ACFC (Detail)
2436  */
2437 #ifdef DEBUG_EVR
2439  EventRecord2 (EvtNetPPP_LcpOptionAcfc, 0, 0);
2440  }
2441 #else
2442  #define EvrNetPPP_LcpOptionAcfc()
2443 #endif
2444 
2445 /**
2446  \brief Event on PPP-LCP option magic number (Detail)
2447  \param magic_number magic random number
2448  */
2449 #ifdef DEBUG_EVR
2450  __STATIC_INLINE void EvrNetPPP_LcpOptionMagicNumber(uint32_t magic_number) {
2451  EventRecord2 (EvtNetPPP_LcpOptionMagicNumber, magic_number, 0);
2452  }
2453 #else
2454  #define EvrNetPPP_LcpOptionMagicNumber(magic_number)
2455 #endif
2456 
2457 /**
2458  \brief Event on PPP-LCP option Authentication PAP (Detail)
2459  \remark Password Authentication Protocol - plain text
2460  */
2461 #ifdef DEBUG_EVR
2463  EventRecord2 (EvtNetPPP_LcpOptionAuthPap, 0, 0);
2464  }
2465 #else
2466  #define EvrNetPPP_LcpOptionAuthPap()
2467 #endif
2468 
2469 /**
2470  \brief Event on PPP-LCP option Authentication CHAP (Detail)
2471  \remark Challenge Handshake Authentication Protocol with MD5
2472  */
2473 #ifdef DEBUG_EVR
2475  EventRecord2 (EvtNetPPP_LcpOptionAuthChapMd5, 0, 0);
2476  }
2477 #else
2478  #define EvrNetPPP_LcpOptionAuthChapMd5()
2479 #endif
2480 
2481 /**
2482  \brief Event on PPP-LCP send echo request (Op)
2483  \param magic_number magic random number
2484  */
2485 #ifdef DEBUG_EVR
2486  __STATIC_INLINE void EvrNetPPP_LcpSendEchoRequest(uint32_t magic_number) {
2487  EventRecord2 (EvtNetPPP_LcpSendEchoRequest, magic_number, 0);
2488  }
2489 #else
2490  #define EvrNetPPP_LcpSendEchoRequest(magic_number)
2491 #endif
2492 
2493 /**
2494  \brief Event on PPP-LCP send LCP terminate request (Op)
2495  */
2496 #ifdef DEBUG_EVR
2498  EventRecord2 (EvtNetPPP_LcpSendTerminateRequest, 0, 0);
2499  }
2500 #else
2501  #define EvrNetPPP_LcpSendTerminateRequest()
2502 #endif
2503 
2504 /**
2505  \brief Event on PPP-LCP send frame (Op)
2506  \param lcp_header pointer to LCP frame header of 4 bytes
2507  - Code (1 byte)
2508  - Id (1 byte)
2509  - Len (2 bytes)
2510  */
2511 #ifdef DEBUG_EVR
2512  __STATIC_INLINE void EvrNetPPP_LcpSendFrame(const void *lcp_header) {
2513  EventRecordData (EvtNetPPP_LcpSendFrame, lcp_header, 4);
2514  }
2515 #else
2516  #define EvrNetPPP_LcpSendFrame(lcp_header)
2517 #endif
2518 
2519 /**
2520  \brief Event on PPP-LCP receive frame (Op)
2521  \param lcp_header pointer to LCP frame header of 4 bytes
2522  - Code (1 byte)
2523  - Id (1 byte)
2524  - Len (2 bytes)
2525  */
2526 #ifdef DEBUG_EVR
2527  __STATIC_INLINE void EvrNetPPP_LcpReceiveFrame(const void *lcp_header) {
2528  EventRecordData (EvtNetPPP_LcpReceiveFrame, lcp_header, 4);
2529  }
2530 #else
2531  #define EvrNetPPP_LcpReceiveFrame(lcp_header)
2532 #endif
2533 
2534 /**
2535  \brief Event on PPP-LCP data-link layer established (Op)
2536  */
2537 #ifdef DEBUG_EVR
2539  EventRecord2 (EvtNetPPP_LcpDataLinkUp, 0, 0);
2540  }
2541 #else
2542  #define EvrNetPPP_LcpDataLinkUp()
2543 #endif
2544 
2545 /**
2546  \brief Event on PPP-LCP option MRU (Op)
2547  \param mru_size maximum receive unit size
2548  */
2549 #ifdef DEBUG_EVR
2550  __STATIC_INLINE void EvrNetPPP_LcpOptionMru(uint16_t mru_size) {
2551  EventRecord2 (EvtNetPPP_LcpOptionMru, mru_size, 0);
2552  }
2553 #else
2554  #define EvrNetPPP_LcpOptionMru(mru_size)
2555 #endif
2556 
2557 /**
2558  \brief Event on PPP-LCP option authentication type (Op)
2559  \param auth_type authentication type code
2560  - 0xC023: PAP
2561  - 0xC223: CHAP
2562  */
2563 #ifdef DEBUG_EVR
2564  __STATIC_INLINE void EvrNetPPP_LcpOptionAuth(uint16_t auth_type) {
2565  EventRecord2 (EvtNetPPP_LcpOptionAuth, auth_type, 0);
2566  }
2567 #else
2568  #define EvrNetPPP_LcpOptionAuth(auth_type)
2569 #endif
2570 
2571 /**
2572  \brief Event on PPP-LCP option CHAP authentication not MD5 type (Op)
2573  */
2574 #ifdef DEBUG_EVR
2576  EventRecord2 (EvtNetPPP_LcpOptionAuthChapNotMd5, 0, 0);
2577  }
2578 #else
2579  #define EvrNetPPP_LcpOptionAuthChapNotMd5()
2580 #endif
2581 
2582 /**
2583  \brief Event on PPP-LCP unknown option received (Op)
2584  \param lcp_option unknown LCP option value
2585  */
2586 #ifdef DEBUG_EVR
2587  __STATIC_INLINE void EvrNetPPP_LcpOptionUnknown(uint8_t lcp_option) {
2588  EventRecord2 (EvtNetPPP_LcpOptionUnknown, lcp_option, 0);
2589  }
2590 #else
2591  #define EvrNetPPP_LcpOptionUnknown(lcp_option)
2592 #endif
2593 
2594 /**
2595  \brief Event on PPP-LCP send reject (Op)
2596  */
2597 #ifdef DEBUG_EVR
2599  EventRecord2 (EvtNetPPP_LcpSendReject, 0, 0);
2600  }
2601 #else
2602  #define EvrNetPPP_LcpSendReject()
2603 #endif
2604 
2605 /**
2606  \brief Event on PPP-LCP send not acknowledge (Op)
2607  */
2608 #ifdef DEBUG_EVR
2610  EventRecord2 (EvtNetPPP_LcpSendNak, 0, 0);
2611  }
2612 #else
2613  #define EvrNetPPP_LcpSendNak()
2614 #endif
2615 
2616 /**
2617  \brief Event on PPP-LCP send acknowledge (Op)
2618  */
2619 #ifdef DEBUG_EVR
2621  EventRecord2 (EvtNetPPP_LcpSendAck, 0, 0);
2622  }
2623 #else
2624  #define EvrNetPPP_LcpSendAck()
2625 #endif
2626 
2627 /**
2628  \brief Event on PPP-LCP wrong acknowledge received (Op)
2629  \param id received LCP identifier
2630  \param id_valid valid LCP identifier
2631  */
2632 #ifdef DEBUG_EVR
2633  __STATIC_INLINE void EvrNetPPP_LcpWrongAckReceived(uint8_t id, uint8_t id_valid) {
2634  EventRecord2 (EvtNetPPP_LcpWrongAckReceived, id, id_valid);
2635  }
2636 #else
2637  #define EvrNetPPP_LcpWrongAckReceived(id, id_valid)
2638 #endif
2639 
2640 /**
2641  \brief Event on PPP-LCP wrong not-acknowledge received (Op)
2642  \param id received LCP identifier
2643  \param id_valid valid LCP identifier
2644  */
2645 #ifdef DEBUG_EVR
2646  __STATIC_INLINE void EvrNetPPP_LcpWrongNakReceived(uint8_t id, uint8_t id_valid) {
2647  EventRecord2 (EvtNetPPP_LcpWrongNakReceived, id, id_valid);
2648  }
2649 #else
2650  #define EvrNetPPP_LcpWrongNakReceived(id, id_valid)
2651 #endif
2652 
2653 /**
2654  \brief Event on PPP-LCP authentication type negotiation failed (Error)
2655  */
2656 #ifdef DEBUG_EVR
2658  EventRecord2 (EvtNetPPP_LcpConfigAuthFailed, 0, 0);
2659  }
2660 #else
2661  #define EvrNetPPP_LcpConfigAuthFailed()
2662 #endif
2663 
2664 /**
2665  \brief Event on PPP-LCP wrong reject received (Op)
2666  \param id received LCP identifier
2667  \param id_valid valid LCP identifier
2668  */
2669 #ifdef DEBUG_EVR
2670  __STATIC_INLINE void EvrNetPPP_LcpWrongRejectReceived(uint8_t id, uint8_t id_valid) {
2671  EventRecord2 (EvtNetPPP_LcpWrongRejectReceived, id, id_valid);
2672  }
2673 #else
2674  #define EvrNetPPP_LcpWrongRejectReceived(id, id_valid)
2675 #endif
2676 
2677 /**
2678  \brief Event on PPP-LCP echo magic number (Op)
2679  \param magic_number peer echo magic number
2680  */
2681 #ifdef DEBUG_EVR
2682  __STATIC_INLINE void EvrNetPPP_LcpEchoMagicNumber(uint32_t magic_number) {
2683  EventRecord2 (EvtNetPPP_LcpEchoMagicNumber, magic_number, 0);
2684  }
2685 #else
2686  #define EvrNetPPP_LcpEchoMagicNumber(magic_number)
2687 #endif
2688 
2689 /**
2690  \brief Event on PPP-LCP wrong peer magic number (Op)
2691  \param magic received peer magic number
2692  \param magic_valid valid peer magic number
2693  */
2694 #ifdef DEBUG_EVR
2695  __STATIC_INLINE void EvrNetPPP_LcpWrongPeerMagicNumber(uint32_t magic, uint32_t magic_valid) {
2696  EventRecord2 (EvtNetPPP_LcpWrongPeerMagicNumber, magic, magic_valid);
2697  }
2698 #else
2699  #define EvrNetPPP_LcpWrongPeerMagicNumber(magic, magic_valid)
2700 #endif
2701 
2702 /**
2703  \brief Event on PPP-LCP send echo reply (Op)
2704  */
2705 #ifdef DEBUG_EVR
2707  EventRecord2 (EvtNetPPP_LcpSendEchoReply, 0, 0);
2708  }
2709 #else
2710  #define EvrNetPPP_LcpSendEchoReply()
2711 #endif
2712 
2713 /**
2714  \brief Event on PPP-LCP wrong echo reply received (Op)
2715  \param id received LCP identifier
2716  \param id_valid valid LCP identifier
2717  */
2718 #ifdef DEBUG_EVR
2719  __STATIC_INLINE void EvrNetPPP_LcpWrongEchoReplyReceived(uint8_t id, uint8_t id_valid) {
2720  EventRecord2 (EvtNetPPP_LcpWrongEchoReplyReceived, id, id_valid);
2721  }
2722 #else
2723  #define EvrNetPPP_LcpWrongEchoReplyReceived(id, id_valid)
2724 #endif
2725 
2726 /**
2727  \brief Event on PPP-LCP send terminate acknowledge (Op)
2728  */
2729 #ifdef DEBUG_EVR
2731  EventRecord2 (EvtNetPPP_LcpSendTerminateAck, 0, 0);
2732  }
2733 #else
2734  #define EvrNetPPP_LcpSendTerminateAck()
2735 #endif
2736 
2737 /**
2738  \brief Event on PPP-LCP de-initialize (Op)
2739  \remark Point-to-Point Link Control Protocol
2740  */
2741 #ifdef DEBUG_EVR
2743  EventRecord2 (EvtNetPPP_LcpUninit, 0, 0);
2744  }
2745 #else
2746  #define EvrNetPPP_LcpUninit()
2747 #endif
2748 
2749 // PPP-PAP event recorder functions --------------------------------------------
2750 
2751 /**
2752  \brief Event on PPP-PAP initialize (Op)
2753  \remark Password Authentication Protocol
2754  */
2755 #ifdef DEBUG_EVR
2757  EventRecord2 (EvtNetPPP_PapInit, 0, 0);
2758  }
2759 #else
2760  #define EvrNetPPP_PapInit()
2761 #endif
2762 
2763 /**
2764  \brief Event on PPP-PAP send authentication request (Op)
2765  \param peer_id peer identifier string (username)
2766  \param length length of the peer_id string
2767  */
2768 #ifdef DEBUG_EVR
2769  __STATIC_INLINE void EvrNetPPP_PapSendAuthRequest(const char *peer_id, uint32_t length) {
2770  if (length > 24) length = 24;
2771  EventRecordData (EvtNetPPP_PapSendAuthRequest, peer_id, length);
2772  }
2773 #else
2774  #define EvrNetPPP_PapSendAuthRequest(peer_id, length)
2775 #endif
2776 
2777 /**
2778  \brief Event on PPP-PAP display password (Op)
2779  \param password authentication password
2780  \param length length of authentication password
2781  */
2782 #ifdef DEBUG_EVR
2783  __STATIC_INLINE void EvrNetPPP_PapShowPassword(const char *password, uint32_t length) {
2784  if (length > 24) length = 24;
2785  EventRecordData (EvtNetPPP_PapShowPassword, password, length);
2786  }
2787 #else
2788  #define EvrNetPPP_PapShowPassword(password, length)
2789 #endif
2790 
2791 /**
2792  \brief Event on PPP-PAP send frame (Op)
2793  \param pap_header pointer to PAP frame header of 4 bytes
2794  - Code (1 byte)
2795  - Id (1 byte)
2796  - Len (2 bytes)
2797  */
2798 #ifdef DEBUG_EVR
2799  __STATIC_INLINE void EvrNetPPP_PapSendFrame(const void *pap_header) {
2800  EventRecordData (EvtNetPPP_PapSendFrame, pap_header, 4);
2801  }
2802 #else
2803  #define EvrNetPPP_PapSendFrame(pap_header)
2804 #endif
2805 
2806 /**
2807  \brief Event on PPP-PAP receive frame (Op)
2808  \param pap_header pointer to PAP frame header of 4 bytes
2809  - Code (1 byte)
2810  - Id (1 byte)
2811  - Len (2 bytes)
2812  */
2813 #ifdef DEBUG_EVR
2814  __STATIC_INLINE void EvrNetPPP_PapReceiveFrame(const void *pap_header) {
2815  EventRecordData (EvtNetPPP_PapReceiveFrame, pap_header, 4);
2816  }
2817 #else
2818  #define EvrNetPPP_PapReceiveFrame(pap_header)
2819 #endif
2820 
2821 /**
2822  \brief Event on PPP-PAP login success (Op)
2823  */
2824 #ifdef DEBUG_EVR
2826  EventRecord2 (EvtNetPPP_PapLoginSuccess, 0, 0);
2827  }
2828 #else
2829  #define EvrNetPPP_PapLoginSuccess()
2830 #endif
2831 
2832 /**
2833  \brief Event on PPP-PAP login failed (Error)
2834  */
2835 #ifdef DEBUG_EVR
2837  EventRecord2 (EvtNetPPP_PapLoginFailed, 0, 0);
2838  }
2839 #else
2840  #define EvrNetPPP_PapLoginFailed()
2841 #endif
2842 
2843 /**
2844  \brief Event on PPP-PAP wrong acknowledge received (Op)
2845  \param id received PAP identifier
2846  \param id_valid valid PAP identifier
2847  */
2848 #ifdef DEBUG_EVR
2849  __STATIC_INLINE void EvrNetPPP_PapWrongAckReceived(uint8_t id, uint8_t id_valid) {
2850  EventRecord2 (EvtNetPPP_PapWrongAckReceived, id, id_valid);
2851  }
2852 #else
2853  #define EvrNetPPP_PapWrongAckReceived(id, id_valid)
2854 #endif
2855 
2856 /**
2857  \brief Event on PPP-PAP wrong not-acknowledge received (Op)
2858  \param id received PAP identifier
2859  \param id_valid valid PAP identifier
2860  */
2861 #ifdef DEBUG_EVR
2862  __STATIC_INLINE void EvrNetPPP_PapWrongNakReceived(uint8_t id, uint8_t id_valid) {
2863  EventRecord2 (EvtNetPPP_PapWrongNakReceived, id, id_valid);
2864  }
2865 #else
2866  #define EvrNetPPP_PapWrongNakReceived(id, id_valid)
2867 #endif
2868 
2869 /**
2870  \brief Event on PPP-PAP de-initialize (Op)
2871  \remark Password Authentication Protocol
2872  */
2873 #ifdef DEBUG_EVR
2875  EventRecord2 (EvtNetPPP_PapUninit, 0, 0);
2876  }
2877 #else
2878  #define EvrNetPPP_PapUninit()
2879 #endif
2880 
2881 // PPP-CHAP event recorder functions -------------------------------------------
2882 
2883 /**
2884  \brief Event on PPP-CHAP initialize (Op)
2885  \remark Challenge-Handshake Authentication Protocol
2886  */
2887 #ifdef DEBUG_EVR
2889  EventRecord2 (EvtNetPPP_ChapInit, 0, 0);
2890  }
2891 #else
2892  #define EvrNetPPP_ChapInit()
2893 #endif
2894 
2895 /**
2896  \brief Event on PPP-CHAP send challenge (Op)
2897  \param name system identification string
2898  \param length length of the system identification string
2899  */
2900 #ifdef DEBUG_EVR
2901  __STATIC_INLINE void EvrNetPPP_ChapSendChallenge(const char *name, uint32_t length) {
2902  EventRecordData (EvtNetPPP_ChapSendChallenge, name, length);
2903  }
2904 #else
2905  #define EvrNetPPP_ChapSendChallenge(name, length)
2906 #endif
2907 
2908 /**
2909  \brief Event on PPP-CHAP send frame (Op)
2910  \param chap_header pointer to CHAP frame header of 4 bytes
2911  - Code (1 byte)
2912  - Id (1 byte)
2913  - Len (2 bytes)
2914  */
2915 #ifdef DEBUG_EVR
2916  __STATIC_INLINE void EvrNetPPP_ChapSendFrame(const void *chap_header) {
2917  EventRecordData (EvtNetPPP_ChapSendFrame, chap_header, 4);
2918  }
2919 #else
2920  #define EvrNetPPP_ChapSendFrame(chap_header)
2921 #endif
2922 
2923 /**
2924  \brief Event on PPP-CHAP receive frame (Op)
2925  \param chap_header pointer to CHAP frame header of 4 bytes
2926  - Code (1 byte)
2927  - Id (1 byte)
2928  - Len (2 bytes)
2929  */
2930 #ifdef DEBUG_EVR
2931  __STATIC_INLINE void EvrNetPPP_ChapReceiveFrame(const void *chap_header) {
2932  EventRecordData (EvtNetPPP_ChapReceiveFrame, chap_header, 4);
2933  }
2934 #else
2935  #define EvrNetPPP_ChapReceiveFrame(chap_header)
2936 #endif
2937 
2938 /**
2939  \brief Event on PPP-CHAP wrong response received (Op)
2940  \param id received CHAP identifier
2941  \param id_valid valid CHAP identifier
2942  */
2943 #ifdef DEBUG_EVR
2944  __STATIC_INLINE void EvrNetPPP_ChapWrongResponseReceived(uint8_t id, uint8_t id_valid) {
2945  EventRecord2 (EvtNetPPP_ChapWrongResponseReceived, id, id_valid);
2946  }
2947 #else
2948  #define EvrNetPPP_ChapWrongResponseReceived(id, id_valid)
2949 #endif
2950 
2951 /**
2952  \brief Event on PPP-CHAP wrong success received (Op)
2953  \param id received CHAP identifier
2954  \param id_valid valid CHAP identifier
2955  */
2956 #ifdef DEBUG_EVR
2957  __STATIC_INLINE void EvrNetPPP_ChapWrongSuccessReceived(uint8_t id, uint8_t id_valid) {
2958  EventRecord2 (EvtNetPPP_ChapWrongSuccessReceived, id, id_valid);
2959  }
2960 #else
2961  #define EvrNetPPP_ChapWrongSuccessReceived(id, id_valid)
2962 #endif
2963 
2964 /**
2965  \brief Event on PPP-CHAP wrong failure received (Op)
2966  \param id received CHAP identifier
2967  \param id_valid valid CHAP identifier
2968  */
2969 #ifdef DEBUG_EVR
2970  __STATIC_INLINE void EvrNetPPP_ChapWrongFailureReceived(uint8_t id, uint8_t id_valid) {
2971  EventRecord2 (EvtNetPPP_ChapWrongFailureReceived, id, id_valid);
2972  }
2973 #else
2974  #define EvrNetPPP_ChapWrongFailureReceived(id, id_valid)
2975 #endif
2976 
2977 /**
2978  \brief Event on PPP-CHAP login success (Op)
2979  */
2980 #ifdef DEBUG_EVR
2982  EventRecord2 (EvtNetPPP_ChapLoginSuccess, 0, 0);
2983  }
2984 #else
2985  #define EvrNetPPP_ChapLoginSuccess()
2986 #endif
2987 
2988 /**
2989  \brief Event on PPP-CHAP login failed (Error)
2990  */
2991 #ifdef DEBUG_EVR
2993  EventRecord2 (EvtNetPPP_ChapLoginFailed, 0, 0);
2994  }
2995 #else
2996  #define EvrNetPPP_ChapLoginFailed()
2997 #endif
2998 
2999 /**
3000  \brief Event on PPP-CHAP de-initialize (Op)
3001  \remark Challenge-Handshake Authentication Protocol
3002  */
3003 #ifdef DEBUG_EVR
3005  EventRecord2 (EvtNetPPP_ChapUninit, 0, 0);
3006  }
3007 #else
3008  #define EvrNetPPP_ChapUninit()
3009 #endif
3010 
3011 // PPP-IPCP event recorder functions -------------------------------------------
3012 
3013 /**
3014  \brief Event on PPP-IPCP initialize (Op)
3015  \remark PPP Internet Protocol Control Protocol
3016  */
3017 #ifdef DEBUG_EVR
3019  EventRecord2 (EvtNetPPP_IpcpInit, 0, 0);
3020  }
3021 #else
3022  #define EvrNetPPP_IpcpInit()
3023 #endif
3024 
3025 /**
3026  \brief Event on PPP-IPCP interface IPv4 configuration error (Error)
3027  */
3028 #ifdef DEBUG_EVR
3030  EventRecord2 (EvtNetPPP_IpcpIp4ConfigError, 0, 0);
3031  }
3032 #else
3033  #define EvrNetPPP_IpcpIp4ConfigError()
3034 #endif
3035 
3036 /**
3037  \brief Event on PPP-IPCP send configuration request (Op)
3038  */
3039 #ifdef DEBUG_EVR
3041  EventRecord2 (EvtNetPPP_IpcpSendConfigRequest, 0, 0);
3042  }
3043 #else
3044  #define EvrNetPPP_IpcpSendConfigRequest()
3045 #endif
3046 
3047 /**
3048  \brief Event on PPP-IPCP option IP-address (Detail)
3049  \param ip4_addr pointer to IPv4 address
3050  */
3051 #ifdef DEBUG_EVR
3052  __STATIC_INLINE void EvrNetPPP_IpcpOptionIpAddress(const uint8_t *ip4_addr) {
3053  EventRecordData (EvtNetPPP_IpcpOptionIpAddress, ip4_addr, 4);
3054  }
3055 #else
3056  #define EvrNetPPP_IpcpOptionIpAddress(ip4_addr)
3057 #endif
3058 
3059 /**
3060  \brief Event on PPP-IPCP option primary DNS server address (Detail)
3061  \param ip4_addr pointer to IPv4 address
3062  */
3063 #ifdef DEBUG_EVR
3064  __STATIC_INLINE void EvrNetPPP_IpcpOptionPrimaryDns(const uint8_t *ip4_addr) {
3065  EventRecordData (EvtNetPPP_IpcpOptionPrimaryDns, ip4_addr, 4);
3066  }
3067 #else
3068  #define EvrNetPPP_IpcpOptionPrimaryDns(ip4_addr)
3069 #endif
3070 
3071 /**
3072  \brief Event on PPP-IPCP option secondary DNS server address (Detail)
3073  \param ip4_addr pointer to IPv4 address
3074  */
3075 #ifdef DEBUG_EVR
3076  __STATIC_INLINE void EvrNetPPP_IpcpOptionSecondaryDns(const uint8_t *ip4_addr) {
3077  EventRecordData (EvtNetPPP_IpcpOptionSecondaryDns, ip4_addr, 4);
3078  }
3079 #else
3080  #define EvrNetPPP_IpcpOptionSecondaryDns(ip4_addr)
3081 #endif
3082 
3083 /**
3084  \brief Event on PPP-IPCP send frame (Op)
3085  \param ipcp_header pointer to IPCP frame header of 4 bytes
3086  - Code (1 byte)
3087  - Id (1 byte)
3088  - Len (2 bytes)
3089  */
3090 #ifdef DEBUG_EVR
3091  __STATIC_INLINE void EvrNetPPP_IpcpSendFrame(const void *ipcp_header) {
3092  EventRecordData (EvtNetPPP_IpcpSendFrame, ipcp_header, 4);
3093  }
3094 #else
3095  #define EvrNetPPP_IpcpSendFrame(ipcp_header)
3096 #endif
3097 
3098 /**
3099  \brief Event on PPP-IPCP receive frame (Op)
3100  \param ipcp_header pointer to IPCP frame header of 4 bytes
3101  - Code (1 byte)
3102  - Id (1 byte)
3103  - Len (2 bytes)
3104  */
3105 #ifdef DEBUG_EVR
3106  __STATIC_INLINE void EvrNetPPP_IpcpReceiveFrame(const void *ipcp_header) {
3107  EventRecordData (EvtNetPPP_IpcpReceiveFrame, ipcp_header, 4);
3108  }
3109 #else
3110  #define EvrNetPPP_IpcpReceiveFrame(ipcp_header)
3111 #endif
3112 
3113 /**
3114  \brief Event on PPP-IPCP unknown option received (Op)
3115  \param ipcp_option unknown IPCP option
3116  */
3117 #ifdef DEBUG_EVR
3118  __STATIC_INLINE void EvrNetPPP_IpcpOptionUnknown(uint8_t ipcp_option) {
3119  EventRecord2 (EvtNetPPP_IpcpOptionUnknown, ipcp_option, 0);
3120  }
3121 #else
3122  #define EvrNetPPP_IpcpOptionUnknown(ipcp_option)
3123 #endif
3124 
3125 /**
3126  \brief Event on PPP-IPCP send reject (Op)
3127  */
3128 #ifdef DEBUG_EVR
3130  EventRecord2 (EvtNetPPP_IpcpSendReject, 0, 0);
3131  }
3132 #else
3133  #define EvrNetPPP_IpcpSendReject()
3134 #endif
3135 
3136 /**
3137  \brief Event on PPP-IPCP send not acknowledge (Op)
3138  */
3139 #ifdef DEBUG_EVR
3141  EventRecord2 (EvtNetPPP_IpcpSendNak, 0, 0);
3142  }
3143 #else
3144  #define EvrNetPPP_IpcpSendNak()
3145 #endif
3146 
3147 /**
3148  \brief Event on PPP-IPCP send acknowledge (Op)
3149  */
3150 #ifdef DEBUG_EVR
3152  EventRecord2 (EvtNetPPP_IpcpSendAck, 0, 0);
3153  }
3154 #else
3155  #define EvrNetPPP_IpcpSendAck()
3156 #endif
3157 
3158 /**
3159  \brief Event on PPP-IPCP wrong acknowledge received (Op)
3160  \param id received IPCP identifier
3161  \param id_valid valid IPCP identifier
3162  */
3163 #ifdef DEBUG_EVR
3164  __STATIC_INLINE void EvrNetPPP_IpcpWrongAckReceived(uint8_t id, uint8_t id_valid) {
3165  EventRecord2 (EvtNetPPP_IpcpWrongAckReceived, id, id_valid);
3166  }
3167 #else
3168  #define EvrNetPPP_IpcpWrongAckReceived(id, id_valid)
3169 #endif
3170 
3171 /**
3172  \brief Event on PPP-IPCP network-layer established (Op)
3173  */
3174 #ifdef DEBUG_EVR
3176  EventRecord2 (EvtNetPPP_IpcpNetworkLayerUp, 0, 0);
3177  }
3178 #else
3179  #define EvrNetPPP_IpcpNetworkLayerUp()
3180 #endif
3181 
3182 /**
3183  \brief Event on PPP-IPCP wrong not-acknowledge received (Op)
3184  \param id received IPCP identifier
3185  \param id_valid valid IPCP identifier
3186  */
3187 #ifdef DEBUG_EVR
3188  __STATIC_INLINE void EvrNetPPP_IpcpWrongNakReceived(uint8_t id, uint8_t id_valid) {
3189  EventRecord2 (EvtNetPPP_IpcpWrongNakReceived, id, id_valid);
3190  }
3191 #else
3192  #define EvrNetPPP_IpcpWrongNakReceived(id, id_valid)
3193 #endif
3194 
3195 /**
3196  \brief Event on PPP-IPCP wrong reject received (Op)
3197  \param id received IPCP identifier
3198  \param id_valid valid IPCP identifier
3199  */
3200 #ifdef DEBUG_EVR
3201  __STATIC_INLINE void EvrNetPPP_IpcpWrongRejectReceived(uint8_t id, uint8_t id_valid) {
3202  EventRecord2 (EvtNetPPP_IpcpWrongRejectReceived, id, id_valid);
3203  }
3204 #else
3205  #define EvrNetPPP_IpcpWrongRejectReceived(id, id_valid)
3206 #endif
3207 
3208 /**
3209  \brief Event on PPP-IPCP advertised IP-address not in subnet (Op)
3210  \param ip4_addr pointer to IPv4 address
3211  */
3212 #ifdef DEBUG_EVR
3213  __STATIC_INLINE void EvrNetPPP_IpcpWrongSubnet(const uint8_t *ip4_addr) {
3214  EventRecordData (EvtNetPPP_IpcpWrongSubnet, ip4_addr, 4);
3215  }
3216 #else
3217  #define EvrNetPPP_IpcpWrongSubnet(ip4_addr)
3218 #endif
3219 
3220 /**
3221  \brief Event on PPP-IPCP primary DNS server option rejected (Op)
3222  */
3223 #ifdef DEBUG_EVR
3225  EventRecord2 (EvtNetPPP_IpcpPrimaryDnsRejected, 0, 0);
3226  }
3227 #else
3228  #define EvrNetPPP_IpcpPrimaryDnsRejected()
3229 #endif
3230 
3231 /**
3232  \brief Event on PPP-IPCP secondary DNS server option rejected (Op)
3233  */
3234 #ifdef DEBUG_EVR
3236  EventRecord2 (EvtNetPPP_IpcpSecondaryDnsRejected, 0, 0);
3237  }
3238 #else
3239  #define EvrNetPPP_IpcpSecondaryDnsRejected()
3240 #endif
3241 
3242 /**
3243  \brief Event on PPP-IPCP IP-address option rejected (Error)
3244  */
3245 #ifdef DEBUG_EVR
3247  EventRecord2 (EvtNetPPP_IpcpIpAddressRejected, 0, 0);
3248  }
3249 #else
3250  #define EvrNetPPP_IpcpIpAddressRejected()
3251 #endif
3252 
3253 /**
3254  \brief Event on PPP-IPCP not requested option rejected (Error)
3255  \param ipcp_option rejected option value
3256  */
3257 #ifdef DEBUG_EVR
3259  EventRecord2 (EvtNetPPP_IpcpNotRequestedOption, ipcp_option, 0);
3260  }
3261 #else
3262  #define EvrNetPPP_IpcpNotRequestedOption(ipcp_option)
3263 #endif
3264 
3265 /**
3266  \brief Event on PPP-IPCP de-initialize (Op)
3267  \remark PPP Internet Protocol Control Protocol
3268  */
3269 #ifdef DEBUG_EVR
3271  EventRecord2 (EvtNetPPP_IpcpUninit, 0, 0);
3272  }
3273 #else
3274  #define EvrNetPPP_IpcpUninit()
3275 #endif
3276 
3277 
3278 // NetSLIP event identifiers ---------------------------------------------------
3279 #ifdef DEBUG_EVR
3280 #define EvtNetSLIP_InitInterface EventID (EventLevelOp, EvtNetSLIP, 0)
3281 #define EvtNetSLIP_Ip4ConfigError EventID (EventLevelError, EvtNetSLIP, 1)
3282 #define EvtNetSLIP_ThreadCreateFailed EventID (EventLevelError, EvtNetSLIP, 2)
3283 #define EvtNetSLIP_GetOptionInvalidParameter EventID (EventLevelError,EvtNetSLIP, 3)
3284 #define EvtNetSLIP_SetOptionInvalidParameter EventID (EventLevelError,EvtNetSLIP, 4)
3285 #define EvtNetSLIP_SetIp4Address EventID (EventLevelOp, EvtNetSLIP, 5)
3286 #define EvtNetSLIP_SetIp4PrimaryDNS EventID (EventLevelOp, EvtNetSLIP, 6)
3287 #define EvtNetSLIP_SetIp4SecondaryDNS EventID (EventLevelOp, EvtNetSLIP, 7)
3288 #define EvtNetSLIP_SetIp4Mtu EventID (EventLevelOp, EvtNetSLIP, 8)
3289 #define EvtNetSLIP_Connect EventID (EventLevelAPI, EvtNetSLIP, 9)
3290 #define EvtNetSLIP_ConnectInvalidParameter EventID (EventLevelError, EvtNetSLIP, 10)
3291 #define EvtNetSLIP_ConnectWrongState EventID (EventLevelError, EvtNetSLIP, 11)
3292 #define EvtNetSLIP_Listen EventID (EventLevelAPI, EvtNetSLIP, 12)
3293 #define EvtNetSLIP_ListenWrongState EventID (EventLevelError, EvtNetSLIP, 13)
3294 #define EvtNetSLIP_Close EventID (EventLevelAPI, EvtNetSLIP, 14)
3295 #define EvtNetSLIP_SendFrame EventID (EventLevelOp, EvtNetSLIP, 15)
3296 #define EvtNetSLIP_InvalidIpVersion EventID (EventLevelError, EvtNetSLIP, 16)
3297 #define EvtNetSLIP_SendDataTooLarge EventID (EventLevelError, EvtNetSLIP, 17)
3298 #define EvtNetSLIP_NoMemoryError EventID (EventLevelError, EvtNetSLIP, 18)
3299 #define EvtNetSLIP_QueueAddTransmit EventID (EventLevelOp, EvtNetSLIP, 19)
3300 #define EvtNetSLIP_ModemOffline EventID (EventLevelOp, EvtNetSLIP, 20)
3301 #define EvtNetSLIP_ReceiveFrame EventID (EventLevelOp, EvtNetSLIP, 21)
3302 #define EvtNetSLIP_UninitInterface EventID (EventLevelOp, EvtNetSLIP, 22)
3303 #endif
3304 
3305 /**
3306  \brief Event on SLIP interface initialize (Op)
3307  */
3308 #ifdef DEBUG_EVR
3310  EventRecord2 (EvtNetSLIP_InitInterface, 0, 0);
3311  }
3312 #else
3313  #define EvrNetSLIP_InitInterface()
3314 #endif
3315 
3316 /**
3317  \brief Event on SLIP IPv4 configuration error (Error)
3318  */
3319 #ifdef DEBUG_EVR
3321  EventRecord2 (EvtNetSLIP_Ip4ConfigError, 0, 0);
3322  }
3323 #else
3324  #define EvrNetSLIP_Ip4ConfigError()
3325 #endif
3326 
3327 /**
3328  \brief Event on SLIP thread create failed (Error)
3329  */
3330 #ifdef DEBUG_EVR
3332  EventRecord2 (EvtNetSLIP_ThreadCreateFailed, 0, 0);
3333  }
3334 #else
3335  #define EvrNetSLIP_ThreadCreateFailed()
3336 #endif
3337 
3338 /**
3339  \brief Event on SLIP get_option invalid parameter (Error)
3340  */
3341 #ifdef DEBUG_EVR
3343  EventRecord2 (EvtNetSLIP_GetOptionInvalidParameter, 0, 0);
3344  }
3345 #else
3346  #define EvrNetSLIP_GetOptionInvalidParameter()
3347 #endif
3348 
3349 /**
3350  \brief Event on SLIP set_option invalid parameter (Error)
3351  */
3352 #ifdef DEBUG_EVR
3354  EventRecord2 (EvtNetSLIP_SetOptionInvalidParameter, 0, 0);
3355  }
3356 #else
3357  #define EvrNetSLIP_SetOptionInvalidParameter()
3358 #endif
3359 
3360 /**
3361  \brief Event on SLIP set interface IPv4 address (Op)
3362  \param ip4_addr pointer to IPv4 address
3363  */
3364 #ifdef DEBUG_EVR
3365  __STATIC_INLINE void EvrNetSLIP_SetIp4Address(const uint8_t *ip4_addr) {
3366  EventRecordData (EvtNetSLIP_SetIp4Address, ip4_addr, 4);
3367  }
3368 #else
3369  #define EvrNetSLIP_SetIp4Address(ip4_addr)
3370 #endif
3371 
3372 /**
3373  \brief Event on SLIP set interface primary DNS server (Op)
3374  \param ip4_addr pointer to IPv4 address of a DNS server
3375  */
3376 #ifdef DEBUG_EVR
3377  __STATIC_INLINE void EvrNetSLIP_SetIp4PrimaryDNS(const uint8_t *ip4_addr) {
3378  EventRecordData (EvtNetSLIP_SetIp4PrimaryDNS, ip4_addr, 4);
3379  }
3380 #else
3381  #define EvrNetSLIP_SetIp4PrimaryDNS(ip4_addr)
3382 #endif
3383 
3384 /**
3385  \brief Event on SLIP set interface secondary DNS server (Op)
3386  \param ip4_addr pointer to IPv4 address of a DNS server
3387  */
3388 #ifdef DEBUG_EVR
3389  __STATIC_INLINE void EvrNetSLIP_SetIp4SecondaryDNS(const uint8_t *ip4_addr) {
3390  EventRecordData (EvtNetSLIP_SetIp4SecondaryDNS, ip4_addr, 4);
3391  }
3392 #else
3393  #define EvrNetSLIP_SetIp4SecondaryDNS(ip4_addr)
3394 #endif
3395 
3396 /**
3397  \brief Event on SLIP set interface MTU (Op)
3398  \param mtu maximum transmission unit
3399  - 0: fragmentation disabled
3400  \remark MTU is limited in the range from 296 to 1500 bytes.
3401  */
3402 #ifdef DEBUG_EVR
3404  EventRecord2 (EvtNetSLIP_SetIp4Mtu, mtu, 0);
3405  }
3406 #else
3407  #define EvrNetSLIP_SetIp4Mtu(mtu)
3408 #endif
3409 
3410 /**
3411  \brief Event on SLIP start connecting (API)
3412  \param dial_number pointer to a number to dial string
3413  \param length length of the dial_number string
3414  */
3415 #ifdef DEBUG_EVR
3416  __STATIC_INLINE void EvrNetSLIP_Connect(const char *dial_number, uint32_t length) {
3417  if (length > 24) length = 24;
3418  EventRecordData (EvtNetSLIP_Connect, dial_number, length);
3419  }
3420 #else
3421  #define EvrNetSLIP_Connect(dial_number, length)
3422 #endif
3423 
3424 /**
3425  \brief Event on SLIP connect invalid parameter (Error)
3426  */
3427 #ifdef DEBUG_EVR
3429  EventRecord2 (EvtNetSLIP_ConnectInvalidParameter, 0, 0);
3430  }
3431 #else
3432  #define EvrNetSLIP_ConnectInvalidParameter()
3433 #endif
3434 
3435 /**
3436  \brief Event on SLIP connect in wrong state (Error)
3437  */
3438 #ifdef DEBUG_EVR
3440  EventRecord2 (EvtNetSLIP_ConnectWrongState, 0, 0);
3441  }
3442 #else
3443  #define EvrNetSLIP_ConnectWrongState()
3444 #endif
3445 
3446 /**
3447  \brief Event on SLIP start listening (API)
3448  */
3449 #ifdef DEBUG_EVR
3451  EventRecord2 (EvtNetSLIP_Listen, 0, 0);
3452  }
3453 #else
3454  #define EvrNetSLIP_Listen()
3455 #endif
3456 
3457 /**
3458  \brief Event on SLIP listen in wrong state (Error)
3459  */
3460 #ifdef DEBUG_EVR
3462  EventRecord2 (EvtNetSLIP_ListenWrongState, 0, 0);
3463  }
3464 #else
3465  #define EvrNetSLIP_ListenWrongState()
3466 #endif
3467 
3468 /**
3469  \brief Event on SLIP close connection (API)
3470  */
3471 #ifdef DEBUG_EVR
3473  EventRecord2 (EvtNetSLIP_Close, 0, 0);
3474  }
3475 #else
3476  #define EvrNetSLIP_Close()
3477 #endif
3478 
3479 /**
3480  \brief Event on SLIP send frame (Op)
3481  \param length frame length in bytes
3482  \param ip_version internet protocol version
3483  - 0: IPv4
3484  - 1: IPv6
3485  */
3486 #ifdef DEBUG_EVR
3487  __STATIC_INLINE void EvrNetSLIP_SendFrame(uint32_t length, uint8_t ip_version) {
3488  EventRecord2 (EvtNetSLIP_SendFrame, length, ip_version);
3489  }
3490 #else
3491  #define EvrNetSLIP_SendFrame(length, ip_version)
3492 #endif
3493 
3494 /**
3495  \brief Event on SLIP invalid IP version (Error)
3496  \param ip_version invalid IP protocol version value
3497  - 0: IPv4
3498  - 1: IPv6
3499  */
3500 #ifdef DEBUG_EVR
3502  EventRecord2 (EvtNetSLIP_InvalidIpVersion, ip_version, 0);
3503  }
3504 #else
3505  #define EvrNetSLIP_InvalidIpVersion(ip_version)
3506 #endif
3507 
3508 /**
3509  \brief Event on SLIP send payload too large (Error)
3510  \param length data length in bytes
3511  \param max_length maximum length of data in bytes
3512  */
3513 #ifdef DEBUG_EVR
3514  __STATIC_INLINE void EvrNetSLIP_SendDataTooLarge(uint32_t length, uint32_t max_length) {
3515  EventRecord2 (EvtNetSLIP_SendDataTooLarge, length, max_length);
3516  }
3517 #else
3518  #define EvrNetSLIP_SendDataTooLarge(length, max_length)
3519 #endif
3520 
3521 /**
3522  \brief Event on SLIP out of memory for send (Error)
3523  */
3524 #ifdef DEBUG_EVR
3526  EventRecord2 (EvtNetSLIP_NoMemoryError, 0, 0);
3527  }
3528 #else
3529  #define EvrNetSLIP_NoMemoryError()
3530 #endif
3531 
3532 /**
3533  \brief Event on SLIP add frame to transmit queue (Op)
3534  */
3535 #ifdef DEBUG_EVR
3537  EventRecord2 (EvtNetSLIP_QueueAddTransmit, 0, 0);
3538  }
3539 #else
3540  #define EvrNetSLIP_QueueAddTransmit()
3541 #endif
3542 
3543 /**
3544  \brief Event on SLIP link change to modem offline (Op)
3545  */
3546 #ifdef DEBUG_EVR
3548  EventRecord2 (EvtNetSLIP_ModemOffline, 0, 0);
3549  }
3550 #else
3551  #define EvrNetSLIP_ModemOffline()
3552 #endif
3553 
3554 /**
3555  \brief Event on SLIP receive frame (Op)
3556  \param length frame length in bytes
3557  */
3558 #ifdef DEBUG_EVR
3560  EventRecord2 (EvtNetSLIP_ReceiveFrame, length, 0);
3561  }
3562 #else
3563  #define EvrNetSLIP_ReceiveFrame(length)
3564 #endif
3565 
3566 /**
3567  \brief Event on SLIP interface de-initialize (Op)
3568  */
3569 #ifdef DEBUG_EVR
3571  EventRecord2 (EvtNetSLIP_UninitInterface, 0, 0);
3572  }
3573 #else
3574  #define EvrNetSLIP_UninitInterface()
3575 #endif
3576 
3577 
3578 // NetLOOP event identifiers ---------------------------------------------------
3579 #ifdef DEBUG_EVR
3580 #define EvtNetLOOP_InitInterface EventID (EventLevelOp, EvtNetLOOP, 0)
3581 #define EvtNetLOOP_SendFrame EventID (EventLevelOp, EvtNetLOOP, 1)
3582 #define EvtNetLOOP_NoMemoryError EventID (EventLevelError, EvtNetLOOP, 2)
3583 #define EvtNetLOOP_ReceiveFrame EventID (EventLevelOp, EvtNetLOOP, 3)
3584 #define EvtNetLOOP_UninitInterface EventID (EventLevelOp, EvtNetLOOP, 4)
3585 #endif
3586 
3587 /**
3588  \brief Event on Loopback interface initialize (Op)
3589  */
3590 #ifdef DEBUG_EVR
3592  EventRecord2 (EvtNetLOOP_InitInterface, 0, 0);
3593  }
3594 #else
3595  #define EvrNetLOOP_InitInterface()
3596 #endif
3597 
3598 /**
3599  \brief Event on Loopback send frame (Op)
3600  \param length frame length in bytes
3601  \param ip_version internet protocol version
3602  - 0: IPv4
3603  - 1: IPv6
3604  */
3605 #ifdef DEBUG_EVR
3606  __STATIC_INLINE void EvrNetLOOP_SendFrame(uint32_t length, uint8_t ip_version) {
3607  EventRecord2 (EvtNetLOOP_SendFrame, length, ip_version);
3608  }
3609 #else
3610  #define EvrNetLOOP_SendFrame(length, ip_version)
3611 #endif
3612 
3613 /**
3614  \brief Event on Loopback out of memory for send (Error)
3615  */
3616 #ifdef DEBUG_EVR
3618  EventRecord2 (EvtNetLOOP_NoMemoryError, 0, 0);
3619  }
3620 #else
3621  #define EvrNetLOOP_NoMemoryError()
3622 #endif
3623 
3624 /**
3625  \brief Event on Loopback receive frame (Op)
3626  \param length frame length in bytes
3627  \param ip_version internet protocol version
3628  - 0: IPv4
3629  - 1: IPv6
3630  */
3631 #ifdef DEBUG_EVR
3632  __STATIC_INLINE void EvrNetLOOP_ReceiveFrame(uint32_t length, uint8_t ip_version) {
3633  EventRecord2 (EvtNetLOOP_ReceiveFrame, length, ip_version);
3634  }
3635 #else
3636  #define EvrNetLOOP_ReceiveFrame(length, ip_version)
3637 #endif
3638 
3639 /**
3640  \brief Event on Loopback interface de-initialize (Op)
3641  */
3642 #ifdef DEBUG_EVR
3644  EventRecord2 (EvtNetLOOP_UninitInterface, 0, 0);
3645  }
3646 #else
3647  #define EvrNetLOOP_UninitInterface()
3648 #endif
3649 
3650 
3651 // NetIP4 event identifiers ----------------------------------------------------
3652 #ifdef DEBUG_EVR
3653 #define EvtNetIP4_InitCore EventID (EventLevelOp, EvtNetIP4, 0)
3654 #define EvtNetIP4_ReceiveFrame EventID (EventLevelOp, EvtNetIP4, 1)
3655 #define EvtNetIP4_FrameTooShort EventID (EventLevelError, EvtNetIP4, 2)
3656 #define EvtNetIP4_InvalidIpVersion EventID (EventLevelError, EvtNetIP4, 3)
3657 #define EvtNetIP4_ShowFrameHeader EventID (EventLevelDetail,EvtNetIP4, 4)
3658 #define EvtNetIP4_SourceIpAddressInvalid EventID (EventLevelError, EvtNetIP4, 5)
3659 #define EvtNetIP4_WrongMulticastProtocol EventID (EventLevelError, EvtNetIP4, 6)
3660 #define EvtNetIP4_WrongBroadcastProtocol EventID (EventLevelError, EvtNetIP4, 7)
3661 #define EvtNetIP4_WrongDestinationAddress EventID (EventLevelOp, EvtNetIP4, 8)
3662 #define EvtNetIP4_ChecksumFailed EventID (EventLevelError, EvtNetIP4, 9)
3663 #define EvtNetIP4_FragmentDfFlagSet EventID (EventLevelError, EvtNetIP4, 10)
3664 #define EvtNetIP4_FragmentationNotEnabled EventID (EventLevelError, EvtNetIP4, 11)
3665 #define EvtNetIP4_SendFrame EventID (EventLevelOp, EvtNetIP4, 12)
3666 #define EvtNetIP4_ProtocolUnknown EventID (EventLevelError, EvtNetIP4, 13)
3667 #define EvtNetIP4_DestinationAddressNull EventID (EventLevelError, EvtNetIP4, 14)
3668 #define EvtNetIP4_SetDefaultInterface EventID (EventLevelOp, EvtNetIP4, 15)
3669 #define EvtNetIP4_UninitCore EventID (EventLevelOp, EvtNetIP4, 16)
3670 #endif
3671 
3672 /**
3673  \brief Event on IP4 core initialize (Op)
3674  \param if_id network interface identifier
3675  */
3676 #ifdef DEBUG_EVR
3677  __STATIC_INLINE void EvrNetIP4_InitCore(uint16_t if_id) {
3678  EventRecord2 (EvtNetIP4_InitCore, if_id, 0);
3679  }
3680 #else
3681  #define EvrNetIP4_InitCore(if_id)
3682 #endif
3683 
3684 /**
3685  \brief Event on IP4 receive frame (Op)
3686  \param if_id network interface identifier
3687  \param length frame length in bytes
3688  */
3689 #ifdef DEBUG_EVR
3690  __STATIC_INLINE void EvrNetIP4_ReceiveFrame(uint16_t if_id, uint32_t length) {
3691  EventRecord2 (EvtNetIP4_ReceiveFrame, if_id, length);
3692  }
3693 #else
3694  #define EvrNetIP4_ReceiveFrame(if_id, length)
3695 #endif
3696 
3697 /**
3698  \brief Event on IP4 receive frame too short (Error)
3699  \param if_id network interface identifier
3700  \param length frame length in bytes
3701  \param min_length minimum length of the frame
3702  */
3703 #ifdef DEBUG_EVR
3704  __STATIC_INLINE void EvrNetIP4_FrameTooShort(uint16_t if_id, uint32_t length, uint32_t min_length) {
3705  uint32_t val2 = (min_length << 16) | length;
3706  EventRecord2 (EvtNetIP4_FrameTooShort, if_id, val2);
3707  }
3708 #else
3709  #define EvrNetIP4_FrameTooShort(if_id, length, min_length)
3710 #endif
3711 
3712 /**
3713  \brief Event on IP4 invalid protocol version (Error)
3714  \param if_id network interface identifier
3715  \param ip_version IP protocol version value
3716  */
3717 #ifdef DEBUG_EVR
3718  __STATIC_INLINE void EvrNetIP4_InvalidIpVersion(uint16_t if_id, uint8_t ip_version) {
3719  EventRecord2 (EvtNetIP4_InvalidIpVersion, if_id, ip_version);
3720  }
3721 #else
3722  #define EvrNetIP4_InvalidIpVersion(if_id, ip_version)
3723 #endif
3724 
3725 /**
3726  \brief Event on IP4 display frame header (Detail)
3727  \param ip4_header pointer to IPv4 frame header of 20 bytes
3728  - VerHlen (1 byte)
3729  - Tos (1 byte)
3730  - Len (2 bytes)
3731  - Id (2 bytes)
3732  - FragOffs (2 bytes)
3733  - Ttl (1 byte)
3734  - Proto (1 byte)
3735  - Chksum (2 bytes)
3736  - SrcAddr (4 bytes)
3737  - DstAddr (4 bytes)
3738  */
3739 #ifdef DEBUG_EVR
3740  __STATIC_INLINE void EvrNetIP4_ShowFrameHeader(const void *ip4_header) {
3741  EventRecordData (EvtNetIP4_ShowFrameHeader, ip4_header, 20);
3742  }
3743 #else
3744  #define EvrNetIP4_ShowFrameHeader(ip4_header)
3745 #endif
3746 
3747 /**
3748  \brief Event on IP4 source IP address invalid (Error)
3749  \param if_id network interface identifier
3750  \param ip4_addr pointer to IPv4 address
3751  */
3752 #ifdef DEBUG_EVR
3753  __STATIC_INLINE void EvrNetIP4_SourceIpAddressInvalid(uint16_t if_id, const uint8_t *ip4_addr) {
3754  memcpy (&evr_buf.u32[0], ip4_addr, 4);
3755  EventRecord2 (EvtNetIP4_SourceIpAddressInvalid, if_id, evr_buf.u32[0]);
3756  }
3757 #else
3758  #define EvrNetIP4_SourceIpAddressInvalid(if_id, ip4_addr)
3759 #endif
3760 
3761 /**
3762  \brief Event on IP4 wrong multicast protocol type (Error)
3763  \param if_id network interface identifier
3764  \param ip4_protocol wrong protocol type value
3765  \remark Only UDP and IGMP multicast frames are allowed.
3766  */
3767 #ifdef DEBUG_EVR
3768  __STATIC_INLINE void EvrNetIP4_WrongMulticastProtocol(uint16_t if_id, uint8_t ip4_protocol) {
3769  EventRecord2 (EvtNetIP4_WrongMulticastProtocol, if_id, ip4_protocol);
3770  }
3771 #else
3772  #define EvrNetIP4_WrongMulticastProtocol(if_id, ip4_protocol)
3773 #endif
3774 
3775 /**
3776  \brief Event on IP4 wrong broadcast protocol type (Error)
3777  \param if_id network interface identifier
3778  \param ip4_protocol wrong protocol type value
3779  \remark Only UDP subnet broadcast frames are allowed.
3780  */
3781 #ifdef DEBUG_EVR
3782  __STATIC_INLINE void EvrNetIP4_WrongBroadcastProtocol(uint16_t if_id, uint8_t ip4_protocol) {
3783  EventRecord2 (EvtNetIP4_WrongBroadcastProtocol, if_id, ip4_protocol);
3784  }
3785 #else
3786  #define EvrNetIP4_WrongBroadcastProtocol(if_id, ip4_protocol)
3787 #endif
3788 
3789 /**
3790  \brief Event on IP4 wrong destination address (Op)
3791  \param if_id network interface identifier
3792  \param ip4_addr pointer to IPv4 destination address
3793  */
3794 #ifdef DEBUG_EVR
3795  __STATIC_INLINE void EvrNetIP4_WrongDestinationAddress(uint16_t if_id, const uint8_t *ip4_addr) {
3796  memcpy (&evr_buf.u32[0], ip4_addr, 4);
3797  EventRecord2 (EvtNetIP4_WrongDestinationAddress, if_id, evr_buf.u32[0]);
3798  }
3799 #else
3800  #define EvrNetIP4_WrongDestinationAddress(if_id, ip4_addr)
3801 #endif
3802 
3803 /**
3804  \brief Event on IP4 header checksum check failed (Error)
3805  \param if_id network interface identifier
3806  \param length header length in bytes
3807  */
3808 #ifdef DEBUG_EVR
3809  __STATIC_INLINE void EvrNetIP4_ChecksumFailed(uint16_t if_id, uint32_t length) {
3810  EventRecord2 (EvtNetIP4_ChecksumFailed, if_id, length);
3811  }
3812 #else
3813  #define EvrNetIP4_ChecksumFailed(if_id, length)
3814 #endif
3815 
3816 /**
3817  \brief Event on IP4 receive fragmented frame with DF-flag set (Error)
3818  \param if_id network interface identifier
3819  \param frag IP flags and fragment offset
3820  */
3821 #ifdef DEBUG_EVR
3822  __STATIC_INLINE void EvrNetIP4_FragmentDfFlagSet(uint16_t if_id, uint16_t frag) {
3823  EventRecord2 (EvtNetIP4_FragmentDfFlagSet, if_id, frag);
3824  }
3825 #else
3826  #define EvrNetIP4_FragmentDfFlagSet(if_id, flags)
3827 #endif
3828 
3829 /**
3830  \brief Event on IP4 receive fragmented frame (Error)
3831  \param if_id network interface identifier
3832  */
3833 #ifdef DEBUG_EVR
3835  EventRecord2 (EvtNetIP4_FragmentationNotEnabled, if_id, 0);
3836  }
3837 #else
3838  #define EvrNetIP4_FragmentationNotEnabled(if_id)
3839 #endif
3840 
3841 /**
3842  \brief Event on IP4 send frame (Op)
3843  \param if_id network interface identifier
3844  \param ip4_protocol IPv4 protocol type
3845  - 1: ICMP
3846  - 2: IGMP
3847  - 6: TCP
3848  - 17: UDP
3849  \param length frame length
3850  */
3851 #ifdef DEBUG_EVR
3852  __STATIC_INLINE void EvrNetIP4_SendFrame(uint16_t if_id, uint8_t ip4_protocol, uint32_t length) {
3853  uint32_t val2 = (length << 16) | ip4_protocol;
3854  EventRecord2 (EvtNetIP4_SendFrame, if_id, val2);
3855  }
3856 #else
3857  #define EvrNetIP4_SendFrame(if_id, ip4_protocol, length)
3858 #endif
3859 
3860 /**
3861  \brief Event on IP4 unknown protocol type in sending frame (Error)
3862  \param if_id network interface identifier
3863  \param ip4_protocol unknown IPv4 protocol type value
3864  */
3865 #ifdef DEBUG_EVR
3866  __STATIC_INLINE void EvrNetIP4_ProtocolUnknown(uint16_t if_id, uint8_t ip4_protocol) {
3867  EventRecord2 (EvtNetIP4_ProtocolUnknown, if_id, ip4_protocol);
3868  }
3869 #else
3870  #define EvrNetIP4_ProtocolUnknown(if_id, ip4_protocol)
3871 #endif
3872 
3873 /**
3874  \brief Event on IP4 destination address not provided (Error)
3875  \param if_id network interface identifier
3876  */
3877 #ifdef DEBUG_EVR
3879  EventRecord2 (EvtNetIP4_DestinationAddressNull, if_id, 0);
3880  }
3881 #else
3882  #define EvrNetIP4_DestinationAddressNull(if_id)
3883 #endif
3884 
3885 /**
3886  \brief Event on IP4 set default interface for internet access (Op)
3887  \param if_id network interface identifier
3888  */
3889 #ifdef DEBUG_EVR
3891  EventRecord2 (EvtNetIP4_SetDefaultInterface, if_id, 0);
3892  }
3893 #else
3894  #define EvrNetIP4_SetDefaultInterface(if_id)
3895 #endif
3896 
3897 /**
3898  \brief Event on IP4 core de-initialize (Op)
3899  */
3900 #ifdef DEBUG_EVR
3902  EventRecord2 (EvtNetIP4_UninitCore, 0, 0);
3903  }
3904 #else
3905  #define EvrNetIP4_UninitCore()
3906 #endif
3907 
3908 
3909 // NetICMP event identifiers ---------------------------------------------------
3910 #ifdef DEBUG_EVR
3911 /* ICMP-Core events */
3912 #define EvtNetICMP_ReceiveFrame EventID (EventLevelOp, EvtNetICMP, 0)
3913 #define EvtNetICMP_ShowFrameHeader EventID (EventLevelDetail,EvtNetICMP, 24) // Max
3914 #define EvtNetICMP_FrameTooShort EventID (EventLevelError, EvtNetICMP, 1)
3915 #define EvtNetICMP_ChecksumFailed EventID (EventLevelError, EvtNetICMP, 2)
3916 #define EvtNetICMP_EchoRequestWrongCode EventID (EventLevelError, EvtNetICMP, 3)
3917 #define EvtNetICMP_EchoRequestReceived EventID (EventLevelOp, EvtNetICMP, 4)
3918 #define EvtNetICMP_SendEchoReply EventID (EventLevelOp, EvtNetICMP, 5)
3919 #define EvtNetICMP_EchoReplyReceived EventID (EventLevelOp, EvtNetICMP, 6)
3920 #define EvtNetICMP_EchoReplyWrongState EventID (EventLevelError, EvtNetICMP, 7)
3921 #define EvtNetICMP_EchoReplyWrongCode EventID (EventLevelError, EvtNetICMP, 8)
3922 #define EvtNetICMP_EchoReplyWrongIpAddress EventID (EventLevelError, EvtNetICMP, 9)
3923 #define EvtNetICMP_EchoReplyWrongId EventID (EventLevelError, EvtNetICMP, 10)
3924 #define EvtNetICMP_EchoReplyWrongPayload EventID (EventLevelError, EvtNetICMP, 11)
3925 #define EvtNetICMP_MessageTypeUnknown EventID (EventLevelOp, EvtNetICMP, 12)
3926 #define EvtNetICMP_SendEchoRequest EventID (EventLevelOp, EvtNetICMP, 13)
3927 /* ICMP-Ping client events */
3928 #define EvtNetICMP_PingInit EventID (EventLevelOp, EvtNetICMP, 14)
3929 #define EvtNetICMP_PingEcho EventID (EventLevelAPI, EvtNetICMP, 15)
3930 #define EvtNetICMP_PingTargetNotValid EventID (EventLevelError, EvtNetICMP, 16)
3931 #define EvtNetICMP_PingDnsError EventID (EventLevelError, EvtNetICMP, 17)
3932 #define EvtNetICMP_PingInvalidParameter EventID (EventLevelError, EvtNetICMP, 18)
3933 #define EvtNetICMP_PingClientBusy EventID (EventLevelError, EvtNetICMP, 19)
3934 #define EvtNetICMP_PingSendRequest EventID (EventLevelOp, EvtNetICMP, 20)
3935 #define EvtNetICMP_PingRetransmitRequest EventID (EventLevelOp, EvtNetICMP, 21)
3936 #define EvtNetICMP_PingTimeout EventID (EventLevelOp, EvtNetICMP, 22)
3937 #define EvtNetICMP_PingUninit EventID (EventLevelOp, EvtNetICMP, 23)
3938 #endif
3939 
3940 /**
3941  \brief Event on ICMP receive frame (Op)
3942  \param if_id network interface identifier
3943  \param length frame length in bytes
3944  */
3945 #ifdef DEBUG_EVR
3946  __STATIC_INLINE void EvrNetICMP_ReceiveFrame(uint16_t if_id, uint32_t length) {
3947  EventRecord2 (EvtNetICMP_ReceiveFrame, if_id, length);
3948  }
3949 #else
3950  #define EvrNetICMP_ReceiveFrame(if_id, length)
3951 #endif
3952 
3953 /**
3954  \brief Event on ICMP display send/receive frame header (Detail)
3955  \param icmp_header pointer to ICMP frame header of 8 bytes
3956  - Type (1 byte)
3957  - Code (1 byte)
3958  - Chksum (2 bytes)
3959  - EchoId (2 bytes)
3960  - EchoSeq (2 bytes)
3961  */
3962 #ifdef DEBUG_EVR
3963  __STATIC_INLINE void EvrNetICMP_ShowFrameHeader(const void *icmp_header) {
3964  EventRecordData (EvtNetICMP_ShowFrameHeader, icmp_header, 8);
3965  }
3966 #else
3967  #define EvrNetICMP_ShowFrameHeader(icmp_header)
3968 #endif
3969 
3970 /**
3971  \brief Event on ICMP receive frame is too short (Error)
3972  \param if_id network interface identifier
3973  \param length frame length in bytes
3974  \param min_length minimum length of the frame
3975  */
3976 #ifdef DEBUG_EVR
3977  __STATIC_INLINE void EvrNetICMP_FrameTooShort(uint16_t if_id, uint32_t length, uint32_t min_length) {
3978  uint32_t val2 = (min_length << 16) | length;
3979  EventRecord2 (EvtNetICMP_FrameTooShort, if_id, val2);
3980  }
3981 #else
3982  #define EvrNetICMP_FrameTooShort(if_id, length, min_length)
3983 #endif
3984 
3985 /**
3986  \brief Event on ICMP frame checksum check failed (Error)
3987  \param if_id network interface identifier
3988  \param length frame length in bytes
3989  */
3990 #ifdef DEBUG_EVR
3991  __STATIC_INLINE void EvrNetICMP_ChecksumFailed(uint16_t if_id, uint32_t length) {
3992  EventRecord2 (EvtNetICMP_ChecksumFailed, if_id, length);
3993  }
3994 #else
3995  #define EvrNetICMP_ChecksumFailed(if_id, length)
3996 #endif
3997 
3998 /**
3999  \brief Event on ICMP receive wrong code in echo request (Error)
4000  \param if_id network interface identifier
4001  \param code received ICMP code
4002  \param code_valid valid ICMP code
4003  */
4004 #ifdef DEBUG_EVR
4005  __STATIC_INLINE void EvrNetICMP_EchoRequestWrongCode(uint16_t if_id, uint8_t code, uint8_t code_valid) {
4006  uint32_t val2 = ((uint32_t)code_valid << 16) | code;
4007  EventRecord2 (EvtNetICMP_EchoRequestWrongCode, if_id, val2);
4008  }
4009 #else
4010  #define EvrNetICMP_EchoRequestWrongCode(if_id, code, code_valid)
4011 #endif
4012 
4013 /**
4014  \brief Event on ICMP receive echo request (Op)
4015  \param if_id network interface identifier
4016  \param data_length length of the payload data
4017  */
4018 #ifdef DEBUG_EVR
4019  __STATIC_INLINE void EvrNetICMP_EchoRequestReceived(uint16_t if_id, uint32_t data_length) {
4020  EventRecord2 (EvtNetICMP_EchoRequestReceived, if_id, data_length);
4021  }
4022 #else
4023  #define EvrNetICMP_EchoRequestReceived(if_id, data_length)
4024 #endif
4025 
4026 /**
4027  \brief Event on ICMP send echo reply (Op)
4028  \param if_id network interface identifier
4029  */
4030 #ifdef DEBUG_EVR
4032  EventRecord2 (EvtNetICMP_SendEchoReply, if_id, 0);
4033  }
4034 #else
4035  #define EvrNetICMP_SendEchoReply(if_id)
4036 #endif
4037 
4038 /**
4039  \brief Event on ICMP receive echo reply (Op)
4040  \param if_id network interface identifier
4041  \param data_length length of the payload data
4042  */
4043 #ifdef DEBUG_EVR
4044  __STATIC_INLINE void EvrNetICMP_EchoReplyReceived(uint16_t if_id, uint32_t data_length) {
4045  EventRecord2 (EvtNetICMP_EchoReplyReceived, if_id, data_length);
4046  }
4047 #else
4048  #define EvrNetICMP_EchoReplyReceived(if_id, data_length)
4049 #endif
4050 
4051 /**
4052  \brief Event on ICMP receive echo reply in wrong state (Error)
4053  \param if_id network interface identifier
4054  */
4055 #ifdef DEBUG_EVR
4057  EventRecord2 (EvtNetICMP_EchoReplyWrongState, if_id, 0);
4058  }
4059 #else
4060  #define EvrNetICMP_EchoReplyWrongState(if_id)
4061 #endif
4062 
4063 /**
4064  \brief Event on ICMP receive wrong code in echo reply (Error)
4065  \param if_id network interface identifier
4066  \param code received ICMP code
4067  \param code_valid valid ICMP code
4068  */
4069 #ifdef DEBUG_EVR
4070  __STATIC_INLINE void EvrNetICMP_EchoReplyWrongCode(uint16_t if_id, uint8_t code, uint8_t code_valid) {
4071  uint32_t val2 = ((uint32_t)code_valid << 16) | code;
4072  EventRecord2 (EvtNetICMP_EchoReplyWrongCode, if_id, val2);
4073  }
4074 #else
4075  #define EvrNetICMP_EchoReplyWrongCode(if_id, code, code_valid)
4076 #endif
4077 
4078 /**
4079  \brief Event on ICMP wrong source IPv4 address in echo reply (Error)
4080  \param if_id network interface identifier
4081  \param ip4_addr pointer to IPv4 address
4082  */
4083 #ifdef DEBUG_EVR
4084  __STATIC_INLINE void EvrNetICMP_EchoReplyWrongIpAddress(uint16_t if_id, const uint8_t *ip4_addr) {
4085  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4086  EventRecord2 (EvtNetICMP_EchoReplyWrongIpAddress, if_id, evr_buf.u32[0]);
4087  }
4088 #else
4089  #define EvrNetICMP_EchoReplyWrongIpAddress(if_id, ip4_addr)
4090 #endif
4091 
4092 /**
4093  \brief Event on ICMP wrong echo identifier in echo reply (Error)
4094  \param if_id network interface identifier
4095  \param eid received echo identifier
4096  \param eid_valid valid echo identifier
4097  */
4098 #ifdef DEBUG_EVR
4099  __STATIC_INLINE void EvrNetICMP_EchoReplyWrongId(uint16_t if_id, uint16_t eid, uint16_t eid_valid) {
4100  uint32_t val2 = ((uint32_t)eid_valid << 16) | eid;
4101  EventRecord2 (EvtNetICMP_EchoReplyWrongId, if_id, val2);
4102  }
4103 #else
4104  #define EvrNetICMP_EchoReplyWrongId(if_id, eid, eid_valid)
4105 #endif
4106 
4107 /**
4108  \brief Event on ICMP invalid payload data in echo reply (Error)
4109  \param if_id network interface identifier
4110  */
4111 #ifdef DEBUG_EVR
4113  EventRecord2 (EvtNetICMP_EchoReplyWrongPayload, if_id, 0);
4114  }
4115 #else
4116  #define EvrNetICMP_EchoReplyWrongPayload(if_id)
4117 #endif
4118 
4119 /**
4120  \brief Event on ICMP message type unknown (Op)
4121  \param if_id network interface identifier
4122  \param icmp_type wrong ICMP message type value
4123  */
4124 #ifdef DEBUG_EVR
4125  __STATIC_INLINE void EvrNetICMP_MessageTypeUnknown(uint16_t if_id, uint8_t icmp_type) {
4126  EventRecord2 (EvtNetICMP_MessageTypeUnknown, if_id, icmp_type);
4127  }
4128 #else
4129  #define EvrNetICMP_MessageTypeUnknown(if_id, icmp_type)
4130 #endif
4131 
4132 /**
4133  \brief Event on ICMP send echo request (Op)
4134  \param if_id network interface identifier
4135  */
4136 #ifdef DEBUG_EVR
4138  EventRecord2 (EvtNetICMP_SendEchoRequest, if_id, 0);
4139  }
4140 #else
4141  #define EvrNetICMP_SendEchoRequest(if_id)
4142 #endif
4143 
4144 // ICMP ping client event recorder functions -----------------------------------
4145 
4146 /**
4147  \brief Event on Ping client initialize (Op)
4148  */
4149 #ifdef DEBUG_EVR
4151  EventRecord2 (EvtNetICMP_PingInit, 0, 0);
4152  }
4153 #else
4154  #define EvrNetICMP_PingInit()
4155 #endif
4156 
4157 /**
4158  \brief Event on Ping echo request (API)
4159  \param ip4_addr pointer to IPv4 address
4160  */
4161 #ifdef DEBUG_EVR
4162  __STATIC_INLINE void EvrNetICMP_PingEcho(const uint8_t *ip4_addr) {
4163  EventRecordData (EvtNetICMP_PingEcho, ip4_addr, 4);
4164  }
4165 #else
4166  #define EvrNetICMP_PingEcho(ip4_addr)
4167 #endif
4168 
4169 /**
4170  \brief Event on Ping target name not valid (Error)
4171  */
4172 #ifdef DEBUG_EVR
4174  EventRecord2 (EvtNetICMP_PingTargetNotValid, 0, 0);
4175  }
4176 #else
4177  #define EvrNetICMP_PingTargetNotValid()
4178 #endif
4179 
4180 /**
4181  \brief Event on Ping host name resolver error (Error)
4182  */
4183 #ifdef DEBUG_EVR
4185  EventRecord2 (EvtNetICMP_PingDnsError, 0, 0);
4186  }
4187 #else
4188  #define EvrNetICMP_PingDnsError()
4189 #endif
4190 
4191 /**
4192  \brief Event on Ping invalid parameter (Error)
4193  */
4194 #ifdef DEBUG_EVR
4196  EventRecord2 (EvtNetICMP_PingInvalidParameter, 0, 0);
4197  }
4198 #else
4199  #define EvrNetICMP_PingInvalidParameter()
4200 #endif
4201 
4202 /**
4203  \brief Event on Ping client busy (Error)
4204  */
4205 #ifdef DEBUG_EVR
4207  EventRecord2 (EvtNetICMP_PingClientBusy, 0, 0);
4208  }
4209 #else
4210  #define EvrNetICMP_PingClientBusy()
4211 #endif
4212 
4213 /**
4214  \brief Event on Ping send echo request (Op)
4215  */
4216 #ifdef DEBUG_EVR
4218  EventRecord2 (EvtNetICMP_PingSendRequest, 0, 0);
4219  }
4220 #else
4221  #define EvrNetICMP_PingSendRequest()
4222 #endif
4223 
4224 /**
4225  \brief Event on Ping retransmit echo request (Op)
4226  */
4227 #ifdef DEBUG_EVR
4229  EventRecord2 (EvtNetICMP_PingRetransmitRequest, 0, 0);
4230  }
4231 #else
4232  #define EvrNetICMP_PingRetransmitRequest()
4233 #endif
4234 
4235 /**
4236  \brief Event on Ping client timeout (Op)
4237  */
4238 #ifdef DEBUG_EVR
4240  EventRecord2 (EvtNetICMP_PingTimeout, 0, 0);
4241  }
4242 #else
4243  #define EvrNetICMP_PingTimeout()
4244 #endif
4245 
4246 /**
4247  \brief Event on Ping client de-initialize (Op)
4248  */
4249 #ifdef DEBUG_EVR
4251  EventRecord2 (EvtNetICMP_PingUninit, 0, 0);
4252  }
4253 #else
4254  #define EvrNetICMP_PingUninit()
4255 #endif
4256 
4257 
4258 // NetIGMP event identifiers ---------------------------------------------------
4259 #ifdef DEBUG_EVR
4260 #define EvtNetIGMP_InitManager EventID (EventLevelOp, EvtNetIGMP, 0)
4261 #define EvtNetIGMP_Join EventID (EventLevelAPI, EvtNetIGMP, 1)
4262 #define EvtNetIGMP_AlreadyInGroup EventID (EventLevelOp, EvtNetIGMP, 2)
4263 #define EvtNetIGMP_NoFreeEntries EventID (EventLevelError, EvtNetIGMP, 3)
4264 #define EvtNetIGMP_SendReport EventID (EventLevelOp, EvtNetIGMP, 4)
4265 #define EvtNetIGMP_Leave EventID (EventLevelAPI, EvtNetIGMP, 5)
4266 #define EvtNetIGMP_NotInGroup EventID (EventLevelError, EvtNetIGMP, 6)
4267 #define EvtNetIGMP_SendLeave EventID (EventLevelOp, EvtNetIGMP, 7)
4268 #define EvtNetIGMP_ReceiveFrame EventID (EventLevelOp, EvtNetIGMP, 8)
4269 #define EvtNetIGMP_FrameTooShort EventID (EventLevelError, EvtNetIGMP, 9)
4270 #define EvtNetIGMP_ChecksumFailed EventID (EventLevelError, EvtNetIGMP, 10)
4271 #define EvtNetIGMP_GroupSpecificQuery EventID (EventLevelOp, EvtNetIGMP, 11)
4272 #define EvtNetIGMP_DestAddressWrong EventID (EventLevelError, EvtNetIGMP, 12)
4273 #define EvtNetIGMP_DelayedReportScheduled EventID (EventLevelOp, EvtNetIGMP, 13)
4274 #define EvtNetIGMP_GeneralQuery EventID (EventLevelOp, EvtNetIGMP, 14)
4275 #define EvtNetIGMP_StartModeIGMPv1 EventID (EventLevelOp, EvtNetIGMP, 15)
4276 #define EvtNetIGMP_MaxTimeForReport EventID (EventLevelOp, EvtNetIGMP, 16)
4277 #define EvtNetIGMP_GroupReportsScheduled EventID (EventLevelOp, EvtNetIGMP, 17)
4278 #define EvtNetIGMP_ReportReceived EventID (EventLevelOp, EvtNetIGMP, 18)
4279 #define EvtNetIGMP_OwnReportCanceled EventID (EventLevelOp, EvtNetIGMP, 19)
4280 #define EvtNetIGMP_StartModeIGMPv2 EventID (EventLevelOp, EvtNetIGMP, 20)
4281 #define EvtNetIGMP_SendDelayedReport EventID (EventLevelOp, EvtNetIGMP, 21)
4282 #define EvtNetIGMP_UninitManager EventID (EventLevelOp, EvtNetIGMP, 22)
4283 #endif
4284 
4285 /**
4286  \brief Event on IGMP manager initialize (Op)
4287  \param if_id network interface identifier
4288  \param num_entries number of entries available in membership table
4289  */
4290 #ifdef DEBUG_EVR
4291  __STATIC_INLINE void EvrNetIGMP_InitManager(uint16_t if_id, uint32_t num_entries) {
4292  EventRecord2 (EvtNetIGMP_InitManager, if_id, num_entries);
4293  }
4294 #else
4295  #define EvrNetIGMP_InitManager(if_id, num_entries)
4296 #endif
4297 
4298 /**
4299  \brief Event on IGMP join group membership (API)
4300  \param if_id network interface identifier
4301  \param ip4_addr pointer to IPv4 address of a group
4302  */
4303 #ifdef DEBUG_EVR
4304  __STATIC_INLINE void EvrNetIGMP_Join(uint16_t if_id, const uint8_t *ip4_addr) {
4305  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4306  EventRecord2 (EvtNetIGMP_Join, if_id, evr_buf.u32[0]);
4307  }
4308 #else
4309  #define EvrNetIGMP_Join(if_id, ip4_addr)
4310 #endif
4311 
4312 /**
4313  \brief Event on IGMP join already a member (Op)
4314  \param if_id network interface identifier
4315  \param group_id group membership identifier
4316  */
4317 #ifdef DEBUG_EVR
4318  __STATIC_INLINE void EvrNetIGMP_AlreadyInGroup(uint16_t if_id, uint8_t group_id) {
4319  EventRecord2 (EvtNetIGMP_AlreadyInGroup, if_id, group_id);
4320  }
4321 #else
4322  #define EvrNetIGMP_AlreadyInGroup(if_id, group_id)
4323 #endif
4324 
4325 /**
4326  \brief Event on IGMP join no free entries available (Error)
4327  \param if_id network interface identifier
4328  \param num_used number of used membership table entries
4329  */
4330 #ifdef DEBUG_EVR
4331  __STATIC_INLINE void EvrNetIGMP_NoFreeEntries(uint16_t if_id, uint8_t num_used) {
4332  EventRecord2 (EvtNetIGMP_NoFreeEntries, if_id, num_used);
4333  }
4334 #else
4335  #define EvrNetIGMP_NoFreeEntries(if_id, num_used)
4336 #endif
4337 
4338 /**
4339  \brief Event on IGMP send report message (Op)
4340  \param if_id network interface identifier
4341  \param ip4_addr pointer to IPv4 address of a group
4342  */
4343 #ifdef DEBUG_EVR
4344  __STATIC_INLINE void EvrNetIGMP_SendReport(uint16_t if_id, const uint8_t *ip4_addr) {
4345  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4346  EventRecord2 (EvtNetIGMP_SendReport, if_id, evr_buf.u32[0]);
4347  }
4348 #else
4349  #define EvrNetIGMP_SendReport(if_id, ip4_addr)
4350 #endif
4351 
4352 /**
4353  \brief Event on IGMP leave group membership (API)
4354  \param if_id network interface identifier
4355  \param ip4_addr pointer to IPv4 address of a group
4356  */
4357 #ifdef DEBUG_EVR
4358  __STATIC_INLINE void EvrNetIGMP_Leave(uint16_t if_id, const uint8_t *ip4_addr) {
4359  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4360  EventRecord2 (EvtNetIGMP_Leave, if_id, evr_buf.u32[0]);
4361  }
4362 #else
4363  #define EvrNetIGMP_Leave(if_id, ip4_addr)
4364 #endif
4365 
4366 /**
4367  \brief Event on IGMP leave not a member (Error)
4368  \param if_id network interface identifier
4369  \param ip4_addr pointer to IPv4 address of a group
4370  */
4371 #ifdef DEBUG_EVR
4372  __STATIC_INLINE void EvrNetIGMP_NotInGroup(uint16_t if_id, const uint8_t *ip4_addr) {
4373  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4374  EventRecord2 (EvtNetIGMP_NotInGroup, if_id, evr_buf.u32[0]);
4375  }
4376 #else
4377  #define EvrNetIGMP_NotInGroup(if_id, ip4_addr)
4378 #endif
4379 
4380 /**
4381  \brief Event on IGMP send leave message (Op)
4382  \param if_id network interface identifier
4383  \param ip4_addr pointer to IPv4 address of a group
4384 */
4385 #ifdef DEBUG_EVR
4386  __STATIC_INLINE void EvrNetIGMP_SendLeave(uint16_t if_id, const uint8_t *ip4_addr) {
4387  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4388  EventRecord2 (EvtNetIGMP_SendLeave, if_id, evr_buf.u32[0]);
4389  }
4390 #else
4391  #define EvrNetIGMP_SendLeave(if_id, ip4_addr)
4392 #endif
4393 
4394 /**
4395  \brief Event on IGMP receive frame (Op)
4396  \param if_id network interface identifier
4397  \param message_type type of received message
4398  \param length length of received message
4399  */
4400 #ifdef DEBUG_EVR
4401  __STATIC_INLINE void EvrNetIGMP_ReceiveFrame(uint16_t if_id, uint8_t message_type, uint32_t length) {
4402  uint32_t val1 = ((uint32_t)message_type << 16) | if_id;
4403  EventRecord2 (EvtNetIGMP_ReceiveFrame, val1, length);
4404  }
4405 #else
4406  #define EvrNetIGMP_ReceiveFrame(if_id, message_type, length)
4407 #endif
4408 
4409 /**
4410  \brief Event on IGMP receive frame is too short (Error)
4411  \param if_id network interface identifier
4412  \param length frame length in bytes
4413  \param min_length minimum length of the frame
4414  */
4415 #ifdef DEBUG_EVR
4416  __STATIC_INLINE void EvrNetIGMP_FrameTooShort(uint16_t if_id, uint32_t length, uint32_t min_length) {
4417  uint32_t val2 = (min_length << 16) | length;
4418  EventRecord2 (EvtNetIGMP_FrameTooShort, if_id, val2);
4419  }
4420 #else
4421  #define EvrNetIGMP_FrameTooShort(if_id, length, min_length)
4422 #endif
4423 
4424 /**
4425  \brief Event on IGMP frame checksum check failed (Error)
4426  \param if_id network interface identifier
4427  \param length frame length in bytes
4428  */
4429 #ifdef DEBUG_EVR
4430  __STATIC_INLINE void EvrNetIGMP_ChecksumFailed(uint16_t if_id, uint32_t length) {
4431  EventRecord2 (EvtNetIGMP_ChecksumFailed, if_id, length);
4432  }
4433 #else
4434  #define EvrNetIGMP_ChecksumFailed(if_id, length)
4435 #endif
4436 
4437 /**
4438  \brief Event on IGMPv2 group specific query (Op)
4439  \param if_id network interface identifier
4440  \param ip4_addr pointer to IPv4 address of a group
4441 */
4442 #ifdef DEBUG_EVR
4443  __STATIC_INLINE void EvrNetIGMP_GroupSpecificQuery(uint16_t if_id, const uint8_t *ip4_addr) {
4444  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4445  EventRecord2 (EvtNetIGMP_GroupSpecificQuery, if_id, evr_buf.u32[0]);
4446  }
4447 #else
4448  #define EvrNetIGMP_GroupSpecificQuery(if_id, ip4_addr)
4449 #endif
4450 
4451 /**
4452  \brief Event on IGMPv2 destination address wrong (Error)
4453  \param if_id network interface identifier
4454  \param ip4_addr pointer to IPv4 address of a group
4455 */
4456 #ifdef DEBUG_EVR
4457  __STATIC_INLINE void EvrNetIGMP_DestAddressWrong(uint16_t if_id, const uint8_t *ip4_addr) {
4458  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4459  EventRecord2 (EvtNetIGMP_DestAddressWrong, if_id, evr_buf.u32[0]);
4460  }
4461 #else
4462  #define EvrNetIGMP_DestAddressWrong(if_id, ip4_addr)
4463 #endif
4464 
4465 /**
4466  \brief Event on IGMPv2 report message delayed (Op)
4467  \param if_id network interface identifier
4468  \param max_time maximum delay time in 100 ms ticks
4469 */
4470 #ifdef DEBUG_EVR
4471  __STATIC_INLINE void EvrNetIGMP_DelayedReportScheduled(uint16_t if_id, uint8_t max_time) {
4472  EventRecord2 (EvtNetIGMP_DelayedReportScheduled, if_id, max_time);
4473  }
4474 #else
4475  #define EvrNetIGMP_DelayedReportScheduled(if_id, max_time)
4476 #endif
4477 
4478 /**
4479  \brief Event on IGMPv1 general query (Op)
4480  \param if_id network interface identifier
4481  \param ip4_addr pointer to IPv4 address of a group
4482 */
4483 #ifdef DEBUG_EVR
4484  __STATIC_INLINE void EvrNetIGMP_GeneralQuery(uint16_t if_id, const uint8_t *ip4_addr) {
4485  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4486  EventRecord2 (EvtNetIGMP_GeneralQuery, if_id, evr_buf.u32[0]);
4487  }
4488 #else
4489  #define EvrNetIGMP_GeneralQuery(if_id, ip4_addr)
4490 #endif
4491 
4492 /**
4493  \brief Event on start IGMPv1 mode (Op)
4494  \param if_id network interface identifier
4495 */
4496 #ifdef DEBUG_EVR
4498  EventRecord2 (EvtNetIGMP_StartModeIGMPv1, if_id, 0);
4499  }
4500 #else
4501  #define EvrNetIGMP_StartModeIGMPv1(if_id)
4502 #endif
4503 
4504 /**
4505  \brief Event on IGMPv2 maximum time for report messages (Op)
4506  \param if_id network interface identifier
4507  \param max_time maximum delay time in 100 ms ticks
4508 */
4509 #ifdef DEBUG_EVR
4510  __STATIC_INLINE void EvrNetIGMP_MaxTimeForReport(uint16_t if_id, uint8_t max_time) {
4511  EventRecord2 (EvtNetIGMP_MaxTimeForReport, if_id, max_time);
4512  }
4513 #else
4514  #define EvrNetIGMP_MaxTimeForReport(if_id, max_time)
4515 #endif
4516 
4517 /**
4518  \brief Event on IGMP scheduled reports for all active groups (Op)
4519  \param if_id network interface identifier
4520  \param n_reports number of scheduled reports
4521 */
4522 #ifdef DEBUG_EVR
4523  __STATIC_INLINE void EvrNetIGMP_GroupReportsScheduled(uint16_t if_id, uint32_t n_reports) {
4524  EventRecord2 (EvtNetIGMP_GroupReportsScheduled, if_id, n_reports);
4525  }
4526 #else
4527  #define EvrNetIGMP_GroupReportsScheduled(if_id, n_reports)
4528 #endif
4529 
4530 /**
4531  \brief Event on IGMP received report message (Op)
4532  \param if_id network interface identifier
4533  \param ip4_addr pointer to IPv4 address of a group
4534  */
4535 #ifdef DEBUG_EVR
4536  __STATIC_INLINE void EvrNetIGMP_ReportReceived(uint16_t if_id, const uint8_t *ip4_addr) {
4537  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4538  EventRecord2 (EvtNetIGMP_ReportReceived, if_id, evr_buf.u32[0]);
4539  }
4540 #else
4541  #define EvrNetIGMP_ReportReceived(if_id, ip4_addr)
4542 #endif
4543 
4544 /**
4545  \brief Event on own report canceled (Op)
4546  \param if_id network interface identifier
4547  \param group_id group membership identifier
4548 */
4549 #ifdef DEBUG_EVR
4550  __STATIC_INLINE void EvrNetIGMP_OwnReportCanceled(uint16_t if_id, uint8_t group_id) {
4551  EventRecord2 (EvtNetIGMP_OwnReportCanceled, if_id, group_id);
4552  }
4553 #else
4554  #define EvrNetIGMP_OwnReportCanceled(if_id, group_id)
4555 #endif
4556 
4557 /**
4558  \brief Event on start IGMPv2 mode (Op)
4559  \param if_id network interface identifier
4560 */
4561 #ifdef DEBUG_EVR
4563  EventRecord2 (EvtNetIGMP_StartModeIGMPv2, if_id, 0);
4564  }
4565 #else
4566  #define EvrNetIGMP_StartModeIGMPv2(if_id)
4567 #endif
4568 
4569 /**
4570  \brief Event on IGMP send delayed report message (Op)
4571  \param if_id network interface identifier
4572  \param ip4_addr pointer to IPv4 address of a group
4573  */
4574 #ifdef DEBUG_EVR
4575  __STATIC_INLINE void EvrNetIGMP_SendDelayedReport(uint16_t if_id, const uint8_t *ip4_addr) {
4576  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4577  EventRecord2 (EvtNetIGMP_SendDelayedReport, if_id, evr_buf.u32[0]);
4578  }
4579 #else
4580  #define EvrNetIGMP_SendDelayedReport(if_id, ip4_addr)
4581 #endif
4582 
4583 /**
4584  \brief Event on IGMP manager de-initialize (Op)
4585  \param if_id network interface identifier
4586  */
4587 #ifdef DEBUG_EVR
4589  EventRecord2 (EvtNetIGMP_UninitManager, if_id, 0);
4590  }
4591 #else
4592  #define EvrNetIGMP_UninitManager(if_id)
4593 #endif
4594 
4595 
4596 // NetNBNS event identifiers ---------------------------------------------------
4597 #ifdef DEBUG_EVR
4598 #define EvtNetNBNS_InitService EventID (EventLevelOp, EvtNetNBNS, 0)
4599 #define EvtNetNBNS_GetSocketFailed EventID (EventLevelError, EvtNetNBNS, 1)
4600 #define EvtNetNBNS_ReceiveFrame EventID (EventLevelOp, EvtNetNBNS, 2)
4601 #define EvtNetNBNS_WrongRemotePort EventID (EventLevelError, EvtNetNBNS, 3)
4602 #define EvtNetNBNS_FrameTooShort EventID (EventLevelError, EvtNetNBNS, 4)
4603 #define EvtNetNBNS_NameQueryRequest EventID (EventLevelOp, EvtNetNBNS, 5)
4604 #define EvtNetNBNS_QueryFromAddress EventID (EventLevelDetail,EvtNetNBNS, 6)
4605 #define EvtNetNBNS_NameQueryResponse EventID (EventLevelOp, EvtNetNBNS, 7)
4606 #define EvtNetNBNS_UninitService EventID (EventLevelOp, EvtNetNBNS, 8)
4607 #endif
4608 
4609 /**
4610  \brief Event on NBNS name service initialize (Op)
4611  \param if_id network interface identifier
4612  */
4613 #ifdef DEBUG_EVR
4615  EventRecord2 (EvtNetNBNS_InitService, if_id, 0);
4616  }
4617 #else
4618  #define EvrNetNBNS_InitService(if_id)
4619 #endif
4620 
4621 /**
4622  \brief Event on NBNS failed to allocate UDP socket (Error)
4623  */
4624 #ifdef DEBUG_EVR
4626  EventRecord2 (EvtNetNBNS_GetSocketFailed, 0, 0);
4627  }
4628 #else
4629  #define EvrNetNBNS_GetSocketFailed()
4630 #endif
4631 
4632 /**
4633  \brief Event on NBNS receive frame (Op)
4634  \param if_id network interface identifier
4635  \param length frame length in bytes
4636  */
4637 #ifdef DEBUG_EVR
4638  __STATIC_INLINE void EvrNetNBNS_ReceiveFrame(uint16_t if_id, uint32_t length) {
4639  EventRecord2 (EvtNetNBNS_ReceiveFrame, if_id, length);
4640  }
4641 #else
4642  #define EvrNetNBNS_ReceiveFrame(if_id, length)
4643 #endif
4644 
4645 /**
4646  \brief Event on NBNS wrong remote UDP port (Error)
4647  \param if_id network interface identifier
4648  \param port received remote port number
4649  \param port_valid valid remote port number
4650  */
4651 #ifdef DEBUG_EVR
4652  __STATIC_INLINE void EvrNetNBNS_WrongRemotePort(uint16_t if_id, uint16_t port, uint16_t port_valid) {
4653  uint32_t val2 = ((uint32_t)port_valid << 16) | port;
4654  EventRecord2 (EvtNetNBNS_WrongRemotePort, if_id, val2);
4655  }
4656 #else
4657  #define EvrNetNBNS_WrongRemotePort(if_id, port, port_valid)
4658 #endif
4659 
4660 /**
4661  \brief Event on NBNS receive frame is too short (Error)
4662  \param if_id network interface identifier
4663  \param length frame length in bytes
4664  \param min_length minimum length of the frame
4665  */
4666 #ifdef DEBUG_EVR
4667  __STATIC_INLINE void EvrNetNBNS_FrameTooShort(uint16_t if_id, uint32_t length, uint32_t min_length) {
4668  uint32_t val2 = (min_length << 16) | length;
4669  EventRecord2 (EvtNetNBNS_FrameTooShort, if_id, val2);
4670  }
4671 #else
4672  #define EvrNetNBNS_FrameTooShort(if_id, length, min_length)
4673 #endif
4674 
4675 /**
4676  \brief Event on NBNS name query request received (Op)
4677  \param q_name pointer to a question name string
4678  \param length length of the question name string
4679  */
4680 #ifdef DEBUG_EVR
4681  __STATIC_INLINE void EvrNetNBNS_NameQueryRequest(const char *q_name, uint32_t length) {
4682  if (length > 16) length = 16;
4683  EventRecordData (EvtNetNBNS_NameQueryRequest, q_name, length);
4684  }
4685 #else
4686  #define EvrNetNBNS_NameQueryRequest(q_name, length)
4687 #endif
4688 
4689 /**
4690  \brief Event on NBNS name query from IP-address (Detail)
4691  \param if_id network interface identifier
4692  \param ip4_addr pointer to IPv4 address of a host
4693  */
4694 #ifdef DEBUG_EVR
4695  __STATIC_INLINE void EvrNetNBNS_QueryFromAddress(uint16_t if_id, const uint8_t *ip4_addr) {
4696  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4697  EventRecord2 (EvtNetNBNS_QueryFromAddress, if_id, evr_buf.u32[0]);
4698  }
4699 #else
4700  #define EvrNetNBNS_QueryFromAddress(if_id, ip4_addr)
4701 #endif
4702 
4703 /**
4704  \brief Event on NBNS response to a name query (Op)
4705  \param if_id network interface identifier
4706  \param ip4_addr pointer to local IPv4 address
4707  */
4708 #ifdef DEBUG_EVR
4709  __STATIC_INLINE void EvrNetNBNS_NameQueryResponse(uint16_t if_id, const uint8_t *ip4_addr) {
4710  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4711  EventRecord2 (EvtNetNBNS_NameQueryResponse, if_id, evr_buf.u32[0]);
4712  }
4713 #else
4714  #define EvrNetNBNS_NameQueryResponse(if_id, ip4_addr)
4715 #endif
4716 
4717 /**
4718  \brief Event on NBNS name service de-initialize (Op)
4719  \param if_id network interface identifier
4720 */
4721 #ifdef DEBUG_EVR
4723  EventRecord2 (EvtNetNBNS_UninitService, if_id, 0);
4724  }
4725 #else
4726  #define EvrNetNBNS_UninitService(if_id)
4727 #endif
4728 
4729 
4730 // NetDHCP event identifiers ---------------------------------------------------
4731 #ifdef DEBUG_EVR
4732 #define EvtNetDHCP_InitClient EventID (EventLevelOp, EvtNetDHCP, 0)
4733 #define EvtNetDHCP_GetSocketFailed EventID (EventLevelError, EvtNetDHCP, 1)
4734 #define EvtNetDHCP_StartClient EventID (EventLevelOp, EvtNetDHCP, 2)
4735 #define EvtNetDHCP_StopClient EventID (EventLevelOp, EvtNetDHCP, 3)
4736 #define EvtNetDHCP_ClientState EventID (EventLevelOp, EvtNetDHCP, 4)
4737 #define EvtNetDHCP_NextState EventID (EventLevelOp, EvtNetDHCP, 5)
4738 #define EvtNetDHCP_StateRetransmit EventID (EventLevelOp, EvtNetDHCP, 6)
4739 #define EvtNetDHCP_ChangeStateOnTimeout EventID (EventLevelOp, EvtNetDHCP, 7)
4740 #define EvtNetDHCP_AutoIpAddressProbe EventID (EventLevelOp, EvtNetDHCP, 8)
4741 #define EvtNetDHCP_AutoIpSuccess EventID (EventLevelOp, EvtNetDHCP, 9)
4742 #define EvtNetDHCP_T2Expired EventID (EventLevelOp, EvtNetDHCP, 10)
4743 #define EvtNetDHCP_LeaseExpired EventID (EventLevelError, EvtNetDHCP, 11)
4744 #define EvtNetDHCP_SendDhcpMessage EventID (EventLevelOp, EvtNetDHCP, 12)
4745 #define EvtNetDHCP_ReceiveFrame EventID (EventLevelOp, EvtNetDHCP, 13)
4746 #define EvtNetDHCP_WrongServerPort EventID (EventLevelError, EvtNetDHCP, 14)
4747 #define EvtNetDHCP_FrameTooShort EventID (EventLevelError, EvtNetDHCP, 15)
4748 #define EvtNetDHCP_MisformedReply EventID (EventLevelError, EvtNetDHCP, 16)
4749 #define EvtNetDHCP_WrongTransactionId EventID (EventLevelError, EvtNetDHCP, 17)
4750 #define EvtNetDHCP_WrongClientHwAddress EventID (EventLevelError, EvtNetDHCP, 18)
4751 #define EvtNetDHCP_WrongMagicCookie EventID (EventLevelError, EvtNetDHCP, 19)
4752 #define EvtNetDHCP_InvalidMessageType EventID (EventLevelOp, EvtNetDHCP, 20)
4753 #define EvtNetDHCP_ShowMessage EventID (EventLevelOp, EvtNetDHCP, 21)
4754 #define EvtNetDHCP_FileOverloadOptions EventID (EventLevelDetail,EvtNetDHCP, 22)
4755 #define EvtNetDHCP_SnameOverloadOptions EventID (EventLevelDetail,EvtNetDHCP, 23)
4756 #define EvtNetDHCP_MissingServerId EventID (EventLevelOp, EvtNetDHCP, 24)
4757 #define EvtNetDHCP_ForwardedMessage EventID (EventLevelOp, EvtNetDHCP, 25)
4758 #define EvtNetDHCP_RelayAgentAddressInvalid EventID (EventLevelError, EvtNetDHCP, 26)
4759 #define EvtNetDHCP_ShowRelayAgentAddress EventID (EventLevelDetail,EvtNetDHCP, 27)
4760 #define EvtNetDHCP_ShowOfferedAddress EventID (EventLevelOp, EvtNetDHCP, 28)
4761 #define EvtNetDHCP_ServerAddressNotSelected EventID (EventLevelOp, EvtNetDHCP, 29)
4762 #define EvtNetDHCP_AssignedAddrNotRequested EventID (EventLevelOp, EvtNetDHCP, 30)
4763 #define EvtNetDHCP_ShowAssignedAddress EventID (EventLevelOp, EvtNetDHCP, 31)
4764 #define EvtNetDHCP_ShowServerId EventID (EventLevelOp, EvtNetDHCP, 32)
4765 #define EvtNetDHCP_ShowNetMask EventID (EventLevelOp, EvtNetDHCP, 33)
4766 #define EvtNetDHCP_ShowGatewayAddress EventID (EventLevelOp, EvtNetDHCP, 34)
4767 #define EvtNetDHCP_ShowDnsServers EventID (EventLevelOp, EvtNetDHCP, 35)
4768 #define EvtNetDHCP_ShowLeaseTime EventID (EventLevelOp, EvtNetDHCP, 36)
4769 #define EvtNetDHCP_ShowTimeT1 EventID (EventLevelOp, EvtNetDHCP, 37)
4770 #define EvtNetDHCP_ShowTimeT2 EventID (EventLevelOp, EvtNetDHCP, 38)
4771 #define EvtNetDHCP_ShowBootfileName EventID (EventLevelOp, EvtNetDHCP, 39)
4772 #define EvtNetDHCP_ShowNtpServerList EventID (EventLevelOp, EvtNetDHCP, 40)
4773 #define EvtNetDHCP_SetOptionInvalidParam EventID (EventLevelError, EvtNetDHCP, 41)
4774 #define EvtNetDHCP_SetOptionInvalidState EventID (EventLevelError, EvtNetDHCP, 42)
4775 #define EvtNetDHCP_SetOptionClientIdDefault EventID (EventLevelAPI, EvtNetDHCP, 43)
4776 #define EvtNetDHCP_SetOptionClientId EventID (EventLevelAPI, EvtNetDHCP, 44)
4777 #define EvtNetDHCP_UninitClient EventID (EventLevelOp, EvtNetDHCP, 45)
4778 #endif
4779 
4780 /**
4781  \brief Event on DHCP client initialize (Op)
4782  \param if_id network interface identifier
4783  \param vcid Vendor Class Identifier option flag
4784  - 0: not enabled
4785  - >0: enabled
4786  \param option_flags DHCP client option flags
4787  - 0x01: Opt.67 Bootfile name
4788  - 0x02: Opt.42 NTP servers
4789  */
4790 #ifdef DEBUG_EVR
4791  __STATIC_INLINE void EvrNetDHCP_InitClient(uint16_t if_id, uint8_t vcid, uint8_t option_flags) {
4792  uint32_t val2 = ((uint32_t)vcid << 16) | option_flags;
4793  EventRecord2 (EvtNetDHCP_InitClient, if_id, val2);
4794  }
4795 #else
4796  #define EvrNetDHCP_InitClient(if_id, vcid, option_flags)
4797 #endif
4798 
4799 /**
4800  \brief Event on DHCP failed to allocate UDP socket (Error)
4801  */
4802 #ifdef DEBUG_EVR
4804  EventRecord2 (EvtNetDHCP_GetSocketFailed, 0, 0);
4805  }
4806 #else
4807  #define EvrNetDHCP_GetSocketFailed()
4808 #endif
4809 
4810 /**
4811  \brief Event on DHCP client start (Op)
4812  \param if_id network interface identifier
4813  */
4814 #ifdef DEBUG_EVR
4816  EventRecord2 (EvtNetDHCP_StartClient, if_id, 0);
4817  }
4818 #else
4819  #define EvrNetDHCP_StartClient(if_id)
4820 #endif
4821 
4822 /**
4823  \brief Event on DHCP client stop (Op)
4824  \param if_id network interface identifier
4825  */
4826 #ifdef DEBUG_EVR
4828  EventRecord2 (EvtNetDHCP_StopClient, if_id, 0);
4829  }
4830 #else
4831  #define EvrNetDHCP_StopClient(if_id)
4832 #endif
4833 
4834 /**
4835  \brief Event on DHCP indication of client state (Op)
4836  \param if_id network interface identifier
4837  \param state current state
4838  */
4839 #ifdef DEBUG_EVR
4840  __STATIC_INLINE void EvrNetDHCP_ClientState(uint16_t if_id, uint8_t state) {
4841  EventRecord2 (EvtNetDHCP_ClientState, if_id, state);
4842  }
4843 #else
4844  #define EvrNetDHCP_ClientState(if_id, state)
4845 #endif
4846 
4847 /**
4848  \brief Event on DHCP transition to next state (Op)
4849  \param if_id network interface identifier
4850  \param state next state
4851  */
4852 #ifdef DEBUG_EVR
4853  __STATIC_INLINE void EvrNetDHCP_NextState(uint16_t if_id, uint8_t state) {
4854  EventRecord2 (EvtNetDHCP_NextState, if_id, state);
4855  }
4856 #else
4857  #define EvrNetDHCP_NextState(if_id, state)
4858 #endif
4859 
4860 /**
4861  \brief Event on DHCP retransmit in current state (Op)
4862  \param if_id network interface identifier
4863  \param state current state
4864  */
4865 #ifdef DEBUG_EVR
4866  __STATIC_INLINE void EvrNetDHCP_StateRetransmit(uint16_t if_id, uint8_t state) {
4867  EventRecord2 (EvtNetDHCP_StateRetransmit, if_id, state);
4868  }
4869 #else
4870  #define EvrNetDHCP_StateRetransmit(if_id, state)
4871 #endif
4872 
4873 /**
4874  \brief Event on DHCP state timeout and transit to next state (Op)
4875  \param if_id network interface identifier
4876  \param current current state
4877  \param next next state
4878  */
4879 #ifdef DEBUG_EVR
4880  __STATIC_INLINE void EvrNetDHCP_ChangeStateOnTimeout(uint16_t if_id, uint8_t current, uint8_t next) {
4881  uint32_t val2 = ((uint32_t)next << 16) | current;
4882  EventRecord2 (EvtNetDHCP_ChangeStateOnTimeout, if_id, val2);
4883  }
4884 #else
4885  #define EvrNetDHCP_ChangeStateOnTimeout(if_id, current, next)
4886 #endif
4887 
4888 /**
4889  \brief Event on DHCP address probe for AutoIP mode (Op)
4890  \param if_id network interface identifier
4891  \param ip4_addr pointer to IP address
4892  */
4893 #ifdef DEBUG_EVR
4894  __STATIC_INLINE void EvrNetDHCP_AutoIpAddressProbe(uint16_t if_id, const uint8_t *ip4_addr) {
4895  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4896  EventRecord2 (EvtNetDHCP_AutoIpAddressProbe, if_id, evr_buf.u32[0]);
4897  }
4898 #else
4899  #define EvrNetDHCP_AutoIpAddressProbe(if_id, ip4_addr)
4900 #endif
4901 
4902 /**
4903  \brief Event on DHCP assign AutoIP address success (Op)
4904  \param if_id network interface identifier
4905  \param auto_lm pointer to assigned AutoIP address and network mask
4906  */
4907 #ifdef DEBUG_EVR
4908  __STATIC_INLINE void EvrNetDHCP_AutoIpSuccess(uint16_t if_id, const uint8_t *auto_lm) {
4909  evr_buf.u32[0] = if_id;
4910  memcpy (&evr_buf.u32[1], auto_lm, 8);
4911  EventRecordData (EvtNetDHCP_AutoIpSuccess, &evr_buf, 12);
4912  }
4913 #else
4914  #define EvrNetDHCP_AutoIpSuccess(if_id, auto_lm)
4915 #endif
4916 
4917 /**
4918  \brief Event on DHCP timer T2 expired (Op)
4919  \param if_id network interface identifier
4920  \param state current state
4921  */
4922 #ifdef DEBUG_EVR
4923  __STATIC_INLINE void EvrNetDHCP_T2Expired(uint16_t if_id, uint8_t state) {
4924  EventRecord2 (EvtNetDHCP_T2Expired, if_id, state);
4925  }
4926 #else
4927  #define EvrNetDHCP_T2Expired(if_id, state)
4928 #endif
4929 
4930 /**
4931  \brief Event on DHCP address lease time expired (Error)
4932  \param if_id network interface identifier
4933  \param state current state
4934  */
4935 #ifdef DEBUG_EVR
4936  __STATIC_INLINE void EvrNetDHCP_LeaseExpired(uint16_t if_id, uint8_t state) {
4937  EventRecord2 (EvtNetDHCP_LeaseExpired, if_id, state);
4938  }
4939 #else
4940  #define EvrNetDHCP_LeaseExpired(if_id, state)
4941 #endif
4942 
4943 /**
4944  \brief Event on DHCP send message (Op)
4945  \param if_id network interface identifier
4946  \param msg_type message type
4947  \param broadcast broadcast the message
4948  - 0: no
4949  - 1: yes
4950  */
4951 #ifdef DEBUG_EVR
4952  __STATIC_INLINE void EvrNetDHCP_SendDhcpMessage(uint16_t if_id, uint8_t msg_type, uint8_t broadcast) {
4953  uint32_t val2 = ((uint32_t)broadcast << 16) | msg_type;
4954  EventRecord2 (EvtNetDHCP_SendDhcpMessage, if_id, val2);
4955  }
4956 #else
4957  #define EvrNetDHCP_SendDhcpMessage(if_id, msg_type, broadcast)
4958 #endif
4959 
4960 /**
4961  \brief Event on DHCP receive frame (Op)
4962  \param if_id network interface identifier
4963  \param ip4_addr pointer to IPv4 address of the server
4964  \param length frame length in bytes
4965  */
4966 #ifdef DEBUG_EVR
4967  __STATIC_INLINE void EvrNetDHCP_ReceiveFrame(uint16_t if_id, const uint8_t *ip4_addr, uint32_t length) {
4968  uint32_t val1 = (length << 16) | if_id;
4969  memcpy (&evr_buf.u32[0], ip4_addr, 4);
4970  EventRecord2 (EvtNetDHCP_ReceiveFrame, val1, evr_buf.u32[0]);
4971  }
4972 #else
4973  #define EvrNetDHCP_ReceiveFrame(if_id, ip4_addr, length)
4974 #endif
4975 
4976 /**
4977  \brief Event on DHCP wrong server UDP port (Error)
4978  \param if_id network interface identifier
4979  \param port received server port number
4980  \param port_valid valid server port number
4981  */
4982 #ifdef DEBUG_EVR
4983  __STATIC_INLINE void EvrNetDHCP_WrongServerPort(uint16_t if_id, uint16_t port, uint16_t port_valid) {
4984  uint32_t val2 = ((uint32_t)port_valid << 16) | port;
4985  EventRecord2 (EvtNetDHCP_WrongServerPort, if_id, val2);
4986  }
4987 #else
4988  #define EvrNetDHCP_WrongServerPort(if_id, port, port_valid)
4989 #endif
4990 
4991 /**
4992  \brief Event on DHCP receive frame too short (Error)
4993  \param if_id network interface identifier
4994  \param length frame length in bytes
4995  \param min_length minimum length of the frame
4996  */
4997 #ifdef DEBUG_EVR
4998  __STATIC_INLINE void EvrNetDHCP_FrameTooShort(uint16_t if_id, uint32_t length, uint32_t min_length) {
4999  uint32_t val2 = (min_length << 16) | length;
5000  EventRecord2 (EvtNetDHCP_FrameTooShort, if_id, val2);
5001  }
5002 #else
5003  #define EvrNetDHCP_FrameTooShort(if_id, length, min_length)
5004 #endif
5005 
5006 /**
5007  \brief Event on DHCP receive misformed reply (Error)
5008  \param if_id network interface identifier
5009  */
5010 #ifdef DEBUG_EVR
5012  EventRecord2 (EvtNetDHCP_MisformedReply, if_id, 0);
5013  }
5014 #else
5015  #define EvrNetDHCP_MisformedReply(if_id)
5016 #endif
5017 
5018 /**
5019  \brief Event on DHCP receive wrong transaction identifier (Error)
5020  \param if_id network interface identifier
5021  \param xid received transaction identifier
5022  \param xid_valid valid transaction identifier
5023  */
5024 #ifdef DEBUG_EVR
5025  __STATIC_INLINE void EvrNetDHCP_WrongTransactionId(uint16_t if_id, uint32_t xid, uint32_t xid_valid) {
5026  EventRecord4 (EvtNetDHCP_WrongTransactionId, if_id, xid, xid_valid, 0);
5027  }
5028 #else
5029  #define EvrNetDHCP_WrongTransactionId(if_id, xid, xid_valid)
5030 #endif
5031 
5032 /**
5033  \brief Event on DHCP receive wrong Client Hardware Address (Error)
5034  \param if_id network interface identifier
5035  \param chaddr pointer to received chaddr address (MAC)
5036  */
5037 #ifdef DEBUG_EVR
5038  __STATIC_INLINE void EvrNetDHCP_WrongClientHwAddress(uint16_t if_id, const uint8_t *chaddr) {
5039  evr_buf.u16[0] = if_id;
5040  memcpy (&evr_buf.u16[1], chaddr, 6);
5041  EventRecordData (EvtNetDHCP_WrongClientHwAddress, chaddr, 8);
5042  }
5043 #else
5044  #define EvrNetDHCP_WrongClientHwAddress(if_id, chaddr)
5045 #endif
5046 
5047 /**
5048  \brief Event on DHCP receive wrong BOOTP Magic Cookie (Error)
5049  \param if_id network interface identifier
5050  \param cookie received magic cookie
5051  \param cookie_valid valid magic cookie
5052  */
5053 #ifdef DEBUG_EVR
5054  __STATIC_INLINE void EvrNetDHCP_WrongMagicCookie(uint16_t if_id, uint32_t cookie, uint32_t cookie_valid) {
5055  EventRecord4 (EvtNetDHCP_WrongMagicCookie, if_id, cookie, cookie_valid, 0);
5056  }
5057 #else
5058  #define EvrNetDHCP_WrongMagicCookie(if_id, cookie, cookie_valid)
5059 #endif
5060 
5061 /**
5062  \brief Event on DHCP receive invalid message type (Op)
5063  \param if_id network interface identifier
5064  \param msg_type received message type
5065  \param msg_valid valid message type
5066  */
5067 #ifdef DEBUG_EVR
5068  __STATIC_INLINE void EvrNetDHCP_InvalidMessageType(uint16_t if_id, uint8_t msg_type, uint8_t msg_valid) {
5069  uint32_t val2 = ((uint32_t)msg_valid << 16) | msg_type;
5070  EventRecord2 (EvtNetDHCP_InvalidMessageType, if_id, val2);
5071  }
5072 #else
5073  #define EvrNetDHCP_InvalidMessageType(if_id, msg_type, msg_valid)
5074 #endif
5075 
5076 /**
5077  \brief Event on DHCP display message type (Op)
5078  \param if_id network interface identifier
5079  \param msg_type message type
5080  */
5081 #ifdef DEBUG_EVR
5082  __STATIC_INLINE void EvrNetDHCP_ShowMessage(uint16_t if_id, uint8_t msg_type) {
5083  EventRecord2 (EvtNetDHCP_ShowMessage, if_id, msg_type);
5084  }
5085 #else
5086  #define EvrNetDHCP_ShowMessage(if_id, msg_type)
5087 #endif
5088 
5089 /**
5090  \brief Event on DHCP receive options overloaded to "File" field (Detail)
5091  \param if_id network interface identifier
5092  \param msg_type message type
5093  */
5094 #ifdef DEBUG_EVR
5095  __STATIC_INLINE void EvrNetDHCP_FileOverloadOptions(uint16_t if_id, uint8_t msg_type) {
5096  EventRecord2 (EvtNetDHCP_FileOverloadOptions, if_id, msg_type);
5097  }
5098 #else
5099  #define EvrNetDHCP_FileOverloadOptions(if_id, msg_type)
5100 #endif
5101 
5102 /**
5103  \brief Event on DHCP receive options overloaded to "Sname" field (Detail)
5104  \param if_id network interface identifier
5105  \param msg_type message type
5106  */
5107 #ifdef DEBUG_EVR
5108  __STATIC_INLINE void EvrNetDHCP_SnameOverloadOptions(uint16_t if_id, uint8_t msg_type) {
5109  EventRecord2 (EvtNetDHCP_SnameOverloadOptions, if_id, msg_type);
5110  }
5111 #else
5112  #define EvrNetDHCP_SnameOverloadOptions(if_id, msg_type)
5113 #endif
5114 
5115 /**
5116  \brief Event on DHCP receive message with no Server ID (Op)
5117  \param if_id network interface identifier
5118  \param msg_type received message type
5119  */
5120 #ifdef DEBUG_EVR
5121  __STATIC_INLINE void EvrNetDHCP_MissingServerId(uint16_t if_id, uint8_t msg_type) {
5122  EventRecord2 (EvtNetDHCP_MissingServerId, if_id, msg_type);
5123  }
5124 #else
5125  #define EvrNetDHCP_MissingServerId(if_id, msg_type)
5126 #endif
5127 
5128 /**
5129  \brief Event on DHCP receive forwarded message (Op)
5130  \param if_id network interface identifier
5131  \param msg_type received message type
5132  */
5133 #ifdef DEBUG_EVR
5134  __STATIC_INLINE void EvrNetDHCP_ForwardedMessage(uint16_t if_id, uint8_t msg_type) {
5135  EventRecord2 (EvtNetDHCP_ForwardedMessage, if_id, msg_type);
5136  }
5137 #else
5138  #define EvrNetDHCP_ForwardedMessage(if_id, msg_type)
5139 #endif
5140 
5141 /**
5142  \brief Event on DHCP receive message from invalid Relay Agent (Error)
5143  \param if_id network interface identifier
5144  */
5145 #ifdef DEBUG_EVR
5147  EventRecord2 (EvtNetDHCP_RelayAgentAddressInvalid, if_id, 0);
5148  }
5149 #else
5150  #define EvrNetDHCP_RelayAgentAddressInvalid(if_id)
5151 #endif
5152 
5153 /**
5154  \brief Event on DHCP display relay agent IP address (Detail)
5155  \param if_id network interface identifier
5156  \param ip4_addr pointer to IPv4 address
5157  */
5158 #ifdef DEBUG_EVR
5159  __STATIC_INLINE void EvrNetDHCP_ShowRelayAgentAddress(uint16_t if_id, const uint8_t *ip4_addr) {
5160  memcpy (&evr_buf.u32[0], ip4_addr, 4);
5161  EventRecord2 (EvtNetDHCP_ShowRelayAgentAddress, if_id, evr_buf.u32[0]);
5162  }
5163 #else
5164  #define EvrNetDHCP_ShowRelayAgentAddress(if_id, ip4_addr)
5165 #endif
5166 
5167 /**
5168  \brief Event on DHCP display offered IP address (Op)
5169  \param if_id network interface identifier
5170  \param ip4_addr pointer to IPv4 address
5171  */
5172 #ifdef DEBUG_EVR
5173  __STATIC_INLINE void EvrNetDHCP_ShowOfferedAddress(uint16_t if_id, const uint8_t *ip4_addr) {
5174  memcpy (&evr_buf.u32[0], ip4_addr, 4);
5175  EventRecord2 (EvtNetDHCP_ShowOfferedAddress, if_id, evr_buf.u32[0]);
5176  }
5177 #else
5178  #define EvrNetDHCP_ShowOfferedAddress(if_id, ip4_addr)
5179 #endif
5180 
5181 /**
5182  \brief Event on DHCP receive message from not selected server (Op)
5183  \param if_id network interface identifier
5184  \param ip4_addr pointer to IPv4 address
5185  */
5186 #ifdef DEBUG_EVR
5187  __STATIC_INLINE void EvrNetDHCP_ServerAddressNotSelected(uint16_t if_id, const uint8_t *ip4_addr) {
5188  memcpy (&evr_buf.u32[0], ip4_addr, 4);
5189  EventRecord2 (EvtNetDHCP_ServerAddressNotSelected, if_id, evr_buf.u32[0]);
5190  }
5191 #else
5192  #define EvrNetDHCP_ServerAddressNotSelected(if_id, ip4_addr)
5193 #endif
5194 
5195 /**
5196  \brief Event on DHCP receive wrong assigned IP address in DHCP_ACK (Op)
5197  \param if_id network interface identifier
5198  \param ip4_addr pointer to IPv4 address
5199  */
5200 #ifdef DEBUG_EVR
5201  __STATIC_INLINE void EvrNetDHCP_AssignedAddrNotRequested(uint16_t if_id, const uint8_t *ip4_addr) {
5202  memcpy (&evr_buf.u32[0], ip4_addr, 4);
5203  EventRecord2 (EvtNetDHCP_AssignedAddrNotRequested, if_id, evr_buf.u32[0]);
5204  }
5205 #else
5206  #define EvrNetDHCP_AssignedAddrNotRequested(if_id, ip4_addr)
5207 #endif
5208 
5209 /**
5210  \brief Event on DHCP display assigned IP address (Op)
5211  \param if_id network interface identifier
5212  \param ip4_addr pointer to IPv4 address
5213  */
5214 #ifdef DEBUG_EVR
5215  __STATIC_INLINE void EvrNetDHCP_ShowAssignedAddress(uint16_t if_id, const uint8_t *ip4_addr) {
5216  memcpy (&evr_buf.u32[0], ip4_addr, 4);
5217  EventRecord2 (EvtNetDHCP_ShowAssignedAddress, if_id, evr_buf.u32[0]);
5218  }
5219 #else
5220  #define EvrNetDHCP_ShowAssignedAddress(if_id, ip4_addr)
5221 #endif
5222 
5223 /**
5224  \brief Event on DHCP display Server Identifier (Op)
5225  \param if_id network interface identifier
5226  \param ip4_addr pointer to IPv4 address
5227  */
5228 #ifdef DEBUG_EVR
5229  __STATIC_INLINE void EvrNetDHCP_ShowServerId(uint16_t if_id, const uint8_t *ip4_addr) {
5230  memcpy (&evr_buf.u32[0], ip4_addr, 4);
5231  EventRecord2 (EvtNetDHCP_ShowServerId, if_id, evr_buf.u32[0]);
5232  }
5233 #else
5234  #define EvrNetDHCP_ShowServerId(if_id, ip4_addr)
5235 #endif
5236 
5237 /**
5238  \brief Event on DHCP display Network Mask (Op)
5239  \param if_id network interface identifier
5240  \param net_mask pointer to network mask
5241  */
5242 #ifdef DEBUG_EVR
5243  __STATIC_INLINE void EvrNetDHCP_ShowNetMask(uint16_t if_id, const uint8_t *net_mask) {
5244  memcpy (&evr_buf.u32[0], net_mask, 4);
5245  EventRecord2 (EvtNetDHCP_ShowNetMask, if_id, evr_buf.u32[0]);
5246  }
5247 #else
5248  #define EvrNetDHCP_ShowNetMask(if_id, net_mask)
5249 #endif
5250 
5251 /**
5252  \brief Event on DHCP display gateway IPv4 address (Op)
5253  \param if_id network interface identifier
5254  \param ip4_addr pointer to IPv4 address
5255  */
5256 #ifdef DEBUG_EVR
5257  __STATIC_INLINE void EvrNetDHCP_ShowGatewayAddress(uint16_t if_id, const uint8_t *ip4_addr) {
5258  memcpy (&evr_buf.u32[0], ip4_addr, 4);
5259  EventRecord2 (EvtNetDHCP_ShowGatewayAddress, if_id, evr_buf.u32[0]);
5260  }
5261 #else
5262  #define EvrNetDHCP_ShowGatewayAddress(if_id, ip4_addr)
5263 #endif
5264 
5265 /**
5266  \brief Event on DHCP display DNS server addresses (Op)
5267  \param if_id network interface identifier
5268  \param dns_list pointer to DNS server address list
5269  \remark Displays primary and secondary DNS server address.
5270  */
5271 #ifdef DEBUG_EVR
5272  __STATIC_INLINE void EvrNetDHCP_ShowDnsServers(uint16_t if_id, const uint8_t *dns_list) {
5273  evr_buf.u32[0] = if_id;
5274  memcpy (&evr_buf.u32[1], dns_list, 8);
5275  EventRecordData (EvtNetDHCP_ShowDnsServers, &evr_buf, 12);
5276  }
5277 #else
5278  #define EvrNetDHCP_ShowDnsServers(if_id, dns_list)
5279 #endif
5280 
5281 /**
5282  \brief Event on DHCP display address lease time (Op)
5283  \param if_id network interface identifier
5284  \param lease_time lease time in seconds
5285  */
5286 #ifdef DEBUG_EVR
5287  __STATIC_INLINE void EvrNetDHCP_ShowLeaseTime(uint16_t if_id, uint32_t lease_time) {
5288  EventRecord2 (EvtNetDHCP_ShowLeaseTime, if_id, lease_time);
5289  }
5290 #else
5291  #define EvrNetDHCP_ShowLeaseTime(if_id, lease_time)
5292 #endif
5293 
5294 /**
5295  \brief Event on DHCP display renewal time T1 (Op)
5296  \param if_id network interface identifier
5297  \param t1_time t1 time in seconds
5298  */
5299 #ifdef DEBUG_EVR
5300  __STATIC_INLINE void EvrNetDHCP_ShowTimeT1(uint16_t if_id, uint32_t t1_time) {
5301  EventRecord2 (EvtNetDHCP_ShowTimeT1, if_id, t1_time);
5302  }
5303 #else
5304  #define EvrNetDHCP_ShowTimeT1(if_id, t1_time)
5305 #endif
5306 
5307 /**
5308  \brief Event on DHCP display rebinding time T2 (Op)
5309  \param if_id network interface identifier
5310  \param t2_time t2 time in seconds
5311  */
5312 #ifdef DEBUG_EVR
5313  __STATIC_INLINE void EvrNetDHCP_ShowTimeT2(uint16_t if_id, uint32_t t2_time) {
5314  EventRecord2 (EvtNetDHCP_ShowTimeT2, if_id, t2_time);
5315  }
5316 #else
5317  #define EvrNetDHCP_ShowTimeT2(if_id, t2_time)
5318 #endif
5319 
5320 /**
5321  \brief Event on DHCP display Bootfile Name (Op)
5322  \param bootfile bootfile name string
5323  \param length length of the bootfile name string
5324  */
5325 #ifdef DEBUG_EVR
5326  __STATIC_INLINE void EvrNetDHCP_ShowBootfileName(const uint8_t *bootfile, uint32_t length) {
5327  if (length > 32) length = 32;
5328  EventRecordData (EvtNetDHCP_ShowBootfileName, bootfile, length);
5329  }
5330 #else
5331  #define EvrNetDHCP_ShowBootfileName(bootfile, length)
5332 #endif
5333 
5334 /**
5335  \brief Event on DHCP display list of NTP server addresses (Op)
5336  \param if_id network interface identifier
5337  \param ntp_list pointer to an array of NTP server IP addresses
5338  \param length length of an array in bytes
5339  */
5340 #ifdef DEBUG_EVR
5341  __STATIC_INLINE void EvrNetDHCP_ShowNtpServerList(uint16_t if_id, const uint8_t *ntp_list, uint32_t length) {
5342  evr_buf.u16[0] = if_id;
5343  evr_buf.u16[1] = (uint16_t)(length > 12 ? 12 : length);
5344  memcpy (&evr_buf.u16[2], ntp_list, evr_buf.u16[1]);
5345  EventRecordData (EvtNetDHCP_ShowNtpServerList, &evr_buf, evr_buf.u16[1]);
5346  }
5347 #else
5348  #define EvrNetDHCP_ShowNtpServerList(if_id, ntp_list, length)
5349 #endif
5350 
5351 /**
5352  \brief Event on DHCP set_option invalid parameter (Error)
5353  \param if_id network interface identifier
5354 */
5355 #ifdef DEBUG_EVR
5357  EventRecord2 (EvtNetDHCP_SetOptionInvalidParam, if_id, 0);
5358  }
5359 #else
5360  #define EvrNetDHCP_SetOptionInvalidParam(if_id)
5361 #endif
5362 
5363 /**
5364  \brief Event on DHCP set_option invalid client state (Error)
5365  \param if_id network interface identifier
5366  \param state DHCP client state
5367  */
5368 #ifdef DEBUG_EVR
5369  __STATIC_INLINE void EvrNetDHCP_SetOptionInvalidState(uint16_t if_id, uint8_t state) {
5370  EventRecord2 (EvtNetDHCP_SetOptionInvalidState, if_id, state);
5371  }
5372 #else
5373  #define EvrNetDHCP_SetOptionInvalidState(if_id, state)
5374 #endif
5375 
5376 /**
5377  \brief Event on DHCP set_option with default Client-identifier (API)
5378  \param if_id network interface identifier
5379  \param type hardware type
5380  - 0: Generic,
5381  - 1: Ethernet,
5382  - 255: IANA.
5383  \remark Default DHCP Client-identifier is ethernet MAC address.
5384 */
5385 #ifdef DEBUG_EVR
5386  __STATIC_INLINE void EvrNetDHCP_SetOptionClientIdDefault(uint16_t if_id, uint8_t type) {
5387  EventRecord2 (EvtNetDHCP_SetOptionClientIdDefault, if_id, type);
5388  }
5389 #else
5390  #define EvrNetDHCP_SetOptionClientIdDefault(if_id, type)
5391 #endif
5392 
5393 /**
5394  \brief Event on DHCP set_option with user Client-identifier (API)
5395  \param if_id network interface identifier
5396  \param type hardware type
5397  - 0: Generic,
5398  - 1: Ethernet,
5399  - 255: IANA.
5400  \param length length of DHCP option including hardware type
5401  */
5402 #ifdef DEBUG_EVR
5403  __STATIC_INLINE void EvrNetDHCP_SetOptionClientId(uint16_t if_id, uint8_t type, uint32_t length) {
5404  uint32_t val2 = ((uint32_t)type << 16) | length;
5405  EventRecord2 (EvtNetDHCP_SetOptionClientId, if_id, val2);
5406  }
5407 #else
5408  #define EvrNetDHCP_SetOptionClientId(if_id, type, length)
5409 #endif
5410 
5411 /**
5412  \brief Event on DHCP client de-initialize (Op)
5413  \param if_id network interface identifier
5414  */
5415 #ifdef DEBUG_EVR
5417  EventRecord2 (EvtNetDHCP_UninitClient, if_id, 0);
5418  }
5419 #else
5420  #define EvrNetDHCP_UninitClient(if_id)
5421 #endif
5422 
5423 
5424 // NetARP event identifiers ----------------------------------------------------
5425 #ifdef DEBUG_EVR
5426 #define EvtNetARP_InitCache EventID (EventLevelOp, EvtNetARP, 0)
5427 #define EvtNetARP_ReceiveFrame EventID (EventLevelOp, EvtNetARP, 1)
5428 #define EvtNetARP_FrameTooShort EventID (EventLevelError, EvtNetARP, 2)
5429 #define EvtNetARP_FrameCorrupted EventID (EventLevelError, EvtNetARP, 3)
5430 #define EvtNetARP_ShowFrameHeader EventID (EventLevelDetail,EvtNetARP, 4)
5431 #define EvtNetARP_SenderAddressInvalid EventID (EventLevelOp, EvtNetARP, 5)
5432 #define EvtNetARP_CacheEntryUpdate EventID (EventLevelOp, EvtNetARP, 6)
5433 #define EvtNetARP_ProbeResponseReceived EventID (EventLevelOp, EvtNetARP, 7)
5434 #define EvtNetARP_WrongIpAddress EventID (EventLevelOp, EvtNetARP, 8)
5435 #define EvtNetARP_WrongMacAddress EventID (EventLevelOp, EvtNetARP, 9)
5436 #define EvtNetARP_OpcodeUnknown EventID (EventLevelOp, EvtNetARP, 10)
5437 #define EvtNetARP_SendReply EventID (EventLevelOp, EvtNetARP, 11)
5438 #define EvtNetARP_CacheEntryRefreshed EventID (EventLevelOp, EvtNetARP, 12)
5439 #define EvtNetARP_WrongResponse EventID (EventLevelError, EvtNetARP, 13)
5440 #define EvtNetARP_SendRequest EventID (EventLevelOp, EvtNetARP, 14)
5441 #define EvtNetARP_CacheAllocFailed EventID (EventLevelError, EvtNetARP, 15)
5442 #define EvtNetARP_CacheIpRefreshed EventID (EventLevelOp, EvtNetARP, 16)
5443 #define EvtNetARP_CacheAdd EventID (EventLevelOp, EvtNetARP, 17)
5444 #define EvtNetARP_GatewayUnknown EventID (EventLevelError, EvtNetARP, 18)
5445 #define EvtNetARP_CacheEntryAdded EventID (EventLevelOp, EvtNetARP, 19)
5446 #define EvtNetARP_CacheEarly EventID (EventLevelOp, EvtNetARP, 20)
5447 #define EvtNetARP_CacheFind EventID (EventLevelOp, EvtNetARP, 21)
5448 #define EvtNetARP_UsingGateway EventID (EventLevelOp, EvtNetARP, 22)
5449 #define EvtNetARP_UnresolvedMacAddress EventID (EventLevelError, EvtNetARP, 23)
5450 #define EvtNetARP_EntryFound EventID (EventLevelOp, EvtNetARP, 24)
5451 #define EvtNetARP_CacheIp EventID (EventLevelAPI, EvtNetARP, 25)
5452 #define EvtNetARP_CacheIpInvalidParameter EventID (EventLevelError, EvtNetARP, 26)
5453 #define EvtNetARP_CacheMac EventID (EventLevelAPI, EvtNetARP, 27)
5454 #define EvtNetARP_CacheMacInvalidParameter EventID (EventLevelError, EvtNetARP, 28)