pika_config.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-12-07 lyon the first version
  9. */
  10. #include <rtthread.h>
  11. #include "PikaPlatform.h"
  12. #ifndef RT_USING_HEAP
  13. #error "Please enable heap in the RT-Thread configuration"
  14. #endif
  15. int __platform_sprintf(char* buff, char* fmt, ...) {
  16. va_list args;
  17. int res;
  18. va_start(args, fmt);
  19. res = rt_vsprintf(buff, fmt, args);
  20. va_end(args);
  21. return res;
  22. }
  23. int __platform_vsprintf(char* buff, char* fmt, va_list args){
  24. return rt_vsprintf(buff, fmt, args);
  25. }
  26. int __platform_vsnprintf(char* buff, size_t size, const char* fmt, va_list args){
  27. return rt_vsnprintf(buff, size, fmt, args);
  28. }
  29. void* __platform_malloc(size_t size) {
  30. return rt_malloc(size);
  31. }
  32. void __platform_free(void* ptr) {
  33. rt_free(ptr);
  34. }
  35. void* __platform_memset(void* mem, int ch, size_t size) {
  36. return rt_memset(mem, ch, size);
  37. }
  38. void* __platform_memcpy(void* dir, const void* src, size_t size) {
  39. return rt_memcpy(dir, src, size);
  40. }