hugemem.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**
  2. * \file
  3. *
  4. * \brief Huge data memory space access
  5. *
  6. * Copyright (c) 2009-2015 Atmel Corporation. All rights reserved.
  7. *
  8. * \asf_license_start
  9. *
  10. * \page License
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions are met:
  14. *
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. *
  18. * 2. Redistributions in binary form must reproduce the above copyright notice,
  19. * this list of conditions and the following disclaimer in the documentation
  20. * and/or other materials provided with the distribution.
  21. *
  22. * 3. The name of Atmel may not be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * 4. This software may only be redistributed and used in connection with an
  26. * Atmel microcontroller product.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  29. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  30. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  31. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  32. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  37. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. * POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. * \asf_license_stop
  41. *
  42. */
  43. /*
  44. * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
  45. */
  46. #ifndef HUGEMEM_H_INCLUDED
  47. #define HUGEMEM_H_INCLUDED
  48. #include <stdint.h>
  49. #include <stddef.h>
  50. #if defined(__AVR32__) || defined(__ICCAVR32__)
  51. # include <generic/hugemem.h>
  52. #elif defined(__AVR__) || defined (__ICCAVR__)
  53. # include <avr8/hugemem.h>
  54. #else
  55. # error Unknown architecture passed to hugemem interface.
  56. # error Expected __AVR32__ or __AVR__.
  57. #endif
  58. /**
  59. * \defgroup hugemem_group Data in Huge Data Memory Space
  60. *
  61. * Due to shortcomings of the GCC compiler for 8-bit AVR, custom functions are
  62. * needed for access to data beyond the 64 kB boundary, i.e., addresses that
  63. * are larger than 16-bit.
  64. *
  65. * The definition of huge memory space can differ between architectures, so the
  66. * implementation is architecture specific.
  67. *
  68. * This module supplies functions for copying a number of bytes between huge
  69. * and 64 kB data memory space, and is needed solely for code compatibility
  70. * across compilers.
  71. *
  72. * @{
  73. */
  74. /**
  75. * \typedef hugemem_ptr_t
  76. *
  77. * \brief Type to use for pointers to huge memory.
  78. */
  79. /**
  80. * \def HUGEMEM_NULL
  81. *
  82. * \brief Hugemem null pointer, similar to NULL, but works across different
  83. * platforms.
  84. */
  85. /**
  86. * \fn uint_fast8_t hugemem_read8(const hugemem_ptr_t from)
  87. *
  88. * \brief Read 8-bit value stored at huge memory address \a from.
  89. */
  90. /**
  91. * \fn uint_fast16_t hugemem_read16(const hugemem_ptr_t from)
  92. *
  93. * \brief Read 16-bit value stored at huge memory address \a from.
  94. */
  95. /**
  96. * \fn void hugemem_read_block(void *to, const hugemem_ptr_t from, size_t size)
  97. *
  98. * \brief Read \a size bytes from huge memory address \a from into buffer at
  99. * address \a to.
  100. */
  101. /**
  102. * \fn uint_fast32_t hugemem_read32(const hugemem_ptr_t from)
  103. *
  104. * \brief Read 32-bit value stored at huge memory address \a from.
  105. */
  106. /**
  107. * \fn void hugemem_write8(hugemem_ptr_t to, uint_fast8_t val)
  108. *
  109. * \brief Write 8-bit value \a val to huge memory address \a to.
  110. */
  111. /**
  112. * \fn void hugemem_write16(hugemem_ptr_t to, uint_fast16_t val)
  113. *
  114. * \brief Write 16-bit value \a val to huge memory address \a to.
  115. */
  116. /**
  117. * \fn void hugemem_write32(hugemem_ptr_t to, uint_fast32_t val)
  118. *
  119. * \brief Write 32-bit value \a val to huge memory address \a to.
  120. */
  121. /**
  122. * \fn void hugemem_write_block(hugemem_ptr_t to, const void *from, size_t size)
  123. *
  124. * \brief Write \a size bytes from buffer at address \a from to huge memory
  125. * address \a to.
  126. */
  127. //@}
  128. #endif /* HUGEMEM_H_INCLUDED */