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 /** Packet Pool Management (Packet) */ 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_packet.h" 30 31 #ifdef NX_ENABLE_LOW_WATERMARK 32 /* Bring in externs for caller checking code. */ 33 34 NX_CALLER_CHECKING_EXTERNS 35 #endif /* NX_ENABLE_LOW_WATERMARK */ 36 37 38 /**************************************************************************/ 39 /* */ 40 /* FUNCTION RELEASE */ 41 /* */ 42 /* _nxe_packet_pool_low_watermark_set PORTABLE C */ 43 /* 6.1 */ 44 /* AUTHOR */ 45 /* */ 46 /* Yuxin Zhou, Microsoft Corporation */ 47 /* */ 48 /* DESCRIPTION */ 49 /* */ 50 /* This function checks for errors in the packet pool low watermark set*/ 51 /* function call. */ 52 /* */ 53 /* INPUT */ 54 /* */ 55 /* pool_ptr Pointer to packet pool */ 56 /* low_watermark Low watermark of packet pool */ 57 /* */ 58 /* OUTPUT */ 59 /* */ 60 /* status Completion status */ 61 /* */ 62 /* CALLS */ 63 /* */ 64 /* _nx_packet_pool_low_watermark_set Actual packet pool low */ 65 /* watermark set function */ 66 /* */ 67 /* CALLED BY */ 68 /* */ 69 /* Application Code */ 70 /* */ 71 /* RELEASE HISTORY */ 72 /* */ 73 /* DATE NAME DESCRIPTION */ 74 /* */ 75 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 76 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 77 /* resulting in version 6.1 */ 78 /* */ 79 /**************************************************************************/ _nxe_packet_pool_low_watermark_set(NX_PACKET_POOL * pool_ptr,ULONG low_watermark)80UINT _nxe_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark) 81 { 82 #ifdef NX_ENABLE_LOW_WATERMARK 83 84 UINT status; 85 86 87 /* Check for invalid input pointers. */ 88 if ((pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID)) 89 { 90 return(NX_PTR_ERROR); 91 } 92 93 /* Check for appropriate caller. */ 94 NX_THREADS_ONLY_CALLER_CHECKING 95 96 /* Call actual packet pool low watermark set function. */ 97 status = _nx_packet_pool_low_watermark_set(pool_ptr, low_watermark); 98 99 /* Return completion status. */ 100 return(status); 101 102 #else /* !NX_ENABLE_LOW_WATERMARK */ 103 NX_PARAMETER_NOT_USED(pool_ptr); 104 NX_PARAMETER_NOT_USED(low_watermark); 105 106 return(NX_NOT_SUPPORTED); 107 108 #endif /* NX_ENABLE_LOW_WATERMARK */ 109 } 110 111