mem_tests.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * @brief Generic memory tests
  3. * Various memory tests for testing external memory integrity. Includes
  4. * inverse address, walking bit, and pattern tests.
  5. *
  6. * @note
  7. * Copyright(C) NXP Semiconductors, 2012
  8. * All rights reserved.
  9. *
  10. * @par
  11. * Software that is described herein is for illustrative purposes only
  12. * which provides customers with programming information regarding the
  13. * LPC products. This software is supplied "AS IS" without any warranties of
  14. * any kind, and NXP Semiconductors and its licensor disclaim any and
  15. * all warranties, express or implied, including all implied warranties of
  16. * merchantability, fitness for a particular purpose and non-infringement of
  17. * intellectual property rights. NXP Semiconductors assumes no responsibility
  18. * or liability for the use of the software, conveys no license or rights under any
  19. * patent, copyright, mask work right, or any other intellectual property rights in
  20. * or to any products. NXP Semiconductors reserves the right to make changes
  21. * in the software without notification. NXP Semiconductors also makes no
  22. * representation or warranty that such application will be suitable for the
  23. * specified use without further testing or modification.
  24. *
  25. * @par
  26. * Permission to use, copy, modify, and distribute this software and its
  27. * documentation is hereby granted, under NXP Semiconductors' and its
  28. * licensor's relevant copyrights in the software, without fee, provided that it
  29. * is used in conjunction with NXP Semiconductors microcontrollers. This
  30. * copyright, permission, and disclaimer notice must appear in all copies of
  31. * this code.
  32. */
  33. #ifndef __MEM_TESTS_H_
  34. #define __MEM_TESTS_H_
  35. #include "lpc_types.h"
  36. /** @defgroup CHIP_Memory_Tests CHIP: Various RAM memory tests
  37. * @ingroup CHIP_Common
  38. * @{
  39. */
  40. /**
  41. * @brief Memory test address/size and result structure
  42. */
  43. typedef struct {
  44. uint32_t *start_addr; /*!< Starting address for memory test */
  45. uint32_t bytes; /*!< Size in bytes for memory test */
  46. uint32_t *fail_addr; /*!< Failed address of test (returned only if failed) */
  47. uint32_t is_val; /*!< Failed value of test (returned only if failed) */
  48. uint32_t ex_val; /*!< Expected value of test (returned only if failed) */
  49. } MEM_TEST_SETUP_T;
  50. /**
  51. * @brief Walking 0 memory test
  52. * @param pMemSetup : Memory test setup (and returned results)
  53. * @return true if the test passed, or false on failure
  54. * Writes a shifting 0 bit pattern to the entire memory range and
  55. * verifies the result after all memory locations are written
  56. */
  57. bool mem_test_walking0(MEM_TEST_SETUP_T *pMemSetup);
  58. /**
  59. * @brief Walking 1 memory test
  60. * @param pMemSetup : Memory test setup (and returned results)
  61. * @return true if the test passed, or false on failure
  62. * Writes a shifting 1 bit pattern to the entire memory range and
  63. * verifies the result after all memory locations are written
  64. */
  65. bool mem_test_walking1(MEM_TEST_SETUP_T *pMemSetup);
  66. /**
  67. * @brief Address memory test
  68. * @param pMemSetup : Memory test setup (and returned results)
  69. * @return true if the test passed, or false on failure
  70. * Writes the address to each memory location and verifies the
  71. * result after all memory locations are written
  72. */
  73. bool mem_test_address(MEM_TEST_SETUP_T *pMemSetup);
  74. /**
  75. * @brief Inverse address memory test
  76. * @param pMemSetup : Memory test setup (and returned results)
  77. * @return true if the test passed, or false on failure
  78. * Writes the inverse address to each memory location and verifies the
  79. * result after all memory locations are written
  80. */
  81. bool mem_test_invaddress(MEM_TEST_SETUP_T *pMemSetup);
  82. /**
  83. * @brief Pattern memory test
  84. * @param pMemSetup : Memory test setup (and returned results)
  85. * @return true if the test passed, or false on failure
  86. * Writes the an alternating 0x55/0xAA pattern to each memory location
  87. * and verifies the result after all memory locations are written
  88. */
  89. bool mem_test_pattern(MEM_TEST_SETUP_T *pMemSetup);
  90. /**
  91. * @brief Pattern memory test with seed and increment value
  92. * @param pMemSetup : Memory test setup (and returned results)
  93. * @param seed : Initial seed value for test
  94. * @param incr : Increment value for each memory location
  95. * @return true if the test passed, or false on failure
  96. * Writes the an alternating pattern to each memory location based on a
  97. * passed seedn and increment value and verifies the result after all
  98. * memory locations are written
  99. */
  100. bool mem_test_pattern_seed(MEM_TEST_SETUP_T *pMemSetup, uint32_t seed, uint32_t incr);
  101. /**
  102. * @}
  103. */
  104. #endif /* __MEM_TESTS_H_ */