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_interface_capability_set PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Yuxin Zhou, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This function sets the capability flag of the specified network */ 44 /* interface. It is typically called by the device driver during */ 45 /* initializaion phase to notify the IP stack the hardware capability */ 46 /* available from the this device. */ 47 /* */ 48 /* INPUT */ 49 /* */ 50 /* ip_ptr IP control block pointer */ 51 /* interface_index Index to the network */ 52 /* interface */ 53 /* interface_capability_flag Interface capability flag */ 54 /* */ 55 /* OUTPUT */ 56 /* */ 57 /* status Completion status */ 58 /* */ 59 /* CALLS */ 60 /* */ 61 /* tx_mutex_get Get protection mutex */ 62 /* tx_mutex_put Put protection mutex */ 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 /**************************************************************************/ _nx_ip_interface_capability_set(NX_IP * ip_ptr,UINT interface_index,ULONG interface_capability_flag)77UINT _nx_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag) 78 { 79 #ifdef NX_ENABLE_INTERFACE_CAPABILITY 80 81 /* Get mutex protection. */ 82 tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); 83 84 /* Set interface capability flag. */ 85 ip_ptr -> nx_ip_interface[interface_index].nx_interface_capability_flag = interface_capability_flag; 86 87 /* Release mutex protection. */ 88 tx_mutex_put(&(ip_ptr -> nx_ip_protection)); 89 90 /* Return completion status. */ 91 return(NX_SUCCESS); 92 93 #else /* NX_ENABLE_INTERFACE_CAPABILITY */ 94 NX_PARAMETER_NOT_USED(ip_ptr); 95 NX_PARAMETER_NOT_USED(interface_index); 96 NX_PARAMETER_NOT_USED(interface_capability_flag); 97 98 return(NX_NOT_SUPPORTED); 99 100 #endif /* NX_ENABLE_INTERFACE_CAPABILITY */ 101 } 102 103