summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tvsetting/CTvSetting.cpp (plain)
blob: 59fc199db260d00f13f8d308f0b4f641fd5c8672
1#define LOG_TAG "TvSetting"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6#include <unistd.h>
7#include <fcntl.h>
8#include <errno.h>
9#include <sys/stat.h>
10#include <sys/wait.h>
11#include <cutils/properties.h>
12
13#include <netinet/ether.h>
14#include <netinet/if_ether.h>
15
16#include <netutils/ifc.h>
17#include <netutils/dhcp.h>
18
19#include "CTvSetting.h"
20
21#include "../tvconfig/tvconfig.h"
22#include "../tvutils/tvutils.h"
23
24#include "../tv/CTvLog.h"
25#define CC_DEF_CHARACTER_CHAR_VAL (0x8A)
26
27pthread_mutex_t ssm_r_w_op_mutex = PTHREAD_MUTEX_INITIALIZER;
28
29/************************ Start APIs For UI ************************/
30
31CTvSettingDeviceFactory *mpSettingDeviceFactory = NULL;
32CBlobDevice *mpCurDevice = NULL;
33
34bool CTvSettingLoad()
35{
36 mpSettingDeviceFactory = new CTvSettingDeviceFactory();
37 mpCurDevice = mpSettingDeviceFactory->getSaveDeviceFromConfigFile();
38 if (mpCurDevice == NULL) {
39 LOGD("%s, CTvSettingLoad = NULL", CFG_SECTION_TV);
40 return false;
41 } else {
42 mpCurDevice->OpenDevice();
43 }
44 return true;
45}
46
47bool CTvSettingunLoad()
48{
49 if (mpSettingDeviceFactory != NULL) {
50 delete mpSettingDeviceFactory;
51 mpSettingDeviceFactory = NULL;
52 }
53 return true;
54}
55
56int CTvSettingdoSuspend()
57{
58 return mpCurDevice->CloseDevice();
59}
60
61int CTvSettingdoResume()
62{
63 return mpCurDevice->OpenDevice();
64}
65template<typename T>
66static int SSMWriteNTypes(int offset, int data_len, T *data_buf)
67{
68 pthread_mutex_lock(&ssm_r_w_op_mutex);
69
70 if (data_buf == NULL) {
71 LOGE("%s, data_buf is NULL.\n", CFG_SECTION_TV);
72
73 pthread_mutex_unlock(&ssm_r_w_op_mutex);
74 return -1;
75 }
76
77 if (mpCurDevice == NULL) {
78 LOGE("%s, ssm_device is NULL.\n", CFG_SECTION_TV);
79
80 pthread_mutex_unlock(&ssm_r_w_op_mutex);
81 return -1;
82 }
83
84 if (mpCurDevice->WriteBytes(offset, data_len * sizeof(T),
85 (unsigned char *) data_buf) < 0) {
86 LOGE("%s, device WriteNBytes error.\n", CFG_SECTION_TV);
87
88 pthread_mutex_unlock(&ssm_r_w_op_mutex);
89 return -1;
90 }
91
92 pthread_mutex_unlock(&ssm_r_w_op_mutex);
93 return 0;
94}
95
96template<typename T>
97static int SSMReadNTypes(int offset, int data_len, T *data_buf)
98{
99 pthread_mutex_lock(&ssm_r_w_op_mutex);
100
101 if (data_buf == NULL) {
102 LOGE("%s, data_buf is NULL.\n", CFG_SECTION_TV);
103
104 pthread_mutex_unlock(&ssm_r_w_op_mutex);
105 return -1;
106 }
107
108 if (mpCurDevice == NULL) {
109 LOGE("%s, ssm_device is NULL.\n", CFG_SECTION_TV);
110
111 pthread_mutex_unlock(&ssm_r_w_op_mutex);
112 return -1;
113 }
114
115 if (mpCurDevice->ReadBytes(offset, data_len * sizeof(T),
116 (unsigned char *) data_buf) < 0) {
117 LOGE("%s, device ReadNBytes error.\n", CFG_SECTION_TV);
118 pthread_mutex_unlock(&ssm_r_w_op_mutex);
119 return -1;
120 }
121
122 pthread_mutex_unlock(&ssm_r_w_op_mutex);
123 return 0;
124}
125int SSMSaveFlash_One_N310_N311(int offset, int rw_val)
126{
127 unsigned char tmp_val = rw_val;
128 LOGD ( "~~~ SSMSaveFlash_One ~~~##offset %d##rw_val %d##" , offset, rw_val);
129
130 return SSMWriteNTypes(offset, 1, &tmp_val);
131}
132
133int SSMReadFlash_One_N310_N311(int offset)
134{
135 unsigned char tmp_val = 0;
136
137 if (SSMReadNTypes(offset, 1, &tmp_val) < 0) {
138 return -1;
139 }
140 LOGD ( "~~~ SSMReadFlash_One ~~~##offset %d##rw_val %d##" , offset, tmp_val);
141
142 return tmp_val;
143}
144
145int SSMSaveFlash_N_N310_N311(int offset, int data_len, int *data_buf)
146{
147 int i = 0;
148 unsigned char *ptr = NULL;
149
150 ptr = new unsigned char[data_len];
151
152 if (ptr != NULL) {
153 for (i = 0; i < data_len; i++) {
154 ptr[i] = data_buf[i];
155 }
156 } else {
157 delete ptr;
158 ptr = NULL;
159
160 return -1;
161 }
162
163 if (SSMWriteNTypes(offset, data_len, ptr) < 0) {
164 delete ptr;
165 ptr = NULL;
166
167 return -1;
168 }
169
170 delete ptr;
171 ptr = NULL;
172
173 return 0;
174}
175
176int SSMReadFlash_N_N310_N311(int offset, int data_len, int *data_buf)
177{
178 int i = 0;
179 unsigned char *ptr = NULL;
180
181 ptr = new unsigned char[data_len];
182
183 if (ptr != NULL) {
184 if (SSMReadNTypes(offset, data_len, ptr) < 0) {
185 delete ptr;
186 ptr = NULL;
187
188 return -1;
189 }
190 } else {
191 delete ptr;
192 ptr = NULL;
193
194 return -1;
195 }
196
197 for (i = 0; i < data_len; i++) {
198 data_buf[i] = ptr[i];
199 }
200
201 delete ptr;
202 ptr = NULL;
203
204 return 0;
205}
206int EEPWriteOneByte(int offset, unsigned char *data_buf)
207{
208 int fd = 0;
209 const char *device_path = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.path", "/sys/devices/i2c-2/2-0050/eeprom");
210 pthread_mutex_lock(&ssm_r_w_op_mutex);
211
212 LOGD ( "~~~EEPWriteOneByte~~~##offset %d##rw_val %s##" , offset, data_buf);
213
214 if (data_buf == NULL) {
215 LOGE("%s, data_buf is NULL.\n", CFG_SECTION_TV);
216
217 pthread_mutex_unlock(&ssm_r_w_op_mutex);
218 return -1;
219 }
220
221 fd = open(device_path, O_RDWR);
222
223 if (fd < 0) {
224 LOGE("%s, ####i2c test device open failed####.\n", CFG_SECTION_TV);
225
226 pthread_mutex_unlock(&ssm_r_w_op_mutex);
227 return -1;
228 }
229
230 lseek(fd, offset, SEEK_SET);
231
232 if (write(fd, data_buf, 1) < 0) {
233 LOGE("%s, device WriteOneBytes error.\n", CFG_SECTION_TV);
234
235 pthread_mutex_unlock(&ssm_r_w_op_mutex);
236 return -1;
237 }
238
239 close(fd);
240
241 LOGE("%s, device WriteOneBytes OK.\n", CFG_SECTION_TV);
242
243 pthread_mutex_unlock(&ssm_r_w_op_mutex);
244 return 0;
245}
246
247int EEPReadOneByte(int offset , unsigned char *data_buf)
248{
249 int fd = 0;
250 //const char* device_type = config_get_str(CFG_SECTION_SETTING, "peripheral.eeprom.device", "disable");
251 const char *device_path = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.path", "/sys/devices/i2c-2/2-0050/eeprom");
252
253 pthread_mutex_lock(&ssm_r_w_op_mutex);
254
255 if (data_buf == NULL) {
256 LOGE("%s, data_buf is NULL.\n", CFG_SECTION_TV);
257
258 pthread_mutex_unlock(&ssm_r_w_op_mutex);
259 return -1;
260 }
261
262 fd = open(device_path, O_RDWR);
263
264 if (fd < 0) {
265 LOGE("%s, ssm_device is NULL.\n", CFG_SECTION_TV);
266
267 pthread_mutex_unlock(&ssm_r_w_op_mutex);
268 return -1;
269 }
270 lseek(fd, offset, SEEK_SET);
271
272 if (read(fd, data_buf, 1) < 0) {
273 LOGE("%s, device ReadOneBytes error.\n", CFG_SECTION_TV);
274 pthread_mutex_unlock(&ssm_r_w_op_mutex);
275 return -1;
276 }
277
278 close(fd);
279
280 LOGD ( "~~~EEPReadOneByte~~~##offset %d##rw_val %s##" , offset, data_buf);
281
282 pthread_mutex_unlock(&ssm_r_w_op_mutex);
283 return 0;
284}
285
286int EEPWriteNByte(int offset, int data_len, unsigned char *data_buf)
287{
288 int fd = 0;
289 const char *device_path = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.path", "/sys/devices/i2c-2/2-0050/eeprom");
290 pthread_mutex_lock(&ssm_r_w_op_mutex);
291
292 LOGD ( "~~~EEPWriteNByte~~~##offset %d##data_len %d##" , offset, data_len);
293
294 if (data_buf == NULL) {
295 LOGE("%s, data_buf is NULL.\n", CFG_SECTION_TV);
296
297 pthread_mutex_unlock(&ssm_r_w_op_mutex);
298 return -1;
299 }
300
301 fd = open(device_path, O_RDWR);
302
303 if (fd < 0) {
304 LOGE("%s, ####i2c test device open failed####.\n", CFG_SECTION_TV);
305
306 pthread_mutex_unlock(&ssm_r_w_op_mutex);
307 return -1;
308 }
309
310 lseek(fd, offset, SEEK_SET);
311
312 if (write(fd, data_buf, data_len) < 0) {
313 LOGE("%s, device WriteNBytes error.\n", CFG_SECTION_TV);
314
315 pthread_mutex_unlock(&ssm_r_w_op_mutex);
316 return -1;
317 }
318
319 close(fd);
320
321 LOGE("%s, device WriteNBytes OK.\n", CFG_SECTION_TV);
322
323 pthread_mutex_unlock(&ssm_r_w_op_mutex);
324 return 0;
325}
326int EEPReadNByte(int offset, int data_len, unsigned char *data_buf)
327{
328 int fd = 0;
329 const char *device_path = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.path", "/sys/devices/i2c-2/2-0050/eeprom");
330 pthread_mutex_lock(&ssm_r_w_op_mutex);
331
332 if (data_buf == NULL) {
333 LOGE("%s, data_buf is NULL.\n", CFG_SECTION_TV);
334
335 pthread_mutex_unlock(&ssm_r_w_op_mutex);
336 return -1;
337 }
338
339 fd = open(device_path, O_RDWR);
340
341 if (fd < 0) {
342 LOGE("%s, ssm_device is NULL.\n", CFG_SECTION_TV);
343
344 pthread_mutex_unlock(&ssm_r_w_op_mutex);
345 return -1;
346 }
347 lseek(fd, offset, SEEK_SET);
348
349 if (read(fd, data_buf, data_len) < 0) {
350 LOGE("%s, device ReadNBytes error.\n", CFG_SECTION_TV);
351
352 pthread_mutex_unlock(&ssm_r_w_op_mutex);
353 return -1;
354 }
355
356 close(fd);
357
358 LOGD ( "~~~EEPReadNByte~~~##offset %d##data_len %d##" , offset, data_len);
359
360 pthread_mutex_unlock(&ssm_r_w_op_mutex);
361 return 0;
362}
363
364
365int SSMSaveEEP_One_N310_N311(int offset, int rw_val)
366{
367 unsigned char tmp_val = rw_val;
368 const char *device_config = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.device", "disable");
369
370 if (strcmp(device_config, "enable") != 0) {
371 LOGD ( "~~~ SSMSaveEEP_One ~~~##peripheral.eeprom.device error##");
372 return -1;
373 }
374 LOGD ( "~~~SSMSaveEEP_One~~~##offset %d##rw_val %d##" , offset, rw_val);
375
376 return EEPWriteOneByte(offset, &tmp_val);
377}
378
379int SSMReadEEP_One_N310_N311(int offset)
380{
381 unsigned char tmp_val = 0;
382 const char *device_config = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.device", "disable");
383
384 if (strcmp(device_config, "enable") != 0) {
385 LOGD ( "~~~ SSMReadEEP_One ~~~##peripheral.eeprom.device error##");
386 return -1;
387 }
388
389 if (EEPReadOneByte(offset, &tmp_val) < 0) {
390 return -1;
391 }
392 LOGD ( "~~~SSMReadEEP_One~~~##offset %d##rw_val %d##" , offset, tmp_val);
393
394 return tmp_val;
395}
396
397int SSMSaveEEP_N_N310_N311(int offset, int data_len, int *data_buf)
398{
399 int i = 0;
400 unsigned char *ptr = NULL;
401 const char *device_config = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.device", "disable");
402
403 if (strcmp(device_config, "enable") != 0) {
404 LOGD ( "~~~ SSMSaveEEP_N ~~~##peripheral.eeprom.device error##");
405 return -1;
406 }
407
408 ptr = new unsigned char[data_len];
409
410 if (ptr != NULL) {
411 for (i = 0; i < data_len; i++) {
412 ptr[i] = data_buf[i];
413 }
414 } else {
415 delete ptr;
416 ptr = NULL;
417
418 return -1;
419 }
420
421 if (EEPWriteNByte(offset, data_len, ptr) < 0) {
422 delete ptr;
423 ptr = NULL;
424
425 return -1;
426 }
427
428 delete ptr;
429 ptr = NULL;
430
431 return 0;
432}
433
434int SSMReadEEP_N_N310_N311(int offset, int data_len, int *data_buf)
435{
436 int i = 0;
437 unsigned char *ptr = NULL;
438 const char *device_config = config_get_str(CFG_SECTION_TV, "peripheral.eeprom.device", "disable");
439
440 if (strcmp(device_config, "enable") != 0) {
441 LOGD ( "~~~ SSMReadEEP_N ~~~##peripheral.eeprom.device error##");
442 return -1;
443 }
444 ptr = new unsigned char[data_len];
445
446 if (ptr != NULL) {
447 if (EEPReadNByte(offset, data_len, ptr) < 0) {
448 delete ptr;
449 ptr = NULL;
450
451 return -1;
452 }
453 } else {
454 delete ptr;
455 ptr = NULL;
456
457 return -1;
458 }
459
460 for (i = 0; i < data_len; i++) {
461 data_buf[i] = ptr[i];
462 }
463
464 delete ptr;
465 ptr = NULL;
466
467 return 0;
468}
469/************************ Start APIs For UI ************************/
470int MiscSSMRestoreDefault()
471{
472 SSMSaveFactoryBurnMode(0);
473 SSMSavePowerOnOffChannel(1);
474 SSMSaveSystemLanguage(0);
475 SSMSaveAgingMode(0);
476 SSMSavePanelType(0);
477 SSMSavePowerOnMusicSwitch(0);
478 SSMSavePowerOnMusicVolume(20);
479 SSMSaveSystemSleepTimer(0xFFFFFFFF);
480 SSMSaveInputSourceParentalControl(0, 0);
481 SSMSaveParentalControlSwitch(0);
482 SSMSaveSerialCMDSwitchValue(0);
483 SSMSaveBlackoutEnable(0);
484 return 0;
485}
486
487int MiscSSMFacRestoreDefault()
488{
489 SSMSaveSystemLanguage(0);
490 SSMSavePowerOnMusicSwitch(1);
491 SSMSavePowerOnMusicVolume(20);
492 SSMSaveSystemSleepTimer(0xFFFFFFFF);
493 SSMSaveInputSourceParentalControl(0, 0);
494 SSMSaveParentalControlSwitch(0);
495 SSMSaveSearchNavigateFlag(1);
496 SSMSaveInputNumLimit(2);
497 SSMSaveLocalDimingOnOffFlg(0);
498
499 return 0;
500}
501
502int ReservedSSMRestoreDefault()
503{
504 SSMSaveBurnWriteCharaterChar(CC_DEF_CHARACTER_CHAR_VAL);
505
506 return 0;
507}
508
509int SSMSaveBurnWriteCharaterChar(int rw_val)
510{
511 unsigned char tmp_val = rw_val;
512
513 return SSMWriteNTypes(SSM_RSV_W_CHARACTER_CHAR_START, 1, &tmp_val);
514}
515
516int SSMReadBurnWriteCharaterChar()
517{
518 unsigned char tmp_val = 0;
519
520 if (SSMReadNTypes(SSM_RSV_W_CHARACTER_CHAR_START, 1, &tmp_val) < 0) {
521 return -1;
522 }
523
524 return tmp_val;
525}
526
527int SSMSaveFactoryBurnMode(int rw_val)
528{
529 unsigned char tmp_val = rw_val;
530
531 return SSMWriteNTypes(SSM_RW_FBMF_START, 1, &tmp_val);
532}
533
534int SSMReadFactoryBurnMode()
535{
536 unsigned char tmp_val = 0;
537
538 if (SSMReadNTypes(SSM_RW_FBMF_START, 1, &tmp_val) < 0) {
539 return 0;
540 }
541
542 if (tmp_val != 0) {
543 return 1;
544 }
545
546 return 0;
547}
548
549int SSMSavePowerOnOffChannel(int rw_val)
550{
551 unsigned char tmp_val = rw_val;
552 return SSMWriteNTypes(SSM_RW_POWER_CHANNEL_START, 1, &tmp_val);
553}
554
555int SSMReadPowerOnOffChannel()
556{
557 unsigned char tmp_val = 0;
558
559 if (SSMReadNTypes(SSM_RW_POWER_CHANNEL_START, 1, &tmp_val) < 0) {
560 return 0;
561 }
562 return tmp_val;
563}
564
565int SSMSaveLastSelectSourceInput(int rw_val)
566{
567 unsigned char tmp_val = rw_val;
568 return SSMWriteNTypes(SSM_RW_LAST_SOURCE_INPUT_START, 1, &tmp_val);
569}
570
571int SSMReadLastSelectSourceInput()
572{
573 unsigned char tmp_val = 0;
574
575 if (SSMReadNTypes(SSM_RW_LAST_SOURCE_INPUT_START, 1, &tmp_val) < 0) {
576 return 0;
577 }
578 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
579 tmp_val = 0;
580 }
581
582 return tmp_val;
583}
584
585int SSMSaveSystemLanguage(int rw_val)
586{
587 unsigned char tmp_val = rw_val;
588
589 return SSMWriteNTypes(SSM_RW_SYS_LANGUAGE_START, 1, &tmp_val);
590}
591
592int SSMReadSystemLanguage()
593{
594 unsigned char tmp_val = 0;
595
596 if (SSMReadNTypes(SSM_RW_SYS_LANGUAGE_START, 1, &tmp_val) < 0) {
597 return 0;
598 }
599
600 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
601 tmp_val = 0;
602 }
603
604 return tmp_val;
605}
606
607int SSMSaveAgingMode(int rw_val)
608{
609 unsigned char tmp_val = rw_val;
610
611 return SSMWriteNTypes(SSM_RW_AGING_MODE_START, 1, &tmp_val);
612}
613
614int SSMReadAgingMode()
615{
616 unsigned char tmp_val = 0;
617
618 if (SSMReadNTypes(SSM_RW_AGING_MODE_START, 1, &tmp_val) < 0) {
619 return 0;
620 }
621
622 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
623 tmp_val = 0;
624 }
625
626 return tmp_val;
627}
628
629int SSMSavePanelType(int rw_val)
630{
631 unsigned char tmp_val = rw_val;
632
633 return SSMWriteNTypes(SSM_RW_PANEL_TYPE_START, 1, &tmp_val);
634}
635
636int SSMReadPanelType()
637{
638 unsigned char tmp_val = 0;
639
640 if (SSMReadNTypes(SSM_RW_PANEL_TYPE_START, 1, &tmp_val) < 0) {
641 return 0;
642 }
643
644 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
645 tmp_val = 0;
646 }
647
648 return tmp_val;
649}
650
651int SSMSavePowerOnMusicSwitch(int rw_val)
652{
653 unsigned char tmp_val = rw_val;
654
655 return SSMWriteNTypes(SSM_RW_POWER_ON_MUSIC_SWITCH_START, 1, &tmp_val);
656}
657
658int SSMReadPowerOnMusicSwitch()
659{
660 unsigned char tmp_val = 0;
661
662 if (SSMReadNTypes(SSM_RW_POWER_ON_MUSIC_SWITCH_START, 1, &tmp_val) < 0) {
663 return 0;
664 }
665
666 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
667 tmp_val = 0;
668 }
669
670 return tmp_val;
671}
672
673int SSMSavePowerOnMusicVolume(int rw_val)
674{
675 unsigned char tmp_val = rw_val;
676
677 return SSMWriteNTypes(SSM_RW_POWER_ON_MUSIC_VOL_START, 1, &tmp_val);
678}
679
680int SSMReadPowerOnMusicVolume()
681{
682 unsigned char tmp_val = 0;
683
684 if (SSMReadNTypes(SSM_RW_POWER_ON_MUSIC_VOL_START, 1, &tmp_val) < 0) {
685 return 0;
686 }
687
688 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
689 tmp_val = 0;
690 }
691
692 return tmp_val;
693}
694
695int SSMSaveSystemSleepTimer(int rw_val)
696{
697 return SSMWriteNTypes(SSM_RW_SYS_SLEEP_TIMER_START, 1, &rw_val);
698}
699
700int SSMReadSystemSleepTimer()
701{
702 int tmp_val = 0;
703
704 if (SSMReadNTypes(SSM_RW_SYS_SLEEP_TIMER_START, 1, &tmp_val) < 0) {
705 return 0;
706 }
707
708 if (tmp_val < 0) {
709 tmp_val = 0;
710 }
711
712 return tmp_val;
713}
714
715int SSMSaveInputSourceParentalControl(int source_index,
716 unsigned char ctl_flag)
717{
718 int tmp_val = 0;
719
720 if (source_index < 0 || source_index > 31) {
721 return -1;
722 }
723
724 if (ctl_flag != 0 && ctl_flag != 1) {
725 return -1;
726 }
727
728 if (SSMReadNTypes(SSM_RW_INPUT_SRC_PARENTAL_CTL_START, 4,
729 (unsigned char *) &tmp_val) < 0) {
730 return -1;
731 }
732
733 tmp_val = (tmp_val & (~(1 << source_index))) | (ctl_flag << source_index);
734
735 return SSMWriteNTypes(SSM_RW_INPUT_SRC_PARENTAL_CTL_START, 4,
736 (unsigned char *) &tmp_val);
737}
738
739int SSMReadInputSourceParentalControl(int source_index)
740{
741 int tmp_val = 0;
742
743 if (SSMReadParentalControlSwitch() == 0) {
744 return 0;
745 }
746
747 if (SSMReadNTypes(SSM_RW_INPUT_SRC_PARENTAL_CTL_START, 4,
748 (unsigned char *) &tmp_val) < 0) {
749 return 0;
750 }
751
752 if (tmp_val & (1 << source_index)) {
753 return 1;
754 }
755
756 return 0;
757}
758
759int SSMSaveParentalControlSwitch(int rw_val)
760{
761 unsigned char tmp_val = rw_val;
762
763 return SSMWriteNTypes(SSM_RW_PARENTAL_CTL_SWITCH_START, 1, &tmp_val);
764}
765
766int SSMReadParentalControlSwitch()
767{
768 unsigned char tmp_val = 0;
769
770 if (SSMReadNTypes(SSM_RW_PARENTAL_CTL_SWITCH_START, 1, &tmp_val) < 0) {
771 return 0;
772 }
773
774 if (tmp_val != 0) {
775 tmp_val = 1;
776 }
777
778 return tmp_val;
779}
780
781int SSMGetCustomerDataStart()
782{
783 return SSM_RW_CUSTOMER_DATA_START;
784}
785
786int SSMGetCustomerDataLen()
787{
788 return SSM_RW_CUSTOMER_DATA_LEN;
789}
790
791int SSMGetATVDataStart()
792{
793 return SSM_RW_ATV_START;
794}
795
796int SSMGetATVDataLen()
797{
798 return SSM_RW_ATV_LEN;
799}
800
801int SSMGetVPPDataStart()
802{
803 return SSM_RW_VPP_START;
804}
805
806int SSMGetVPPDataLen()
807{
808 return SSM_RW_VPP_LEN;
809}
810
811int SSMSaveSearchNavigateFlag(int rw_val)
812{
813 unsigned char tmp_val = rw_val;
814
815 return SSMWriteNTypes(SSM_RW_SEARCH_NAVIGATE_FLAG_START, 1, &tmp_val);
816}
817
818int SSMReadSearchNavigateFlag()
819{
820 unsigned char tmp_val = 0;
821
822 if (SSMReadNTypes(SSM_RW_SEARCH_NAVIGATE_FLAG_START, 1, &tmp_val) < 0) {
823 return 0;
824 }
825
826 return tmp_val;
827}
828
829int SSMSaveInputNumLimit(int rw_val)
830{
831 unsigned char tmp_val = rw_val;
832
833 return SSMWriteNTypes(SSM_RW_INPUT_NUMBER_LIMIT_START, 1, &tmp_val);
834}
835
836int SSMReadInputNumLimit()
837{
838 unsigned char tmp_val = 0;
839
840 if (SSMReadNTypes(SSM_RW_INPUT_NUMBER_LIMIT_START, 1, &tmp_val) < 0) {
841 return 0;
842 }
843
844 return tmp_val;
845}
846
847int SSMSaveLocalDimingOnOffFlg(int rw_val)
848{
849 unsigned char tmp_val = rw_val;
850
851 return SSMWriteNTypes(SSM_RW_LOCAL_DIMING_START, 1, &tmp_val);
852}
853
854int SSMReadLocalDimingOnOffFlg()
855{
856 unsigned char tmp_val = 0;
857
858 if (SSMReadNTypes(SSM_RW_LOCAL_DIMING_START, 1, &tmp_val) < 0) {
859 return 0;
860 }
861
862 return tmp_val;
863}
864
865int SSMSaveVDac2DValue(unsigned short rw_val)
866{
867 return SSMWriteNTypes(SSM_RW_VDAC_2D_START, 1, &rw_val);
868}
869
870int SSMReadVDac2DValue()
871{
872 unsigned short tmp_val = 0;
873
874 if (SSMReadNTypes(SSM_RW_VDAC_2D_START, 1, &tmp_val) < 0) {
875 return 0;
876 }
877
878 return tmp_val;
879}
880
881int SSMSaveVDac3DValue(unsigned short rw_val)
882{
883 return SSMWriteNTypes(SSM_RW_VDAC_3D_START, 1, &rw_val);
884}
885
886int SSMReadVDac3DValue()
887{
888 unsigned short tmp_val = 0;
889
890 if (SSMReadNTypes(SSM_RW_VDAC_3D_START, 1, &tmp_val) < 0) {
891 return 0;
892 }
893
894 return tmp_val;
895}
896
897int SSMSaveChromaStatus(int mode)
898{
899 int fd = -1, ret = -1;
900 char value[20] = "";
901
902 sprintf(value, "%d", mode);
903
904 fd = open("/sys/class/tvafe/tvafe0/cvd_reg8a", O_RDWR);
905
906 if (fd < 0) {
907 LOGE("open /sys/class/tvafe/tvafe0/cvd_reg8a ERROR(%s)!!\n",
908 strerror(errno));
909 return -1;
910 }
911
912 ret = write(fd, value, strlen(value));
913
914 close(fd);
915
916 return ret;
917}
918
919int SSMSaveNonStandardValue(unsigned short rw_val)
920{
921 int i = 0, tmp_ret = 0;
922 unsigned char data[] = { 0, 0 };
923
924 {
925 data[0] = (unsigned char) rw_val;
926 rw_val >>= 8;
927 data[1] = (unsigned char) rw_val;
928 }
929
930 LOGD("%s, save NonStandard_value = %d", CFG_SECTION_TV, rw_val);
931
932 return SSMWriteNTypes(SSM_RW_NON_STANDARD_START, 2, data);
933}
934
935int SSMReadNonStandardValue(void)
936{
937 int i = 0, value = 0;
938 int data[] = { 0, 0 };
939
940 if (SSMReadNTypes(SSM_RW_NON_STANDARD_START, 2, data) < 0) {
941 LOGE("%s, read NonStandard_value error.", CFG_SECTION_TV);
942 return 0;
943 }
944
945 {
946 value += data[1];
947 value <<= 8;
948 value += data[0];
949 }
950
951 LOGD("%s, read NonStandard_value = %d.", CFG_SECTION_TV, value);
952
953 return value;
954}
955
956int SSMSaveAdbSwitchValue(int rw_val)
957{
958 unsigned char tmp_val = rw_val;
959
960 return SSMWriteNTypes(SSM_RW_ADB_SWITCH_START, 1, &tmp_val);
961}
962
963int SSMReadAdbSwitchValue(void)
964{
965 unsigned char switch_val = 0;
966
967 if (SSMReadNTypes(SSM_RW_ADB_SWITCH_START, 1, &switch_val) < 0) {
968 LOGD("%s, read switch value error", CFG_SECTION_TV);
969 return -1;
970 }
971
972 LOGD("%s, read switch value = %d", CFG_SECTION_TV, switch_val);
973
974 return switch_val;
975}
976
977int SSMSaveSerialCMDSwitchValue(int rw_val)
978{
979 unsigned char tmp_val = rw_val;
980
981 return SSMWriteNTypes(SSM_RW_SERIAL_CMD_SWITCH_START, 1, &tmp_val);
982}
983
984int SSMReadSerialCMDSwitchValue(void)
985{
986 unsigned char switch_val = 0;
987
988 if (SSMReadNTypes(SSM_RW_SERIAL_CMD_SWITCH_START, 1, &switch_val) < 0) {
989 LOGD("%s, read switch value error", CFG_SECTION_TV);
990 return -1;
991 }
992
993 LOGD("%s, read switch value = %d", CFG_SECTION_TV, switch_val);
994
995 return switch_val;
996}
997
998int SSMSaveNoiseGateThresholdValue(int rw_val)
999{
1000 unsigned char tmp_val = rw_val;
1001
1002 return SSMWriteNTypes(SSM_RW_NOISE_GATE_THRESHOLD_START, 1, &tmp_val);
1003}
1004
1005int SSMReadNoiseGateThresholdValue(void)
1006{
1007 unsigned char tmp_val = 0;
1008
1009 if (SSMReadNTypes(SSM_RW_NOISE_GATE_THRESHOLD_START, 1, &tmp_val) < 0) {
1010 LOGD("%s, read NoiseGateThreshold error", CFG_SECTION_TV);
1011 return -1;
1012 }
1013
1014 LOGD("%s, read NoiseGateThreshold = %d", CFG_SECTION_TV, tmp_val);
1015
1016 return tmp_val;
1017}
1018
1019int SSMSaveGraphyBacklight(int rw_val)
1020{
1021 unsigned char tmp_val = rw_val;
1022
1023 if (rw_val < 0 || rw_val > 100) {
1024 return -1;
1025 }
1026
1027 return SSMWriteNTypes(SSM_RW_UI_GRHPHY_BACKLIGHT_START, 1, &tmp_val);
1028}
1029
1030int SSMReadGraphyBacklight(void)
1031{
1032 unsigned char value = 0;
1033
1034 if (SSMReadNTypes(SSM_RW_UI_GRHPHY_BACKLIGHT_START, 1, &value) < 0) {
1035 LOGD("%s, read graphybacklight error.\n", CFG_SECTION_TV);
1036 return -1;
1037 }
1038
1039 if (/*value < 0 || */value > 100) {
1040 LOGD("%s, range of graphybacklight (%d) is not between 0-100.\n",
1041 CFG_SECTION_TV, value);
1042 return -1;
1043 }
1044
1045 return value;
1046}
1047
1048int SSMSaveFastSuspendFlag(int rw_val)
1049{
1050 unsigned char tmp_val = rw_val;
1051
1052 return SSMWriteNTypes(SSM_RW_FASTSUSPEND_FLAG_START, 1, &tmp_val);
1053}
1054
1055int SSMReadFastSuspendFlag(void)
1056{
1057 unsigned char value = 0;
1058
1059 if (SSMReadNTypes(SSM_RW_FASTSUSPEND_FLAG_START, 1, &value) < 0) {
1060 LOGD("%s, read FastSuspendFlag error.\n", CFG_SECTION_TV);
1061 return -1;
1062 }
1063
1064 return value;
1065}
1066
1067int SSMSaveCABufferSizeValue(unsigned short rw_val)
1068{
1069 int i = 0, tmp_ret = 0;
1070 unsigned char data[] = { 0, 0 };
1071
1072 {
1073 data[0] = (unsigned char) rw_val;
1074 rw_val >>= 8;
1075 data[1] = (unsigned char) rw_val;
1076 }
1077
1078 return SSMWriteNTypes(SSM_RW_CA_BUFFER_SIZE_START, 2, data);
1079}
1080
1081int SSMReadCABufferSizeValue(void)
1082{
1083 int i = 0, value = 0;
1084 unsigned char data[] = { 0, 0 };
1085
1086 if (SSMReadNTypes(SSM_RW_CA_BUFFER_SIZE_START, 2, data) < 0) {
1087 LOGE("%s, read ca_buffer_size error", CFG_SECTION_TV);
1088 return 0;
1089 }
1090
1091 {
1092 value += data[1];
1093 value <<= 8;
1094 value += data[0];
1095 }
1096
1097 return value;
1098}
1099
1100int SSMSaveStandbyMode(int rw_val)
1101{
1102 unsigned char tmp_val = rw_val;
1103
1104 return SSMWriteNTypes(SSM_RW_STANDBY_MODE_FLAG_START, 1, &tmp_val);
1105}
1106
1107int SSMReadStandbyMode()
1108{
1109 unsigned char tmp_val = 0;
1110
1111 if (SSMReadNTypes(SSM_RW_STANDBY_MODE_FLAG_START, 1, &tmp_val) < 0) {
1112 return 0;
1113 }
1114
1115 return tmp_val;
1116}
1117
1118int SSMSaveHDMIEQMode(int rw_val)
1119{
1120 unsigned char tmp_val = rw_val;
1121
1122 return SSMWriteNTypes(SSM_RW_HDMIEQ_MODE_START, 1, &tmp_val);
1123}
1124
1125int SSMReadHDMIEQMode()
1126{
1127 unsigned char tmp_val = 0;
1128
1129 if (SSMReadNTypes(SSM_RW_HDMIEQ_MODE_START, 1, &tmp_val) < 0) {
1130 return 0;
1131 }
1132
1133 return tmp_val;
1134}
1135
1136int SSMSaveLogoOnOffFlag(int rw_val)
1137{
1138 unsigned char tmp_val = rw_val;
1139
1140 return SSMWriteNTypes(SSM_RW_LOGO_ON_OFF_FLAG_START, 1, &tmp_val);
1141}
1142
1143int SSMReadLogoOnOffFlag()
1144{
1145 unsigned char tmp_val = 0;
1146
1147 if (SSMReadNTypes(SSM_RW_LOGO_ON_OFF_FLAG_START, 1, &tmp_val) < 0) {
1148 return 0;
1149 }
1150
1151 return tmp_val;
1152}
1153
1154int SSMSaveHDMIInternalMode(unsigned int rw_val)
1155{
1156 int i = 0, tmp_ret = 0;
1157 unsigned char data[] = { 0, 0, 0, 0 };
1158
1159 for (i = 3; i >= 0; i--) {
1160 data[i] = (unsigned char) rw_val;
1161 rw_val >>= 8;
1162 }
1163
1164 return SSMWriteNTypes(SSM_RW_HDMIINTERNAL_MODE_START, 4, data);
1165}
1166
1167int SSMReadHDMIInternalMode()
1168{
1169 int i = 0, value = 0;
1170 int data[] = { 0, 0, 0, 0 };
1171
1172 if (SSMReadNTypes(SSM_RW_HDMIINTERNAL_MODE_START, 4, data) < 0) {
1173 return 0;
1174 }
1175
1176 for (i = 0; i < 4; i++) {
1177 value <<= 8;
1178 value += data[i];
1179 }
1180
1181 return value;
1182}
1183
1184int SSMSaveParentalControlPassWord(unsigned char *password, int size)
1185{
1186 return SSMWriteNTypes(SSM_RW_PARENTAL_CTL_PASSWORD_START, size, password);
1187}
1188
1189int SSMReadParentalControlPassWord(unsigned short *password)
1190{
1191 if (SSMReadNTypes(SSM_RW_PARENTAL_CTL_PASSWORD_START,
1192 SSM_RW_PARENTAL_CTL_PASSWORD_LEN, (unsigned char *) password)
1193 < 0) {
1194 return -1;
1195 }
1196 return 0;
1197}
1198
1199int SSMSaveDisable3D(int rw_val)
1200{
1201 unsigned char tmp_val = rw_val;
1202
1203 return SSMWriteNTypes(SSM_RW_DISABLE_3D_START, 1, &tmp_val);
1204}
1205
1206int SSMReadDisable3D()
1207{
1208 unsigned char tmp_val = 0;
1209
1210 if (SSMReadNTypes(SSM_RW_DISABLE_3D_START, 1, &tmp_val) < 0) {
1211 return 0;
1212 }
1213
1214 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
1215 tmp_val = 0;
1216 }
1217
1218 return tmp_val;
1219}
1220
1221int SSMSaveGlobalOgoEnable(int rw_val)
1222{
1223 unsigned char tmp_val = rw_val;
1224
1225 return SSMWriteNTypes(SSM_RW_GLOBAL_OGO_ENABLE_START, 1, &tmp_val);
1226}
1227
1228int SSMReadGlobalOgoEnable()
1229{
1230 unsigned char tmp_val = 0;
1231
1232 if (SSMReadNTypes(SSM_RW_GLOBAL_OGO_ENABLE_START, 1, &tmp_val) < 0) {
1233 return 0;
1234 }
1235
1236 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
1237 tmp_val = 0;
1238 }
1239
1240 return tmp_val;
1241}
1242
1243int SSMDeviceMarkCheck()
1244{
1245 int i = 0, failed_count = 0;
1246 int mark_offset[3] = { 0, 0, 0 };
1247 unsigned char mark_values[3] = { 0, 0, 0 };
1248 unsigned char tmp_ch = 0;
1249
1250 //read temp one byte
1251 SSMReadNTypes(0, 1, &tmp_ch);
1252
1253 mark_offset[0] = SSM_MARK_01_START;
1254 mark_offset[1] = SSM_MARK_02_START;
1255 mark_offset[2] = SSM_MARK_03_START;
1256
1257 mark_values[0] = SSM_MARK_01_VALUE;
1258 mark_values[1] = SSM_MARK_02_VALUE;
1259 mark_values[2] = SSM_MARK_03_VALUE;
1260
1261 if (SSMReadBurnWriteCharaterChar() != CC_DEF_CHARACTER_CHAR_VAL) {
1262 SSMSaveBurnWriteCharaterChar(CC_DEF_CHARACTER_CHAR_VAL);
1263 }
1264
1265 failed_count = 0;
1266 for (i = 0; i < 3; i++) {
1267 tmp_ch = 0;
1268 if (SSMReadNTypes(mark_offset[i], 1, &tmp_ch) < 0) {
1269 LOGE("%s, SSMDeviceMarkCheck Read Mark failed!!!\n", CFG_SECTION_TV);
1270 break;
1271 }
1272
1273 if (tmp_ch != mark_values[i]) {
1274 failed_count += 1;
1275 LOGE(
1276 "%s, SSMDeviceMarkCheck Mark[%d]'s offset = %d, Mark[%d]'s Value = %d, read value = %d.\n",
1277 CFG_SECTION_TV, i, mark_offset[i], i, mark_values[i], tmp_ch);
1278 }
1279 }
1280
1281 if (failed_count >= 3) {
1282 return -1;
1283 }
1284
1285 return 0;
1286}
1287
1288int SSMRestoreDeviceMarkValues()
1289{
1290 int i;
1291 int mark_offset[3] = {
1292 (int) SSM_MARK_01_START, //
1293 (int) SSM_MARK_02_START, //
1294 (int) SSM_MARK_03_START, //
1295 };
1296
1297 unsigned char mark_values[3] = {
1298 //
1299 (unsigned char) SSM_MARK_01_VALUE, (unsigned char) SSM_MARK_02_VALUE,
1300 (unsigned char) SSM_MARK_03_VALUE, //
1301 };
1302
1303 for (i = 0; i < 3; i++) {
1304 if (SSMWriteNTypes(mark_offset[i], 1, &(mark_values[i])) < 0) {
1305 LOGD("SSMRestoreDeviceMarkValues Write Mark failed.\n");
1306 break;
1307 }
1308 }
1309
1310 if (i < 3) {
1311 return -1;
1312 }
1313
1314 return 0;
1315}
1316
1317static int SSMGetPreCopyingEnableCfg()
1318{
1319 const char *prop_value;
1320
1321 prop_value = config_get_str(CFG_SECTION_TV, "ssm.precopying.en", "null");
1322 if (strcmp(prop_value, "null") == 0 || strcmp(prop_value, "0") == 0
1323 || strcmp(prop_value, "disable") == 0) {
1324 return 0;
1325 }
1326
1327 return 1;
1328}
1329
1330static int SSMGetPreCopyingDevicePathCfg(char dev_path[])
1331{
1332 const char *prop_value;
1333
1334 if (dev_path == NULL) {
1335 return -1;
1336 }
1337
1338 prop_value = config_get_str(CFG_SECTION_TV, "ssm.precopying.devpath", "null");
1339 if (strcmp(prop_value, "null") == 0) {
1340 return 1;
1341 }
1342
1343 strcpy(dev_path, prop_value);
1344
1345 return 0;
1346}
1347
1348static unsigned char gTempDataBuf[4096] = { 0 };
1349int SSMHandlePreCopying()
1350{
1351 int device_fd = -1;
1352 int i = 0, tmp_size = 0;
1353 unsigned char tmp_ch = 0;
1354 char tmpPreCopyingDevicePath[256] = { '\0' };
1355
1356 if (SSMGetPreCopyingEnableCfg() == 0) {
1357 LOGD("%s, Pre copying is disable now.\n", CFG_SECTION_TV);
1358 return 0;
1359 }
1360
1361 //read temp one byte
1362 SSMReadNTypes(0, 1, &tmp_ch);
1363
1364 SSMGetPreCopyingDevicePathCfg(tmpPreCopyingDevicePath);
1365
1366 device_fd = open(tmpPreCopyingDevicePath, O_RDONLY);
1367 if (device_fd < 0) {
1368 LOGE("%s, Open device file \"%s\" error: %s.\n", CFG_SECTION_TV,
1369 tmpPreCopyingDevicePath, strerror(errno));
1370 return -1;
1371 }
1372
1373 tmp_size = lseek(device_fd, 0, SEEK_END);
1374 if (tmp_size == 4096) {
1375 lseek(device_fd, 0, SEEK_SET);
1376 read(device_fd, gTempDataBuf, tmp_size);
1377
1378 SSMWriteNTypes(0, tmp_size, gTempDataBuf);
1379 }
1380
1381 close(device_fd);
1382
1383 remove(tmpPreCopyingDevicePath);
1384
1385 return 0;
1386}
1387
1388int SSMSaveDTVType(int rw_val)
1389{
1390 unsigned char tmp_val = rw_val;
1391
1392 return SSMWriteNTypes(SSM_RW_DTV_TYPE_START, 1, &tmp_val);
1393}
1394
1395int SSMReadDTVType(int *rw_val)
1396{
1397 int tmp_ret = 0;
1398 unsigned char tmp_val = 0;
1399
1400 tmp_ret = SSMReadNTypes(SSM_RW_DTV_TYPE_START, 1, &tmp_val);
1401 *rw_val = tmp_val;
1402
1403 return tmp_ret;
1404}
1405
1406#ifndef NELEM
1407# define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
1408#endif
1409
1410/************************ End APIs For UI ************************/
1411
1412// other api
1413int GetSSMCfgBufferData(const char *key_str, int *buf_item_count, int radix,
1414 unsigned char data_buf[])
1415{
1416 int cfg_item_count = 0;
1417 char *token = NULL;
1418 const char *strDelimit = ",";
1419 const char *config_value;
1420 char data_str[CC_CFG_VALUE_STR_MAX_LEN] = { 0 };
1421
1422 config_value = config_get_str(CFG_SECTION_TV, key_str, "null");
1423 if (strcasecmp(config_value, "null") == 0) {
1424 LOGE("%s, can't get config \"%s\"!!!\n", CFG_SECTION_TV, key_str);
1425 return -1;
1426 }
1427
1428 cfg_item_count = 0;
1429
1430 memset((void *)data_str, 0, sizeof(data_str));
1431 strncpy(data_str, config_value, sizeof(data_str) - 1);
1432
1433 char *pSave;
1434 token = strtok_r(data_str, strDelimit, &pSave);
1435 while (token != NULL) {
1436 if (cfg_item_count < *buf_item_count) {
1437 data_buf[cfg_item_count] = strtol(token, NULL, radix);
1438
1439 token = strtok_r(NULL, strDelimit, &pSave);
1440 cfg_item_count += 1;
1441 } else {
1442 LOGE("%s, we get data count more than desire count (%d)!!!\n",
1443 CFG_SECTION_TV, *buf_item_count);
1444 return -1;
1445 }
1446 }
1447
1448 *buf_item_count = cfg_item_count;
1449
1450 return 0;
1451}
1452
1453int SSMSaveSourceInput(unsigned char rw_val)
1454{
1455 return SSMWriteNTypes(TVIN_DATA_POS_SOURCE_INPUT_START, 1, &rw_val);
1456}
1457
1458int SSMReadSourceInput()
1459{
1460 unsigned char tmp_val = 0;
1461
1462 if (SSMReadNTypes(TVIN_DATA_POS_SOURCE_INPUT_START, 1, &tmp_val) < 0) {
1463 return 0;
1464 }
1465 if (tmp_val == CBlobDevice::CC_INIT_BYTE_VAL) {
1466 tmp_val = 0;
1467 }
1468
1469 return tmp_val;
1470}
1471
1472int SSMSaveCVBSStd(unsigned char rw_val)
1473{
1474 return SSMWriteNTypes(TVIN_DATA_CVBS_STD_START, 1, &rw_val);
1475}
1476
1477int SSMReadCVBSStd(unsigned char *rw_val)
1478{
1479 return SSMReadNTypes(TVIN_DATA_CVBS_STD_START, 1, rw_val);
1480}
1481
1482int SSMSave3DMode(unsigned char rw_val)
1483{
1484 return SSMWriteNTypes(TVIN_DATA_POS_3D_MODE_START, 1, &rw_val);
1485}
1486
1487int SSMRead3DMode(unsigned char *rw_val)
1488{
1489 return SSMReadNTypes(TVIN_DATA_POS_3D_MODE_START, 1, rw_val);
1490}
1491
1492int SSMSave3DLRSwitch(unsigned char rw_val)
1493{
1494 return SSMWriteNTypes(TVIN_DATA_POS_3D_LRSWITCH_START, 1, &rw_val);
1495}
1496
1497int SSMRead3DLRSwitch(unsigned char *rw_val)
1498{
1499 return SSMReadNTypes(TVIN_DATA_POS_3D_LRSWITCH_START, 1, rw_val);
1500}
1501
1502int SSMSave3DDepth(unsigned char rw_val)
1503{
1504 return SSMWriteNTypes(TVIN_DATA_POS_3D_DEPTH_START, 1, &rw_val);
1505}
1506
1507int SSMRead3DDepth(unsigned char *rw_val)
1508{
1509 return SSMReadNTypes(TVIN_DATA_POS_3D_DEPTH_START, 1, rw_val);
1510}
1511
1512int SSMSave3DTO2D(unsigned char rw_val)
1513{
1514 return SSMWriteNTypes(TVIN_DATA_POS_3D_TO2D_START, 1, &rw_val);
1515}
1516
1517int SSMRead3DTO2D(unsigned char *rw_val)
1518{
1519 return SSMReadNTypes(TVIN_DATA_POS_3D_TO2D_START, 1, rw_val);
1520}
1521
1522int SSMSaveBrightness(int offset, int rw_val)
1523{
1524 unsigned char tmp_val = rw_val;
1525
1526 return SSMWriteNTypes(VPP_DATA_POS_BRIGHTNESS_START + offset, 1, &tmp_val);
1527}
1528
1529int SSMReadBrightness(int offset, int *rw_val)
1530{
1531 int tmp_ret = 0;
1532 unsigned char tmp_val = 0;
1533
1534 tmp_ret = SSMReadNTypes(VPP_DATA_POS_BRIGHTNESS_START + offset, 1,
1535 &tmp_val);
1536 *rw_val = tmp_val;
1537
1538 return tmp_ret;
1539}
1540
1541int SSMSaveContrast(int offset, int rw_val)
1542{
1543 unsigned char tmp_val = rw_val;
1544
1545 return SSMWriteNTypes(VPP_DATA_POS_CONTRAST_START + offset, 1, &tmp_val);
1546}
1547
1548int SSMReadContrast(int offset, int *rw_val)
1549{
1550 int tmp_ret = 0;
1551 unsigned char tmp_val = 0;
1552
1553 tmp_ret = SSMReadNTypes(VPP_DATA_POS_CONTRAST_START + offset, 1, &tmp_val);
1554 *rw_val = tmp_val;
1555
1556 return tmp_ret;
1557}
1558
1559int SSMSaveSaturation(int offset, int rw_val)
1560{
1561 unsigned char tmp_val = rw_val;
1562
1563 return SSMWriteNTypes(VPP_DATA_POS_SATURATION_START + offset, 1, &tmp_val);
1564}
1565
1566int SSMReadSaturation(int offset, int *rw_val)
1567{
1568 int tmp_ret = 0;
1569 unsigned char tmp_val = 0;
1570
1571 tmp_ret = SSMReadNTypes(VPP_DATA_POS_SATURATION_START + offset, 1,
1572 &tmp_val);
1573 *rw_val = tmp_val;
1574
1575 return tmp_ret;
1576}
1577
1578int SSMSaveHue(int offset, int rw_val)
1579{
1580 unsigned char tmp_val = rw_val;
1581
1582 return SSMWriteNTypes(VPP_DATA_POS_HUE_START + offset, 1, &tmp_val);
1583}
1584
1585int SSMReadHue(int offset, int *rw_val)
1586{
1587 int tmp_ret = 0;
1588 unsigned char tmp_val = 0;
1589
1590 tmp_ret = SSMReadNTypes(VPP_DATA_POS_HUE_START + offset, 1, &tmp_val);
1591 *rw_val = tmp_val;
1592
1593 return tmp_ret;
1594}
1595
1596int SSMSaveSharpness(int offset, int rw_val)
1597{
1598 unsigned char tmp_val = rw_val;
1599
1600 return SSMWriteNTypes(VPP_DATA_POS_SHARPNESS_START + offset, 1, &tmp_val);
1601}
1602
1603int SSMReadSharpness(int offset, int *rw_val)
1604{
1605 int tmp_ret = 0;
1606 unsigned char tmp_val = 0;
1607
1608 tmp_ret = SSMReadNTypes(VPP_DATA_POS_SHARPNESS_START + offset, 1, &tmp_val);
1609 *rw_val = tmp_val;
1610
1611 return tmp_ret;
1612}
1613
1614int SSMSaveSceneMode(int rw_val)
1615{
1616 unsigned char tmp_val = rw_val;
1617
1618 return SSMWriteNTypes(VPP_DATA_POS_SCENE_MODE_START, 1, &tmp_val);
1619}
1620
1621int SSMReadSceneMode(int *rw_val)
1622{
1623 int tmp_ret = 0;
1624 unsigned char tmp_val = 0;
1625
1626 tmp_ret = SSMReadNTypes(VPP_DATA_POS_SCENE_MODE_START, 1, &tmp_val);
1627 *rw_val = tmp_val;
1628
1629 return tmp_ret;
1630}
1631
1632int SSMSavePictureMode(int offset, int rw_val)
1633{
1634 unsigned char tmp_val = rw_val;
1635
1636 return SSMWriteNTypes(VPP_DATA_POS_PICTURE_MODE_START + offset, 1, &tmp_val);
1637}
1638
1639int SSMReadPictureMode(int offset, int *rw_val)
1640{
1641 int tmp_ret = 0;
1642 unsigned char tmp_val = 0;
1643
1644 tmp_ret = SSMReadNTypes(VPP_DATA_POS_PICTURE_MODE_START + offset, 1,
1645 &tmp_val);
1646 *rw_val = tmp_val;
1647
1648 return tmp_ret;
1649}
1650
1651int SSMSaveColorTemperature(int offset, int rw_val)
1652{
1653 unsigned char tmp_val = rw_val;
1654
1655 return SSMWriteNTypes(VPP_DATA_POS_COLOR_TEMP_START + offset, 1, &tmp_val);
1656}
1657
1658int SSMReadColorTemperature(int offset, int *rw_val)
1659{
1660 int tmp_ret = 0;
1661 unsigned char tmp_val = 0;
1662
1663 tmp_ret = SSMReadNTypes(VPP_DATA_POS_COLOR_TEMP_START + offset, 1,
1664 &tmp_val);
1665 *rw_val = tmp_val;
1666
1667 return tmp_ret;
1668}
1669
1670int SSMSaveNoiseReduction(int offset, int rw_val)
1671{
1672 unsigned char tmp_val = rw_val;
1673
1674 return SSMWriteNTypes(VPP_DATA_POS_NOISE_REDUCTION_START + offset, 1,
1675 &tmp_val);
1676}
1677
1678int SSMReadNoiseReduction(int offset, int *rw_val)
1679{
1680 int tmp_ret = 0;
1681 unsigned char tmp_val = 0;
1682
1683 tmp_ret = SSMReadNTypes(VPP_DATA_POS_NOISE_REDUCTION_START + offset, 1,
1684 &tmp_val);
1685 *rw_val = tmp_val;
1686
1687 return tmp_ret;
1688}
1689
1690int SSMSaveDisplayMode(int offset, int rw_val)
1691{
1692 unsigned char tmp_val = rw_val;
1693
1694 return SSMWriteNTypes(VPP_DATA_POS_DISPLAY_MODE_START + offset, 1, &tmp_val);
1695}
1696
1697int SSMReadDisplayMode(int offset, int *rw_val)
1698{
1699 int tmp_ret = 0;
1700 unsigned char tmp_val = 0;
1701
1702 tmp_ret = SSMReadNTypes(VPP_DATA_POS_DISPLAY_MODE_START + offset, 1,
1703 &tmp_val);
1704 *rw_val = tmp_val;
1705
1706 return tmp_ret;
1707}
1708
1709int SSMSaveBackLightVal(int offset, int rw_val)
1710{
1711 unsigned char tmp_val = rw_val;
1712
1713 return SSMWriteNTypes(VPP_DATA_POS_BACKLIGHT_START + offset, 1, &tmp_val);
1714}
1715
1716int SSMReadBackLightVal(int offset, int *rw_val)
1717{
1718 int tmp_ret = 0;
1719 unsigned char tmp_val = 0;
1720
1721 tmp_ret = SSMReadNTypes(VPP_DATA_POS_BACKLIGHT_START + offset, 1, &tmp_val);
1722 *rw_val = tmp_val;
1723
1724 return tmp_ret;
1725}
1726
1727int SSMSaveFBCN360BackLightVal(int rw_val)
1728{
1729 unsigned char tmp_val = rw_val;
1730
1731 return SSMWriteNTypes(VPP_DATA_POS_FBC_BACKLIGHT_START , 1, &tmp_val);
1732}
1733
1734int SSMReadFBCN360BackLightVal(int *rw_val)
1735{
1736 int tmp_ret = 0;
1737 unsigned char tmp_val = 0;
1738
1739 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_BACKLIGHT_START, 1, &tmp_val);
1740 *rw_val = tmp_val;
1741
1742 return tmp_ret;
1743}
1744
1745int SSMSaveFBCN360ColorTempVal(int rw_val)
1746{
1747 unsigned char tmp_val = rw_val;
1748
1749 return SSMWriteNTypes(VPP_DATA_POS_FBC_COLORTEMP_START , 1, &tmp_val);
1750}
1751
1752int SSMReadFBCN360ColorTempVal(int *rw_val)
1753{
1754 int tmp_ret = 0;
1755 unsigned char tmp_val = 0;
1756
1757 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_COLORTEMP_START, 1, &tmp_val);
1758 *rw_val = tmp_val;
1759
1760 return tmp_ret;
1761}
1762
1763
1764int SSMSaveFBCELECmodeVal(int rw_val)
1765{
1766 unsigned char tmp_val = rw_val;
1767 return SSMWriteNTypes(VPP_DATA_POS_FBC_ELECMODE_START , 1, &tmp_val);
1768}
1769
1770int SSMReadFBCELECmodeVal(int *rw_val)
1771{
1772 int tmp_ret = 0;
1773 unsigned char tmp_val = 0;
1774
1775 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_ELECMODE_START, 1, &tmp_val);
1776 *rw_val = tmp_val;
1777
1778 return tmp_ret;
1779}
1780
1781
1782int SSMSaveColorDemoMode(unsigned char rw_val)
1783{
1784 return SSMWriteNTypes(VPP_DATA_POS_COLOR_DEMO_MODE_START, 1, &rw_val);
1785}
1786
1787int SSMReadColorDemoMode(unsigned char *rw_val)
1788{
1789 return SSMReadNTypes(VPP_DATA_POS_COLOR_DEMO_MODE_START, 1, rw_val);
1790}
1791
1792int SSMSaveColorBaseMode(unsigned char rw_val)
1793{
1794 return SSMWriteNTypes(VPP_DATA_POS_COLOR_BASE_MODE_START, 1, &rw_val);
1795}
1796
1797int SSMReadColorBaseMode(unsigned char *rw_val)
1798{
1799 return SSMReadNTypes(VPP_DATA_POS_COLOR_BASE_MODE_START, 1, rw_val);
1800}
1801
1802int SSMSaveRGBGainRStart(int offset, unsigned int rw_val)
1803{
1804 return SSMWriteNTypes(VPP_DATA_POS_RGB_GAIN_R_START + offset, 1, &rw_val);
1805}
1806
1807int SSMReadRGBGainRStart(int offset, unsigned int *rw_val)
1808{
1809 return SSMReadNTypes(VPP_DATA_POS_RGB_GAIN_R_START + offset, 1, rw_val);
1810}
1811
1812int SSMSaveRGBGainGStart(int offset, unsigned int rw_val)
1813{
1814 return SSMWriteNTypes(VPP_DATA_POS_RGB_GAIN_G_START + offset, 1, &rw_val);
1815}
1816
1817int SSMReadRGBGainGStart(int offset, unsigned int *rw_val)
1818{
1819 return SSMReadNTypes(VPP_DATA_POS_RGB_GAIN_G_START + offset, 1, rw_val);
1820}
1821
1822int SSMSaveRGBGainBStart(int offset, unsigned int rw_val)
1823{
1824 return SSMWriteNTypes(VPP_DATA_POS_RGB_GAIN_B_START + offset, 1, &rw_val);
1825}
1826
1827int SSMReadRGBGainBStart(int offset, unsigned int *rw_val)
1828{
1829 return SSMReadNTypes(VPP_DATA_POS_RGB_GAIN_B_START + offset, 1, rw_val);
1830}
1831
1832int SSMSaveRGBPostOffsetRStart(int offset, int rw_val)
1833{
1834 return SSMWriteNTypes(VPP_DATA_POS_RGB_POST_OFFSET_R_START + offset, 1,
1835 &rw_val);
1836}
1837
1838int SSMReadRGBPostOffsetRStart(int offset, int *rw_val)
1839{
1840 return SSMReadNTypes(VPP_DATA_POS_RGB_POST_OFFSET_R_START + offset, 1,
1841 rw_val);
1842}
1843
1844int SSMSaveRGBPostOffsetGStart(int offset, int rw_val)
1845{
1846 return SSMWriteNTypes(VPP_DATA_POS_RGB_POST_OFFSET_G_START + offset, 1,
1847 &rw_val);
1848}
1849
1850int SSMReadRGBPostOffsetGStart(int offset, int *rw_val)
1851{
1852 return SSMReadNTypes(VPP_DATA_POS_RGB_POST_OFFSET_G_START + offset, 1,
1853 rw_val);
1854}
1855
1856int SSMSaveRGBPostOffsetBStart(int offset, int rw_val)
1857{
1858 return SSMWriteNTypes(VPP_DATA_POS_RGB_POST_OFFSET_B_START + offset, 1,
1859 &rw_val);
1860}
1861
1862int SSMReadRGBPostOffsetBStart(int offset, int *rw_val)
1863{
1864 return SSMReadNTypes(VPP_DATA_POS_RGB_POST_OFFSET_B_START + offset, 1,
1865 rw_val);
1866}
1867
1868int SSMSaveRGBValueStart(int offset, int8_t rw_val)
1869{
1870 return SSMWriteNTypes(VPP_DATA_RGB_START + offset, 1, &rw_val);
1871}
1872
1873int SSMReadRGBValueStart(int offset, int8_t *rw_val)
1874{
1875 return SSMReadNTypes(VPP_DATA_RGB_START + offset, 1, &rw_val);
1876}
1877
1878int SSMSaveDBCStart(unsigned char rw_val)
1879{
1880 return SSMWriteNTypes(VPP_DATA_POS_DBC_START, 1, &rw_val);
1881}
1882
1883int SSMReadDBCStart(unsigned char *rw_val)
1884{
1885 return SSMReadNTypes(VPP_DATA_POS_DBC_START, 1, rw_val);
1886}
1887
1888int SSMSaveColorSpaceStart(unsigned char rw_val)
1889{
1890 return SSMWriteNTypes(VPP_DATA_COLOR_SPACE_START, 1, &rw_val);
1891}
1892
1893int SSMReadColorSpaceStart(unsigned char *rw_val)
1894{
1895 return SSMReadNTypes(VPP_DATA_COLOR_SPACE_START, 1, rw_val);
1896}
1897
1898int SSMSaveDnlpStart(unsigned char rw_val)
1899{
1900 return SSMWriteNTypes(VPP_DATA_POS_DNLP_START, 1, &rw_val);
1901}
1902
1903int SSMReadDnlpStart(unsigned char *rw_val)
1904{
1905 return SSMReadNTypes(VPP_DATA_POS_DNLP_START, 1, rw_val);
1906}
1907
1908int SSMSavePanoramaStart(int offset, unsigned char rw_val)
1909{
1910 return SSMWriteNTypes(VPP_DATA_POS_PANORAMA_START + offset, 1, &rw_val);
1911}
1912
1913int SSMReadPanoramaStart(int offset, unsigned char *rw_val)
1914{
1915 return SSMReadNTypes(VPP_DATA_POS_PANORAMA_START + offset, 1, rw_val);
1916}
1917
1918int SSMSaveTestPattern(unsigned char rw_val)
1919{
1920 return SSMWriteNTypes(VPP_DATA_POS_TEST_PATTERN_START, 1, &rw_val);
1921}
1922
1923int SSMReadTestPattern(unsigned char *rw_val)
1924{
1925 return SSMReadNTypes(VPP_DATA_POS_TEST_PATTERN_START, 1, rw_val);
1926}
1927
1928int SSMSaveAPL(unsigned char rw_val)
1929{
1930 return SSMWriteNTypes(VPP_DATA_APL_START, VPP_DATA_APL_SIZE, &rw_val);
1931}
1932
1933int SSMReadAPL(unsigned char *rw_val)
1934{
1935 return SSMReadNTypes(VPP_DATA_APL_START, VPP_DATA_APL_SIZE, rw_val);
1936}
1937
1938int SSMSaveAPL2(unsigned char rw_val)
1939{
1940 return SSMWriteNTypes(VPP_DATA_APL2_START, VPP_DATA_APL2_SIZE, &rw_val);
1941}
1942
1943int SSMReadAPL2(unsigned char *rw_val)
1944{
1945 return SSMReadNTypes(VPP_DATA_APL2_START, VPP_DATA_APL2_SIZE, rw_val);
1946}
1947
1948int SSMSaveBD(unsigned char rw_val)
1949{
1950 return SSMWriteNTypes(VPP_DATA_BD_START, VPP_DATA_BD_SIZE, &rw_val);
1951}
1952
1953int SSMReadBD(unsigned char *rw_val)
1954{
1955 return SSMReadNTypes(VPP_DATA_BD_START, VPP_DATA_BD_SIZE, rw_val);
1956}
1957
1958int SSMSaveBP(unsigned char rw_val)
1959{
1960 return SSMWriteNTypes(VPP_DATA_BP_START, VPP_DATA_BP_SIZE, &rw_val);
1961}
1962
1963int SSMReadBP(unsigned char *rw_val)
1964{
1965 return SSMReadNTypes(VPP_DATA_BP_START, VPP_DATA_BP_SIZE, rw_val);
1966}
1967
1968int SSMSaveDDRSSC(unsigned char rw_val)
1969{
1970 return SSMWriteNTypes(VPP_DATA_POS_DDR_SSC_START, 1, &rw_val);
1971}
1972
1973int SSMReadDDRSSC(unsigned char *rw_val)
1974{
1975 return SSMReadNTypes(VPP_DATA_POS_DDR_SSC_START, 1, rw_val);
1976}
1977
1978int SSMSaveLVDSSSC(unsigned char *rw_val)
1979{
1980 return SSMWriteNTypes(VPP_DATA_POS_LVDS_SSC_START, 2, rw_val);
1981}
1982
1983int SSMReadLVDSSSC(unsigned char *rw_val)
1984{
1985 return SSMReadNTypes(VPP_DATA_POS_LVDS_SSC_START, 2, rw_val);
1986}
1987
1988int SSMSaveDreamPanel(unsigned char rw_val)
1989{
1990 return SSMWriteNTypes(VPP_DATA_POS_DREAM_PANEL_START, 1, &rw_val);
1991}
1992
1993int SSMReadDreamPanel(unsigned char *rw_val)
1994{
1995 return SSMReadNTypes(VPP_DATA_POS_DREAM_PANEL_START, 1, rw_val);
1996}
1997
1998int SSMSaveUserNatureLightSwitch(unsigned char rw_val)
1999{
2000 return SSMWriteNTypes(VPP_DATA_USER_NATURE_SWITCH_START, 1, &rw_val);
2001}
2002
2003int SSMReadUserNatureLightSwitch(unsigned char *rw_val)
2004{
2005 return SSMReadNTypes(VPP_DATA_USER_NATURE_SWITCH_START, 1, rw_val);
2006}
2007
2008int SSMSaveDBCBacklightEnable(unsigned char rw_val)
2009{
2010 return SSMWriteNTypes(VPP_DATA_DBC_BACKLIGHT_START, 1, &rw_val);
2011}
2012
2013int SSMReadDBCBacklightEnable(unsigned char *rw_val)
2014{
2015 return SSMReadNTypes(VPP_DATA_DBC_BACKLIGHT_START, 1, rw_val);
2016}
2017
2018int SSMSaveDBCBacklightStd(unsigned char rw_val)
2019{
2020 return SSMWriteNTypes(VPP_DATA_DBC_STANDARD_START, 1, &rw_val);
2021}
2022
2023int SSMReadDBCBacklightStd(unsigned char *rw_val)
2024{
2025 return SSMReadNTypes(VPP_DATA_DBC_STANDARD_START, 1, rw_val);
2026}
2027
2028int SSMSaveDBCEnable(unsigned char rw_val)
2029{
2030 return SSMWriteNTypes(VPP_DATA_DBC_ENABLE_START, 1, &rw_val);
2031}
2032
2033int SSMReadDBCEnable(unsigned char *rw_val)
2034{
2035 return SSMReadNTypes(VPP_DATA_DBC_ENABLE_START, 1, rw_val);
2036}
2037
2038int SSMSaveGammaValue(int rw_val)
2039{
2040 unsigned char tmp_val = rw_val;
2041
2042 return SSMWriteNTypes(VPP_DATA_GAMMA_VALUE_START, 1, &tmp_val);
2043}
2044
2045int SSMReadGammaValue(int *rw_val)
2046{
2047 int tmp_ret = 0;
2048 unsigned char tmp_val = 0;
2049
2050 tmp_ret = SSMReadNTypes(VPP_DATA_GAMMA_VALUE_START, 1, &tmp_val);
2051 *rw_val = tmp_val;
2052
2053 return tmp_ret;
2054}
2055
2056int SSMSaveBackLightReverse(unsigned char rw_val)
2057{
2058 return SSMWriteNTypes(VPP_DATA_POS_BACKLIGHT_REVERSE_START, 1, &rw_val);
2059}
2060
2061int SSMReadBackLightReverse(unsigned char *rw_val)
2062{
2063 return SSMReadNTypes(VPP_DATA_POS_BACKLIGHT_REVERSE_START, 1, rw_val);
2064}
2065
2066int SSMSaveAudioMasterVolume(int8_t rw_val)
2067{
2068 return SSMWriteNTypes(SSM_AUD_MASTR_VOLUME_VAL, 1, &rw_val);
2069}
2070
2071int SSMReadAudioMasterVolume(int8_t *rw_val)
2072{
2073 return SSMReadNTypes(SSM_AUD_MASTR_VOLUME_VAL, 1, rw_val);
2074}
2075
2076int SSMSaveAudioBalanceVal(int8_t rw_val)
2077{
2078 return SSMWriteNTypes(SSM_AUD_BALANCE_VAL, 1, &rw_val);
2079}
2080
2081int SSMReadAudioBalanceVal(int8_t *rw_val)
2082{
2083 return SSMReadNTypes(SSM_AUD_BALANCE_VAL, 1, rw_val);
2084}
2085
2086int SSMSaveAudioSupperBassVolume(int8_t rw_val)
2087{
2088 return SSMWriteNTypes(SSM_AUD_SUPPERBASS_VOLUME_VAL, 1, &rw_val);
2089}
2090
2091int SSMReadAudioSupperBassVolume(int8_t *rw_val)
2092{
2093 return SSMReadNTypes(SSM_AUD_SUPPERBASS_VOLUME_VAL, 1, rw_val);
2094}
2095
2096int SSMSaveAudioSupperBassSwitch(int8_t rw_val)
2097{
2098 return SSMWriteNTypes(SSM_AUD_SUPPERBASS_SWITCH, 1, &rw_val);
2099}
2100
2101int SSMReadAudioSupperBassSwitch(int8_t *rw_val)
2102{
2103 return SSMReadNTypes(SSM_AUD_SUPPERBASS_SWITCH, 1, rw_val);
2104}
2105
2106int SSMSaveAudioSRSSurroundSwitch(int8_t rw_val)
2107{
2108 return SSMWriteNTypes(SSM_AUD_SRS_SURROUND_SWITCH, 1, &rw_val);
2109}
2110
2111int SSMReadAudioSRSSurroundSwitch(int8_t *rw_val)
2112{
2113 return SSMReadNTypes(SSM_AUD_SRS_SURROUND_SWITCH, 1, rw_val);
2114}
2115
2116int SSMSaveAudioSRSDialogClaritySwitch(int8_t rw_val)
2117{
2118 return SSMWriteNTypes(SSM_AUD_SRS_DIALOG_CLARITY_SWITCH, 1, &rw_val);
2119}
2120
2121int SSMSaveAudioDbxTvValue(int son_value, int vol_value, int sur_value)
2122{
2123 int8_t rw_val = son_value;
2124 SSMWriteNTypes(SSM_AUD_DBX_TV_SON, 1, &rw_val);
2125 rw_val = vol_value;
2126 SSMWriteNTypes(SSM_AUD_DBX_TV_VAL, 1, &rw_val);
2127 rw_val = sur_value;
2128 SSMWriteNTypes(SSM_AUD_DBX_TV_SUR, 1, &rw_val);
2129 return 0;
2130}
2131
2132int SSMReadAudioDbxTvValue(int *son_value, int *vol_value, int *sur_value)
2133{
2134 unsigned char rw_val;
2135 SSMReadNTypes(SSM_AUD_DBX_TV_SON, 1, &rw_val);
2136 *son_value = rw_val;
2137 SSMReadNTypes(SSM_AUD_DBX_TV_VAL, 1, &rw_val);
2138 *vol_value = rw_val;
2139 SSMReadNTypes(SSM_AUD_DBX_TV_SUR, 1, &rw_val);
2140 *sur_value = rw_val;
2141 return 0;
2142}
2143
2144int SSMReadAudioSRSDialogClaritySwitch(int8_t *rw_val)
2145{
2146 return SSMReadNTypes(SSM_AUD_SRS_DIALOG_CLARITY_SWITCH, 1, rw_val);
2147}
2148
2149int SSMSaveAudioSRSTruBassSwitch(int8_t rw_val)
2150{
2151 return SSMWriteNTypes(SSM_AUD_SRS_TRUEBASS_SWITCH, 1, &rw_val);
2152}
2153
2154int SSMReadAudioSRSTruBassSwitch(int8_t *rw_val)
2155{
2156 return SSMReadNTypes(SSM_AUD_SRS_TRUEBASS_SWITCH, 1, rw_val);
2157}
2158
2159int SSMSaveAudioBassVolume(int8_t rw_val)
2160{
2161 return SSMWriteNTypes(SSM_AUD_BASS_VOLUME_VAL, 1, &rw_val);
2162}
2163
2164int SSMReadAudioBassVolume(int8_t *rw_val)
2165{
2166 return SSMReadNTypes(SSM_AUD_BASS_VOLUME_VAL, 1, rw_val);
2167}
2168
2169int SSMSaveAudioTrebleVolume(int8_t rw_val)
2170{
2171 return SSMWriteNTypes(SSM_AUD_TREBLE_VOLUME_VAL, 1, &rw_val);
2172}
2173
2174int SSMReadAudioTrebleVolume(int8_t *rw_val)
2175{
2176 return SSMReadNTypes(SSM_AUD_TREBLE_VOLUME_VAL, 1, rw_val);
2177}
2178
2179int SSMSaveAudioSoundModeVal(int8_t rw_val)
2180{
2181 return SSMWriteNTypes(SSM_AUD_SOUND_MODE_VAL, 1, &rw_val);
2182}
2183
2184int SSMReadAudioSoundModeVal(int8_t *rw_val)
2185{
2186 return SSMReadNTypes(SSM_AUD_SOUND_MODE_VAL, 1, rw_val);
2187}
2188
2189int SSMSaveAudioWallEffectSwitch(int8_t rw_val)
2190{
2191 return SSMWriteNTypes(SSM_AUD_WALL_EFFCT_SWITCH, 1, &rw_val);
2192}
2193
2194int SSMReadAudioWallEffectSwitch(int8_t *rw_val)
2195{
2196 return SSMReadNTypes(SSM_AUD_WALL_EFFCT_SWITCH, 1, rw_val);
2197}
2198
2199int SSMSaveAudioSPDIFSwitchVal(int8_t rw_val)
2200{
2201 return SSMWriteNTypes(SSM_AUD_SPDIF_SWITCH, 1, &rw_val);
2202}
2203
2204int SSMReadAudioSPDIFSwitchVal(int8_t *rw_val)
2205{
2206 return SSMReadNTypes(SSM_AUD_SPDIF_SWITCH, 1, rw_val);
2207}
2208
2209int SSMSaveAudioSPDIFModeVal(int8_t rw_val)
2210{
2211 return SSMWriteNTypes(SSM_AUD_SPDIF_MODE_VAL, 1, &rw_val);
2212}
2213
2214int SSMReadAudioSPDIFModeVal(int8_t *rw_val)
2215{
2216 return SSMReadNTypes(SSM_AUD_SPDIF_MODE_VAL, 1, rw_val);
2217}
2218
2219int SSMSaveAudioEQModeVal(int8_t rw_val)
2220{
2221 return SSMWriteNTypes(SSM_AUD_EQ_MODE_VAL, 1, &rw_val);
2222}
2223
2224int SSMReadAudioEQModeVal(int8_t *rw_val)
2225{
2226 return SSMReadNTypes(SSM_AUD_EQ_MODE_VAL, 1, rw_val);
2227}
2228
2229int SSMSaveAudioEQGain(int offset, int size, int8_t tmp_buf[])
2230{
2231 return SSMWriteNTypes(SSM_AUD_EQ_GAIN + offset, size, tmp_buf);
2232}
2233
2234int SSMReadAudioEQGain(int offset __unused, int size, int8_t tmp_buf[])
2235{
2236 return SSMReadNTypes(SSM_AUD_EQ_GAIN, size, tmp_buf);
2237}
2238
2239int SSMSaveAudioAVOutMuteVal(int8_t rw_val)
2240{
2241 return SSMWriteNTypes(SSM_AUD_AVOUT_MUTE, 1, &rw_val);
2242}
2243
2244int SSMReadAudioAVOutMuteVal(int8_t *rw_val)
2245{
2246 return SSMReadNTypes(SSM_AUD_AVOUT_MUTE, 1, rw_val);
2247}
2248
2249int SSMSaveAudioSPIDFMuteVal(int8_t rw_val)
2250{
2251 return SSMWriteNTypes(SSM_AUD_SPIDF_MUTE, 1, &rw_val);
2252}
2253
2254int SSMReadAudioSPIDFMuteVal(int8_t *rw_val)
2255{
2256 return SSMReadNTypes(SSM_AUD_SPIDF_MUTE, 1, rw_val);
2257}
2258int SSMSaveBlackoutEnable(int8_t enable)
2259{
2260 return SSMWriteNTypes(SSM_RW_BLACKOUT_ENABLE_START, 1, &enable);
2261}
2262
2263int SSMReadBlackoutEnable(int8_t *enable)
2264{
2265 return SSMReadNTypes(SSM_RW_BLACKOUT_ENABLE_START, 1, enable);
2266}
2267int SSMSaveFBCN310BackLightVal(int rw_val)
2268{
2269 unsigned char tmp_val = rw_val;
2270
2271 return SSMWriteNTypes(VPP_DATA_POS_FBC_N310_BACKLIGHT_START , 1, &tmp_val);
2272}
2273
2274int SSMReadFBCN310BackLightVal(int *rw_val)
2275{
2276 int tmp_ret = 0;
2277 unsigned char tmp_val = 0;
2278
2279 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_N310_BACKLIGHT_START, 1, &tmp_val);
2280 *rw_val = tmp_val;
2281
2282 return tmp_ret;
2283}
2284
2285int SSMSaveFBCN310ColorTempVal(int rw_val)
2286{
2287 unsigned char tmp_val = rw_val;
2288
2289 return SSMWriteNTypes(VPP_DATA_POS_FBC_N310_COLORTEMP_START , 1, &tmp_val);
2290}
2291
2292int SSMReadFBCN310ColorTempVal(int *rw_val)
2293{
2294 int tmp_ret = 0;
2295 unsigned char tmp_val = 0;
2296
2297 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_N310_COLORTEMP_START, 1, &tmp_val);
2298 *rw_val = tmp_val;
2299
2300 return tmp_ret;
2301}
2302
2303int SSMSaveFBCN310LightsensorVal(int rw_val)
2304{
2305 unsigned char tmp_val = rw_val;
2306
2307 return SSMWriteNTypes(VPP_DATA_POS_FBC_N310_LIGHTSENSOR_START , 1, &tmp_val);
2308}
2309
2310int SSMReadFBCN310LightsensorVal(int *rw_val)
2311{
2312 int tmp_ret = 0;
2313 unsigned char tmp_val = 0;
2314
2315 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_N310_LIGHTSENSOR_START, 1, &tmp_val);
2316 *rw_val = tmp_val;
2317
2318 return tmp_ret;
2319}
2320
2321int SSMSaveFBCN310Dream_PanelVal(int rw_val)
2322{
2323 unsigned char tmp_val = rw_val;
2324
2325 return SSMWriteNTypes(VPP_DATA_POS_FBC_N310_DREAMPANEL_START , 1, &tmp_val);
2326}
2327
2328int SSMReadFBCN310Dream_PanelVal(int *rw_val)
2329{
2330 int tmp_ret = 0;
2331 unsigned char tmp_val = 0;
2332
2333 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_N310_DREAMPANEL_START, 1, &tmp_val);
2334 *rw_val = tmp_val;
2335
2336 return tmp_ret;
2337}
2338
2339int SSMSaveFBCN310MULT_PQVal(int rw_val)
2340{
2341 unsigned char tmp_val = rw_val;
2342
2343 return SSMWriteNTypes(VPP_DATA_POS_FBC_N310_MULTI_PQ_START , 1, &tmp_val);
2344}
2345
2346int SSMReadFBCN310MULT_PQVal(int *rw_val)
2347{
2348 int tmp_ret = 0;
2349 unsigned char tmp_val = 0;
2350
2351 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_N310_MULTI_PQ_START, 1, &tmp_val);
2352 *rw_val = tmp_val;
2353
2354 return tmp_ret;
2355}
2356
2357int SSMSaveFBCN310MEMCVal(int rw_val)
2358{
2359 unsigned char tmp_val = rw_val;
2360
2361 return SSMWriteNTypes(VPP_DATA_POS_FBC_N310_MEMC_START , 1, &tmp_val);
2362}
2363
2364int SSMReadFBCN310MEMCVal(int *rw_val)
2365{
2366 int tmp_ret = 0;
2367 unsigned char tmp_val = 0;
2368
2369 tmp_ret = SSMReadNTypes(VPP_DATA_POS_FBC_N310_MEMC_START, 1, &tmp_val);
2370 *rw_val = tmp_val;
2371
2372 return tmp_ret;
2373}
2374
2375int SSMSaveN311_VbyOne_Spread_Spectrum_Val(int rw_val)
2376{
2377 unsigned char tmp_val = rw_val;
2378
2379 return SSMWriteNTypes(VPP_DATA_POS_N311_VBYONE_SPREAD_SPECTRUM_START , 1, &tmp_val);
2380}
2381
2382int SSMReadN311_VbyOne_Spread_Spectrum_Val(int *rw_val)
2383{
2384 int tmp_ret = 0;
2385 unsigned char tmp_val = 0;
2386
2387 tmp_ret = SSMReadNTypes(VPP_DATA_POS_N311_VBYONE_SPREAD_SPECTRUM_START, 1, &tmp_val);
2388 *rw_val = tmp_val;
2389
2390 return tmp_ret;
2391}
2392int SSMSaveN311_Bluetooth_Vol(int rw_val)
2393{
2394 unsigned char tmp_val = rw_val;
2395
2396 return SSMWriteNTypes(VPP_DATA_POS_N311_BLUETOOTH_VAL_START , 1, &tmp_val);
2397}
2398
2399int SSMReadN311_Bluetooth_Vol(void)
2400{
2401 int tmp_ret = 0;
2402 unsigned char tmp_val = 0;
2403
2404 tmp_ret = SSMReadNTypes(VPP_DATA_POS_N311_BLUETOOTH_VAL_START, 1, &tmp_val);
2405
2406 if (tmp_ret < 0) {
2407 return 0;
2408 }
2409
2410 return tmp_val;
2411}
2412int SSMSave_DRC_ONOFF_Val(int rw_val)
2413{
2414 unsigned char tmp_val = rw_val;
2415
2416 return SSMWriteNTypes(SSM_AUD_DRC_ONOFF , 1, &tmp_val);
2417
2418}
2419int SSMRead_DRC_ONOFF_Val(void)
2420{
2421 unsigned char tmp_val = 0;
2422 int tmp_ret = 0;
2423
2424 tmp_ret = SSMReadNTypes(SSM_AUD_DRC_ONOFF, 1, &tmp_val);
2425
2426 if (tmp_ret < 0) {
2427 return 0;
2428 }
2429
2430 return tmp_val;
2431
2432}
2433
2434int SSMSave_PANEL_ID_Val(int rw_val)
2435{
2436 unsigned char tmp_val = rw_val;
2437 return SSMWriteNTypes(SSM_RW_PANEL_ID_START , 1, &tmp_val);
2438}
2439int SSMRead_PANEL_ID_Val(void)
2440{
2441 unsigned char tmp_val = 0;
2442 int tmp_ret = 0;
2443 tmp_ret = SSMReadNTypes(SSM_RW_PANEL_ID_START, 1, &tmp_val);
2444 if (tmp_ret < 0) {
2445 return 0;
2446 }
2447 return tmp_val;
2448}
2449