Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vcos_mem.h 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. Copyright (c) 2012, Broadcom Europe Ltd
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * Neither the name of the copyright holder nor the
  12. names of its contributors may be used to endorse or promote products
  13. derived from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
  18. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. /*=============================================================================
  26. VideoCore OS Abstraction Layer - memory support
  27. =============================================================================*/
  28. #ifndef VCOS_MEM_H
  29. #define VCOS_MEM_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include "vcos_types.h"
  34. #include "pthreads/vcos_platform.h"
  35. /** \file
  36. *
  37. * Memory allocation api (malloc/free equivalents) is for benefit of host
  38. * applications. VideoCore code should use rtos_XXX functions.
  39. *
  40. */
  41. /** Allocate memory
  42. *
  43. * @param size Size of memory to allocate
  44. * @param description Description, to aid in debugging. May be ignored internally on some platforms.
  45. */
  46. VCOS_INLINE_DECL
  47. void *vcos_malloc(VCOS_UNSIGNED size, const char *description);
  48. void *vcos_kmalloc(VCOS_UNSIGNED size, const char *description);
  49. void *vcos_kcalloc(VCOS_UNSIGNED num, VCOS_UNSIGNED size, const char *description);
  50. /** Allocate cleared memory
  51. *
  52. * @param num Number of items to allocate.
  53. * @param size Size of each item in bytes.
  54. * @param description Description, to aid in debugging. May be ignored internally on some platforms.
  55. */
  56. VCOS_INLINE_DECL
  57. void *vcos_calloc(VCOS_UNSIGNED num, VCOS_UNSIGNED size, const char *description);
  58. /** Free memory
  59. *
  60. * Free memory that has been allocated.
  61. */
  62. VCOS_INLINE_DECL
  63. void vcos_free(void *ptr);
  64. void vcos_kfree(void *ptr);
  65. /** Allocate aligned memory
  66. *
  67. * Allocate memory aligned on the specified boundary.
  68. *
  69. * @param size Size of memory to allocate
  70. * @param description Description, to aid in debugging. May be ignored internally on some platforms.
  71. */
  72. VCOS_INLINE_DECL
  73. void *vcos_malloc_aligned(VCOS_UNSIGNED size, VCOS_UNSIGNED align, const char *description);
  74. /** Return the amount of free heap memory
  75. *
  76. */
  77. VCOS_INLINE_DECL
  78. unsigned long vcos_get_free_mem(void);
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif