aboutsummaryrefslogtreecommitdiffstats
path: root/drv_M50530.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--drv_M50530.c138
1 files changed, 72 insertions, 66 deletions
diff --git a/drv_M50530.c b/drv_M50530.c
index cddf0cc..b576ebe 100644
--- a/drv_M50530.c
+++ b/drv_M50530.c
@@ -1,4 +1,4 @@
-/* $Id: drv_M50530.c,v 1.12 2004/06/20 10:09:54 reinelt Exp $
+#/* $Id: drv_M50530.c,v 1.13 2004/06/26 09:27:20 reinelt Exp $
*
* new style driver for M50530-based displays
*
@@ -23,6 +23,12 @@
*
*
* $Log: drv_M50530.c,v $
+ * Revision 1.13 2004/06/26 09:27:20 reinelt
+ *
+ * added '-W' to CFLAGS
+ * changed all C++ comments to C ones ('//' => '/* */')
+ * cleaned up a lot of signed/unsigned mistakes
+ *
* Revision 1.12 2004/06/20 10:09:54 reinelt
*
* 'const'ified the whole source
@@ -122,9 +128,9 @@ static unsigned char SIGNAL_IOC1;
static unsigned char SIGNAL_IOC2;
static unsigned char SIGNAL_GPO;
-// Fixme: GPO's not yet implemented
+/* Fixme: GPO's not yet implemented */
static int GPOS;
-// static int GPO=0;
+/* static int GPO=0; */
typedef struct {
@@ -138,31 +144,31 @@ static MODEL Models[] = {
};
-// ****************************************
-// *** hardware dependant functions ***
-// ****************************************
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
static void drv_M5_command (const unsigned int cmd, const int delay)
{
- // put data on DB1..DB8
+ /* put data on DB1..DB8 */
drv_generic_parport_data (cmd&0xff);
- // set I/OC1
- // set I/OC2
+ /* set I/OC1 */
+ /* set I/OC2 */
drv_generic_parport_control (SIGNAL_IOC1|SIGNAL_IOC2,
(cmd&0x200?SIGNAL_IOC1:0) |
(cmd&0x100?SIGNAL_IOC2:0));
- // Control data setup time
+ /* Control data setup time */
ndelay(200);
- // send command
- // EX signal pulse width = 500ns
- // Fixme: why 500 ns? Datasheet says 200ns
+ /* send command */
+ /* EX signal pulse width = 500ns */
+ /* Fixme: why 500 ns? Datasheet says 200ns */
drv_generic_parport_toggle (SIGNAL_EX, 1, 500);
- // wait
+ /* wait */
udelay(delay);
}
@@ -170,11 +176,11 @@ static void drv_M5_command (const unsigned int cmd, const int delay)
static void drv_M5_clear (void)
{
- drv_M5_command (0x0001, 1250); // clear display
+ drv_M5_command (0x0001, 1250); /* clear display */
}
-static void drv_M5_write (const int row, const int col, const unsigned char *data, const int len)
+static void drv_M5_write (const int row, const int col, const char *data, const int len)
{
int l = len;
unsigned int cmd;
@@ -197,28 +203,28 @@ static void drv_M5_defchar (const int ascii, const unsigned char *matrix)
drv_M5_command (0x300+192+8*(ascii-CHAR0), 20);
- // Fixme: looks like the M50530 cannot control the bottom line
- // therefore we have only 7 bytes here
+ /* Fixme: looks like the M50530 cannot control the bottom line */
+ /* therefore we have only 7 bytes here */
for (i=0; i<7; i++) {
drv_M5_command (0x100|(matrix[i] & 0x3f), 20);
}
}
-// Fixme: GPO's
+/* Fixme: GPO's */
#if 0
static void drv_M5_setGPO (const int bits)
{
if (Lcd.gpos>0) {
- // put data on DB1..DB8
+ /* put data on DB1..DB8 */
drv_generic_parport_data (bits);
- // 74HCT573 set-up time
+ /* 74HCT573 set-up time */
ndelay(20);
- // send data
- // 74HCT573 enable pulse width = 24ns
+ /* send data */
+ /* 74HCT573 enable pulse width = 24ns */
drv_generic_parport_toggle (SIGNAL_GPO, 1, 24);
}
}
@@ -274,16 +280,16 @@ static int drv_M5_start (const char *section, const int quiet)
if ((SIGNAL_IOC2 = drv_generic_parport_wire_ctrl ("IOC2", "AUTOFD"))==0xff) return -1;
if ((SIGNAL_GPO = drv_generic_parport_wire_ctrl ("GPO", "INIT" ))==0xff) return -1;
- // clear all signals
+ /* clear all signals */
drv_generic_parport_control (SIGNAL_EX|SIGNAL_IOC1|SIGNAL_IOC2|SIGNAL_GPO, 0);
- // set direction: write
+ /* set direction: write */
drv_generic_parport_direction (0);
- drv_M5_command (0x00FA, 20); // set function mode
- drv_M5_command (0x0020, 20); // set display mode
- drv_M5_command (0x0050, 20); // set entry mode
- drv_M5_command (0x0030, 20); // set display mode
+ drv_M5_command (0x00FA, 20); /* set function mode */
+ drv_M5_command (0x0020, 20); /* set display mode */
+ drv_M5_command (0x0050, 20); /* set entry mode */
+ drv_M5_command (0x0030, 20); /* set display mode */
drv_M5_clear();
@@ -300,28 +306,28 @@ static int drv_M5_start (const char *section, const int quiet)
}
-// ****************************************
-// *** plugins ***
-// ****************************************
+/****************************************/
+/*** plugins ***/
+/****************************************/
-// none at the moment
+/* none at the moment */
-// ****************************************
-// *** widget callbacks ***
-// ****************************************
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
-// using drv_generic_text_draw(W)
-// using drv_generic_text_icon_draw(W)
-// using drv_generic_text_bar_draw(W)
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
-// ****************************************
-// *** exported functions ***
-// ****************************************
+/****************************************/
+/*** exported functions ***/
+/****************************************/
-// list models
+/* list models */
int drv_M5_list (void)
{
int i;
@@ -333,81 +339,81 @@ int drv_M5_list (void)
}
-// initialize driver & display
+/* initialize driver & display */
int drv_M5_init (const char *section, const int quiet)
{
WIDGET_CLASS wc;
int ret;
- // display preferences
- XRES = 5; // pixel width of one char
- YRES = 8; // pixel height of one char
- CHARS = 8; // number of user-defineable characters
- CHAR0 = 248; // ASCII of first user-defineable char
- GOTO_COST = 1; // number of bytes a goto command requires
+ /* display preferences */
+ XRES = 5; /* pixel width of one char */
+ YRES = 8; /* pixel height of one char */
+ CHARS = 8; /* number of user-defineable characters */
+ CHAR0 = 248; /* ASCII of first user-defineable char */
+ GOTO_COST = 1; /* number of bytes a goto command requires */
- // real worker functions
+ /* real worker functions */
drv_generic_text_real_write = drv_M5_write;
drv_generic_text_real_defchar = drv_M5_defchar;
- // start display
+ /* start display */
if ((ret=drv_M5_start (section, quiet))!=0)
return ret;
- // initialize generic text driver
+ /* initialize generic text driver */
if ((ret=drv_generic_text_init(section, Name))!=0)
return ret;
- // initialize generic icon driver
+ /* initialize generic icon driver */
if ((ret=drv_generic_text_icon_init())!=0)
return ret;
- // initialize generic bar driver
+ /* initialize generic bar driver */
if ((ret=drv_generic_text_bar_init(0))!=0)
return ret;
- // add fixed chars to the bar driver
- drv_generic_text_bar_add_segment (0,0,255,32); // ASCII 32 = blank
+ /* add fixed chars to the bar driver */
+ drv_generic_text_bar_add_segment (0,0,255,32); /* ASCII 32 = blank */
- // register text widget
+ /* register text widget */
wc=Widget_Text;
wc.draw=drv_generic_text_draw;
widget_register(&wc);
- // register icon widget
+ /* register icon widget */
wc=Widget_Icon;
wc.draw=drv_generic_text_icon_draw;
widget_register(&wc);
- // register bar widget
+ /* register bar widget */
wc=Widget_Bar;
wc.draw=drv_generic_text_bar_draw;
widget_register(&wc);
- // register plugins
- // none at the moment
+ /* register plugins */
+ /* none at the moment */
return 0;
}
-// close driver & display
+/* close driver & display */
int drv_M5_quit (const int quiet) {
info("%s: shutting down.", Name);
drv_generic_text_quit();
- // clear display
+ /* clear display */
drv_M5_clear();
- // say goodbye...
+ /* say goodbye... */
if (!quiet) {
drv_generic_text_greet ("goodbye!", NULL);
}
- // clear all signals
+ /* clear all signals */
drv_generic_parport_control (SIGNAL_EX|SIGNAL_IOC1|SIGNAL_IOC2|SIGNAL_GPO, 0);
drv_generic_parport_close();