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

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [soc/] [sw/] [sd_boot_loader/] [main.c] - Diff between revs 17 and 22

Show entire file | Details | Blame | View Log

Rev 17 Rev 22
Line 25... Line 25...
#define DEBUG 1
#define DEBUG 1
 
 
#define barrier() __asm__ __volatile__("": : :"memory")
#define barrier() __asm__ __volatile__("": : :"memory")
 
 
#ifdef DEBUG
#ifdef DEBUG
void putc(int c)
void or1k_putc(int c)
{
{
        while ( 0x20 != (REG8(UART_BASE_ADD+5) & 0x20) )
        while ( 0x20 != (REG8(UART_BASE_ADD+5) & 0x20) )
                ;
                ;
 
 
        REG8(UART_BASE_ADD) = c;
        REG8(UART_BASE_ADD) = c;
Line 41... Line 41...
 
 
        if (c == NULL)
        if (c == NULL)
                return;
                return;
 
 
        for (i = 0; c[i] != 0; i++) {
        for (i = 0; c[i] != 0; i++) {
                putc(c[i]);
                or1k_putc(c[i]);
        }
        }
}
}
 
 
void print32bit (long unsigned int val)
void print32bit (long unsigned int val)
{
{
Line 57... Line 57...
    myNibble =  (val >> 28) & 0xfUL;
    myNibble =  (val >> 28) & 0xfUL;
    if (myNibble <= 0x9)
    if (myNibble <= 0x9)
      myChar = (char) myNibble + 0x30;
      myChar = (char) myNibble + 0x30;
    else
    else
      myChar = (char) myNibble + 0x37;
      myChar = (char) myNibble + 0x37;
    putc (myChar);
    or1k_putc (myChar);
    val = val << 4;
    val = val << 4;
  }
  }
  putc ('\n');
  or1k_putc ('\n');
  putc ('\r');
  or1k_putc ('\r');
}
}
 
 
 
 
#else
#else
#define putc(a)
#define or1k_putc(a)
#define print(a)
#define print(a)
#endif
#endif
 
 
 
 
void do_sleep()
void do_sleep()
Line 142... Line 142...
        uint32 blockCnt;
        uint32 blockCnt;
        uint32 numBlocks = 2 * 1024 * 10; // How mang blocks will be copied
        uint32 numBlocks = 2 * 1024 * 10; // How mang blocks will be copied
 
 
        uint32 ddr_offset = 0;
        uint32 ddr_offset = 0;
 
 
        print("Start copying SD image to DDR SDRAM...\n\r");
        print("\n\r");
 
        print("Copying SD image to DDR SDRAM...\n\r");
        print("Blocks:");
        print("Blocks:");
        print32bit((long unsigned int)numBlocks);
        print32bit((long unsigned int)numBlocks);
 
 
        for (blockCnt = 0; blockCnt < numBlocks; blockCnt++) {
        for (blockCnt = 0; blockCnt < numBlocks; blockCnt++) {
                REG8(SD_BASE_ADD + SD_ADDR_7_0_REG)   = 0;
                REG8(SD_BASE_ADD + SD_ADDR_7_0_REG)   = 0;
Line 168... Line 169...
                                data = REG8(SD_BASE_ADD + SD_RX_FIFO_DATA_REG) ;
                                data = REG8(SD_BASE_ADD + SD_RX_FIFO_DATA_REG) ;
                                REG8(DDR_SDRAM_BASE_ADDR + ddr_offset + i) = data ;
                                REG8(DDR_SDRAM_BASE_ADDR + ddr_offset + i) = data ;
//                              print32bit((long unsigned int)data);
//                              print32bit((long unsigned int)data);
                        }
                        }
                        if ((blockCnt % 0x40) == 0) {
                        if ((blockCnt % 0x40) == 0) {
                                putc('.');
                                or1k_putc('.');
                                j++;
                                j++;
                        }
                        }
                        if (j == 20) {
                        if (j == 20) {
                                j = 0;
                                j = 0;
                                print("\n\r");
                                print("\n\r");
                        }
                        }
 
 
                        ddr_offset += 512;
                        ddr_offset += 512;
                } else {
                } else {
                        putc('R');
                        or1k_putc('R');
                        j++;
                        j++;
                        if (j == 20) {
                        if (j == 20) {
                                j = 0;
                                j = 0;
                                print("\n\r");
                                print("\n\r");
                        }
                        }
Line 319... Line 320...
  jumpToRAM();
  jumpToRAM();
 
 
  print("Should not get here!!:\n\r");
  print("Should not get here!!:\n\r");
  while(TRUE) {
  while(TRUE) {
        do_sleep();
        do_sleep();
        putc('.');
        or1k_putc('.');
        GPIO_Write(~0x0);  // Test finished
        GPIO_Write(~0x0);  // Test finished
        do_sleep();
        do_sleep();
        GPIO_Write(~0x1);
        GPIO_Write(~0x1);
        do_sleep();
        do_sleep();
        GPIO_Write(~0x2);
        GPIO_Write(~0x2);

powered by: WebSVN 2.1.0

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