aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F4xx/FSMC_SRAM/memtest.hpp
blob: 4a9e4e3aed381c401d3b96c16c149c3ba0612021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef MEMTEST_HPP_
#define MEMTEST_HPP_

#define MEMTEST_WALKING_ONE               (1 << 0)
#define MEMTEST_WALKING_ZERO              (1 << 1)
#define MEMTEST_OWN_ADDRESS               (1 << 2)
#define MEMTEST_MOVING_INVERSION_ZERO     (1 << 3)
#define MEMTEST_MOVING_INVERSION_55AA     (1 << 4)
#define MEMTEST_MOVING_INVERSION_RAND     (1 << 5)

#define MEMTEST_RUN_ALL                   (MEMTEST_WALKING_ONE | \
                                           MEMTEST_WALKING_ZERO | \
                                           MEMTEST_OWN_ADDRESS | \
                                           MEMTEST_MOVING_INVERSION_ZERO | \
                                           MEMTEST_MOVING_INVERSION_55AA | \
                                           MEMTEST_MOVING_INVERSION_RAND)

typedef struct memtest_t memtest_t;
typedef uint32_t testtype_t;

/*
 * Error call back.
 */
typedef void (*memtestecb_t)(memtest_t *memp, testtype_t e, size_t address);

/*
 *
 */
typedef enum {
  MEMTEST_WIDTH_8,
  MEMTEST_WIDTH_16,
  MEMTEST_WIDTH_32
} memtest_bus_width_t;

/*
 *
 */
struct memtest_t {
  void                *start;
  size_t              size;
  memtest_bus_width_t width;
  memtestecb_t        ecb;
  unsigned int        rand_seed;
};

/*
 *
 */
#ifdef __cplusplus
extern "C" {
#endif
  void memtest_run(memtest_t *memp, uint32_t testmask);
#ifdef __cplusplus
}
#endif

#endif /* MEMTEST_HPP_ */