Example #1
0
void usb_init_slave(void)
{
	struct s3c24x0_gpio * const gpioregs = s3c24x0_get_base_gpio();
	char *mode;

	udelay(100000);

	Isr_Init();

   writel((readl(&gpioregs->MISCCR) & ~((1<<3) | (1<<13))), &gpioregs->MISCCR); 
// USBD is selected instead of USBH1 
// USB port 1 is enabled.
//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

	UsbdMain(); 
	udelay(100000);
    
    writel((readl(&gpioregs->GPCDAT) | (1<<5)), &gpioregs->GPCDAT); 
 /* enable USB Device, thisway.diy */
#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif
	download_run=0; //The default menu is the Download & Run mode.
	printf("USB slave is enable!\n");
}
Example #2
0
void Main(void)
{
	//硬件初始化
	var_Init();//初始化定时器相关的参数
	Port_Init();//IO端口初始化
	Isr_Init();//中断初始化
	Uart_Init(0,115200);//串口初始化
	Uart_Select(0);
	_init_alloc(0x32500000,0x333fffff);//初始化堆地址:15M,使能malloc等存储分配函数
	setlocale(LC_ALL,"C");//使能本地函数,如sprintf等
	Timer4_Init();
	lcdTest();
}	
Example #3
0
void Main(void)
{
    Port_Init();		//IO端口初始化
	Isr_Init();			//中断初始化

    Uart_Init(0,115200);//串口初始化
    Uart_Select(0);

    Uart_Printf("\n\nDM2410 Experiment System (ADS) Ver1.10\n") ;//打印系统信息
    
    Test_SDI();
    
}
Example #4
0
void usb_init_slave(void)
{
	struct s3c24x0_gpio * const gpioregs = s3c24x0_get_base_gpio();
	char *mode;

	udelay(100000);

	Isr_Init();

   writel((readl(&gpioregs->misccr) & ~((1<<3) | (1<<13))), &gpioregs->misccr); 
// USBD is selected instead of USBH1 
// USB port 1 is enabled.
//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

	UsbdMain(); 
	udelay(100000);
    
    writel((readl(&gpioregs->gpcdat) | (1<<5)), &gpioregs->gpcdat); 
 /* enable USB Device, thisway.diy */
#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif
	download_run=0; //The default menu is the Download & Run mode.
	printf("\n");
	printf("+------------------------------------------------------------+\n");
	printf("| S3C2440A USB Downloader (Port from tekkamanninja 2012 Aug) |\n");
	printf("+------------------------------------------------------------+\n");
	printf("USB: IN_ENDPOINT:1 OUT_ENDPOINT:3\n");
	printf("FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>\n");
	printf("NOTE: Power off/on or press the reset button for 1 sec\n");
	printf("      in order to get a valid USB device address.\n");
	printf("\n");
}
Example #5
0
void usb_init_slave(void)
{
	char *mode;
	int i;
	U8 key;
	U32 mpll_val, upll_val, divn_upll=0;
	extern int bBootFrmNORFlash(void);

	/* start add by ll ,replace the Port_Init() */
	gpioregs = S3C24X0_GetBase_GPIO();
	gpioregs->GPGCON = 0xfd95ffba;	/* thisway.diy, GPG12-->OUTPUT, GPG9-->OUTPUT for FS2410, as USB Device enable */
	gpioregs->GPGUP  = 0xffff;	// The pull up function is disabled GPG[15:0]
	gpioregs->GPGDAT &= ~(1<<12);	/* disable USB Device, enable later, thisway.diy */
	/* end ll */

	clk_powerregs = S3C24X0_GetBase_CLOCK_POWER();

	usbdevregs = S3C24X0_GetBase_USB_DEVICE();
	dmaregs = S3C24X0_GetBase_DMAS();

	udelay(100000);
#if 0
	// USB device detection control
	rGPGCON &= ~(3<<24);
	rGPGCON |=  (1<<24); // output
	rGPGUP  |=  (1<<12); // pullup disable
	rGPGDAT |=  (1<<12); // output
#endif

	//ChangeUPllValue(60,4,2);		// 48MHz
	//for(i=0; i<7; i++);
	//ChangeClockDivider(13,12);
	//ChangeMPllValue(97,1,2);		//296Mhz

	Isr_Init();


	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<3); // USBD is selected instead of USBH1
	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<13); // USB port 1 is enabled.

