This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: LCD on EP7211


Hi Wilson,

The function below is all you should need to turn on the LCD controller. 
For the Alps display, you should define:

#define EP_LCD_WIDTH 640
#define EP_LCD_HEIGHT 240

Also make sure that LCD support was enabled in your eCos config before you 
built the library. I'm not sure what happens if it's not, but I suspect the 
memory allocation for the frame buffer will be screwed, which could easily 
explain why writing to that area hangs the system! Possibly c0000000 
mirrors 00000000 under that case, which means you've just trashed the 
vector table. Nasty :)


/*
	Enable display hardware.
*/
void GDI_Screen_On(void)
{
     cyg_int32 ctl_word = 0;

	// Set up EP7212 LCD controller
	*(volatile cyg_int32 *)PALLSW = 0x76543210;
	*(volatile cyg_int32 *)PALMSW = 0xFEDCBA98;

	// Set LCD controller for grayscale (4bpp) operation
	ctl_word = LCDCON_GSEN | LCDCON_GSMD;

     // Video buffer size
     ctl_word |= ((EP_LCD_WIDTH * EP_LCD_HEIGHT * 4) / 128 - 1) << 
LCDCON_BUFSIZ_S;

     // Line length
     ctl_word |= ((EP_LCD_WIDTH / 16) - 1) << LCDCON_LINE_LENGTH_S;

     // Pixel prescale
     ctl_word |= ((526628 / (EP_LCD_WIDTH * EP_LCD_HEIGHT)) - 1) << 
LCDCON_PIX_PRESCALE_S;

     // AC frequency bias
     ctl_word |= 0 << LCDCON_AC_PRESCALE_S;

	// Write control word
     *(volatile cyg_int32 *)LCDCON = ctl_word;

	#define LCD_DCDC      0x02
	#define LCD_ENABLE    0x04
	#define LCD_BACKLIGHT 0x08
	#define LCD_INIT (LCD_DCDC|LCD_ENABLE|LCD_BACKLIGHT)

	*(volatile cyg_uint8 *)PDDDR   = 0x40;      // 1's are inputs (backwards 
from A/B/E)
	*(volatile cyg_uint8 *)PDDR    = LCD_INIT;  // Enable video + backlight + 
DC-DC converter

	*(volatile cyg_uint8 *)FRBADDR = 0x0C;  // Highest order nibble of LCD 
frame address

	// Enable LCD controller
     *(volatile cyg_uint32 *)SYSCON1 |= SYSCON1_LCDEN;
}
=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]