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 /* Bring in externs for caller checking code. */
32 NX_CALLER_CHECKING_EXTERNS
33
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _nxe_ip_interface_physical_address_get PORTABLE C */
39 /* 6.1 */
40 /* AUTHOR */
41 /* */
42 /* Yuxin Zhou, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function checks errors in the IP physical address get */
47 /* function call. */
48 /* */
49 /* INPUT */
50 /* */
51 /* ip_ptr IP control block pointer */
52 /* interface_index Index of interface */
53 /* physical_msw Physical address MSW pointer */
54 /* physical_lsw Physical address LSW pointer */
55 /* */
56 /* OUTPUT */
57 /* */
58 /* status Completion status */
59 /* */
60 /* CALLS */
61 /* */
62 /* _nx_ip_interface_physical_address_get */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Application Code */
67 /* */
68 /* RELEASE HISTORY */
69 /* */
70 /* DATE NAME DESCRIPTION */
71 /* */
72 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
73 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
74 /* resulting in version 6.1 */
75 /* */
76 /**************************************************************************/
_nxe_ip_interface_physical_address_get(NX_IP * ip_ptr,UINT interface_index,ULONG * physical_msw,ULONG * physical_lsw)77 UINT _nxe_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index,
78 ULONG *physical_msw, ULONG *physical_lsw)
79 {
80
81 UINT status;
82
83 /* Check for invalid input pointers. */
84 if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || (physical_msw == NX_NULL) || (physical_lsw == NX_NULL))
85 {
86 return(NX_PTR_ERROR);
87 }
88
89 /* Check for invalid interface ID */
90 if (interface_index >= NX_MAX_PHYSICAL_INTERFACES)
91 {
92 return(NX_INVALID_INTERFACE);
93 }
94
95 /* Check for appropriate caller. */
96 NX_INIT_AND_THREADS_CALLER_CHECKING
97
98 status = _nx_ip_interface_physical_address_get(ip_ptr, interface_index, physical_msw, physical_lsw);
99
100 /* Return completion status. */
101 return(status);
102 }
103
104