harmonize coding style and messages
This commit is contained in:
+35
-57
@@ -293,24 +293,23 @@ stv5730_init (Driver *drvthis)
|
||||
/* End of config file parsing */
|
||||
|
||||
if (timing_init() == -1) {
|
||||
report(RPT_ERR, "timing_init: failed (%s)\n", strerror(errno));
|
||||
report(RPT_ERR, "%s: timing_init() failed (%s)", drvthis->name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Initialize the Port and the stv5730
|
||||
if (port_access (stv5730_lptport) || port_access (stv5730_lptport + 1))
|
||||
{
|
||||
if (port_access(stv5730_lptport) || port_access(stv5730_lptport + 1)) {
|
||||
report(RPT_ERR,
|
||||
"Couldn't get IO-permission for 0x%X ! Are we running as root ?\n ",
|
||||
stv5730_lptport);
|
||||
"%s: cannot get IO-permission for 0x%03X! Are we running as root?",
|
||||
drvthis->name, stv5730_lptport);
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
if (stv5730_detect ())
|
||||
{
|
||||
report(RPT_ERR, "No STV5730 hardware found at 0x%X !\n ", stv5730_lptport);
|
||||
if (stv5730_detect()) {
|
||||
report(RPT_ERR, "%s: no STV5730 hardware found at 0x%03X ",
|
||||
drvthis->name, stv5730_lptport);
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
port_out(stv5730_lptport, 0);
|
||||
|
||||
@@ -327,12 +326,11 @@ stv5730_init (Driver *drvthis)
|
||||
stv5730_write16bit(STV5730_REG_CONTROL);
|
||||
stv5730_write16bit(0x1FF4);
|
||||
|
||||
report(RPT_INFO, "Detecting Video Signal: ");
|
||||
report(RPT_INFO, "%s: detecting video signal: ", drvthis->name);
|
||||
usleep (50000);
|
||||
|
||||
if (stv5730_is_mute ())
|
||||
{
|
||||
report(RPT_INFO, "No Video Signal found, using full page mode.\n");
|
||||
if (stv5730_is_mute()) {
|
||||
report(RPT_INFO, "%s: no video signal found; using full page mode", drvthis->name);
|
||||
// Setup Mode + Control for full page mode
|
||||
stv5730_charattrib = STV5730_ATTRIB;
|
||||
stv5730_write16bit(STV5730_REG_MODE);
|
||||
@@ -347,9 +345,8 @@ stv5730_init (Driver *drvthis)
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
report(RPT_INFO, "Video Signal found, using mixed mode (B&W).\n");
|
||||
else {
|
||||
report(RPT_INFO, "%s: video signal found, using mixed mode (B&W)", drvthis->name);
|
||||
// Setup Mode + Control for mixed mode, disable color
|
||||
stv5730_charattrib = 0;
|
||||
stv5730_write16bit(STV5730_REG_MODE);
|
||||
@@ -378,23 +375,24 @@ stv5730_init (Driver *drvthis)
|
||||
stv5730_write16bit(0x1000 + 4);
|
||||
|
||||
// Set the Row Attributes
|
||||
for (i = 0; i <= 10; i++)
|
||||
{
|
||||
for (i = 0; i <= 10; i++) {
|
||||
stv5730_write16bit(0x00C0 + i);
|
||||
stv5730_write16bit(0x10C0);
|
||||
}
|
||||
|
||||
// Allocate our own framebuffer
|
||||
stv5730_framebuf = malloc(STV5730_WID * STV5730_HGT);
|
||||
if (!stv5730_framebuf)
|
||||
{
|
||||
if (stv5730_framebuf == NULL) {
|
||||
report(RPT_ERR, "%s: unable to allocate framebuffer", drvthis->name);
|
||||
stv5730_close(drvthis);
|
||||
return -4;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// clear screen
|
||||
memset(stv5730_framebuf, 0, STV5730_WID * STV5730_HGT);
|
||||
|
||||
report(RPT_DEBUG, "%s: init() done", drvthis->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -469,23 +467,21 @@ stv5730_flush (Driver *drvthis)
|
||||
|
||||
stv5730_locate(0, 0);
|
||||
|
||||
for (i = 0; i < STV5730_HGT; i++)
|
||||
{
|
||||
for (i = 0; i < STV5730_HGT; i++) {
|
||||
if (i == 0)
|
||||
atr = (STV5730_COL_FLINE << 8);
|
||||
else
|
||||
atr = (STV5730_COL_TEXT << 8);
|
||||
stv5730_write16bit (0x1000 + atr + stv5730_framebuf[i * STV5730_WID] +
|
||||
stv5730_charattrib);
|
||||
for (j = 1; j < STV5730_WID; j++)
|
||||
{
|
||||
for (j = 1; j < STV5730_WID; j++) {
|
||||
if (stv5730_framebuf[j + (i * STV5730_WID) - 1] !=
|
||||
stv5730_framebuf[j + (i * STV5730_WID)])
|
||||
stv5730_write8bit (stv5730_framebuf[j + (i * STV5730_WID)]);
|
||||
else
|
||||
stv5730_write0bit();
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,11 +493,11 @@ MODULE_EXPORT void
|
||||
stv5730_string (Driver *drvthis, int x, int y, char string[])
|
||||
{
|
||||
int i;
|
||||
|
||||
x--; // Convert 1-based coords to 0-based...
|
||||
y--;
|
||||
|
||||
for (i = 0; string[i]; i++)
|
||||
{
|
||||
for (i = 0; string[i] != '\0'; i++) {
|
||||
stv5730_drawchar2fb(x + i, y, string[i]);
|
||||
}
|
||||
}
|
||||
@@ -525,7 +521,6 @@ stv5730_chr (Driver *drvthis, int x, int y, char c)
|
||||
MODULE_EXPORT void
|
||||
stv5730_num (Driver *drvthis, int x, int num)
|
||||
{
|
||||
|
||||
int i, j;
|
||||
x--;
|
||||
|
||||
@@ -536,19 +531,15 @@ stv5730_num (Driver *drvthis, int x, int num)
|
||||
if (num == 10 && (x < 0 || x > 19))
|
||||
return;
|
||||
|
||||
for (j = 1; j < 10; j++)
|
||||
{
|
||||
if (num != 10)
|
||||
{
|
||||
for (j = 1; j < 10; j++) {
|
||||
if (num != 10) {
|
||||
for (i = 0; i < 3; i++)
|
||||
stv5730_drawchar2fb (x + i, j, '0' + num);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
stv5730_drawchar2fb (x, j, ':');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
@@ -558,27 +549,21 @@ stv5730_num (Driver *drvthis, int x, int num)
|
||||
MODULE_EXPORT void
|
||||
stv5730_old_vbar (Driver *drvthis, int x, int len)
|
||||
{
|
||||
|
||||
int i;
|
||||
x--;
|
||||
|
||||
if (x < 0 || len < 0 || (len / 6) >= STV5730_WID)
|
||||
return;
|
||||
|
||||
for (i = 0; i <= len; i += 6)
|
||||
{
|
||||
|
||||
if (len >= (i + 6))
|
||||
{
|
||||
for (i = 0; i <= len; i += 6) {
|
||||
if (len >= (i + 6)) {
|
||||
stv5730_framebuf[((10 - (i / 6)) * STV5730_WID) + x] = 0x77;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
stv5730_framebuf[((10 - (i / 6)) * STV5730_WID) + x] =
|
||||
0x72 + (len % 6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -598,15 +583,11 @@ stv5730_old_hbar (Driver *drvthis, int x, int y, int len)
|
||||
|| (x + (len / 5)) >= STV5730_WID)
|
||||
return;
|
||||
|
||||
for (i = 0; i <= len; i += 5)
|
||||
{
|
||||
|
||||
if (len >= (i + 4))
|
||||
{
|
||||
for (i = 0; i <= len; i += 5) {
|
||||
if (len >= (i + 4)) {
|
||||
stv5730_framebuf[(y * STV5730_WID) + x + (i / 5)] = 0x64;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
stv5730_framebuf[(y * STV5730_WID) + x + (i / 5)] =
|
||||
0x65 + (len % 5);
|
||||
}
|
||||
@@ -622,8 +603,7 @@ stv5730_old_hbar (Driver *drvthis, int x, int y, int len)
|
||||
MODULE_EXPORT void
|
||||
stv5730_old_icon (Driver *drvthis, int which, char dest)
|
||||
{
|
||||
switch (which)
|
||||
{
|
||||
switch (which) {
|
||||
case 0: // 0:empty Heart
|
||||
stv5730_to_ascii[(int) dest] = 0x71;
|
||||
break;
|
||||
@@ -636,7 +616,5 @@ stv5730_old_icon (Driver *drvthis, int which, char dest)
|
||||
default:
|
||||
stv5730_to_ascii[(int) dest] = 0x0B;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -261,7 +261,8 @@ svgalib_drv_init (Driver *drvthis)
|
||||
if ((sscanf(size, "%dx%d", &w, &h) != 2) ||
|
||||
(w <= 0) || (w > LCD_MAX_WIDTH) ||
|
||||
(h <= 0) || (h > LCD_MAX_HEIGHT)) {
|
||||
report(RPT_WARNING, "svga: Cannot read size: %s. Using default value.\n", size);
|
||||
report(RPT_WARNING, "%s: cannot read Size: %s; using default %s",
|
||||
drvthis->name, size, DEFAULT_SIZE);
|
||||
sscanf(DEFAULT_SIZE, "%dx%d", &w, &h);
|
||||
}
|
||||
p->width = w;
|
||||
@@ -277,14 +278,14 @@ svgalib_drv_init (Driver *drvthis)
|
||||
p->height = LCD_DEFAULT_HEIGHT;
|
||||
}
|
||||
}
|
||||
report(RPT_INFO, "%s: Using size %dx%d", __FUNCTION__, p->width, p->height);
|
||||
report(RPT_INFO, "%s: using Size %dx%d", drvthis->name, p->width, p->height);
|
||||
|
||||
/* Which backlight brightness */
|
||||
tmp = drvthis->config_get_int(drvthis->name, "Brightness", 0, DEFAULT_BRIGHTNESS);
|
||||
debug(RPT_INFO, "%s: Brightness (in config) is '%d'", __FUNCTION__, tmp);
|
||||
if ((tmp < 0) || (tmp > 1000)) {
|
||||
report (RPT_WARNING, "%s: Brightness must be between 0 and 1000. Using default %d.\n",
|
||||
__FUNCTION__, DEFAULT_BRIGHTNESS);
|
||||
report(RPT_WARNING, "%s: Brightness must be between 0 and 1000; using default %d",
|
||||
drvthis->name, DEFAULT_BRIGHTNESS);
|
||||
tmp = DEFAULT_BRIGHTNESS;
|
||||
}
|
||||
p->brightness = tmp;
|
||||
@@ -293,8 +294,8 @@ svgalib_drv_init (Driver *drvthis)
|
||||
tmp = drvthis->config_get_int(drvthis->name, "OffBrightness", 0, DEFAULT_OFFBRIGHTNESS);
|
||||
debug(RPT_INFO, "%s: OffBrightness (in config) is '%d'", __FUNCTION__, tmp);
|
||||
if ((tmp < 0) || (tmp > 1000)) {
|
||||
report (RPT_WARNING, "%s: OffBrightness must be between 0 and 1000. Using default %d.\n",
|
||||
__FUNCTION__, DEFAULT_OFFBRIGHTNESS);
|
||||
report(RPT_WARNING, "%s: OffBrightness must be between 0 and 1000. Using default %d",
|
||||
drvthis->name, DEFAULT_OFFBRIGHTNESS);
|
||||
tmp = DEFAULT_OFFBRIGHTNESS;
|
||||
}
|
||||
p->offbrightness = tmp;
|
||||
@@ -307,21 +308,21 @@ svgalib_drv_init (Driver *drvthis)
|
||||
|
||||
/* initialize svgalib library */
|
||||
if (vga_init() != 0) {
|
||||
report(RPT_ERR, "svga: vga_init() failed.");
|
||||
report(RPT_ERR, "%s: vga_init() failed", drvthis->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check for legal VGA mode */
|
||||
tmp = vga_getmodenumber(modestr);
|
||||
if (tmp <= 0) {
|
||||
report(RPT_ERR, "svga: illegal VGA mode %s.", modestr);
|
||||
report(RPT_ERR, "%s: illegal VGA mode %s", drvthis->name, modestr);
|
||||
return -1;
|
||||
}
|
||||
p->mode = tmp;
|
||||
|
||||
/* switch to selected VGA mode if it is available */
|
||||
if (!vga_hasmode (p->mode)) {
|
||||
report(RPT_ERR, "svga: VGA mode %s not available.", modestr);
|
||||
report(RPT_ERR, "%s: VGA mode %s not available.", drvthis->name, modestr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -338,7 +339,7 @@ svgalib_drv_init (Driver *drvthis)
|
||||
p->yoffs = p->cellheight + (modeinfo->height - p->height * p->cellheight) / 2;
|
||||
|
||||
if (vga_setmode (p->mode) < 0) {
|
||||
report(RPT_ERR, "svga: unable to switch to mode %s", modestr);
|
||||
report(RPT_ERR, "%s: unable to switch to mode %s", drvthis->name, modestr);
|
||||
return -1;
|
||||
}
|
||||
gl_setcontextvga(p->mode); /* Physical screen context. */
|
||||
@@ -347,7 +348,7 @@ svgalib_drv_init (Driver *drvthis)
|
||||
/* allocate space, expand and install the font */
|
||||
p->font = malloc(256 * p->cellheight * p->cellwidth * modeinfo->bytesperpixel);
|
||||
if (p->font == NULL) {
|
||||
report(RPT_ERR, "svga: unable to allocate font memory");
|
||||
report(RPT_ERR, "%s: unable to allocate font memory", drvthis->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -359,6 +360,8 @@ svgalib_drv_init (Driver *drvthis)
|
||||
|
||||
gl_clearscreen(gl_rgbcolor (0, 0, 0));
|
||||
|
||||
report(RPT_DEBUG, "%s: init() done", drvthis->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -471,6 +474,7 @@ svgalib_drv_string (Driver *drvthis, int x, int y, char string[])
|
||||
|
||||
for (i = 0; string[i] != '\0'; i++) {
|
||||
unsigned char *c = &string[i];
|
||||
|
||||
switch (*c) {
|
||||
case '\0':
|
||||
*c = icon_char;
|
||||
@@ -641,7 +645,7 @@ svgalib_drv_set_contrast (Driver *drvthis, int promille)
|
||||
int contrast;
|
||||
|
||||
/* Check it */
|
||||
if (promille < 0 || promille > 1000)
|
||||
if ((promille < 0) || (promille > 1000))
|
||||
return;
|
||||
|
||||
/* store the software value since there is not get */
|
||||
@@ -675,7 +679,7 @@ svgalib_drv_set_brightness(Driver *drvthis, int state, int promille)
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
/* Check it */
|
||||
if (promille < 0 || promille > 1000)
|
||||
if ((promille < 0) || (promille > 1000))
|
||||
return;
|
||||
|
||||
/* store the software value since there is no get */
|
||||
|
||||
Reference in New Issue
Block a user