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