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