platform_memory.c 631 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-14 22:02:07
  5. * @LastEditTime: 2020-04-27 16:32:58
  6. * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
  7. */
  8. #include "platform_memory.h"
  9. #include "string.h"
  10. #include "FreeRTOS.h"
  11. void *platform_memory_alloc(size_t size)
  12. {
  13. char *ptr;
  14. ptr = pvPortMalloc(size);
  15. memset(ptr, 0, size);
  16. return (void *)ptr;
  17. }
  18. void *platform_memory_calloc(size_t num, size_t size)
  19. {
  20. return pvPortMalloc(num * size);
  21. }
  22. void platform_memory_free(void *ptr)
  23. {
  24. vPortFree(ptr);
  25. }