bsal_osif.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-05-28 Supperthomas the first version
  9. */
  10. #ifndef __BSAL_OSIF_H__
  11. #define __BSAL_OSIF_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <stdio.h>
  16. #include <stdint.h>
  17. #include <rtthread.h>
  18. /**
  19. * BSAL OSIF malloc the buffer
  20. *
  21. * @param len the buffer size of the buffer
  22. * @Note malloc the buffer
  23. */
  24. void *bsal_osif_malloc(uint32_t len);
  25. /**
  26. * BSAL OSIF free the buffer
  27. *
  28. * @param p the point of the buffer
  29. * @Note free the buffer
  30. */
  31. void bsal_osif_free(void *p);
  32. /**
  33. * BSAL OSIF delay
  34. *
  35. * @param ms the ms of delay time
  36. * @Note delay the time
  37. */
  38. void bsal_osif_delay(uint32_t ms);
  39. #if 0
  40. int bsal_osif_printf_dbg(const char *fmt, ...);
  41. int bsal_osif_printf_err(const char *fmt, ...);
  42. int bsal_osif_printf_info(const char *fmt, ...);
  43. int bsal_osif_printf_warn(const char *fmt, ...);
  44. #else
  45. #define bsal_osif_printf_dbg rt_kprintf
  46. #define bsal_osif_printf_err rt_kprintf
  47. #define bsal_osif_printf_info rt_kprintf
  48. #define bsal_osif_printf_warn rt_kprintf
  49. #endif
  50. #ifdef BSAL_ASSERT_DEBUG
  51. #define BSAL_ASSERT_PTR(x) if(x==NULL) \
  52. {bsal_osif_printf_err("%s line:%d: the point is NULL:%p",__FUNCTION__, __LINE__,x); while(1);}
  53. #else
  54. #define BSAL_ASSERT_PTR(x)
  55. #endif
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif