ok6410 LCD Bare-metal Example

Source: Internet
Author: User

/****************************************** Experiment Step 1. Configure the PIN function, set its GPI, GPJ pin to VD data output mode, and the GPJ after several settings to the LCD clock output    ; 2. Set the LCD timing value to initialize the timing value.    (1) Initialization timing required: VSPW, VBPD, Lineval, VFPD, HSPW, HBPB, Hozval, HFPD, Clkval (find the initialization sequence diagram in the LCD chip manual and find the corresponding timing parameters)    (2) Find the appropriate registers to initialize these timing signals (locate the appropriate registers in the chip manual and initialize them) (3) combine the LCD chip manual and timing diagram to set the corresponding parameters 3. Frame Cache Initialization (frame buffering refers to the CMA that is created in memory to store image data space and is communicated to the LCD. ) (1) Set the Register for the window size (2) to tell the ADM register the memory start address and size 4. Miscellaneous initialization () 5. Draw a dot 6. Draw a line 7. Plot QQ Figure 8. Monochrome Display ******************************************** **************/    #defineGpicon (* (volatile unsigned long *) 0x7f008100)#defineGpjcon (* (volatile unsigned long *) 0x7f008120)#defineMofpcon (* (volatile unsigned long *) 0x7410800c)#defineSpcon (* (volatile unsigned long *) 0x7f0081a0)#defineVIDCON0 (* (volatile unsigned long *) 0x77100000)#defineVIDCON1 (* (volatile unsigned long *) 0x77100004)#defineVIDTCON0 (* (volatile unsigned long *) 0x77100010)#defineVIDTCON1 (* (volatile unsigned long *) 0x77100014)#defineVIDTCON2 (* (volatile unsigned long *) 0x77100018)#defineWINCON0 (* (volatile unsigned long *) 0x77100020)#defineVIDOSD0A (* (volatile unsigned long *) 0x77100040)#defineVIDOSD0B (* (volatile unsigned long *) 0x77100044)#defineVIDOSD0C (* (volatile unsigned long *) 0x77100048)#defineVIDW00ADD0B0 (* (volatile unsigned long *) 0x771000a0)#defineVIDW00ADD1B0 (* (volatile unsigned long *) 0x771000d0)#defineVSPW 9#defineVBPD 1#defineLineval 271#defineVFPD 1//#define CLKVAL 4//ten = 100/((clkval+1) * *)#defineHSPW 40#defineHBPD 1#defineHozval 479#defineHFPD 1#defineLEFTTOPX 0#defineLefttopy 0#defineRightbotx 479#defineRightboty 271#defineFrame_buffer 0x54000000externUnsignedCharbmp[135300];/*when exporting, remember not to include the image header data!!!!!! */voidLcd_port_init () {Gpicon=0xaaaaaaaa; Gpjcon=0xaaaaaaaa;}voidLcd_contral_init () {Mofpcon=0<<3;/*this one must be set to 0*/Spcon=0x01;/*must be set to 1 in RGB mode*/VIDCON0= ( -<<6)| (1<<4)| (3<<0);/*Disable video output and control signal Select Video Clock source determine values for VCLK and clkval[7:0] [vclk= video clock source/(clkval+1)]*/VIDCON1= (1<<5)| (1<<6); VIDTCON0= (vbpd<< -)| (vfpd<<8)| (vspw<<0);/*Clock Initialization*/VIDTCON1= (hbpd<< -)| (hfpd<<8)| (hspw<<0); VIDTCON2= (lineval<< One)| (hozval<<0); WINCON0= (1<< -)| (0xb<<2)| (1<<0);/*Disable video output and video control signal Select BPP Image window Mode (24BPP) Open half-word exchange control bit*/vidosd0a= (lefttopx<< One)| (lefttopy<<0);/*set the location of the video window 0*/vidosd0b= (rightbotx<< One)| (rightboty<<0); VIDOSD0C= (lineval+1)| (hozval+1);/*set the size of the video window 0*/vidw00add0b0= Frame_buffer;/*set the cache start address*/vidw00add1b0= ((frame_buffer+ (hozval+1)*4* (lineval+1))) & (0xFFFFFF);/*Set buffer end address???? */}voidLcd_init () {lcd_port_init ();        Lcd_contral_init (); //turn on the LCD power}voidPointintRowintColintcolor) {    intred, green, blue; unsignedLong*point = (unsignedLong*) Frame_buffer; Red= (color>> -) &0xFF; Green= (color>>8) &0xFF; Blue= (color>>0) &0xFF; * (Point + row*480+ col) = (green<< -) | (blue<< -) | Red/*I don't know why I tried it.*/}voidPaint_bmp (ConstUnsignedCharbmp[]) {    inti,j; unsignedChar*p = (unsignedChar*) BMP; intBlue, green,red; intcolor;  for(i=0;i<205; i++)/*must be the same size as the exported!!! */    {         for(j=0;j< -; j + +) {Red= *p++;/*must be identical to the exported color order!!!!!! */Blue= *p++; Green= *p++; Color= (red<< -)| (green<<8)| (blue<<0);        Point (I,j,color); }    }}voidlcd_test () {inty;  for(y=1;y<470; y++) Point ( theY0xFF0000); Paint_bmp (BMP);}

ok6410 LCD Bare-metal Example

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.