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 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _nx_ip_interface_physical_address_get PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Yuxin Zhou, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This function gets the physical address of interface. */ 44 /* */ 45 /* INPUT */ 46 /* */ 47 /* ip_ptr IP control block pointer */ 48 /* interface_index Index of interface */ 49 /* physical_msw Physical address MSW pointer */ 50 /* physical_lsw Physical address LSW pointer */ 51 /* */ 52 /* OUTPUT */ 53 /* */ 54 /* status Completion status */ 55 /* */ 56 /* CALLS */ 57 /* */ 58 /* tx_mutex_get Get protection mutex */ 59 /* tx_mutex_put Put protection mutex */ 60 /* */ 61 /* CALLED BY */ 62 /* */ 63 /* Application Code */ 64 /* */ 65 /* RELEASE HISTORY */ 66 /* */ 67 /* DATE NAME DESCRIPTION */ 68 /* */ 69 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 70 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 71 /* resulting in version 6.1 */ 72 /* */ 73 /**************************************************************************/ _nx_ip_interface_physical_address_get(NX_IP * ip_ptr,UINT interface_index,ULONG * physical_msw,ULONG * physical_lsw)74UINT _nx_ip_interface_physical_address_get(NX_IP *ip_ptr, UINT interface_index, 75 ULONG *physical_msw, ULONG *physical_lsw) 76 { 77 78 /* Obtain protection on this IP instance. */ 79 tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); 80 81 /* Get new physical address. */ 82 *physical_msw = ip_ptr -> nx_ip_interface[interface_index].nx_interface_physical_address_msw; 83 *physical_lsw = ip_ptr -> nx_ip_interface[interface_index].nx_interface_physical_address_lsw; 84 85 /* Release the protection. */ 86 tx_mutex_put(&(ip_ptr -> nx_ip_protection)); 87 88 /* Return completion status. */ 89 return(NX_SUCCESS); 90 } 91 92