//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

#if 0
	UsbdMain();
	MMU_Init(); //MMU should be reconfigured or turned off for the debugger,
	//After downloading, MMU should be turned off for the MMU based program,such as WinCE.
#else
//thisway.diy	MMU_EnableICache();
	UsbdMain();
	udelay(100000);
	gpioregs->GPGDAT |= ((1<<9) | (1<<12));  /* enable USB Device, thisway.diy */
	gpioregs->GPBDAT |= (1<<9);   /* enable USB Device, thisway.diy */
	gpioregs->GPCDAT |= (1<<5);   /* enable USB Device, thisway.diy */
#endif

#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif

	// CLKOUT0/1 select.
	//printf("CLKOUT0:MPLL in, CLKOUT1:RTC clock.\n");
	//Clk0_Enable(0);	// 0:MPLLin, 1:UPLL, 2:FCLK, 3:HCLK, 4:PCLK, 5:DCLK0
	//Clk1_Enable(2);	// 0:MPLLout, 1:UPLL, 2:RTC, 3:HCLK, 4:PCLK, 5:DCLK1
//	Clk0_Disable();
//	Clk1_Disable();

	mpll_val = clk_powerregs->MPLLCON;
	upll_val = clk_powerregs->UPLLCON;


	if (0) //(!bBootFrmNORFlash())
	{
		S3C24X0_INTERRUPT * intregs;
		intregs = S3C24X0_GetBase_INTERRUPT();
		printf("UPLLVal [M:%xh,P:%xh,S:%xh]\n", (upll_val&(0xff<<12))>>12,(upll_val&(0x3f<<4))>>4,(upll_val&0x3));
		printf("MPLLVal [M:%xh,P:%xh,S:%xh]\n", (mpll_val&(0xff<<12))>>12,(mpll_val&(0x3f<<4))>>4,(mpll_val&0x3));
		printf("CLKDIVN:%xh\n", clk_powerregs->CLKDIVN);

			intregs->INTSUBMSK = 0x3ff;
			gpioregs->GPBDAT = 0x740;
			gpioregs->GPCDAT = 0x20;
			gpioregs->GPGDAT = 0xba2c;

		printf("\nINTMOD = %x\n", intregs->INTMOD);
		printf("INTMSK = %x\n", intregs->INTMSK);
		printf("INTSUBMSK = %x\n", intregs->INTSUBMSK);

		printf("\nGPBCON = %x\n", gpioregs->GPBCON);
		printf("GPBDAT = %x\n", gpioregs->GPBDAT);
		printf("GPCCON = %x\n", gpioregs->GPCCON);
		printf("GPCDAT = %x\n", gpioregs->GPCDAT);
		printf("GPGCON = %x\n", gpioregs->GPGCON);
		printf("GPGDAT = %x\n", gpioregs->GPGDAT);
/*
		printf("\n\n");
		printf("+---------------------------------------------+\n");
		printf("| S3C2440A USB Downloader ver R0.03 2004 Jan  |\n");
		printf("+---------------------------------------------+\n");
	//	printf("FCLK=%4.1fMHz,%s mode\n",FCLK/1000000.,mode);
		printf("USB: IN_ENDPOINT:1 OUT_ENDPOINT:3\n");
		printf("FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>\n");
		printf("NOTE: Power off/on or press the reset button for 1 sec\n");
		printf("	  in order to get a valid USB device address.\n");
		printf("\n");
*/
	}
Example #6
0
void usb_init(void)
{
	char *mode;
	int i;
	U8 key;
	U32 mpll_val, upll_val, divn_upll=0;
    extern int bBootFrmNORFlash(void);

    Port_Init();

    clk_powerregs = S3C24X0_GetBase_CLOCK_POWER();

    usbdevregs = S3C24X0_GetBase_USB_DEVICE();
    dmaregs = S3C24X0_GetBase_DMAS();

    udelay(100000);
#if 0	
	// USB device detection control
	rGPGCON &= ~(3<<24);
	rGPGCON |=  (1<<24); // output
	rGPGUP  |=  (1<<12); // pullup disable
	rGPGDAT |=  (1<<12); // output	
#endif

	//ChangeUPllValue(60,4,2);		// 48MHz
	//for(i=0; i<7; i++);
	//ChangeClockDivider(13,12);
	//ChangeMPllValue(97,1,2);		//296Mhz

	Isr_Init();


	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<3); // USBD is selected instead of USBH1 
	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<13); // USB port 1 is enabled.

