Memtest. Changed way to specify memtest data width

This commit is contained in:
barthess 2015-09-28 17:36:25 +03:00
parent 51514b134e
commit d5e967add4
2 changed files with 24 additions and 28 deletions

View File

@ -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;
}
}
/*

View File

@ -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;
@ -40,15 +53,6 @@ typedef uint32_t testtype;
typedef void (*memtestecb_t)(memtest_t *testp, testtype type, size_t index,
size_t current_width, uint32_t got, uint32_t expect);
/*
*
*/
typedef enum {
MEMTEST_WIDTH_8,
MEMTEST_WIDTH_16,
MEMTEST_WIDTH_32,
} memtest_bus_width_t;
/*
*
*/
@ -56,22 +60,19 @@ 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;
};
/*