⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u241mon.c

📁 s3c2410 平台 无操作系统下 对NAND flash的 读写 源代码
💻 C
字号:
/****************************************************************
 NAME: u241mon.c
 DESC: u241mon entry point,menu,download
 HISTORY:
 Mar.25.2002:purnnamu: S3C2400X profile.c is ported for S3C2410X.
 Mar.27.2002:purnnamu: DMA is enabled.
 Apr.01.2002:purnnamu: isDownloadReady flag is added.
 Apr.10.2002:purnnamu: - Selecting menu is available in the waiting loop. 
                         So, isDownloadReady flag gets not needed
                       - UART ch.1 can be selected for the console.
 Aug.20.2002:purnnamu: revision number change 0.2 -> R1.1       
 Sep.03.2002:purnnamu: To remove the power noise in the USB signal, the unused CLKOUT0,1 is disabled.
 ****************************************************************/

#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "option.h"
#include "2410addr.h"
#include "2410lib.h"
#include "2410slib.h"
#include "mmu.h"
#include "profile.h"
#include "memtest.h"


extern U32 srcAddress;
 extern U32 targetBlock;     // Block number (0 ~ 4095)
 extern U32 targetSize;      // Total byte size 
  extern void InputTargetBlock(void);
void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);
void Lcd_Off(void);
void WaitDownload(void);
int Menu(void);


extern char Image$$RW$$Limit[];
U32 *pMagicNum=(U32 *)Image$$RW$$Limit;
int consoleNum;

void Main(void)
{
   
    #if ADS10   
    __rt_lib_init(); //for ADS 1.0
    #endif

    ChangeClockDivider(1,1);    // 1:2:4    
    //ChangeMPllValue(82,2,1);  //FCLK=135.0Mhz     
    ChangeMPllValue(82,1,1);    //FCLK=180.0Mhz     
    //ChangeMPllValue(161,3,1); //FCLK=202.8Mhz     
    
    Port_Init();
    
    rGPHCON = rGPHCON&~(0xf<<18)|(0x5<<18);   
    MMU_Init();
     Isr_Init();
    if(*pMagicNum!=0x12345678)
    	consoleNum=0;
    else
    	consoleNum=1;
    	
    Uart_Init(0,115200);
    Uart_Select(consoleNum);
    Delay(0);  //calibrate Delay()
    Led_Display(0x6);
    
    	Uart_Printf("Press Any Key to program nand flash\n");
    	Uart_Getch();
   
	K9S1208_Program();

	
	while(1)
		K9S1208_PrintBlock();
	

}

void Isr_Init(void)
{
    pISR_UNDEF=(unsigned)HaltUndef;
    pISR_SWI  =(unsigned)HaltSwi;
    pISR_PABORT=(unsigned)HaltPabort;
    pISR_DABORT=(unsigned)HaltDabort;
    rINTMOD=0x0;	  // All=IRQ mode
    rINTMSK=BIT_ALLMSK;	  // All interrupt is masked.

   
}


void HaltUndef(void)
{
    Uart_Printf("Undefined instruction exception!!!\n");
    while(1);
}

void HaltSwi(void)
{
    Uart_Printf("SWI exception!!!\n");
    while(1);
}

void HaltPabort(void)
{
    Uart_Printf("Pabort exception!!!\n");
    while(1);
}

void HaltDabort(void)
{
    Uart_Printf("Dabort exception!!!\n");
    while(1);
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -