41 lines
969 B
C
41 lines
969 B
C
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include "printf.h"
|
|
|
|
#include "user_tasks.h"
|
|
|
|
// SDRAM BANK 2, default mapping
|
|
#define SDRAM_START 0xD0000000
|
|
#define SDRAM_END 0xD4000000
|
|
|
|
osThreadId_t g_sdram_task_handle;
|
|
osThreadAttr_t g_sdram_task_attributes = {
|
|
.name = "SDRAMT",
|
|
.stack_size = 256 * 4,
|
|
.priority = (osPriority_t) osPriorityNormal,
|
|
};
|
|
|
|
void sdram_task(void * argument) {
|
|
printf("SDRAM test started...\r\n");
|
|
|
|
for(uint32_t i = SDRAM_START; i < SDRAM_END; i += 4) {
|
|
*(uint32_t *)i = i;
|
|
if(i % 0x10000 == 0) {
|
|
printf("Write: 0x%08lx\r\n", i);
|
|
}
|
|
}
|
|
for(uint32_t i = SDRAM_START; i < SDRAM_END; i += 4) {
|
|
if(*(uint32_t *)i != i) {
|
|
printf("Verify err: 0x%08lx\r\n", i);
|
|
break;
|
|
}
|
|
if(i % 0x10000 == 0) {
|
|
printf("Verify: 0x%08lx\r\n", i);
|
|
}
|
|
}
|
|
printf("SDRAM test completed.\r\n");
|
|
|
|
osThreadExit();
|
|
} |