alt_cache.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef __ALT_CACHE_H__
  2. #define __ALT_CACHE_H__
  3. /******************************************************************************
  4. * *
  5. * License Agreement *
  6. * *
  7. * Copyright (c) 2003, 2007 Altera Corporation, San Jose, California, USA. *
  8. * All rights reserved. *
  9. * *
  10. * Permission is hereby granted, free of charge, to any person obtaining a *
  11. * copy of this software and associated documentation files (the "Software"), *
  12. * to deal in the Software without restriction, including without limitation *
  13. * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
  14. * and/or sell copies of the Software, and to permit persons to whom the *
  15. * Software is furnished to do so, subject to the following conditions: *
  16. * *
  17. * The above copyright notice and this permission notice shall be included in *
  18. * all copies or substantial portions of the Software. *
  19. * *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
  23. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
  24. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
  25. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
  26. * DEALINGS IN THE SOFTWARE. *
  27. * *
  28. * This agreement shall be governed in all respects by the laws of the State *
  29. * of California and by the laws of the United States of America. *
  30. * *
  31. ******************************************************************************/
  32. #include <stdlib.h>
  33. #include "alt_types.h"
  34. /*
  35. * alt_cache.h defines the processor specific functions for manipulating the
  36. * cache.
  37. */
  38. #ifdef __cplusplus
  39. extern "C"
  40. {
  41. #endif /* __cplusplus */
  42. /*
  43. * alt_icache_flush() is called to flush the instruction cache for a memory
  44. * region of length "len" bytes, starting at address "start".
  45. */
  46. extern void alt_icache_flush (void* start, alt_u32 len);
  47. /*
  48. * alt_dcache_flush() is called to flush the data cache for a memory
  49. * region of length "len" bytes, starting at address "start".
  50. * Any dirty lines in the data cache are written back to memory.
  51. */
  52. extern void alt_dcache_flush (void* start, alt_u32 len);
  53. /*
  54. * alt_dcache_flush() is called to flush the data cache for a memory
  55. * region of length "len" bytes, starting at address "start".
  56. * Any dirty lines in the data cache are NOT written back to memory.
  57. */
  58. extern void alt_dcache_flush_no_writeback (void* start, alt_u32 len);
  59. /*
  60. * Flush the entire instruction cache.
  61. */
  62. extern void alt_icache_flush_all (void);
  63. /*
  64. * Flush the entire data cache.
  65. */
  66. extern void alt_dcache_flush_all (void);
  67. /*
  68. * Allocate a block of uncached memory.
  69. */
  70. extern volatile void* alt_uncached_malloc (size_t size);
  71. /*
  72. * Free a block of uncached memory.
  73. */
  74. extern void alt_uncached_free (volatile void* ptr);
  75. /*
  76. * Convert a pointer to a block of cached memory, into a block of
  77. * uncached memory.
  78. */
  79. extern volatile void* alt_remap_uncached (void* ptr, alt_u32 len);
  80. /*
  81. * Convert a pointer to a block of uncached memory, into a block of
  82. * cached memory.
  83. */
  84. extern void* alt_remap_cached (volatile void* ptr, alt_u32 len);
  85. /*
  86. *
  87. */
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* __ALT_CACHE_H__ */