dspcache.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * \file dspcache.h
  3. *
  4. * \brief Contains DSP cache API declarations and parameter definitions.
  5. */
  6. /*
  7. * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. *
  16. * Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the
  19. * distribution.
  20. *
  21. * Neither the name of Texas Instruments Incorporated nor the names of
  22. * its contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  30. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #ifndef CACHE_H_
  38. #define CACHE_H_
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. /******************************************************************************
  43. ** INTERNAL MACRO DEFINITIONS
  44. ******************************************************************************/
  45. /* Defines used for 'memCfg' defines -- make 'memCfg' defines unique */
  46. #define L1P_MEM_UNIQUE (0x1 << 0)
  47. #define L1D_MEM_UNIQUE (0x1 << 1)
  48. #define L2_MEM_UNIQUE (0x1 << 2)
  49. /******************************************************************************
  50. ** EXTERNAL MACRO DEFINITIONS
  51. ******************************************************************************/
  52. /*
  53. * API Parameter: memCfg
  54. *
  55. * Brief: Used to select L1P, L1D, and/or L2 cache configuration.
  56. *
  57. * Functions: TBD
  58. *
  59. * NOTE: User can perform a logical OR using the below parameters to configure
  60. * L1P, L1D, and L2 with one call.
  61. * Ex: (L1PCFG_L1PMODE_4K | L1DCFG_L1DMODE_16K | L2CFG_L2MODE_256K) */
  62. /* L1P (Choose 1) */
  63. #define L1PCFG_L1PMODE_4K (0x1 << ((L1P_MEM_UNIQUE >> 1) * 4))
  64. #define L1PCFG_L1PMODE_8K (0x2 << ((L1P_MEM_UNIQUE >> 1) * 4))
  65. #define L1PCFG_L1PMODE_16K (0x3 << ((L1P_MEM_UNIQUE >> 1) * 4))
  66. #define L1PCFG_L1PMODE_32K (0x4 << ((L1P_MEM_UNIQUE >> 1) * 4))
  67. /* OR L1D (Choose 1) */
  68. #define L1DCFG_L1DMODE_4K (0x1 << ((L1D_MEM_UNIQUE >> 1) * 4))
  69. #define L1DCFG_L1DMODE_8K (0x2 << ((L1D_MEM_UNIQUE >> 1) * 4))
  70. #define L1DCFG_L1DMODE_16K (0x3 << ((L1D_MEM_UNIQUE >> 1) * 4))
  71. #define L1DCFG_L1DMODE_32K (0x4 << ((L1D_MEM_UNIQUE >> 1) * 4))
  72. /* OR L2 (Choose 1) */
  73. #define L2CFG_L2MODE_32K (0x1 << ((L2_MEM_UNIQUE >> 1) * 4))
  74. #define L2CFG_L2MODE_64K (0x2 << ((L2_MEM_UNIQUE >> 1) * 4))
  75. #define L2CFG_L2MODE_128K (0x3 << ((L2_MEM_UNIQUE >> 1) * 4))
  76. #define L2CFG_L2MODE_256K (0x4 << ((L2_MEM_UNIQUE >> 1) * 4))
  77. /******************************************************************************
  78. ** FUNCTION DEFINITIONS
  79. ******************************************************************************/
  80. extern void CacheEnable (unsigned int memCfg);
  81. extern void CacheEnableMAR (unsigned int baseAddr, unsigned int byteSize);
  82. extern void CacheDisableMAR (unsigned int baseAddr, unsigned int byteSize);
  83. extern void CacheInvL1pAll (void);
  84. extern void CacheWBAll (void);
  85. extern void CacheWBInvAll (void);
  86. extern void CacheInv (unsigned int baseAddr, unsigned int byteSize);
  87. extern void CacheWB (unsigned int baseAddr, unsigned int byteSize);
  88. extern void CacheWBInv (unsigned int baseAddr, unsigned int byteSize);
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif