- From: james.ousley AT setel.com (James Ousley)
- Subject: [Lcdproc] Re: How to compile this driver?
- Date: Wed Nov 23 21:39:03 2005
>
Send LCDproc mailing list submissions to
>
=09lcdproc AT lists.omnipotent.net
>
>
To subscribe or unsubscribe via the World Wide Web, visit
>
=09http://lists.omnipotent.net/mailman/listinfo/lcdproc
>
or, via email, send a message with subject or body 'help' to
>
=09lcdproc-request AT lists.omnipotent.net
>
>
You can reach the person managing the list at
>
=09lcdproc-admin AT lists.omnipotent.net
>
>
When replying, please edit your Subject line so it is more specific
>
than "Re: Contents of LCDproc digest..."
>
>
>
Today's Topics:
>
>
1. How to compile this driver? (James Ousley)
>
2. Re: How to compile this driver? (Romuald Conty)
>
>
--__--__--
>
>
Message: 1
>
Date: Tue, 22 Nov 2005 17:31:19 -0500
>
From: James Ousley
>
<james.ousley AT setel.com>
>
To:
>
lcdproc AT lists.omnipotent.net
>
Reply-to:
>
james.ousley AT setel.com
>
Subject: [Lcdproc] How to compile this driver?
>
>
=09I have located a driver for my tyan 1U server (GS series) that uses an
>
LCD panel via com2. I have smacked this code around trying to get it to
>
compile but have yet to get it functioning. I even overwrote the
>
MtxOrb.c and MtxOrb.h files with these and modified them accordingly to
>
get the make to complete without errors, yet LCDd aborts with No output
>
driver.
>
=09Looking at this driver, what version of LCDproc and how do I compile it
>
for that version?
>
>
tyan_lcdm.h
>
/* This is the LCDproc driver header for tyan lcd module (tyan Barebone
>
GS series)
>
>
Author:
>
yhlu AT tyan.com
>
>
Copyright (C) 2004 Tyan Corp
>
>
This program is free software; you can redistribute it and/or modify
>
it under the terms of the GNU General Public License as published by
>
the Free Software Foundation; either version 2 of the License, or
>
any later version.
>
>
This program is distributed in the hope that it will be useful,
>
but WITHOUT ANY WARRANTY; without even the implied warranty of
>
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>
GNU General Public License for more details.
>
>
You should have received a copy of the GNU General Public License
>
along with this program; if not, write to the Free Software
>
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>
*/
>
#ifndef TYAN_LCDM_H
>
#define TYAN_LCDM_H
>
>
#include "lcd.h"
>
>
#define DEFAULT_CELL_WIDTH 5
>
#define DEFAULT_CELL_HEIGHT 8
>
#define DEFAULT_DEVICE "/dev/lcd"
>
#define DEFAULT_SPEED B9600
>
#define DEFAULT_SIZE "16x2"
>
>
MODULE_EXPORT int tyan_lcdm_init (Driver * drvthis, char *device);
>
MODULE_EXPORT void tyan_lcdm_close (Driver * drvthis);
>
MODULE_EXPORT int tyan_lcdm_width (Driver * drvthis);
>
MODULE_EXPORT int tyan_lcdm_height (Driver * drvthis);
>
MODULE_EXPORT void tyan_lcdm_clear (Driver * drvthis);
>
MODULE_EXPORT void tyan_lcdm_flush (Driver * drvthis);
>
MODULE_EXPORT void tyan_lcdm_string (Driver * drvthis, int x, int y, char
>
string[]);
>
MODULE_EXPORT void tyan_lcdm_chr (Driver * drvthis, int x, int y, char c);
>
>
MODULE_EXPORT void tyan_lcdm_vbar (Driver * drvthis, int x, int y, int
>
len, int promille, int options);
>
MODULE_EXPORT void tyan_lcdm_hbar (Driver * drvthis, int x, int y, int
>
len, int promille, int options);
>
MODULE_EXPORT void tyan_lcdm_num (Driver * drvthis, int x, int num);
>
MODULE_EXPORT int tyan_lcdm_icon(Driver * drvthis, int x, int y, int
>
icon);
>
>
MODULE_EXPORT void tyan_lcdm_set_char (Driver * drvthis, int n, char
>
*dat);
>
>
MODULE_EXPORT void tyan_lcdm_backlight (Driver * drvthis, int on);
>
>
#endif
>
>
>
>
>
tyan_lcdm.c
>
/* This is the LCDproc driver for tyan lcd module (tyan Barebone GS
>
series)
>
>
Author:
>
yhlu AT tyan.com
>
>
Copyright (C) 2004 Tyan Corp
>
>
This program is free software; you can redistribute it and/or modify
>
it under the terms of the GNU General Public License as published by
>
the Free Software Foundation; either version 2 of the License, or
>
any later version.
>
>
This program is distributed in the hope that it will be useful,
>
but WITHOUT ANY WARRANTY; without even the implied warranty of
>
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>
GNU General Public License for more details.
>
>
You should have received a copy of the GNU General Public License
>
along with this program; if not, write to the Free Software
>
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>
*/
>
>
>
/*
>
* Driver status
>
* 02/04/2004: Working driver
>
*
>
*
>
*
>
*/
>
>
#include <stdlib.h>
>
#include <stdio.h>
>
#include <unistd.h>
>
#include <termios.h>
>
#include <fcntl.h>
>
#include <string.h>
>
#include <errno.h>
>
#include <syslog.h>
>
>
#ifdef HAVE_CONFIG_H
>
# include "config.h"
>
#endif
>
>
#include "lcd.h"
>
#include "tyan_lcdm.h"
>
#include "report.h"
>
#include "lcd_lib.h"
>
>
#define TYAN_LCDM_KEY_ENTER 0xf2
>
#define TYAN_LCDM_KEY_ESCAPE 0xf3
>
#define TYAN_LCDM_KEY_RIGHT 0xf5
>
#define TYAN_LCDM_KEY_LEFT 0xf6
>
#define TYAN_LCDM_KEY_UP 0xf7
>
#define TYAN_LCDM_KEY_DOWN 0xf8
>
>
#define TYAN_LCDM_CMD_BEGIN 0xf1
>
#define TYAN_LCDM_CMD_END 0xf2
>
>
>
>
static int custom =3D 0;
>
typedef enum {
>
=09hbar =3D 1,
>
=09vbar =3D 2,
>
=09cust =3D 3,
>
} custom_type;
>
>
static int fd;
>
static char *framebuf =3D NULL;
>
static char *old =3D NULL;
>
static int width =3D 0;
>
static int height =3D 0;
>
static int cellwidth =3D DEFAULT_CELL_WIDTH;
>
static int cellheight =3D DEFAULT_CELL_HEIGHT;
>
>
/* Vars for the server core */
>
MODULE_EXPORT char *api_version =3D API_VERSION;
>
MODULE_EXPORT int stay_in_foreground =3D 0;
>
MODULE_EXPORT int supports_multiple =3D 0;
>
MODULE_EXPORT char *symbol_prefix =3D "tyan_lcdm_";
>
>
/* Internal functions */
>
static void tyan_lcdm_init_vbar (Driver * drvthis);
>
static void tyan_lcdm_init_hbar (Driver * drvthis);
>
static void tyan_lcdm_switch_mode ();
>
static void tyan_lcdm_hardware_clear (Driver * drvthis);
>
>
static void tyan_lcdm_set_rampos(unsigned char pos);
>
static void tyan_lcdm_write_str(char *str,unsigned char start_addr, int
>
length);
>
#if 0
>
static void tyan_lcdm_set_cursor(unsigned char start_addr, int pos);
>
#endif
>
static unsigned char tyan_lcdm_read_key();
>
>
/*
>
* Opens com port and sets baud correctly...
>
*/
>
MODULE_EXPORT int
>
tyan_lcdm_init (Driver * drvthis, char *args)
>
{
>
=09struct termios portset;
>
=09int tmp, w, h;
>
>
=09char device[200] =3D DEFAULT_DEVICE;
>
=09int speed =3D DEFAULT_SPEED;
>
=09char size[200] =3D DEFAULT_SIZE;
>
>
=09debug(RPT_INFO, "tyan_lcdm: init(%p,%s)", drvthis, args );
>
>
=09/* Read config file */
>
=09/* Which serial device should be used */
>
=09strncpy(device, drvthis->config_get_string ( drvthis->name , "Device" ,
>
0 , DEFAULT_DEVICE),sizeof(device));
>
=09device[sizeof(device)-1]=3D0;
>
=09debug (RPT_INFO,"tyan_lcdm: Using device: %s", device);
>
>
=09/* Which size */
>
=09strncpy(size, drvthis->config_get_string ( drvthis->name , "Size" , 0 ,
>
DEFAULT_SIZE),sizeof(size));
>
=09size[sizeof(size)-1]=3D0;
>
=09if( sscanf(size , "%dx%d", &w, &h ) !=3D 2
>
=09|| (w <=3D 0) || (w > LCD_MAX_WIDTH)
>
=09|| (h <=3D 0) || (h > LCD_MAX_HEIGHT)) {
>
=09=09report (RPT_WARNING, "tyan_lcdm_init: Cannot read size: %s. Using
>
default value.\n", size);
>
=09=09sscanf( DEFAULT_SIZE , "%dx%d", &w, &h );
>
=09} else {
>
=09=09width =3D w;
>
=09=09height =3D h;
>
=09}
>
>
=09/* Which speed */
>
=09tmp =3D drvthis->config_get_int ( drvthis->name , "Speed" , 0 ,
>
DEFAULT_SPEED);
>
=09if (tmp =3D=3D 4800) speed =3D B4800;
>
=09else if (tmp =3D=3D 9600) speed =3D B9600;
>
=09else { report (RPT_WARNING, "tyan_lcdm_init: Speed must be 4800 or 9600.
>
Using default value.\n", speed);
>
=09}
>
>
=09/* Set up io port correctly, and open it... */
>
=09debug( RPT_DEBUG, "tyan_lcdm: Opening serial device: %s", device);
>
>
fd =3D open (device, O_RDWR | O_NOCTTY | O_NDELAY);
>
>
=09if (fd =3D=3D -1) {
>
=09=09report (RPT_ERR, "tyan_lcdm_init: failed (%s)\n", strerror (errno));
>
=09=09return -1;
>
=09}
>
>
=09tcgetattr (fd, &portset);
>
>
=09/* We use RAW mode */
>
#ifdef HAVE_CFMAKERAW
>
=09=09/* The easy way */
>
=09=09cfmakeraw( &portset );
>
#else
>
=09=09/* The hard way */
>
=09portset.c_cflag =3D CS8 | CREAD | CLOCAL;
>
=09portset.c_iflag =3D IXON | IXOFF | IGNBRK | IGNCR;
>
=09portset.c_oflag &=3D ~ONLCR;
>
=09portset.c_lflag =3D 0;
>
=09portset.c_cc[VMIN] =3D 1;
>
=09portset.c_cc[VTIME] =3D 0;
>
>
#endif
>
>
=09/* Set port speed */
>
=09cfsetospeed (&portset, speed);
>
=09cfsetispeed (&portset, speed);
>
>
=09/* Do it... */
>
=09tcsetattr (fd, TCSANOW, &portset);
>
>
=09/* Make sure the frame buffer is there... */
>
=09framebuf =3D (unsigned char *) malloc (width * height);
>
=09memset (framebuf, ' ', width * height);
>
>
=09/* Set display-specific stuff.. */
>
=09tyan_lcdm_switch_mode ();
>
>
=09report (RPT_DEBUG, "tyan_lcdm_init: done\n");
>
>
=09return 0;
>
}
>
>
/*
>
* Clean-up
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_close (Driver * drvthis)
>
{
>
=09close (fd);
>
>
=09if(framebuf) free (framebuf);
>
=09framebuf =3D NULL;
>
>
=09if(old) free (old);
>
=09old =3D NULL;
>
}
>
>
/*
>
* Returns the display width
>
*/
>
MODULE_EXPORT int
>
tyan_lcdm_width (Driver *drvthis)
>
{
>
=09return width;
>
}
>
>
/*
>
* Returns the display height
>
*/
>
MODULE_EXPORT int
>
tyan_lcdm_height (Driver *drvthis)
>
{
>
=09return height;
>
}
>
>
/*
>
* Flushes all output to the lcd...
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_flush (Driver * drvthis)
>
{
>
=09int i;
>
=09char *xp, *xq;
>
/*
>
* We don't use delta update yet.
>
* It is possible but not easy, we can only update a line, full or
>
begining.
>
*/
>
=09if (old=3D=3DNULL) {
>
=09=09old =3D (unsigned char *) malloc (width * height);
>
=09=09memset (old, ' ', width * height);
>
=09=09tyan_lcdm_hardware_clear (drvthis);
>
=09}
>
>
xp =3D framebuf;
>
xq =3D old;
>
>
for (i=3D0; i<width; i++) {
>
=09if (*xp !=3D *xq) {
>
=09=09tyan_lcdm_write_str(framebuf,0x80,16);
>
=09=09memcpy(old, framebuf, width);
>
=09=09break;
>
=09=09}
>
=09xp++; xq++;
>
=09}
>
>
xp =3D &framebuf[width];
>
xq =3D &old[width];
>
>
for (i=3D0; i<width; i++) {
>
=09if (*xp !=3D *xq) {
>
=09=09tyan_lcdm_write_str(&framebuf[width],0xc0,16);
>
=09=09memcpy(&old[width], &framebuf[width], width);
>
=09=09break;
>
=09=09}
>
=09xp++; xq++;
>
=09}
>
>
}
>
>
/*
>
* Return one char from the KeyRing
>
*/
>
MODULE_EXPORT char *
>
tyan_lcdm_get_key (Driver *drvthis)
>
{
>
unsigned char akey;
>
>
=09akey =3D tyan_lcdm_read_key();
>
>
switch(akey) {
>
case TYAN_LCDM_KEY_LEFT:
>
return "Left";
>
break;
>
case TYAN_LCDM_KEY_UP:
>
return "Up";
>
break;
>
case TYAN_LCDM_KEY_DOWN:
>
return "Down";
>
break;
>
case TYAN_LCDM_KEY_RIGHT:
>
return "Right";
>
break;
>
case TYAN_LCDM_KEY_ENTER:
>
return "Enter";
>
break;
>
case TYAN_LCDM_KEY_ESCAPE:
>
return "Escape";
>
break;
>
default:
>
report( RPT_INFO, "tyan_lcdm: Untreated key
>
0x%2x", akey);
>
return NULL;
>
break;
>
}
>
}
>
>
>
/*
>
* Prints a character on the lcd display, at position (x,y).
>
* The upper-left is (1,1), and the lower right should be (16,2).
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_chr (Driver * drvthis, int x, int y, char c)
>
{
>
=09y--;
>
=09x--;
>
>
=09framebuf[(y * width) + x] =3D c;
>
}
>
>
/*
>
* Sets the backlight on or off.
>
* The hardware support any value between 0 and 100.
>
* Need to find out if we have support for intermediate value.
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_backlight (Driver * drvthis, int on)
>
{
>
}
>
>
/*
>
* switch mode()
>
*/
>
static void
>
tyan_lcdm_switch_mode (Driver * drvthis)
>
{
>
=09char lcdcmd[4];
>
=09//set os selection
>
=09lcdcmd[0]=3DTYAN_LCDM_CMD_BEGIN;
>
=09lcdcmd[1]=3D0x73;
>
=09lcdcmd[2]=3D0x01;
>
=09lcdcmd[3]=3DTYAN_LCDM_CMD_END;
>
=09write(fd,lcdcmd,4);
>
=09sleep(1);
>
>
=09//send "LCD Ready" cmd
>
=09lcdcmd[1]=3D0x6c;
>
=09lcdcmd[2]=3DTYAN_LCDM_CMD_END;
>
=09write(fd,lcdcmd,3);
>
=09sleep(1);
>
>
}
>
>
>
>
/*
>
* Sets up for vertical bars.
>
*/
>
static void
>
tyan_lcdm_init_vbar (Driver * drvthis)
>
{
>
=09char a[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
=09char b[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
=09char c[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
=09char d[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
=09char e[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
=09char f[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
=09char g[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
>
=09if (custom !=3D vbar) {
>
=09//=09printf("+++ vbar +++\n");
>
=09=09tyan_lcdm_set_char (drvthis, 1, a);
>
=09=09tyan_lcdm_set_char (drvthis, 2, b);
>
=09=09tyan_lcdm_set_char (drvthis, 3, c);
>
=09=09tyan_lcdm_set_char (drvthis, 4, d);
>
=09=09tyan_lcdm_set_char (drvthis, 5, e);
>
=09=09tyan_lcdm_set_char (drvthis, 6, f);
>
=09=09tyan_lcdm_set_char (drvthis, 7, g);
>
=09=09custom =3D vbar;
>
=09}
>
}
>
>
/*
>
* Inits horizontal bars...
>
*/
>
static void
>
tyan_lcdm_init_hbar (Driver * drvthis)
>
{
>
>
=09char a[] =3D {
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09=090, 0, 0, 0, 0,
>
=09};
>
=09char b[] =3D {
>
=09=091, 0, 0, 0, 0,
>
=09=091, 0, 0, 0, 0,
>
=09=091, 0, 0, 0, 0,
>
=09=091, 0, 0, 0, 0,
>
=09=091, 0, 0, 0, 0,
>
=09=091, 0, 0, 0, 0,
>
=09=091, 0, 0, 0, 0,
>
=09=091, 0, 0, 0, 0,
>
=09};
>
=09char c[] =3D {
>
=09=091, 1, 0, 0, 0,
>
=09=091, 1, 0, 0, 0,
>
=09=091, 1, 0, 0, 0,
>
=09=091, 1, 0, 0, 0,
>
=09=091, 1, 0, 0, 0,
>
=09=091, 1, 0, 0, 0,
>
=09=091, 1, 0, 0, 0,
>
=09=091, 1, 0, 0, 0,
>
=09};
>
=09char d[] =3D {
>
=09=091, 1, 1, 0, 0,
>
=09=091, 1, 1, 0, 0,
>
=09=091, 1, 1, 0, 0,
>
=09=091, 1, 1, 0, 0,
>
=09=091, 1, 1, 0, 0,
>
=09=091, 1, 1, 0, 0,
>
=09=091, 1, 1, 0, 0,
>
=09=091, 1, 1, 0, 0,
>
=09};
>
=09char e[] =3D {
>
=09=091, 1, 1, 1, 0,
>
=09=091, 1, 1, 1, 0,
>
=09=091, 1, 1, 1, 0,
>
=09=091, 1, 1, 1, 0,
>
=09=091, 1, 1, 1, 0,
>
=09=091, 1, 1, 1, 0,
>
=09=091, 1, 1, 1, 0,
>
=09=091, 1, 1, 1, 0,
>
=09};
>
=09char f[] =3D {
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09=091, 1, 1, 1, 1,
>
=09};
>
>
=09if (custom !=3D hbar) {
>
=09=09tyan_lcdm_set_char (drvthis, 1, a);
>
=09=09tyan_lcdm_set_char (drvthis, 2, b);
>
=09=09tyan_lcdm_set_char (drvthis, 3, c);
>
=09=09tyan_lcdm_set_char (drvthis, 4, d);
>
=09=09tyan_lcdm_set_char (drvthis, 5, e);
>
=09=09tyan_lcdm_set_char (drvthis, 6, f);
>
=09=09custom =3D hbar;
>
=09}
>
}
>
>
>
/*
>
* Draws a vertical bar...
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_vbar (Driver * drvthis, int x, int y, int len, int promille,
>
int options)
>
{
>
/* x and y are the start position of the bar.
>
* The bar by default grows in the 'up' direction
>
* (other direction not yet implemented).
>
* len is the number of characters that the bar is long at 100%
>
* promille is the number of promilles (0..1000) that the bar should be
>
filled.
>
*/
>
>
=09tyan_lcdm_init_vbar(drvthis);
>
>
=09lib_vbar_static(drvthis, x, y, len, promille, options, cellheight, 0);
>
}
>
>
>
/*
>
* Draws a horizontal bar to the right.
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_hbar (Driver * drvthis, int x, int y, int len, int promille,
>
int options)
>
{
>
/* x and y are the start position of the bar.
>
* The bar by default grows in the 'right' direction
>
* (other direction not yet implemented).
>
* len is the number of characters that the bar is long at 100%
>
* promille is the number of promilles (0..1000) that the bar should be
>
filled.
>
*/
>
>
=09tyan_lcdm_init_hbar(drvthis);
>
>
=09lib_hbar_static(drvthis, x, y, len, promille, options, cellwidth, 0);
>
}
>
>
>
/*
>
* Writes a big number.
>
* This is not supported on 633 because we only have 2 lines...
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_num (Driver * drvthis, int x, int num)
>
{
>
/*
>
=09char out[5];
>
=09snprintf (out, sizeof(out), "%c%c%c", 28, x, num);
>
=09write (fd, out, 3);
>
*/
>
}
>
>
/*
>
* Sets a custom character from 0-7...
>
*
>
* For input, values > 0 mean "on" and values <=3D 0 are "off".
>
*
>
* The input is just an array of characters...
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_set_char (Driver * drvthis, int n, char *dat)
>
{
>
=09char out[8];
>
=09int row, col;
>
=09int letter;
>
>
=09if (n < 0 || n > 7)
>
=09=09return;
>
=09if (!dat)
>
=09=09return;
>
>
=09for (row =3D 0; row < cellheight; row++) {
>
=09=09letter =3D 0;
>
=09=09for (col =3D 0; col < cellwidth; col++) {
>
=09=09=09letter <<=3D 1;
>
=09=09=09letter |=3D (dat[(row * cellwidth) + col] > 0);
>
=09=09/* I should remove that debug code. */
>
=09=09//=09if (dat[(row * cellheight) + col] =3D=3D 0) printf(".");
>
=09=09//=09if (dat[(row * cellheight) + col] =3D=3D 1) printf("+");
>
=09=09//=09if (dat[(row * cellheight) + col] =3D=3D 2) printf("x");
>
=09=09//=09if (dat[(row * cellheight) + col] =3D=3D 3) printf("*");
>
=09=09//=09printf("'%1d'", dat[(row * cellwidth) + col]);
>
=09=09//=09printf("%3d ", letter);
>
=09=09}
>
=09=09out[row+1]=3Dletter;
>
=09//=09printf(": %d\n", letter);
>
=09}
>
=09tyan_lcdm_write_str(out,(unsigned char)(0x40+n*8),8);
>
}
>
>
/*
>
* Places an icon on screen
>
*/
>
MODULE_EXPORT int
>
tyan_lcdm_icon (Driver * drvthis, int x, int y, int icon)
>
{
>
=09char icons[8][5 * 8] =3D {
>
=09/* Empty Heart */
>
=09=09{
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 1, 0, 0, 0, 1,
>
=09=09 1, 1, 0, 1, 1,
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 },
>
=09/* Filled Heart */
>
=09=09{
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 0, 1, 0, 1, 0,
>
=09=09 0, 1, 1, 1, 0,
>
=09=09 0, 1, 1, 1, 0,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 1, 1, 0, 1, 1,
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 },
>
=09/* arrow_up */
>
=09=09{
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 1, 1, 1, 0,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 },
>
=09/* arrow_down */
>
=09=09{
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 0, 1, 1, 1, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 },
>
=09/* checkbox_off */
>
=09=09{
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 1, 0, 0, 0, 1,
>
=09=09 1, 0, 0, 0, 1,
>
=09=09 1, 0, 0, 0, 1,
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 },
>
=09/* checkbox_on */
>
=09=09{
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 0, 0, 1, 0, 0,
>
=09=09 1, 1, 1, 0, 1,
>
=09=09 1, 0, 1, 1, 0,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 1, 0, 0, 0, 1,
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 },
>
=09/* checkbox_gray */
>
=09=09{
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 1, 1, 0, 1, 1,
>
=09=09 1, 0, 1, 0, 1,
>
=09=09 1, 1, 1, 1, 1,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 },
>
=09 /* Ellipsis */
>
=09=09{
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 0, 0, 0, 0,
>
=09=09 0, 1, 0, 1, 0,
>
=09=09 },
>
=09};
>
>
=09/* Yes we know, this is a VERY BAD implementation :-) */
>
=09switch( icon ) {
>
=09=09case ICON_BLOCK_FILLED:
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 255 );
>
=09=09=09break;
>
=09=09case ICON_HEART_FILLED:
>
=09=09 custom =3D cust;
>
=09=09=09tyan_lcdm_set_char( drvthis, 0, icons[1] );
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 0 );
>
=09=09=09break;
>
=09=09case ICON_HEART_OPEN:
>
=09=09 custom =3D cust;
>
=09=09=09tyan_lcdm_set_char( drvthis, 0, icons[0] );
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 0 );
>
=09=09=09break;
>
=09=09case ICON_ARROW_UP:
>
=09=09 custom =3D cust;
>
=09=09=09tyan_lcdm_set_char( drvthis, 1, icons[2] );
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 1 );
>
=09=09=09break;
>
=09=09case ICON_ARROW_DOWN:
>
=09=09 custom =3D cust;
>
=09=09=09tyan_lcdm_set_char( drvthis, 2, icons[3] );
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 2 );
>
=09=09=09break;
>
=09=09case ICON_ARROW_LEFT:
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 0x7F );
>
=09=09=09break;
>
=09=09case ICON_ARROW_RIGHT:
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 0x7E );
>
=09=09=09break;
>
=09=09case ICON_CHECKBOX_OFF:
>
=09=09 custom =3D cust;
>
=09=09=09tyan_lcdm_set_char( drvthis, 3, icons[4] );
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 3 );
>
=09=09=09break;
>
=09=09case ICON_CHECKBOX_ON:
>
=09=09 custom =3D cust;
>
=09=09=09tyan_lcdm_set_char( drvthis, 4, icons[5] );
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 4 );
>
=09=09=09break;
>
=09=09case ICON_CHECKBOX_GRAY:
>
=09=09 custom =3D cust;
>
=09=09=09tyan_lcdm_set_char( drvthis, 5, icons[6] );
>
=09=09=09tyan_lcdm_chr( drvthis, x, y, 5 );
>
=09=09=09break;
>
=09=09default:
>
=09=09=09return -1; /* Let the core do other icons */
>
=09}
>
=09return 0;
>
>
}
>
>
/*
>
* Clears the LCD screen
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_clear (Driver * drvthis)
>
{
>
=09memset (framebuf, ' ', width * height);
>
}
>
>
/*
>
* Hardware clears the LCD screen
>
*/
>
static void
>
tyan_lcdm_hardware_clear (Driver * drvthis)
>
{
>
=09char lcdcmd[5];
>
=09//set os selection
>
=09lcdcmd[0]=3DTYAN_LCDM_CMD_BEGIN;
>
=09lcdcmd[1]=3D0x70;
>
=09lcdcmd[2]=3D0x00;
>
=09lcdcmd[3]=3D0x01;
>
=09lcdcmd[4]=3DTYAN_LCDM_CMD_END;
>
=09write(fd,lcdcmd,5);
>
>
}
>
>
/*
>
* Prints a string on the lcd display, at position (x,y). The
>
* upper-left is (1,1), and the lower right should be (16,2).
>
*/
>
MODULE_EXPORT void
>
tyan_lcdm_string (Driver * drvthis, int x, int y, char string[])
>
{
>
=09int i;
>
>
=09/* Convert 1-based coords to 0-based... */
>
=09x -=3D 1;
>
=09y -=3D 1;
>
>
=09for (i =3D 0; string[i]; i++) {
>
>
=09=09/* Check for buffer overflows... */
>
=09=09if ((y * width) + x + i > (width * height))
>
=09=09=09break;
>
=09=09framebuf[(y * width) + x + i] =3D string[i];
>
=09}
>
}
>
>
static
>
void tyan_lcdm_set_rampos(unsigned char pos)
>
{
>
=09char cmd_str[5];
>
=09cmd_str[0]=3DTYAN_LCDM_CMD_BEGIN;
>
=09cmd_str[1]=3D0x70;
>
=09cmd_str[2]=3D0x00;
>
=09cmd_str[3]=3Dpos;
>
=09cmd_str[4]=3DTYAN_LCDM_CMD_END;
>
=09write( fd,cmd_str,5);
>
}
>
>
static
>
void tyan_lcdm_write_str(char *str,unsigned char start_addr, int length)
>
{
>
//CGRAM 0x40, 0x48,....
>
//if Line 1: start_addr =3D 0x80
>
//if Line 2: start_addr =3D 0xc0
>
// 1<=3D length <=3D16
>
=09char cmd_str[20];
>
=09tyan_lcdm_set_rampos(start_addr);
>
=09memset(cmd_str,' ', 20);
>
=09cmd_str[0] =3D TYAN_LCDM_CMD_BEGIN;
>
=09cmd_str[1] =3D 0x70;
>
=09cmd_str[2] =3D 0x02;
>
=09cmd_str[19] =3D TYAN_LCDM_CMD_END;
>
=09memcpy(cmd_str+3,str,length);
>
write(fd,cmd_str,20);
>
}
>
#if 0
>
static
>
void tyan_lcdm_set_cursor(unsigned char start_addr, int pos){
>
=09char cmd_str[5];
>
=09tyan_lcdm_set_rampos(pos+start_addr);
>
=09cmd_str[0] =3D TYAN_LCDM_CMD_BEGIN;
>
=09cmd_str[1] =3D 0x70;
>
=09cmd_str[2] =3D 0x00;
>
=09cmd_str[3] =3D 0x0e;
>
=09cmd_str[4] =3D TYAN_LCDM_CMD_END;
>
=09write(fd,cmd_str,5);
>
}
>
>
#endif
>
>
static
>
unsigned char tyan_lcdm_read_key(){
>
=09int count=3D0;
>
=09char key_str[4];
>
=09memset(key_str,0,4);
>
=09count=3Dread(fd,key_str,4);
>
=09if( key_str[0] =3D=3D (char)TYAN_LCDM_CMD_BEGIN &&=
key_str[1]=3D=3D(char)0x72 &&
>
key_str[3]=3D=3D(char)TYAN_LCDM_CMD_END){
>
=09=09return key_str[2];
>
=09}
>
=09return 0xf4; //error
>
}
>
>
--__--__--
>
>
Message: 2
>
Date: Wed, 23 Nov 2005 01:47:54 +0100
>
From: Romuald Conty
>
<conty.romuald AT gmail.com>
>
To:
>
lcdproc AT lists.omnipotent.net
>
Subject: Re: [Lcdproc] How to compile this driver?
>
>
Hi,
>
>
Your code seems to be in 0.5 version, to compile it i recommend you
>
using autoconf and automake before compiling;
>
Some lines need to be changed in
>
$LCDPROC_DIR/server/drivers/Makefile.am & in $LCD_PROC/configure.in
>
like as have been described in
>
http://lcdproc.sourceforge.net/docs/current-dev-html/x767.html before
>
running autoconf,automake.
>
>
Good luck.
>
Romuald.
>
>
PS : Keep in mind, if your work can help you, your work can help
>
others... so supply your patch with this new driver to lcdproc's
>
developpement team.
>
>
-- Sorry for my poor english language --
>
>
On 11/22/05, James Ousley
>
<james.ousley AT setel.com>
>
wrote:
>
> I have located a driver for my tyan 1U server (GS series) that=
us=3D
>
es an
>
> LCD panel via com2. I have smacked this code around trying to get it to
>
> compile but have yet to get it functioning. I even overwrote the
>
> MtxOrb.c and MtxOrb.h files with these and modified them accordingly to
>
> get the make to complete without errors, yet LCDd aborts with No output
>
> driver.
>
> Looking at this driver, what version of LCDproc and how do I=
comp=3D
>
ile it
>
> for that version?
>
>
>
--__--__--
>
>
_______________________________________________
>
LCDproc mailing list
>
LCDproc AT lists.omnipotent.net
>
http://lists.omnipotent.net/mailman/listinfo/lcdproc
>
>
>
End of LCDproc Digest
>
>
Indeed this is the correct version that this driver was built for. =
However, I am unable to compile the CVS source tree (without any =
modifications). It configures fine but fails on make with:
make[3]: *** No rule to make target `MtxOrb.so', needed by `all-am'. =
Stop.
I know that is probably a build environment issue but have not been to =
locate a fix for it. I am using lastest stable debian. uname -a: Linux =
nsr 2.4.27-2-386 #1 Mon May 16 16:47:51 JST 2005 i686 GNU/Linux
automake version: 1.4-p6
autoconf version: 2.59
GNU make version: 3.80
gcc version:=09 3.3.5
glibc version:=09 2.3.2
Any clues?
- [Lcdproc] Re: How to compile this driver?, James Ousley, 11/23/2005
Archive powered by MHonArc 2.6.18.