close Warning: Can't use blame annotator:
No changeset 2 in the repository

source: svn/zasc/app_c/DST_EEPROM.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

File size: 2.9 KB
RevLine 
1#include "DST_Common.h"
2#include "DST_EEPROM.h"
3#include "DST_HostInterface.h"
4#include "DST_GlobalVariables.h"
5#include "DST_CommonAPI.h"
6#include "DST_ChannelTune.h"
7#include "DST_WinManagerTask.h" //ui
8
9#include "DST_DB_Engine.h"
10#include "DST_DB.h"
11#include "DST_MemoryDB.h"
12
13typedef struct 
14{
15        const char* name;
16        int min;
17        int max;
18        int default_value;
19} CONFIG;
20
21static CONFIG config[] =
22{
23        {"NeedReset", 0, 1, 0},
24        {"First", 0, 1, 1},
25        {"TuneMode", 0, 2, 1},
26        {"Volume", 0, 50, 25},
27        {"CC", 0, 1, 0},
28        {"RF", 0, 154, 0}, // RFÀÇ index¸¦ ÀúÀåÇÑ´Ù.
29        {"program_number", 0, 0xFFFF, 0},
30        {"aspect_4x3o_4x3i", 0, 2, 1},
31        {"aspect_4x3o_16x9i", 0, 2, 1},
32        {"AudioPref", 0, 1, 0},
33        {"VI", 0, 1, 0},
34        {"PreferredConn", 0, 1, 0},
35        {"MinRF", 0, RF_COUNT-1, 0}, 
36        {"MaxRF", 0, RF_COUNT-1, RF_COUNT-1}
37};
38// unsigned aspect_4x3o_4x3i:2; // 0~2
39// unsigned aspect_4x3o_16x9i:2; // 0~2
40// unsigned aspect_16x9o_4x3i:2; // 0~2
41// unsigned aspect_16x9o_16x9i:2; // 0~2
42void DST_EEPROM_SetAspect(bool bSource4x3,  int nVal) 
43{
44        if (bSource4x3)
45        {
46                DST_EEPROM_SetConfig("aspect_4x3o_4x3i", 1);
47        }       
48        else
49        {
50                DST_EEPROM_SetConfig("aspect_4x3o_16x9i", nVal);
51        }
52}
53
54int DST_EEPROM_GetAspect(bool bSource4x3)
55{
56         //µðÆúÆ®°ª 4:3À϶§´Â ³ë¸»
57        if (bSource4x3) return DST_EEPROM_GetConfig("aspect_4x3o_4x3i");
58        return DST_EEPROM_GetConfig("aspect_4x3o_16x9i");
59}
60
61void DST_EEPROM_SetConfig(const char * name, int value)
62{
63        int i;
64        for (i = 0; i < DB_CONFIG_MAX; i++) // µ¿ÀÏ Á¤º¸ Áö¿ì±â
65        {
66                if (strcmp(db_config[i].name, name) != 0) continue;
67                memset(&db_config[i], 0, sizeof(_DB_CONFIG_));
68        }
69        for (i = 0; i < DB_CONFIG_MAX; i++) // µ¥ÀÌÅÍ Ãß°¡
70        {
71                if (strlen(db_config[i].name) != 0) continue; 
72                strcpy(db_config[i].name, name);
73                db_config[i].value = value;
74                break;
75        }
76        DST_DB_Sync();
77}
78
79int DST_EEPROM_GetConfig(const char *name) 
80{
81        int i;
82        int nCount = sizeof(config)/sizeof(CONFIG);
83        int nPos = -1;
84        for (i = 0; i < nCount; i++)
85        {
86                if (strcmp(config[i].name, name) != 0) continue;
87                nPos = i;
88                break;
89        } 
90        if (nPos < 0)
91        {
92                DST_Printf("%s|%d|Invalid name %s", __func__, __LINE__, name);
93                return 0;
94        }
95        for (i = 0; i < DB_CONFIG_MAX; i++)
96        {
97                if (strcmp(db_config[i].name, name) != 0) continue;
98                if (db_config[i].value < config[nPos].min) db_config[i].value = config[nPos].default_value;
99                if (db_config[i].value > config[nPos].max) db_config[i].value = config[nPos].default_value;
100                return db_config[i].value;
101        } 
102        return  config[nPos].default_value;
103}
104
105void DST_EEPROM_FactoryInit()
106{
107        int MinRF = DST_EEPROM_GetMinRF(); // ÀÌ °ªÀº »ç¿ëÀÚ °øÀåÃʱâÈ­ÇØµµ Áö¿öÁö¸é ¾È µÈ´Ù.
108        int MaxRF = DST_EEPROM_GetMaxRF(); // ÀÌ °ªÀº »ç¿ëÀÚ °øÀåÃʱâÈ­ÇØµµ Áö¿öÁö¸é ¾È µÈ´Ù.
109        memset(&db_config, 0, sizeof(_DB_CONFIG_) * DB_CONFIG_MAX);
110        DST_EEPROM_SetMinRF(MinRF);
111        DST_EEPROM_SetMaxRF(MaxRF);
112}
113
114void DST_SetSleepTimer(DS_U8 value)
115{
116        DST_g_SleepTimer = (value < 5) ? value : 0;
117}
118
119DS_U8 DST_GetSleepTimer()
120{
121        return (DST_g_SleepTimer < 5) ? DST_g_SleepTimer : 0;
122}
123
Note: See TracBrowser for help on using the repository browser.