From 347ac211c9bb0365d8a5c3a1b943cbd2856c4df3 Mon Sep 17 00:00:00 2001 From: reinelt Date: Wed, 18 Feb 2004 06:39:20 +0000 Subject: [lcd4linux @ 2004-02-18 06:39:20 by reinelt] T6963 driver for graphic displays finished git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@371 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- drv_T6963.c | 106 +++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 33 deletions(-) (limited to 'drv_T6963.c') diff --git a/drv_T6963.c b/drv_T6963.c index 2706805..5a0e6a7 100644 --- a/drv_T6963.c +++ b/drv_T6963.c @@ -1,4 +1,4 @@ -/* $Id: drv_T6963.c,v 1.1 2004/02/15 21:43:43 reinelt Exp $ +/* $Id: drv_T6963.c,v 1.2 2004/02/18 06:39:20 reinelt Exp $ * * new style driver for T6963-based displays * @@ -23,6 +23,9 @@ * * * $Log: drv_T6963.c,v $ + * Revision 1.2 2004/02/18 06:39:20 reinelt + * T6963 driver for graphic displays finished + * * Revision 1.1 2004/02/15 21:43:43 reinelt * T6963 driver nearly finished * framework for graphic displays done @@ -81,6 +84,8 @@ static unsigned char SIGNAL_CD; static unsigned char SIGNAL_RD; static unsigned char SIGNAL_WR; +unsigned char *Buffer1, *Buffer2; + // Fixme: static int bug=0; @@ -261,14 +266,14 @@ static void drv_T6_send_word (unsigned char cmd, unsigned short data) } -static void drv_T6_memset(unsigned short addr, unsigned char data, int len) +static void drv_T6_clear(unsigned short addr, int len) { int i; drv_T6_send_word (0x24, addr); // Set Adress Pointer drv_T6_write_cmd(0xb0); // Set Data Auto Write for (i=0; i4) break; + } else { + e=0; + } + } + memcpy (Buffer2+j, Buffer1+j, i-j-e+1); + drv_T6_copy (j, Buffer1+j, i-j-e+1); + // sleep (1); + } +} + static int drv_T6_start (char *section) { char *model, *s; - int rows, cols; + int rows, TROWS, TCOLS; model=cfg_get(section, "Model", "generic"); if (model!=NULL && *model!='\0') { @@ -319,6 +361,7 @@ static int drv_T6_start (char *section) return -1; } + // read display size from config s=cfg_get(section, "Size", NULL); if (s==NULL || *s=='\0') { error ("%s: no '%s.Size' entry from %s", Name, section, cfg_source()); @@ -332,19 +375,25 @@ static int drv_T6_start (char *section) return -1; } - s=cfg_get(section, "Font", "6x8"); - if (s==NULL || *s=='\0') { - error ("%s: no '%s.Font' entry from %s", Name, section, cfg_source()); + TROWS=DROWS/8; // text rows, assume 6x8 font + TCOLS=DCOLS/6; // text cols, assume 6x8 font + + Buffer1=malloc(DCOLS*TROWS); + if (Buffer1==NULL) { + error ("%s: framebuffer #1 could not be allocated: malloc() failed", Name); return -1; } - XRES = -1; - YRES = -1; - if (sscanf(s, "%dx%d", &XRES, &YRES)!=2 || XRES<1 || YRES<1) { - error ("%s: bad Font '%s' from %s", Name, s, cfg_source()); + Buffer2=malloc(DCOLS*TROWS); + if (Buffer2==NULL) { + error ("%s: framebuffer #2 could not be allocated: malloc() failed", Name); return -1; } + + memset(Buffer1,0,TCOLS*DROWS*sizeof(*Buffer1)); + memset(Buffer2,0,TCOLS*DROWS*sizeof(*Buffer2)); + if (drv_generic_parport_open(section, Name) != 0) { error ("%s: could not initialize parallel port!", Name); return -1; @@ -362,15 +411,12 @@ static int drv_T6_start (char *section) drv_generic_parport_direction (0); // initialize display - - rows=DROWS/8; // text rows, assume 6x8 font - cols=DCOLS/6; // text cols, assume 6x8 font drv_T6_send_word (0x40, 0x0000); // Set Text Home Address - drv_T6_send_word (0x41, cols); // Set Text Area + drv_T6_send_word (0x41, TCOLS); // Set Text Area drv_T6_send_word (0x42, 0x0200); // Set Graphic Home Address - drv_T6_send_word (0x43, cols); // Set Graphic Area + drv_T6_send_word (0x43, TCOLS); // Set Graphic Area drv_T6_write_cmd (0x80); // Mode Set: OR mode, Internal CG RAM mode drv_T6_send_word (0x22, 0x0002); // Set Offset Register @@ -382,17 +428,17 @@ static int drv_T6_start (char *section) // clear display // upper half - if (rows>8) rows=8; - drv_T6_memset(0x0000, 0, cols*rows); // clear text area - drv_T6_memset(0x0200, 0, cols*rows*8); // clear graphic area + rows=TROWS>8?8:TROWS; + drv_T6_clear(0x0000, TCOLS*rows); // clear text area + drv_T6_clear(0x0200, TCOLS*rows*8); // clear graphic area // lower half - if (DROWS>8*8) { - rows=DROWS/8-8; - drv_T6_memset(0x8000, 0, cols*rows); // clear text area #2 - drv_T6_memset(0x8200, 0, cols*rows*8); // clear graphic area #2 + if (TROWS>8) { + rows=TROWS-8; + drv_T6_clear(0x8000, TCOLS*rows); // clear text area #2 + drv_T6_clear(0x8200, TCOLS*rows*8); // clear graphic area #2 } - + return 0; } @@ -437,14 +483,8 @@ int drv_T6_init (char *section) WIDGET_CLASS wc; int ret; - // display preferences - GOTO_COST = 2; // number of bytes a goto command requires - // real worker functions - // Fixme: which one? - // drv_generic_text_real_write = drv_T6_write; - // drv_generic_text_real_goto = drv_T6_goto; - // drv_generic_text_real_defchar = drv_T6_defchar; + drv_generic_graphic_real_blit = drv_T6_blit; // start display if ((ret=drv_T6_start (section))!=0) -- cgit v1.2.3