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