📄 dk3200_1_demo.lst
字号:
233 1
234 1 // while(1)
235 1 // {
236 1 ISDcheck(); // initialize uVision2 ISD51 Debugger and continue program run
237 1
238 1 e_test = e4a;
239 1 // e_test = e5a;
240 1 switch ( e_test )
241 1 {
C51 COMPILER V7.00 DK3200_1_DEMO 01/21/2003 14:51:26 PAGE 5
242 2 case e1a:
243 2 {
244 3 status = EEPROM_Format(0x0001);
245 3 printfLCD("EEPROM Init\n");
246 3 printfLCD("%x\n", status);
247 3 break;
248 3 }
249 2 case e1b:
250 2 {
251 3 status = EEPROM_Format(0x0008);
252 3 printfLCD("EEPROM Init\n");
253 3 printfLCD("%x\n", status);
254 3 break;
255 3 }
256 2 case e2a:
257 2 {
258 3 status = 0;
259 3 status = EEPROM_Format(0x002F);
260 3
261 3 status = Update_Record(10, &buf1);
262 3 printfLCD("Update_Record\n");
263 3 printfLCD("%x\n", status);
264 3 break;
265 3 }
266 2 case e2b:
267 2 {
268 3 status = 0;
269 3 status = EEPROM_Format(0x002F);
270 3
271 3 status = Update_Record(0x2E, &buf1);
272 3 printfLCD("Update_Record\n");
273 3 printfLCD("%x\n", status);
274 3 break;
275 3 }
276 2 case e2c:
277 2 {
278 3 status = 0;
279 3 status = EEPROM_Format(0x002F);
280 3
281 3 for ( i=0; i<0x2E; i+=2 )
282 3 {
283 4 if ( Update_Record(i, &buf1) ) status = 1;
284 4 if ( Update_Record(i+1, &buf2) ) status = 1;
285 4 if ( Update_Record(i, &buf3) ) status = 1;
286 4 }
287 3 printfLCD("Done\n");
288 3 printfLCD("%x\n", status);
289 3 break;
290 3 }
291 2 case e2d: // this one takes a few minutes to complete
292 2 {
293 3 status = 0;
294 3 status = EEPROM_Format(0x002F);
295 3
296 3 for ( i=0; i<0x2E; i++ )
297 3 {
298 4 if ( Update_Record(i, &buf1) ) status = 1;
299 4 }
300 3 while ( Get_Sector_Status(SECTOR_0) == VALID__SECTOR )
301 3 {
302 4 if ( Update_Record(0x10, &buf2) ) status = 1;
303 4 }
C51 COMPILER V7.00 DK3200_1_DEMO 01/21/2003 14:51:26 PAGE 6
304 3 printfLCD("1st Swap\n");
305 3 printfLCD("%x\n", status);
306 3 while ( Get_Sector_Status(SECTOR_1) == VALID__SECTOR )
307 3 {
308 4 if ( Update_Record(0x15, &buf3) ) status = 1;
309 4 }
310 3 printfLCD("Done \n");
311 3 printfLCD("%x\n", status);
312 3 break;
313 3 }
314 2 case e4a:
315 2 {
316 3 // Format sectors if not already done
317 3 if ( (Get_Sector_Status(SECTOR_0) == ERASED) &&
318 3 (Get_Sector_Status(SECTOR_1) == ERASED) )
319 3 {
320 4 status = EEPROM_Format(0x0400); //Format 1000 records
321 4 }
322 3
323 3 // Write every other record
324 3
325 3 for ( i=0; i<0xFF; i+=2 )
326 3 {
327 4 Update_Record(i, &buftst[i]); // write record to flash
328 4
329 4 Read_Record(i,&buftemp[i]); // read and compare records
330 4
331 4 if (buftemp[i] == i)
332 4 {
333 5 printfLCD("Compared_ok\n");
334 5 printfLCD("%x\n",buftemp[i]);
335 5 delay_2sec();
336 5 status = 0;
337 5 lcd_clear();
338 5 }
339 4 else
340 4 {
341 5 status =1;
342 5 printfLCD("Miscompared\n");
343 5 printfLCD("%x\n",buftemp[i]);
344 5 for(;;)
345 5 delay_2sec();
346 5 // lcd_clear();
347 5 }
348 4 }
349 3 loop_count++;
350 3 printfLCD("LOOP_COUNT\n");
351 3 printfLCD("%w\n",loop_count);
352 3 delay_2sec();
353 3 lcd_clear();
354 3
355 3 // printfLCD("%w %x\n", ptr,i);
356 3 // Update_Record(0x1, &buf1);
357 3 // Update_Record(0x5, &buf2);
358 3 // if ( Update_Record(0x1, &buf1) ) status = 1;
359 3 // if ( Update_Record(0x5, &buf2) ) status = 1;
360 3 // Run init - verify data unchanged
361 3 // status = Eeprom_Init();
362 3 break;
363 3 }
364 2 case e4b:
365 2 {
C51 COMPILER V7.00 DK3200_1_DEMO 01/21/2003 14:51:26 PAGE 7
366 3 // Format sectors if not already done
367 3 if ( (Get_Sector_Status(SECTOR_0) == ERASED) &&
368 3 (Get_Sector_Status(SECTOR_1) == ERASED) )
369 3 {
370 4 status = EEPROM_Format(0x002E);
371 4 // Write max records
372 4 for ( i=0; i<0x2E; i++ )
373 4 {
374 5 if ( Update_Record(i, &buf1) ) status = 1;
375 5 }
376 4
377 4 if ( Update_Record(0x10, &buf2) ) status = 1;
378 4 if ( Update_Record(0x10, &buf3) ) status = 1;
379 4 if ( Update_Record(0x10, &buf4) ) status = 1;
380 4 }
381 3
382 3 // Run init - verify data repaired
383 3 status = Eeprom_Init();
384 3
385 3 printfLCD("Init \n");
386 3 printfLCD("%x\n", status);
387 3
388 3 break;
389 3 }
390 2 case e4c:
391 2 {
392 3 // Format sectors if not already done
393 3 if ( (Get_Sector_Status(SECTOR_0) == ERASED) &&
394 3 (Get_Sector_Status(SECTOR_1) == ERASED) )
395 3 {
396 4 status = EEPROM_Format(0x002E);
397 4 // Write max records
398 4 for ( i=0; i<0x2E; i++ )
399 4 {
400 5 if ( Update_Record(i, &buf1) ) status = 1;
401 5 }
402 4
403 4 if ( Update_Record(0x10, &buf2) ) status = 1;
404 4 if ( Update_Record(0x10, &buf3) ) status = 1;
405 4 }
406 3
407 3 // Run init - verify data repaired
408 3 status = Eeprom_Init();
409 3
410 3 printfLCD("Init \n");
411 3 printfLCD("%x\n", status);
412 3
413 3 break;
414 3 }
415 2 case e4d:
416 2 {
417 3 // Erase sector 0
418 3 status = Eeprom_Sector_Erase(SECTOR_0);
419 3 // Write random data to second half of sector
420 3 for ( i=0x9000; i<0x9FFF; i++ )
421 3 {
422 4 db = (BYTE)rand();
423 4 status = Boot_Flash_Write(i, db);
424 4 }
425 3
426 3 // Run init - verify sector erased
427 3 // Note - Init should return INVALID_SECTOR_STATE)
C51 COMPILER V7.00 DK3200_1_DEMO 01/21/2003 14:51:26 PAGE 8
428 3 status = Eeprom_Init();
429 3
430 3 printfLCD("Init 0 \n");
431 3 printfLCD("%x\n", status);
432 3
433 3 // Erase sector 1
434 3 status = Eeprom_Sector_Erase(SECTOR_1);
435 3 // Write random data to second half of sector
436 3 for ( i=0xB000; i<0xBFFF; i++ )
437 3 {
438 4 db = (BYTE)rand();
439 4 status = Boot_Flash_Write(i, db);
440 4 }
441 3
442 3 // Run init - verify sector erased
443 3 // Note - Init should return INVALID_SECTOR_STATE
444 3 status = Eeprom_Init();
445 3
446 3 printfLCD("Init 1 \n");
447 3 printfLCD("%x\n", status);
448 3
449 3 break;
450 3 }
451 2 case e4e:
452 2 {
453 3 // State 1 - both sectors erased
454 3 // This state is tested implicitly in e4d
455 3
456 3 // State 2 - sector 0 ERASED, sector 1 RECEIVE_DATA
457 3 status = Sector_Test( ERASED, RECEIVE_DATA );
458 3
459 3 // State 3 - sector 0 ERASED, sector 1 VALID__SECTOR
460 3 status = Sector_Test( ERASED, VALID__SECTOR );
461 3
462 3 // State 4 - sector 0 ERASED, sector 1 TRANSFER_COMPLETE
463 3 status = Sector_Test( ERASED, TRANSFER_COMPLETE );
464 3
465 3 // State 5 - sector 0 RECEIVE_DATA, sector 1 ERASED
466 3 status = Sector_Test( RECEIVE_DATA, ERASED );
467 3
468 3 // State 6 - sector 0 RECEIVE_DATA, sector 1 RECEIVE_DATA
469 3 status = Sector_Test( RECEIVE_DATA, RECEIVE_DATA );
470 3
471 3 // State 7 - sector 0 RECEIVE_DATA, sector 1 VALID__SECTOR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -