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

📄 2410test.c

📁 S3C2410 SD卡驱动程序,开发板是傅立叶电子的FFT2410
💻 C
字号:
//====================================================================
// File Name : 2410test.c
// Function  : S3C2410 Test Main Menu
// Program   : Shin, On Pil (SOP)
// Date      : May 30, 2002
// Version   : 0.0
// History
//   0.0 : Programming start (February 20,2002) -> SOP
//   1.0 (20020530) : First release for customer
//   1.1 (20020801) : Strata NOR Flash Added and etc. -> SOP
//====================================================================

#include <stdlib.h>
#include <string.h>

//Shin, On Pil
#include "def.h"
//#include "option.h"
#include "2410addr.h"
#include "2410lib.h"
#include "2410slib.h"

//#include "2410etc.h"
//#include "2410IIC.h"
//#include "2410iis.h"
#include "2410int.h"
#include "2410RTC.h"
//#include "2410swi.h"
//#include "timer.h"

//#include "adc.h"
//#include "dma.h"
//#include "dma2.h"
//#include "eint.h"
//#include "extdma.h"
#include "k9s1208.h"
#include "mmu.h"
//#include "nwait.h"
#include "sdi.h"
//#include "stone.h"
//#include "ts_auto.h"
//#include "ts_sep.h"
//#include "usbfifo.h"

//Shin, Jeong Seuk
//#include "IrDA.h"
#include "lcd.h"
#include "lcdlib.h"
#include "glib.h"
//#include "palette.h"
//#include "spi.h"
#include "uart0.h"
//#include "uart1.h"
//#include "uart2.h"

//Kong, In Wook
//#include "etc.h"
//#include "flash.h"
//#include "idle.h"
//#include "pd6710.h"
//#include "pll.h"
//#include "power.h"
//#include "pwr_c.h"
//#include "stop.h"

void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);

void * function[][2]=
{

    (void *)Test_SDI,                       "SDI Write/Read      ",

    0,0
};

//===================================================================
void Main(void)
{
    int i,j,n,cc;

//    MMU_Init();         //mmu.c
    ChangeClockDivider(1,1);          // 1:2:4    2410lib.c

    ChangeMPllValue(0xa1,0x3,0x1);    // FCLK=202.8MHz  2410lib.c

    Port_Init();              //2410lib.c
    Isr_Init();

    Uart_Init(0,115200);
    Uart_Select(0);

    rIISPSR=(2<<5)|(2<<0); //IIS_LRCK=44.1Khz @384fs,PCLK=50Mhz.
    rGPHCON = rGPHCON & ~(0xf<<18)|(0x5<<18);   //CLKOUT 0,1=OUTPUT to reduce the power consumption.

//  测试sd卡
    Uart_Printf("\n\n fft-s3c2410 SD/MMC CARD TEST\n\n");
    Test_SDI();
    while(1)
    {
        i = 0;
        while(1)
        {   
            Uart_Printf("%2d:%s",i,function[i][1]);
               i++;
            if((int)(function[i][0])==0)
            {
                Uart_Printf("\n");
                break;
            }
            if((i%4)==0)
            Uart_Printf("\n");
        }

        Uart_Printf("\nSelect the function to test : ");
        i = Uart_GetIntNum();
        Uart_Printf("\n");
        
        rGPGCON = (rGPGCON & 0xfffffcff) | (1<<8);
        rGPGDAT = (rGPGDAT & 0xffef) | (1<<4);        
        
        if(i==0)  
            ( (void (*)(void)) (function[i][0]) )();            
        else
           continue;    
   }   
}

//===================================================================
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
//    rINTCON=0x5;                           //Non-vectored,IRQ enable,FIQ disable    
    rINTMSK     = BIT_ALLMSK;              //All interrupt is masked.
    rINTSUBMSK  = BIT_SUB_ALLMSK;          //All sub-interrupt is masked. <- April 01, 2002 SOP

//    rINTSUBMSK  = ~(BIT_SUB_RXD0);         //Enable Rx0 Default value=0x7ff
//    rINTMSK     = ~(BIT_UART0);            //Enable UART0 Default value=0xffffffff    
    
//    pISR_UART0=(unsigned)RxInt;            //pISR_FIQ,pISR_IRQ must be initialized
}

//===================================================================
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);
}





/*
//=========================
    while(1)
    {
       Led_Display(3);
    }
//=========================    
*/
/*
//=========================
    while(1)
    {
       Led_Display(1);
       Delay(1500);   
       Led_Display(2);
       Delay(1500);             
       Led_Display(4);
       Delay(1500);   
       Led_Display(8);
       Delay(1500);                
    }
//=========================   
*/

⌨️ 快捷键说明

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