Port remaining drivers to 0.5 API (icon, hbar, vbar).
This commit is contained in:
+83
-67
@@ -29,7 +29,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
//#include <sys/io.h>
|
||||
#include <time.h>
|
||||
#include "port.h"
|
||||
#include "timing.h"
|
||||
@@ -102,40 +101,42 @@ MODULE_EXPORT char *symbol_prefix = "stv5730_";
|
||||
|
||||
// Translation map ascii->stv5730 charset
|
||||
unsigned char stv5730_to_ascii[256] =
|
||||
{ 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x27, 0x0B, 0x27, 0x28,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x26, 0x26,
|
||||
0x62, 0x78, 0x61, 0x70,
|
||||
0x6c, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1A,
|
||||
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x72,
|
||||
0x0B, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34,
|
||||
0x35, 0x36, 0x37, 0x38,
|
||||
0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43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||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x29, /* ' */
|
||||
0x0B, 0x0B, 0x5F, 0x5E, 0x27, 0x0A, 0x27, 0x28, /* * + . - . / */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0 1 2 3 4 5 6 7 */
|
||||
0x08, 0x09, 0x26, 0x26, 0x62, 0x78, 0x61, 0x70, /* 8 9 : : « = » ? */
|
||||
0x6c, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, /* @ A B C D E F G */
|
||||
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, /* H I J K L M N O */
|
||||
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, /* P Q R S T U V W */
|
||||
0x23, 0x24, 0x25, 0x0B, 0x0B, 0x0B, 0x0B, 0x72, /* X Y Z _ */
|
||||
0x0B, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, /* a b c d e f g */
|
||||
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, /* h i j k l m n o */
|
||||
0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, /* p q r s t u v w */
|
||||
0x41, 0x42, 0x43, 0x6E, 0x6C, 0x71, 0x79, 0x7F, /* x y z # # # # # */
|
||||
/* 80 - FF */
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B,
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x58, 0x69, 0x0B, 0x0B, /* Ä Å */
|
||||
0x0B, 0x6B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, /* É */
|
||||
0x0B, 0x6D, 0x0B, 0x0B, 0x0B, 0x0B, 0x59, 0x0B, /* Ñ Ö */
|
||||
0x0B, 0x0B, 0x0B, 0x0B, 0x5A, 0x0B, 0x0B, 0x5C, /* Ü ß */
|
||||
0x44, 0x47, 0x45, 0x0B, 0x46, 0x6A, 0x0B, 0x58, /* à á â ä å ç */
|
||||
0x49, 0x48, 0x4B, 0x4A, 0x4C, 0x4F, 0x4D, 0x4E, /* è é ê ë ì í î ï */
|
||||
0x0B, 0x5D, 0x50, 0x53, 0x51, 0x0B, 0x52, 0x0B, /* ñ ò ó ô ö */
|
||||
0x0B, 0x54, 0x57, 0x55, 0x56, 0x0B, 0x0B, 0x77 /* ù ú û ü # */
|
||||
};
|
||||
|
||||
|
||||
//static void stv5730_upause(int delayCalls);
|
||||
@@ -144,7 +145,6 @@ unsigned char stv5730_to_ascii[256] =
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// This function returns true if a powered and working STV5730
|
||||
// hardware is present at p->port
|
||||
|
||||
static int
|
||||
stv5730_detect (unsigned int port)
|
||||
{
|
||||
@@ -178,7 +178,6 @@ stv5730_is_mute (unsigned int port)
|
||||
// this family of functions write commands or data to the stv5730
|
||||
// 8 bit writes repeat the high byte, 0 byte writes repeat the last
|
||||
// written word
|
||||
|
||||
static void
|
||||
stv5730_write16bit (unsigned int port, unsigned int flags, unsigned int value)
|
||||
{
|
||||
@@ -571,49 +570,53 @@ stv5730_num (Driver *drvthis, int x, int num)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a vertical bar from the bottom up to the last 7 rows of the
|
||||
// framebuffer at 1-based position x. len is given in pixels.
|
||||
// Draws a vertical bar from the bottom up at 1-based position x.
|
||||
//
|
||||
MODULE_EXPORT void
|
||||
stv5730_old_vbar (Driver *drvthis, int x, int len)
|
||||
stv5730_vbar(Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int i;
|
||||
int i; /* number of pixels drawn */
|
||||
int pixels;
|
||||
|
||||
x--;
|
||||
|
||||
if (x < 0 || len < 0 || (len / 6) >= STV5730_WID)
|
||||
if (x < 0 || len < 0 || (len) >= STV5730_HGT)
|
||||
return;
|
||||
|
||||
for (i = 0; i <= len; i += 6) {
|
||||
if (len >= (i + 6)) /* 6 = cellheight */
|
||||
pixels = ((long) 2 * len * 6) * promille / 2000;
|
||||
|
||||
for (i = 0; i <= pixels; i += 6) {
|
||||
if (pixels >= (i + 6)) /* 6 = cellheight */
|
||||
p->framebuf[((10 - (i / 6)) * STV5730_WID) + x] = 0x77;
|
||||
else
|
||||
p->framebuf[((10 - (i / 6)) * STV5730_WID) + x] = 0x72 + (len % 6);
|
||||
p->framebuf[((10 - (i / 6)) * STV5730_WID) + x] = 0x72 + (pixels % 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Draws a horizontal bar from left to right at 1-based position
|
||||
// x,y into the framebuffer. len is given in pixels.
|
||||
// x,y into the framebuffer.
|
||||
// It uses the STV5730 'channel-tuning' chars(0x64-0x68) to do
|
||||
// this.
|
||||
MODULE_EXPORT void
|
||||
stv5730_old_hbar (Driver *drvthis, int x, int y, int len)
|
||||
stv5730_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int i;
|
||||
int pixels;
|
||||
|
||||
x--;
|
||||
y--;
|
||||
|
||||
if (y < 0 || y >= STV5730_HGT || x < 0 || len < 0
|
||||
|| (x + (len / 5)) >= STV5730_WID)
|
||||
if (y < 0 || y >= STV5730_HGT || x < 0 || len < 0 || (x + len) >= STV5730_WID)
|
||||
return;
|
||||
|
||||
for (i = 0; i <= len; i += 5) {
|
||||
if (len >= (i + 4)) /* 4 = cellwidth */
|
||||
pixels = ((long) 2 * len * 4) * promille / 2000;
|
||||
|
||||
for (i = 0; i <= pixels; i += 5) {
|
||||
if (pixels >= (i + 4)) /* 4 = cellwidth */
|
||||
p->framebuf[(y * STV5730_WID) + x + (i / 5)] = 0x64;
|
||||
else
|
||||
p->framebuf[(y * STV5730_WID) + x + (i / 5)] = 0x65 + (len % 5);
|
||||
@@ -626,23 +629,36 @@ stv5730_old_hbar (Driver *drvthis, int x, int y, int len)
|
||||
// The STV5730 has no programmable chars. The charset is very
|
||||
// limited, it doesn't even contain a '%' char. But wait...
|
||||
// It contains a heartbeat char ! :-)
|
||||
MODULE_EXPORT void
|
||||
stv5730_old_icon (Driver *drvthis, int which, char dest)
|
||||
MODULE_EXPORT int
|
||||
stv5730_icon(Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
switch (which) {
|
||||
case 0: // 0:empty Heart
|
||||
stv5730_to_ascii[(int) dest] = 0x71;
|
||||
break;
|
||||
case 1: // 1:Filled Heart
|
||||
stv5730_to_ascii[(int) dest] = 0x0B;
|
||||
break;
|
||||
case 2: // 2:Ellipsis
|
||||
stv5730_to_ascii[(int) dest] = 0x5F;
|
||||
break;
|
||||
switch (icon) {
|
||||
case ICON_BLOCK_FILLED:
|
||||
p->framebuf[(y * STV5730_WID) + x] = 0x77;
|
||||
break;
|
||||
case ICON_HEART_OPEN:
|
||||
p->framebuf[(y * STV5730_WID) + x] = 0x0B;
|
||||
break;
|
||||
case ICON_HEART_FILLED:
|
||||
p->framebuf[(y * STV5730_WID) + x] = 0x71;
|
||||
break;
|
||||
case ICON_ARROW_UP:
|
||||
p->framebuf[(y * STV5730_WID) + x] = 0x7C;
|
||||
break;
|
||||
case ICON_ARROW_DOWN:
|
||||
p->framebuf[(y * STV5730_WID) + x] = 0x7D;
|
||||
break;
|
||||
case ICON_ARROW_LEFT:
|
||||
p->framebuf[(y * STV5730_WID) + x] = 0x7B;
|
||||
break;
|
||||
case ICON_ARROW_RIGHT:
|
||||
p->framebuf[(y * STV5730_WID) + x] = 0x7A;
|
||||
break;
|
||||
default:
|
||||
stv5730_to_ascii[(int) dest] = 0x0B;
|
||||
break;
|
||||
}
|
||||
return -1; /* Let the core do the others */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user