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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
| init.c
#include "s3c2440_soc.h"
void sdram_init(void) { BWSCON = 0x22000000;
BANKCON6 = 0x18001; BANKCON7 = 0x18001;
REFRESH = 0x8404f5;
BANKSIZE = 0xb1;
MRSRB6 = 0x20; MRSRB7 = 0x20; }
#if 0
void memsetup(void) { unsigned long *p = (unsigned long *)MEM_CTL_BASE; p[0] = 0x22111110; p[1] = 0x00000700; p[2] = 0x00000700; p[3] = 0x00000700; p[4] = 0x00000700; p[5] = 0x00000700; p[6] = 0x00000700; p[7] = 0x00018005; p[8] = 0x00018005; p[9] = 0x008e07a3; p[10] = 0x000000b2; p[11] = 0x00000030; p[12] = 0x00000030; }
#endif
void sdram_init2(void) { unsigned int arr[] = { 0x22000000, 0x00000700, 0x00000700, 0x00000700, 0x00000700, 0x00000700, 0x00000700, 0x18001, 0x18001, 0x8404f5, 0xb1, 0x20, 0x20,
}; volatile unsigned int * p = (volatile unsigned int *)0x48000000; int i;
for (i = 0; i < 13; i++) { *p = arr[i]; p++; } }
int sdram_test(void) { volatile unsigned char *p = (volatile unsigned char *)0x30000000; int i;
for (i = 0; i < 1000; i++) p[i] = 0x55;
for (i = 0; i < 1000; i++) if (p[i] != 0x55) return -1;
return 0; }
void copy2sdram(void) {
extern int __code_start, __bss_start;
volatile unsigned int *dest = (volatile unsigned int *)&__code_start; volatile unsigned int *end = (volatile unsigned int *)&__bss_start; volatile unsigned int *src = (volatile unsigned int *)0;
while (dest < end) { *dest++ = *src++; } }
void clean_bss(void) {
extern int _end, __bss_start;
volatile unsigned int *start = (volatile unsigned int *)&__bss_start; volatile unsigned int *end = (volatile unsigned int *)&_end;
while (start <= end) { *start++ = 0; } }
|