Esempio n. 1
0
/**********************************************************

  主函数

**********************************************************/
void main(void)
{  
   P2 = 0xff;
   P0 = 0xff;

   LCD_init();                 //液晶初始化
 //  LCD_color_H();              //水平彩条显示
//   delay_ms(2000);
   LCD_clear(7);
   LCD_ShowString(16,4,colors[4],colors[7],"SD&MMC Card");
   LCD_ShowString(12,20,colors[4],colors[7],"Test Process");

   MMC_Init();                 //卡初始化
   FAT_init();                  //FAT初始化

   if(Init_Flag == 0)          //卡初始化成功
   {
     card_info();              //卡信息显示
   }
  
   ChineseChar(14,120,1,colors[2],colors[7],2);	//文
   ChineseChar(38,120,1,colors[2],colors[7],3);	//件
   ChineseChar(62,120,1,colors[2],colors[7],4);	//系
   ChineseChar(86,120,1,colors[2],colors[7],5);	//统
 
   delay_ms(3000);
   LCD_clear(7);
   
   if(DirSecitemCunt == 8)
   {
     LCD_ShowString(2,4,colors[0],colors[7],"FORMAT:");
     LCD_ShowString(66,4,colors[2],colors[7],"FAT16");
   }
   else
   if(DirSecitemCunt == 7)
   {
     LCD_ShowString(2,4,colors[0],colors[7],"FORMAT:");
     LCD_ShowString(66,4,colors[2],colors[7],"FAT32");
   }
   
   BPB_INFO();                 //BPB信息显示

   while(1);
}
Esempio n. 2
0
void main(void)
{
  DEBUG_FUNC_IN();

  fileTYPE ft;
  int i;

  // !!! a pointer to start of RAM
  unsigned char * ram = ((unsigned char *)0x400000);

  // initialize SD card
  LEDS(led=0xf);
  if (!MMC_Init()) FatalError();

  // find drive
  LEDS(led=0x8);
  if (!FindDrive()) FatalError();

  // open file
  LEDS(led=0x3);
  LoadFile(firmware,ram);
#if 0
  if (!FileOpen(&ft, firmware)) FatalError();

  // load firmware to RAM
  LEDS(led=0x1);
  for(i=0; i<((ft.size>>9)+1); i++) {
    FileRead(&ft, ram+(i*512));
    FileNextSector(&ft);
  }
#endif
  // jump to RAM firmware
  LEDS(led=0x0);
  DisableCard();
  sys_jump(0x400004);

  // loop forever
  while(1);

  DEBUG_FUNC_OUT();
}
Esempio n. 3
0
void SetupHardware(void)
{
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	CLKPR = (1 << CLKPCE);
	CLKPR = 0;

#ifdef TONE_DEBUG
	MCUCR |= (1 << JTD); 
	MCUCR |= (1 << JTD); 
   
	DDRF  = 0xff;
	PORTF = 0x00;
#endif

	USB_Init();
	LEDs_Init();
	
	f_mount(0, &Main_fs);
	Main_mmcInitialized = MMC_Init();
	
	Tone_Init();
}
Esempio n. 4
0
__geta4 void main(void)
#endif
{
  DEBUG_FUNC_IN();

  uint32_t spiclk;
  fileTYPE sd_boot_file;

  HideSplash();
  SPI_fast();

  // boot message
  draw_boot_logo();
  BootPrintEx("**** MINIMIG-DE1 ****");
  BootPrintEx("Minimig by Dennis van Weeren");
  BootPrintEx("Updates by Jakub Bednarski, Tobias Gubener, Sascha Boing, A.M. Robinson & others");
  BootPrintEx("DE1 port by Rok Krajnc ([email protected])");
  BootPrintEx(" ");
  sprintf(s, "Build git commit: %s", __BUILD_REV);
  BootPrintEx(s);
  sprintf(s, "Build git tag: %s", __BUILD_TAG);
  BootPrintEx(s);
  BootPrintEx(" ");
  BootPrintEx("For updates & code see https://github.com/rkrajnc/minimig-de1");
  BootPrintEx("For support, see http://www.minimig.net");
  BootPrintEx(" ");

  printf("\r\r**** MINIMIG-DE1 ****\r\r");
  printf("Minimig by Dennis van Weeren\r");
  printf("Updates by Jakub Bednarski, Tobias Gubener, Sascha Boing, A.M. Robinson & others\r");
  printf("DE1 port by Rok Krajnc ([email protected])\r\r");
  printf("Build no. ");
  printf(__BUILD_NUM);
  //printf(" by ");
  //printf(__BUILD_USER);
  printf("\rgit commit ");
  printf(__BUILD_REV);
  printf("\rgit tag");
  printf(__BUILD_TAG);
  printf("\r\r");
  printf("For updates & code see https://github.com/rkrajnc/minimig-de1\r");
  printf("For support, see http://www.minimig.net/\r\r");

  spiclk = 100000 / (20*(read32(REG_SPI_DIV_ADR) + 2));
  printf("SPI divider: %u\r", read32(REG_SPI_DIV_ADR));
  sprintf(s, "SPI clock: %u.%uMHz", spiclk/100, spiclk%100);
  BootPrintEx(s);
  printf("%s\r", s);

  if (!MMC_Init()) FatalError(1);
  BootPrintEx("SD card found ...");
  printf("SD card found ...\r");

  if (!FindDrive()) FatalError(2);
  BootPrintEx("Drive found ...");
  printf("Drive found ...\r");

  ChangeDirectory(DIRECTORY_ROOT);

  //eject all disk
  df[0].status = 0;
  df[1].status = 0;
  df[2].status = 0;
  df[3].status = 0;
 
  BootPrintEx("Booting ...");
  printf("Booting ...\r");

  TIMER_wait(8000);
  config.kickstart.name[0]=0;
  SetConfigurationFilename(0); // Use default config
  LoadConfiguration(0);  // Use slot-based config filename

  // main loop
  while (1) {
    HandleFpga();
    HandleUI();
  }

  DEBUG_FUNC_OUT();
}