public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Lewin A.R.W. Edwards" <larwe@larwe.com>
To: "Wilson Kwan" <wilson@kinesphere.com>
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] LCD on EP7211
Date: Wed, 31 Jan 2001 15:19:00 -0000	[thread overview]
Message-ID: <4.3.2.7.2.20010131181422.00b21dd0@larwe.com> (raw)
In-Reply-To: <006c01c08bdb$2c1caf70$0b02a8c0@r2d2>

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."

  reply	other threads:[~2001-01-31 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-31 14:43 Wilson Kwan
2001-01-31 14:49 ` Lewin A.R.W. Edwards
2001-01-31 15:10   ` Wilson Kwan
2001-01-31 15:19     ` Lewin A.R.W. Edwards [this message]
2001-01-31 16:20       ` Wilson Kwan
2001-01-31 19:01         ` Lewin A.R.W. Edwards
2001-02-01 22:26           ` Wilson Kwan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4.3.2.7.2.20010131181422.00b21dd0@larwe.com \
    --to=larwe@larwe.com \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=wilson@kinesphere.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).