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 /** USBX Component */
16 /** */
17 /** Utility */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22
23 /* Include necessary system files. */
24
25 #define UX_SOURCE_CODE
26
27 #include "ux_api.h"
28
29
30 /**************************************************************************/
31 /* */
32 /* FUNCTION RELEASE */
33 /* */
34 /* _ux_utility_memory_set PORTABLE C */
35 /* 6.1 */
36 /* AUTHOR */
37 /* */
38 /* Chaoqiong Xiao, Microsoft Corporation */
39 /* */
40 /* DESCRIPTION */
41 /* */
42 /* This function sets a memory block with a specific value. */
43 /* */
44 /* INPUT */
45 /* */
46 /* destination Destination address */
47 /* value 8-bit value */
48 /* length Size of memory to set */
49 /* */
50 /* OUTPUT */
51 /* */
52 /* None */
53 /* */
54 /* CALLS */
55 /* */
56 /* None */
57 /* */
58 /* CALLED BY */
59 /* */
60 /* USBX Components */
61 /* */
62 /* RELEASE HISTORY */
63 /* */
64 /* DATE NAME DESCRIPTION */
65 /* */
66 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
67 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
68 /* resulting in version 6.1 */
69 /* */
70 /**************************************************************************/
_ux_utility_memory_set(VOID * destination,UCHAR value,ULONG length)71 VOID _ux_utility_memory_set(VOID *destination, UCHAR value, ULONG length)
72 {
73
74 UCHAR * work_ptr;
75
76
77 /* Setup the working pointer */
78 work_ptr = (UCHAR *) destination;
79
80 /* Loop to set the memory. */
81 while(length--)
82 {
83
84 /* Set a byte. */
85 *work_ptr++ = value;
86 }
87
88 /* Return to caller. */
89 return;
90 }
91
92