osal.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*****************************************************************************
  2. * @file osal.h
  3. * @author MDG
  4. * @brief This header file defines the OS abstraction layer used by
  5. * the BLE stack. OSAL defines the set of functions which needs to be
  6. * ported to target operating system and target platform.
  7. * Actually, only memset, memcpy and memcmp wrappers are defined.
  8. *****************************************************************************
  9. * @attention
  10. *
  11. * Copyright (c) 2018-2022 STMicroelectronics.
  12. * All rights reserved.
  13. *
  14. * This software is licensed under terms that can be found in the LICENSE file
  15. * in the root directory of this software component.
  16. * If no LICENSE file comes with this software, it is provided AS-IS.
  17. *
  18. *****************************************************************************
  19. */
  20. #ifndef OSAL_H__
  21. #define OSAL_H__
  22. /**
  23. * This function copies size number of bytes from a
  24. * memory location pointed by src to a destination
  25. * memory location pointed by dest
  26. *
  27. * @param[in] dest Destination address
  28. * @param[in] src Source address
  29. * @param[in] size size in the bytes
  30. *
  31. * @return Address of the destination
  32. */
  33. extern void* Osal_MemCpy(void* dest, const void* src, unsigned int size);
  34. /**
  35. * This function sets first number of bytes, specified
  36. * by size, to the destination memory pointed by ptr
  37. * to the specified value
  38. *
  39. * @param[in] ptr Destination address
  40. * @param[in] value Value to be set
  41. * @param[in] size Size in the bytes
  42. *
  43. * @return Address of the destination
  44. */
  45. extern void* Osal_MemSet(void* ptr, int value, unsigned int size);
  46. /**
  47. * This function compares n bytes of two regions of memory
  48. *
  49. * @param[in] s1 First buffer to compare.
  50. * @param[in] s2 Second buffer to compare.
  51. * @param[in] size Number of bytes to compare.
  52. *
  53. * @return 0 if the two buffers are equal, 1 otherwise
  54. */
  55. extern int Osal_MemCmp(const void* s1, const void* s2, unsigned int size);
  56. #endif /* OSAL_H__ */