1 #include <lib/gdi/lcd.h>
7 #if defined(HAVE_DBOX_FP_H) && defined(HAVE_DBOX_LCD_KS0713_H)
9 #include <dbox/lcd-ks0713.h>
14 #include <lib/gdi/esize.h>
15 #include <lib/base/init.h>
16 #include <lib/base/init_num.h>
17 #include <lib/gdi/glcddc.h>
19 eDBoxLCD *eDBoxLCD::instance;
27 void eLCD::setSize(int xres, int yres, int bpp)
29 res = eSize(xres, yres);
30 _buffer=new unsigned char[xres * yres * bpp/8];
31 memset(_buffer, 0, res.height()*res.width()*bpp/8);
32 _stride=res.width()*bpp/8;
33 eDebug("lcd buffer %p %d bytes, stride %d", _buffer, xres*yres*bpp/8, _stride);
57 int xres=132, yres=64, bpp=8;
60 lcdfd = open("/dev/dbox/oled0", O_RDWR);
63 FILE *f=fopen("/proc/stb/lcd/oled_brightness", "w");
65 f = fopen("/proc/stb/fp/oled_brightness", "w");
71 lcdfd = open("/dev/dbox/lcd0", O_RDWR);
74 eDebug("found OLED display!");
79 eDebug("couldn't open LCD - load lcd.o!");
83 ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
85 FILE *f = fopen("/proc/stb/lcd/xres", "r");
89 if (fscanf(f, "%x", &tmp) == 1)
92 f = fopen("/proc/stb/lcd/yres", "r");
95 if (fscanf(f, "%x", &tmp) == 1)
98 f = fopen("/proc/stb/lcd/bpp", "r");
101 if (fscanf(f, "%x", &tmp) == 1)
110 #ifdef SET_RIGHT_HALF_VFD_SKIN
111 fprintf(stdout,"SET RIGHT HALF VFD SKIN\n");
112 FILE *f = fopen("/proc/stb/lcd/right_half", "w");
118 setSize(xres, yres, bpp);
121 void eDBoxLCD::setInverted(unsigned char inv)
127 void eDBoxLCD::setLED(int value, int option)
132 ioctl(lcdfd, LED_IOCTL_BRIGHTNESS_NORMAL, (unsigned char)value);
134 case LED_DEEPSTANDBY:
135 ioctl(lcdfd, LED_IOCTL_BRIGHTNESS_DEEPSTANDBY, (unsigned char)value);
137 case LED_BLINKINGTIME:
138 ioctl(lcdfd, LED_IOCTL_BLINKING_TIME, (unsigned char)value);
143 void eDBoxLCD::setLEDDefault(int normal, int deepstandby, int blinktime)
145 int value = (blinktime << 16) + (deepstandby << 8) + normal;
146 ioctl(lcdfd, LED_IOCTL_SET_DEFAULT, value);
149 int eDBoxLCD::setLCDContrast(int contrast)
153 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
155 eDebug("[LCD] can't open /dev/dbox/fp0");
159 if(ioctl(lcdfd, LCD_IOCTL_SRV, &contrast))
161 eDebug("[LCD] can't set lcd contrast");
168 int eDBoxLCD::setLCDBrightness(int brightness)
171 eDebug("setLCDBrightness %d", brightness);
172 FILE *f=fopen("/proc/stb/lcd/oled_brightness", "w");
174 f = fopen("/proc/stb/fp/oled_brightness", "w");
177 if (fprintf(f, "%d", brightness) == 0)
178 eDebug("write /proc/stb/lcd/oled_brightness failed!! (%m)");
184 if((fp=open("/dev/dbox/fp0", O_RDWR))<=0)
186 eDebug("[LCD] can't open /dev/dbox/fp0");
190 if(ioctl(fp, FP_IOCTL_LCD_DIMM, &brightness)<=0)
191 eDebug("[LCD] can't set lcd brightness (%m)");
198 eDBoxLCD::~eDBoxLCD()
207 eDBoxLCD *eDBoxLCD::getInstance()
212 void eDBoxLCD::update()
214 #ifdef BUILD_VUPLUS /* ikseong */
219 if (!is_oled || is_oled == 2)
221 unsigned char raw[132*8];
225 for (x=0; x<132; x++)
228 for (yy=0; yy<8; yy++)
230 pix|=(_buffer[(y*8+yy)*132+x]>=108)<<yy;
232 raw[y*132+x]=(pix^inverted);
235 write(lcdfd, raw, 132*8);
237 else if (is_oled == 3)
238 write(lcdfd, _buffer, _stride * res.height());
241 unsigned char raw[64*64];
243 memset(raw, 0, 64*64);
247 for (x=0; x<128 / 2; x++)
249 pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
255 write(lcdfd, raw, 64*64);