From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Lewin A.R.W. Edwards" To: "Wilson Kwan" Cc: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] LCD on EP7211 Date: Wed, 31 Jan 2001 15:19:00 -0000 Message-id: <4.3.2.7.2.20010131181422.00b21dd0@larwe.com> References: <4.3.2.7.2.20010131174437.00aa1100@larwe.com> <006c01c08bdb$2c1caf70$0b02a8c0@r2d2> X-SW-Source: 2001-01/msg00510.html 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."