00001
00051 #include "avr_compiler.h"
00052 #include "ebi_driver.h"
00053
00055 #define SDRAM_ADDR 0x4000
00056
00058 #define SDRAM(addr) ((uint8_t *) SDRAM_ADDR)[addr]
00059
00061 #define VECTOR_SIZE 1000
00062
00063
00064
00088 int main( void )
00089 {
00090
00091 bool equal = true;
00092
00093
00094 PORTH.OUT = 0x0F;
00095
00096
00097 PORTH.DIR = 0xFF;
00098 PORTK.DIR = 0xFF;
00099 PORTJ.DIR = 0xF0;
00100
00101
00102 PORTC.DIR = 0x01;
00103 PORTC.OUT = 0x00;
00104
00105
00106 EBI_Enable( EBI_SDDATAW_4BIT_gc,
00107 EBI_LPCMODE_ALE1_gc,
00108 EBI_SRMODE_ALE12_gc,
00109 EBI_IFMODE_3PORT_gc );
00110
00111
00112 EBI_EnableSDRAM( EBI_CS_ASPACE_8KB_gc,
00113 (void *) SDRAM_ADDR,
00114 false,
00115 false,
00116 EBI_SDCOL_8BIT_gc,
00117 EBI_MRDLY_1CLK_gc,
00118 EBI_ROWCYCDLY_1CLK_gc,
00119 EBI_RPDLY_1CLK_gc,
00120 EBI_WRDLY_1CLK_gc,
00121 EBI_ESRDLY_1CLK_gc,
00122 EBI_ROWCOLDLY_1CLK_gc,
00123 0x03FF,
00124 0x0100 );
00125
00126
00127 for (uint16_t i = 0; i < VECTOR_SIZE; i++) {
00128 SDRAM(i) = (uint8_t) i & 0xFF;
00129 }
00130
00131
00132 for (uint16_t i = 0; i < VECTOR_SIZE; i++) {
00133 if (SDRAM(i) != ((uint8_t) i & 0xFF)){
00134 equal = false;
00135 break;
00136 }
00137 }
00138
00139
00140
00141 if (equal) {
00142 while(true) {
00143
00144 nop();
00145 }
00146 }
00147 else {
00148 while(true) {
00149
00150 nop();
00151 }
00152 }
00153 }