//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

#if 0
	UsbdMain(); 
	MMU_Init(); //MMU should be reconfigured or turned off for the debugger, 
	//After downloading, MMU should be turned off for the MMU based program,such as WinCE.	
#else
//mike.arm9    MMU_EnableICache();  
	UsbdMain(); 
    udelay(100000);
    gpioregs->GPGDAT |= (1<<12);  /* enable USB Device, mike.arm9 */
    gpioregs->GPBDAT |= (1<<9);   /* enable USB Device, mike.arm9 */
    gpioregs->GPCDAT |= (1<<5);   /* enable USB Device, mike.arm9 */
#endif

#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif

	// CLKOUT0/1 select.
	//printf("CLKOUT0:MPLL in, CLKOUT1:RTC clock.\n");
	//Clk0_Enable(0);	// 0:MPLLin, 1:UPLL, 2:FCLK, 3:HCLK, 4:PCLK, 5:DCLK0
	//Clk1_Enable(2);	// 0:MPLLout, 1:UPLL, 2:RTC, 3:HCLK, 4:PCLK, 5:DCLK1	
//	Clk0_Disable();
//	Clk1_Disable();
	
	mpll_val = clk_powerregs->MPLLCON;
	upll_val = clk_powerregs->UPLLCON; 


    if (1) //(!bBootFrmNORFlash())
    {
    	printf("UPLLVal [M:%xh,P:%xh,S:%xh]\n", (upll_val&(0xff<<12))>>12,(upll_val&(0x3f<<4))>>4,(upll_val&0x3));
    	printf("MPLLVal [M:%xh,P:%xh,S:%xh]\n", (mpll_val&(0xff<<12))>>12,(mpll_val&(0x3f<<4))>>4,(mpll_val&0x3));
    	printf("CLKDIVN:%xh\n", clk_powerregs->CLKDIVN);

    	printf("\n\n");
    	printf("+---------------------------------------------+\n");
    	printf("| S3C2440A USB Downloader ver R0.03 2004 Jan  |\n");
    	printf("+---------------------------------------------+\n");
    //	printf("FCLK=%4.1fMHz,%s mode\n",FCLK/1000000.,mode); 
    	printf("USB: IN_ENDPOINT:1 OUT_ENDPOINT:3\n"); 
    	printf("FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>\n");
    	printf("NOTE: Power off/on or press the reset button for 1 sec\n");
    	printf("      in order to get a valid USB device address.\n");
    	printf("\n");
    }
