diff options
Diffstat (limited to 'os/various')
-rw-r--r-- | os/various/memtest.cpp | 17 | ||||
-rw-r--r-- | os/various/memtest.h | 35 |
2 files changed, 24 insertions, 28 deletions
diff --git a/os/various/memtest.cpp b/os/various/memtest.cpp index b853fe7..8fb5262 100644 --- a/os/various/memtest.cpp +++ b/os/various/memtest.cpp @@ -227,20 +227,15 @@ static void memtest_wrapper(memtest_t *testp, void (*p_u8)(memtest_t *testp), void (*p_u16)(memtest_t *testp), void (*p_u32)(memtest_t *testp)) { - switch(testp->width) { - case MEMTEST_WIDTH_32: + + if (testp->width_mask & MEMTEST_WIDTH_8) p_u8(testp); + + if (testp->width_mask & MEMTEST_WIDTH_16) p_u16(testp); + + if (testp->width_mask & MEMTEST_WIDTH_32) p_u32(testp); - break; - case MEMTEST_WIDTH_16: - p_u8(testp); - p_u16(testp); - break; - case MEMTEST_WIDTH_8: - p_u8(testp); - break; - } } /* diff --git a/os/various/memtest.h b/os/various/memtest.h index 721b36b..e67df5f 100644 --- a/os/various/memtest.h +++ b/os/various/memtest.h @@ -17,6 +17,9 @@ #ifndef MEMTEST_H_ #define MEMTEST_H_ +/* + * Memtest types + */ #define MEMTEST_WALKING_ONE (1 << 0) #define MEMTEST_WALKING_ZERO (1 << 1) #define MEMTEST_OWN_ADDRESS (1 << 2) @@ -24,6 +27,9 @@ #define MEMTEST_MOVING_INVERSION_55AA (1 << 4) #define MEMTEST_MOVING_INVERSION_RAND (1 << 5) +/* + * combined types for convenient + */ #define MEMTEST_RUN_ALL (MEMTEST_WALKING_ONE | \ MEMTEST_WALKING_ZERO | \ MEMTEST_OWN_ADDRESS | \ @@ -31,6 +37,13 @@ MEMTEST_MOVING_INVERSION_55AA | \ MEMTEST_MOVING_INVERSION_RAND) +/* + * Memtest data widths + */ +#define MEMTEST_WIDTH_8 (1 << 0) +#define MEMTEST_WIDTH_16 (1 << 1) +#define MEMTEST_WIDTH_32 (1 << 2) + typedef struct memtest_t memtest_t; typedef uint32_t testtype; @@ -43,35 +56,23 @@ typedef void (*memtestecb_t)(memtest_t *testp, testtype type, size_t index, /* * */ -typedef enum { - MEMTEST_WIDTH_8, - MEMTEST_WIDTH_16, - MEMTEST_WIDTH_32, -} memtest_bus_width_t; - -/* - * - */ struct memtest_t { /* * Pointer to the test area start. Must be word aligned. */ - void *start; + void *start; /* * Test area size in bytes. */ - size_t size; + size_t size; /* - * Maximum width of transactions. - * Note: it implies all narrower tests. - * Note: width my be wider then your memory interface because AHB is - * smart enough to split big transactions to smaller ones. + * Allowable data widths mask. */ - memtest_bus_width_t width; + uint32_t width_mask; /* * Error callback pointer. Set to NULL if unused. */ - memtestecb_t errcb; + memtestecb_t errcb; }; /* |