MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
mem_utils.h
1 
5 /* ***************************************************************************
6  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
22  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24  * OTHER DEALINGS IN THE SOFTWARE.
25  *
26  * Except as contained in this notice, the name of Maxim Integrated
27  * Products, Inc. shall not be used except as stated in the Maxim Integrated
28  * Products, Inc. Branding Policy.
29  *
30  * The mere transfer of this software does not imply any licenses
31  * of trade secrets, proprietary technology, copyrights, patents,
32  * trademarks, maskwork rights, or any other form of intellectual
33  * property whatsoever. Maxim Integrated Products, Inc. retains all
34  * ownership rights.
35  *
36  * $Date: 2018-10-15 16:49:29 -0500 (Mon, 15 Oct 2018) $
37  * $Revision: 38520 $
38  *
39  ************************************************************************** */
40 
41 #ifndef _MEM_UTILS_H_
42 #define _MEM_UTILS_H_
43 
44 /* **** Definitions **** */
45 
46 
47 /* **** Global Data **** */
48 
49 
50 /* **** Function Prototypes **** */
51 
61 void memset32(uint32_t * dst, uint32_t value, unsigned int len);
62 
72 void memcpy32(uint32_t * dst, uint32_t * src, unsigned int len);
73 
74 
75 
76 /* ***********************************************************************
77  *
78  * @brief Compares the first @c len bytes of @c src and @c dst and
79  * returns #E_NO_ERROR if they match.
80  * @param dst Destination address
81  * @param src Source address
82  * @param[in] len Number of bytes to compare between the @c src and
83  * @c dst.
84  * @note The compare is done 32-bits at a time and @c len should be
85  * a multiple of 4 and any bytes beyond a multiple of 4 are
86  * ignored. For example, the following call to memcmp32() only
87  * compares the first 8 bytes (2 32-bit words) of @c dst and
88  * @c src and would return 0 indicating the memory is the same.
89  * @code
90  * int retval;
91  * int len = 11;
92  * char src[len] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
93  * char dst[len] = {0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0};
94  *
95  * if (memcmp32(dst, src, len) != 0)
96  * {
97  * printf("Memory compare failed\n");
98  * }
99  * else
100  * {
101  * // memcmp32 passes even though the src and dst are
102  * // not identical starting at src[8] and dst[8]
103  * printf("memcmp32 passed.\n");
104  * }
105  * @endcode
106  *
107  * @return #E_NO_ERROR Contents of @c src and @c dst are equal
108  * @return #E_INVALID Memory is not equal
109  */
110 int memcmp32(uint32_t * dst, uint32_t * src, unsigned int len);
111 
112 #endif /* _MEM_UTILS_H_ */
113