CV_CML1Cache.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*-----------------------------------------------------------------------------
  2. * Name: CV_CML1Cache.c
  3. * Purpose: CMSIS CORE validation tests implementation
  4. *-----------------------------------------------------------------------------
  5. * Copyright (c) 2020 - 2021 ARM Limited. All rights reserved.
  6. *----------------------------------------------------------------------------*/
  7. #include "CV_Framework.h"
  8. #include "cmsis_cv.h"
  9. /*-----------------------------------------------------------------------------
  10. * Test implementation
  11. *----------------------------------------------------------------------------*/
  12. /*-----------------------------------------------------------------------------
  13. * Test cases
  14. *----------------------------------------------------------------------------*/
  15. /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
  16. void TC_CML1Cache_EnDisableICache(void) {
  17. #ifdef __ICACHE_PRESENT
  18. SCB_EnableICache();
  19. ASSERT_TRUE((SCB->CCR & SCB_CCR_IC_Msk) == SCB_CCR_IC_Msk);
  20. SCB_DisableICache();
  21. ASSERT_TRUE((SCB->CCR & SCB_CCR_IC_Msk) == 0U);
  22. #endif
  23. }
  24. /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
  25. void TC_CML1Cache_EnDisableDCache(void) {
  26. #ifdef __DCACHE_PRESENT
  27. SCB_EnableDCache();
  28. ASSERT_TRUE((SCB->CCR & SCB_CCR_DC_Msk) == SCB_CCR_DC_Msk);
  29. SCB_DisableDCache();
  30. ASSERT_TRUE((SCB->CCR & SCB_CCR_DC_Msk) == 0U);
  31. #endif
  32. }
  33. /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
  34. #ifdef __DCACHE_PRESENT
  35. static uint32_t TC_CML1Cache_CleanDCacheByAddrWhileDisabled_Values[] = { 42U, 0U, 8U, 15U };
  36. #endif
  37. void TC_CML1Cache_CleanDCacheByAddrWhileDisabled(void) {
  38. #ifdef __DCACHE_PRESENT
  39. SCB_DisableDCache();
  40. SCB_CleanDCache_by_Addr(TC_CML1Cache_CleanDCacheByAddrWhileDisabled_Values, sizeof(TC_CML1Cache_CleanDCacheByAddrWhileDisabled_Values)/sizeof(TC_CML1Cache_CleanDCacheByAddrWhileDisabled_Values[0]));
  41. ASSERT_TRUE((SCB->CCR & SCB_CCR_DC_Msk) == 0U);
  42. #endif
  43. }