1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** NetX Component */
16 /** */
17 /**************************************************************************/
18 /**************************************************************************/
19
20 #define NX_SOURCE_CODE
21
22
23 /* Include necessary system files. */
24
25 #include "nx_api.h"
26 #include "nx_ip.h"
27
28
29 /**************************************************************************/
30 /* */
31 /* FUNCTION RELEASE */
32 /* */
33 /* _nx_ip_driver_link_status_event PORTABLE C */
34 /* 6.1 */
35 /* AUTHOR */
36 /* */
37 /* Yuxin Zhou, Microsoft Corporation */
38 /* */
39 /* DESCRIPTION */
40 /* */
41 /* This function deferrs link status event from ISR to the IP helper */
42 /* thread. */
43 /* */
44 /* INPUT */
45 /* */
46 /* ip_ptr Pointer to IP control block */
47 /* interface_index Index of interface */
48 /* */
49 /* OUTPUT */
50 /* */
51 /* None */
52 /* */
53 /* CALLS */
54 /* */
55 /* tx_event_flags_set Wakeup IP helper thread */
56 /* */
57 /* CALLED BY */
58 /* */
59 /* Application I/O Driver */
60 /* */
61 /* RELEASE HISTORY */
62 /* */
63 /* DATE NAME DESCRIPTION */
64 /* */
65 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
66 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
67 /* resulting in version 6.1 */
68 /* */
69 /**************************************************************************/
_nx_ip_driver_link_status_event(NX_IP * ip_ptr,UINT interface_index)70 VOID _nx_ip_driver_link_status_event(NX_IP *ip_ptr, UINT interface_index)
71 {
72 TX_INTERRUPT_SAVE_AREA
73
74 /* Disable interrupts. */
75 TX_DISABLE
76
77 /* Mark link status changed. */
78 ip_ptr -> nx_ip_interface[interface_index].nx_interface_link_status_change = NX_TRUE;
79
80 /* Wakeup IP helper thread to process the link status event. */
81 tx_event_flags_set(&(ip_ptr -> nx_ip_events), NX_IP_LINK_STATUS_EVENT, TX_OR);
82
83 /* Restore interrupts. */
84 TX_RESTORE
85 }
86
87