/* $Id$ * $URL$ * * generic driver helper for i2c displays * * Copyright (C) 2005 Luis Correia * Copyright (C) 2005 The LCD4Linux Team * * This file is part of LCD4Linux. * * LCD4Linux 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, or (at your option) * any later version. * * LCD4Linux 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* DISCLAIMER!!!! The following code is WORK IN PROGRESS, since it basicly 'works for us...' (C) 2005 Paul Kamphuis & Luis Correia We have removed all of the delays from this code, as the I2C bus is slow enough... (maximum possible speed is 100KHz only) */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "lcd4linux_i2c.h" #include "debug.h" #include "qprintf.h" #include "cfg.h" #include "udelay.h" #include "drv_generic_i2c.h" static char *Driver = ""; static char *Section = ""; static int i2c_device; static void my_i2c_smbus_write_byte_data(const int device, const unsigned char val) { struct i2c_smbus_ioctl_data args; union i2c_smbus_data data; args.read_write = I2C_SMBUS_WRITE; args.command = val; args.size = I2C_SMBUS_BYTE_DATA; data.byte = val; args.data = &data; if (ioctl(device, I2C_SMBUS, &args) < 0) { info("I2C: device %d IOCTL failed !\n", device); } } /* unused, ifdef'ed away to avoid compiler warning */ #if 0 static void my_i2c_smbus_read_byte_data(const int device, const unsigned char data) { struct i2c_smbus_ioctl_data args; args.read_write = I2C_SMBUS_READ; args.command = data; args.size = I2C_SMBUS_BYTE; args.data = 0; ioctl(device, I2C_SMBUS, &args); } #endif int drv_generic_i2c_open(const char *section, const char *driver) { int dev; char *bus, *device; udelay_init(); Section = (char *) section; Driver = (char *) driver; bus = cfg_get(Section, "Port", NULL); device = cfg_get(Section, "Device", NULL); dev = atoi(device); info("%s: initializing I2C bus %s", Driver, bus); if ((i2c_device = open(bus, O_WRONLY)) < 0) { error("%s: I2C bus %s open failed !\n", Driver, bus); goto exit_error; } info("%s: selecting slave device 0x%x", Driver, dev); if (ioctl(i2c_device, I2C_SLAVE, dev) < 0) { error("%s: error selecting slave device 0x%x\n", Driver, dev); goto exit_error; } info("%s: initializing I2C slave device 0x%x", Driver, dev); if (i2c_smbus_write_quick(i2c_device, I2C_SMBUS_WRITE) < 0) { error("%s: error initializing device 0x%x\n", Driver, dev); close(i2c_device); } return 0; exit_error: free(bus); free(device); close(i2c_device); return -1; } int drv_generic_i2c_close(void) { close(i2c_device); return 0; } unsigned char drv_generic_i2c_wire(const char *name, const char *deflt) { unsigned char w; char wire[256]; char *s; qprintf(wire, sizeof(wire), "Wire.%s", name); s = cfg_get(Section, wire, deflt); if (strlen(s) == 3 && strncasecmp(s, "DB", 2) == 0 && s[2] >= '0' && s[2] <= '7') { w = s[2] - '0'; } else if (strcasecmp(s, "GND") == 0) { w = 0; } else { error("%s: unknown signal <%s> for wire <%s>", Driver, s, name); error("%s: should be DB0..7 or GND", Driver); return 0xff; } free(s); if (w == 0) { info("%s: wiring: [DISPLAY:%s]<==>[i2c:GND]", Driver, name); } else { info("%s: wiring: [DISPLAY:%s]<==>[i2c:DB%d]", Driver, name, w); } w = 1 << w; return w; } void drv_generic_i2c_data(const unsigned char data) { my_i2c_smbus_write_byte_data(i2c_device, data); } void drv_generic_i2c_command(const unsigned char command, /*const */ unsigned char *data, const unsigned char length) { i2c_smbus_write_block_data(i2c_device, command, length, data); } */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Austria, all DVB-T transmitters run by ORS
# Created from http://www.ors.at/view/ors.php?mid=29
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 474000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 490000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 498000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 514000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 522000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 530000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 538000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 546000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 554000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 562000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 578000000 8MHz 3/4 NONE QAM16 8k 1/8 NONE
T 586000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 594000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 602000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 626000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 634000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 650000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 698000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 722000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 754000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 802000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE
T 858000000 8MHz 3/4 NONE QAM16 8k 1/4 NONE