No Description

memory.h 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /****************************************************************************
  2. * Copyright (C) 2015-2016 by the SotS Team *
  3. * *
  4. * This file is part of Sovereign of the Skies. *
  5. * *
  6. * Sovereign of the Skies is free software: you can redistribute it *
  7. * and/or modify it *
  8. * under the terms of the GNU Lesser General Public License as published *
  9. * by the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version provided you include a copy of the *
  11. * licence and this header. *
  12. * *
  13. * Sovereign of the Skies is distributed in the hope that it will be *
  14. * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU Lesser General Public License for more details. *
  17. * *
  18. * You should have received a copy of the GNU Lesser General Public *
  19. * License along with Sovereign of the Skies. *
  20. * If not, see <http://www.gnu.org/licenses/>. *
  21. ****************************************************************************/
  22. /**
  23. * @file memory.h
  24. * @author Sturmvogel
  25. * @date 15 dec 2016
  26. * @brief Manage memory
  27. *
  28. * This header file provides methods to allocate and free memory areas.
  29. * It also provides basic memory copy/set methods.
  30. */
  31. #ifndef MEMORY_H
  32. #define MEMORY_H
  33. /* === INCLUDE === */
  34. #include <types.h>
  35. /* === EXTERN METHODS === */
  36. /**
  37. * @brief allocates memory
  38. * @param size amount of bytes to allocate
  39. * @return address to allocated memory area
  40. */
  41. extern void* malloc(size_t size);
  42. /**
  43. * @brief frees previously allocated memory
  44. * @param address address to free
  45. */
  46. extern void free(void* address);
  47. /**
  48. * @brief copy bytes in memory
  49. * @param destination address to copy to
  50. * @param source address to copy from
  51. * @param num amount of bytes to copy
  52. * @return destination pointer
  53. */
  54. extern void* memcpy (void * destination, const void* source, size_t num);
  55. /**
  56. * @brief set bytes in memory
  57. * @param dst destination to set words
  58. * @param value to be set
  59. * @param size number of bytes to set
  60. * @return
  61. */
  62. extern void* memset (void* dst, int value, size_t size);
  63. /**
  64. * @brief decompress data into wram using interrupt
  65. * @param src data source
  66. * @param dst data destination (must be in wram)
  67. */
  68. extern void wram_decompress(void* src, void* dst);
  69. /**
  70. * @brief decompress data into vram using interrupt
  71. * @param src data source
  72. * @param dst data destination (must be in vram)
  73. */
  74. extern void vram_decompress(void* src, void* dst);
  75. #endif /* MEMORY_H */