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
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _nx_packet_pool_low_watermark_set PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Yuxin Zhou, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function sets the low watermark for the specified packet pool. */
45 /* */
46 /* INPUT */
47 /* */
48 /* pool_ptr Pointer to packet pool */
49 /* low_watermark Low watermark of packet pool */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* status Completion status */
54 /* */
55 /* CALLS */
56 /* */
57 /* CALLED BY */
58 /* */
59 /* Application Code */
60 /* */
61 /* RELEASE HISTORY */
62 /* */
63 /* DATE NAME DESCRIPTION */
64 /* */
65 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
66 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
67 /* resulting in version 6.1 */
68 /* */
69 /**************************************************************************/
_nx_packet_pool_low_watermark_set(NX_PACKET_POOL * pool_ptr,ULONG low_watermark)70 UINT _nx_packet_pool_low_watermark_set(NX_PACKET_POOL *pool_ptr, ULONG low_watermark)
71 {
72 #ifdef NX_ENABLE_LOW_WATERMARK
73
74 TX_INTERRUPT_SAVE_AREA
75
76 /* Disable interrupts to get a packet from the pool. */
77 TX_DISABLE
78
79 /* Set low watermark to packet pool. */
80 pool_ptr -> nx_packet_pool_low_watermark = low_watermark;
81
82 /* Restore interrupts. */
83 TX_RESTORE
84
85 /* Return completion status. */
86 return(NX_SUCCESS);
87
88 #else /* !NX_ENABLE_LOW_WATERMARK */
89 NX_PARAMETER_NOT_USED(pool_ptr);
90 NX_PARAMETER_NOT_USED(low_watermark);
91
92 return(NX_NOT_SUPPORTED);
93
94 #endif /* NX_ENABLE_LOW_WATERMARK */
95 }
96
97