1 /*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.32a-lca02/firmware/public_inc/mem_intf.h#1 $*/ 2 /** 3 ******************************************************************************** 4 * @file mem_intf.h 5 * @brief This file contains all the functions prototypes for the mem_intf.c. 6 ****************************************************************************** 7 * @copy 8 * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and 9 * associated documentation ( hereinafter the "Software") is an unsupported 10 * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in 11 * writing between Synopsys and you. The Software IS NOT an item of Licensed 12 * Software or a Licensed Product under any End User Software License Agreement 13 * or Agreement for Licensed Products with Synopsys or any supplement thereto. 14 * Synopsys is a registered trademark of Synopsys, Inc. Other names included in 15 * the SOFTWARE may be the trademarks of their respective owners. 16 * 17 * Synopsys MIT License: 18 * Copyright (c) 2020-Present Synopsys, Inc 19 * 20 * Permission is hereby granted, free of charge, to any person obtaining a copy of 21 * the Software), to deal in the Software without restriction, including without 22 * limitation the rights to use, copy, modify, merge, publish, distribute, 23 * sublicense, and/or sell copies of the Software, and to permit persons to whom 24 * the Software is furnished to do so, subject to the following conditions: 25 * 26 * The above copyright notice and this permission notice shall be included in all 27 * copies or substantial portions of the Software. 28 * 29 * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, 34 * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 * 36 * */ 37 38 /* Define to prevent recursive inclusion -------------------------------------*/ 39 #ifndef MEM_INTF_H 40 #define MEM_INTF_H 41 42 /* Includes ------------------------------------------------------------------*/ 43 #include <stdint.h> 44 /* Defination ----------------------------------------------------------------*/ 45 /* Exported variables ------------------------------------------------------- */ 46 /* Exported types ------------------------------------------------------------*/ 47 /* Exported macros -----------------------------------------------------------*/ 48 /* Exported types ------------------------------------------------------------*/ 49 /* Exported functions ------------------------------------------------------- */ 50 51 /** @addtogroup Memory_Interface_Exported_Functions 52 * @{ 53 */ 54 55 /** 56 * @brief Coping memory from position to another. 57 * @param ptr_dstntion : pointer to the destination array where the content is to be copied. 58 * @param ptr_src : pointer to the source of data to be copied. 59 * @param n : the number of bytes to be copied. 60 * @retval pointer to destination. 61 */ 62 void *ble_memcpy( 63 void *ptr_dstntion, 64 const void *ptr_src, 65 uint16_t n); 66 67 /** 68 * @brief Setting a certian block of memory with a certain value. 69 * @param ptr_mem : pointer to the block of memory to fill. 70 * @param value : the value to be set. The value is passed as an int. 71 * @param n : the number of bytes to be set to the value. 72 * @retval pointer to destination. 73 */ 74 void *ble_memset( 75 void *ptr_mem, 76 uint8_t value, 77 uint16_t n); 78 79 /** 80 * @brief comparing a certain block of memory with another. 81 * @param ptr_dstntion : pointer to the destination array where the content is to be compared. 82 * @param ptr_src : pointer to the source of data to be compared. 83 * @param n : the number of bytes to be compared. 84 * @retval < 0 ptr_dstntion is less than ptr_src. 85 * > 0 ptr_src is less than ptr_dstntion. 86 * 0 ptr_dstntion is equal to ptr_src. 87 */ 88 int8_t ble_memcmp( 89 const void *ptr_dstntion, 90 const void *ptr_src, 91 uint16_t n); 92 93 /** 94 * @brief Moving memory from position to another. 95 * @param ptr_dstntion : pointer to the destination array where the content is to be moved. 96 * @param ptr_src : pointer to the source of data to be moved. 97 * @param n : the number of bytes to be moved. 98 * @retval pointer to destination. 99 */ 100 101 void *ble_memmov( 102 void *ptr_dstntion, 103 const void *ptr_src, 104 uint16_t n); 105 /** 106 * @brief Coping n bytes of memory from position to another. 107 * @param destination : pointer to the destination array where the content is to be copied. 108 * @param source : pointer to the source of data to be copied. 109 * @param num_bytes : the number of bytes to be copied. 110 * @param keep_endian : flag to keep or change the endian 111 * @retval pointer to destination. 112 */ 113 void ble_memcpy_n_bytes(uint8_t *destination, 114 const uint8_t *source, uint8_t num_bytes, uint8_t keep_endian); 115 /** 116 * @} 117 */ 118 #endif /* MEM_INTF_H */ 119