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