OpenCores
URL https://opencores.org/ocsvn/layer2/layer2/trunk

Subversion Repositories layer2

[/] [layer2/] [trunk/] [sw/] [void/] [main.c] - Diff between revs 2 and 4

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 4
Line 33... Line 33...
void upload() {
void upload() {
 
 
   uchar state;         // Flash state.
   uchar state;         // Flash state.
   uint size;           // Image size.
   uint size;           // Image size.
   uint step;           // Progress bar step size.
   uint step;           // Progress bar step size.
   uint cval;           //
   uint cval;           // Current progress value.
 
 
   // Clear screen.
   // Clear screen.
   cls();
   cls();
 
 
   // User Upload Menu.
   // User Upload Menu.
Line 115... Line 115...
      }
      }
   }
   }
 
 
   // Copy flash data to DDR2 memory.
   // Copy flash data to DDR2 memory.
   // NOTE: Missing bytes, if binary file is not 4 bytes aligned.
   // NOTE: Missing bytes, if binary file is not 4 bytes aligned.
   for(uint i=0; i < (size / 4) /* + 1 */; i++) {
   // for(uint i=0; i < (size / 4) /* + 1 */; i++) {
      DDR_ADDRESS[i] = flash_read(i);
      // DDR_ADDRESS[i] = flash_read(i);
   }
   // }
 
 
   // Go back to main menu.
   // Go back to main menu.
   boot();
   boot();
}
}
 
 
 
 
/******************************************************************************
/******************************************************************************
 
 * DDR Load View                                                              *
 
 ******************************************************************************/
 
/* Load Flash contents into DDR. */
 
void load() {
 
 
 
   uint step;           // Progress bar step size.
 
   uint cval;           // Current progress value.
 
 
 
   cls();
 
 
 
   // User Upload Menu.
 
   drawWindow(&wDDRUpload);
 
 
 
   // Upload Initialization.
 
   pbUpload.val = 0;
 
   drawProgressBar(&wDDRUpload, &pbUpload);
 
 
 
   step = FLASH_BLOCK_SIZE * 2;
 
   cval = step;
 
 
 
   // Copy flash data to DDR2 memory.
 
   for(uint i=0; i < FLASH_BLOCKS * FLASH_BLOCK_SIZE; i++) {
 
 
 
      DDR_ADDRESS[i] = flash_read(i);
 
 
 
      // Update status bar.
 
      if(i == cval) {
 
         pbUpload.val++;
 
         drawProgressBar(&wUpload, &pbUpload);
 
         cval += step;
 
      }
 
   }
 
}
 
 
 
 
 
/******************************************************************************
 * Memory View                                                                *
 * Memory View                                                                *
 ******************************************************************************/
 ******************************************************************************/
/* TODO: Cleaner generic version.
/* TODO: Cleaner generic version.
   Quick and dirty implementation of an memory matrix view. Shows the next
   Quick and dirty implementation of an memory matrix view. Shows the next
   'NUM_OF_WORDS' starting at location 'adr' of the Flash and the DDR memory
   'NUM_OF_WORDS' starting at location 'adr' of the Flash and the DDR memory
Line 247... Line 283...
               case OPTION_MEMORY:
               case OPTION_MEMORY:
                  view_memories();
                  view_memories();
                  break;
                  break;
 
 
               case OPTION_START:
               case OPTION_START:
 
                  load();
                  start();
                  start();
                  break;
                  break;
 
 
               default:
               default:
                  break;
                  break;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.