Example #7
0
int main( void)
{

    int autoID,dispID,dispIndex;
    int timerval;
    U16 btnStat,oldStat;


    rGPACDH = rdGPACDH & ~(1<<5) | (0<<5); // RDATA_OEN : enable

    rGPHCON=rGPHCON&~(0xf<<26)|(0xa<<26);
    rMISCCR=rMISCCR&~((0x7<<8)|(0x7<<4))|(0x3<<8)|(0x2<<4);

    // test code start setting in option.h
    SetCLKDIV( Startup_ARMCLKdiv, Startup_PREdiv, Startup_HCLKdiv, Startup_PCLKdiv);
    SetMPLL( Startup_MDIV, Startup_PDIV, Startup_SDIV);
    SystemCLK(0);

    Isr_Init();
    MMU_Init();
    SPI_Init();

    Console();

    printf("\n\n***********TST-500_OTM1283+AUO5.7_720*1280 Test Program Ver 0.0***********\n");
    //printf("MPLL=%.2fMHz, ARMCLK=%.2fMHz (%d:%d:%d), HCLK=%.2fMHz, PCLK=%.2fMHz\n\n",
    //   		(float)MPLL/1000000,(float)ARMCLK/1000000,ARMCLKdiv+1,(ARMCLKdiv+1)*(HCLKdiv+1),(ARMCLKdiv+1)*(HCLKdiv+1)*(PCLKdiv+1),(float)HCLK/1000000,(float)PCLK/1000000);


    Init_SSD2805_SPI();	//2805 spi初始化,位于/Peripheral/Video/LCD/Display.c文件
    SetLcdPort(); 		//2443 RGB端口及相关寄存器配置,其中RGB参数位于Display.h文件

    SPI_READ_ID(0xb0);


    Key_Init();				//按键初始化

    dispID    = 0;
    dispIndex = 1;
    autoID    = 0;
    timerval  = 0;

    btnStat=0;
    oldStat=0;

    while(1)	//
    {

        if(dispIndex)
        {
            dispIndex = 0;

            switch(dispID)
            {

            case 0:
                disp_color(0xF800,0,0,XSIZE,YSIZE);
                break;	//显示R颜色
            case 1:
                disp_color(0x07E0,0,0,XSIZE,YSIZE);
                break;	//显示G颜色
            case 2:
                disp_color(0x001F,0,0,XSIZE,YSIZE);
                break;	//显示B颜色
            case 3:
                disp_9WB();
                break;
            case 4:
                disp_color_table();
                break;
            case 5:
                disp_gray();
                break;
            case 6:
                disp_color(0xffff,0,0,XSIZE,YSIZE);
                break;	//显示白色
            case 7:
                disp_color(0x0000,0,0,XSIZE,YSIZE);
                K9S1208_RdBmp(TFT_RAM1,TFT_SMC_BLK1,TFT_BmpSize);
                break;//把图片数据拷贝到内存,TFT_RAM1,TFT_SMC_BLK1定义在Display.h文件	break;//Delay(10);    	//显示黑色
            case 8:
                disp_bmp((U16 *)TFT_RAM1,0,0,XSIZE,YSIZE);
                K9S1208_RdBmp(TFT_RAM2,TFT_SMC_BLK2,TFT_BmpSize);
                break; 	//显示内存的图片的数据
            case 9:
                disp_bmp((U16 *)TFT_RAM2,0,0,XSIZE,YSIZE);
                K9S1208_RdBmp(TFT_RAM3,TFT_SMC_BLK3,TFT_BmpSize);
                break;	//显示内存的图片的数据
            case 10:
                disp_bmp((U16 *)TFT_RAM3,0,0,XSIZE,YSIZE);
                K9S1208_RdBmp(TFT_RAM4,TFT_SMC_BLK4,TFT_BmpSize);
                break;	//显示内存的图片的数据
            case 11:
                disp_bmp((U16 *)TFT_RAM4,0,0,XSIZE,YSIZE);
                break;
            }

            //	printf("\display id = %d\n",dispID);
            Delay_MS(400);
        }

        if(autoID)
        {
            timerval++;
            if(timerval>30)
            {
                timerval = 0;
                dispID++;
                if(dispID>BmpMAX) dispID=0;
                dispIndex = 1;
                //Init_SSD2805_SPI();
            }
        }

        btnStat = rGPJDAT;
        btnStat = (~btnStat)&0x0007;
        //printf("\ndisplay btn = 0x%x\n",btnStat);

        if(btnStat)
        {
            if(((btnStat&0x01)==0x01) && ((oldStat&0x01)==0x00))	//GPJ0自动手动切换
            {
                if(autoID) autoID = 0;
                else       autoID = 1;
            }

            if(((btnStat&0x02)==0x02) && ((oldStat&0x02)==0x00))	//GPJ1画面向前翻
            {
                dispID++;
                if(dispID>BmpMAX) dispID=0;
                dispIndex = 1;
                //Init_SSD2828();
            }

            if(((btnStat&0x04)==0x04) && ((oldStat&0x04)==0x00))	//GPJ2画面向后翻
            {
                //	dispID++;
                if(dispID>0) dispID--;
                else         dispID = BmpMAX;
                dispIndex = 1;
            }
            //	Delay_MS(100);
        }

        Delay_MS(50);						//延时,并且监视串口

        oldStat = btnStat;

    }
//--------------------------------------------------------------------------------------------


}