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 /** Internet Protocol (IP) */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define NX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "nx_api.h"
29 #include "nx_ip.h"
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _nx_ip_link_status_change_notify_set PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Yuxin Zhou, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function configures the link status change notify callback */
44 /* function specified by the application. */
45 /* */
46 /* If a NULL pointer is supplied, the link status change notify */
47 /* callback feature is disabled. */
48 /* */
49 /* INPUT */
50 /* */
51 /* ip_ptr Pointer to IP instance */
52 /* link_status_change_notify Routine to call when link */
53 /* staus is changed */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* status Actual completion status */
58 /* */
59 /* CALLS */
60 /* */
61 /* None */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Application Code */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
72 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
_nx_ip_link_status_change_notify_set(NX_IP * ip_ptr,VOID (* link_status_change_notify)(NX_IP * ip_ptr,UINT interface_index,UINT link_up))76 UINT _nx_ip_link_status_change_notify_set(NX_IP *ip_ptr, VOID (*link_status_change_notify)(NX_IP *ip_ptr, UINT interface_index, UINT link_up))
77 {
78 TX_INTERRUPT_SAVE_AREA
79
80 /* Disable interrupts. */
81 TX_DISABLE
82
83 /* Setup the link status change callback function pointer. */
84 ip_ptr -> nx_ip_link_status_change_callback = link_status_change_notify;
85
86 /* Restore interrupts. */
87 TX_RESTORE
88
89 /* Return successful completion. */
90 return(NX_SUCCESS);
91 }
92
93