| 1 | /**************************************************************************** |
|---|
| 2 | * NAME: App_Main.c |
|---|
| 3 | *---------------------------------------------------------------------------- |
|---|
| 4 | * Copyright (c) DIGITAL STREAM Technology Inc. |
|---|
| 5 | *---------------------------------------------------------------------------- |
|---|
| 6 | * CREATED_BY: Do Gon Lee |
|---|
| 7 | * CREATION_DATE: 2009/08/24 |
|---|
| 8 | * $Author: foxhunt $ |
|---|
| 9 | * $Revision: 1.0 $ |
|---|
| 10 | * $Date: 2009/08/24 10:39:43 $ |
|---|
| 11 | *---------------------------------------------------------------------------- |
|---|
| 12 | * PURPOSE: |
|---|
| 13 | * - Entry point of Main application. |
|---|
| 14 | *****************************************************************************/ |
|---|
| 15 | |
|---|
| 16 | /*_____ I N C L U D E __________________________________________*/ |
|---|
| 17 | |
|---|
| 18 | #include "App_Main.h" |
|---|
| 19 | #include "App_Version.h" |
|---|
| 20 | |
|---|
| 21 | #include "DMW_Main.h" |
|---|
| 22 | #include "DMW_ChannelAPI.h" |
|---|
| 23 | #include "DMW_EpgInterface.h" |
|---|
| 24 | |
|---|
| 25 | #include "App_Fnc_NvRam.h" |
|---|
| 26 | #include "App_Fnc_Audio.h" |
|---|
| 27 | #include "App_Fnc_Video.h" |
|---|
| 28 | #include "App_Fnc_ChTune.h" |
|---|
| 29 | #include "App_Fnc_DigitKeyProc.h" |
|---|
| 30 | #include "App_Fnc_EPG.h" |
|---|
| 31 | #include "App_Fnc_Power.h" |
|---|
| 32 | #include "App_Fnc_Rating.h" |
|---|
| 33 | #include "App_Fnc_RRT.h" |
|---|
| 34 | #include "App_Fnc_RfUpdate.h" |
|---|
| 35 | #include "App_Fnc_Time.h" |
|---|
| 36 | #include "App_Fnc_Ucm.h" |
|---|
| 37 | #include "App_Fnc_AutoScan.h" |
|---|
| 38 | #include "App_Fnc_SignalMonitor.h" |
|---|
| 39 | #include "App_Fnc_CC.h" |
|---|
| 40 | #include "App_Fnc_Pod.h" |
|---|
| 41 | #include "App_Fnc_Sdds.h" |
|---|
| 42 | #include "App_Fnc_EA2.h" |
|---|
| 43 | |
|---|
| 44 | #include "App_Fnc_Comm.h" |
|---|
| 45 | |
|---|
| 46 | #include "App_Res_Resources.h" |
|---|
| 47 | #include "App_Proc.h" |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | /*_____ D E F I N I T I O N ____________________________________*/ |
|---|
| 52 | |
|---|
| 53 | #if COMMENT |
|---|
| 54 | _____DbgPrint_____(){} |
|---|
| 55 | #endif |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | #if COMMENT |
|---|
| 62 | ____Config____(){} |
|---|
| 63 | #endif |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | #if COMMENT |
|---|
| 70 | ____Types____(){} |
|---|
| 71 | #endif |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | #if COMMENT |
|---|
| 78 | ____Variables____(){} |
|---|
| 79 | #endif |
|---|
| 80 | |
|---|
| 81 | static BOOL g_bInitialized; |
|---|
| 82 | /* system init flag */ |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | /*_____ F U N C T I O N ________________________________________*/ |
|---|
| 89 | |
|---|
| 90 | #if COMMENT |
|---|
| 91 | ____Function____(){} |
|---|
| 92 | #endif |
|---|
| 93 | |
|---|
| 94 | /******************************************************************************** |
|---|
| 95 | FUNCTION: |
|---|
| 96 | - App_PrintLogo |
|---|
| 97 | |
|---|
| 98 | Purpose: |
|---|
| 99 | - print application logo.(include sw version, project name, etc..) |
|---|
| 100 | *********************************************************************************/ |
|---|
| 101 | void App_PrintLogo(void) |
|---|
| 102 | { |
|---|
| 103 | #if APP_PORTING |
|---|
| 104 | UINT32 board_ver; |
|---|
| 105 | DHL_BOARD_TYPE board_type; |
|---|
| 106 | |
|---|
| 107 | DHL_SYS_GetBoardVersion(&board_ver, &board_type); |
|---|
| 108 | |
|---|
| 109 | DHL_OS_Printf("\n"); |
|---|
| 110 | DHL_OS_Printf("/////////////////////////////////////////////////////////////\n"); |
|---|
| 111 | DHL_OS_Printf("\n"); |
|---|
| 112 | DHL_OS_Printf("\t ------- Project %s ------- \n", App_GetPrjName()); |
|---|
| 113 | DHL_OS_Printf("\n"); |
|---|
| 114 | DHL_OS_Printf("\t\t\t - Build : %s %s\n", App_GetBuildDateString(), App_GetBuildTimeString()); |
|---|
| 115 | DHL_OS_Printf("\t\t\t - BOARD : %s (%u), ver %u\n", |
|---|
| 116 | DHL_BOARD_TYPE_STR(board_type), board_type, board_ver); |
|---|
| 117 | DHL_OS_Printf("\n"); |
|---|
| 118 | |
|---|
| 119 | DHL_OS_Printf("\t # Channel MW\t: %d\n", DMW_GetChannelMWVersion()); |
|---|
| 120 | DHL_OS_Printf("\t # EPG MW\t: %d\n", DMW_EpgGetVersion()); |
|---|
| 121 | DHL_OS_Printf("\t # Caption MW\t: %d\n", 0); |
|---|
| 122 | DHL_OS_Printf("\n"); |
|---|
| 123 | |
|---|
| 124 | DHL_OS_Printf("\t # Application\t: %s\n", App_GetSwVersion()); |
|---|
| 125 | DHL_OS_Printf("\t # Svn Revision\t: rev %s\n", App_GetRevision()); |
|---|
| 126 | DHL_OS_Printf("\n"); |
|---|
| 127 | DHL_OS_Printf("//////////////////////////////////////////////////////////////\n"); |
|---|
| 128 | DHL_OS_Printf("\n"); |
|---|
| 129 | #endif |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | /******************************************************************************** |
|---|
| 134 | FUNCTION: |
|---|
| 135 | - App_InitVariable |
|---|
| 136 | |
|---|
| 137 | Purpose: |
|---|
| 138 | - Àоî¾ß ÇÒ ÀÎÀÚµéÀ» EEPROM¿¡¼ Àоî¿À°Å³ª ÃʱâÈ ÇÏ´Â ÇÔ¼ö. |
|---|
| 139 | *********************************************************************************/ |
|---|
| 140 | void App_InitVariable(void) |
|---|
| 141 | { |
|---|
| 142 | BOOL bFormatRequired = FALSE; |
|---|
| 143 | BOOL bNvramMismatch = FALSE; |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | /* seting foramt func of each module */ |
|---|
| 147 | App_AudioParamInit(); |
|---|
| 148 | App_CCParamInit(); |
|---|
| 149 | App_ChTuneParamInit(); |
|---|
| 150 | App_TimeParamInit(); |
|---|
| 151 | App_VideoParamInit(); |
|---|
| 152 | #if SUPPORT_SDDS |
|---|
| 153 | //App_SddsParamInit(); |
|---|
| 154 | #endif |
|---|
| 155 | |
|---|
| 156 | App_RatingParamInit(); |
|---|
| 157 | AppF_EAParamInit(); |
|---|
| 158 | |
|---|
| 159 | DMW_CDB_InitNvRam(); |
|---|
| 160 | /* EEPROM Check and load NvRam data */ |
|---|
| 161 | /* EPROMÀÌ Æ÷¸Ë µÇ¾îÀÖ´ÂÁö üũÇÏ°í ¾ÈµÇ¾îÀÖÀ¸¸é Æ÷¸Ë. */ |
|---|
| 162 | if (DMW_CDB_CheckNvRam() != statusOK) { |
|---|
| 163 | printf("!! MW: NvRam not valid\n"); |
|---|
| 164 | bFormatRequired = TRUE; |
|---|
| 165 | } |
|---|
| 166 | |
|---|
| 167 | if (!bFormatRequired && (App_NVM_LoadNvParam() == statusNvRamNotFormatted)) { |
|---|
| 168 | printf("!! App: NvRam not valid\n"); |
|---|
| 169 | bFormatRequired = TRUE; |
|---|
| 170 | bNvramMismatch = TRUE; |
|---|
| 171 | } |
|---|
| 172 | |
|---|
| 173 | if (bFormatRequired) |
|---|
| 174 | { |
|---|
| 175 | /* FormatÀÌ ¾ÈµÇ¾îÀÖ´Â °æ¿ì */ |
|---|
| 176 | printf("Format NvRam now!!!\n"); |
|---|
| 177 | App_NVM_FormatNvParam(FALSE); |
|---|
| 178 | /* cafrii 060529, add argument |
|---|
| 179 | channel map clean-up may not be synchronized. pass 'FALSE' for speed up. */ |
|---|
| 180 | #if 1 |
|---|
| 181 | if(bNvramMismatch) { |
|---|
| 182 | App_NVM_SetBootingScan(TRUE); |
|---|
| 183 | } |
|---|
| 184 | #endif |
|---|
| 185 | } |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | /******************************************************************************** |
|---|
| 190 | FUNCTION: |
|---|
| 191 | - App_InitializeTask |
|---|
| 192 | |
|---|
| 193 | Purpose: |
|---|
| 194 | - |
|---|
| 195 | *********************************************************************************/ |
|---|
| 196 | |
|---|
| 197 | void App_PreInitialize() |
|---|
| 198 | { |
|---|
| 199 | DHL_SYS_PlatformInit(); |
|---|
| 200 | Dmc_Init(); |
|---|
| 201 | |
|---|
| 202 | App_NVM_Init(); //nvm init±îÁö.. |
|---|
| 203 | |
|---|
| 204 | App_Fnc_CommInit(); //comm init |
|---|
| 205 | App_Menu_Init(); |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | } |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | void App_InitializeTask() |
|---|
| 213 | { |
|---|
| 214 | printf("App_Initialize Task..\n"); |
|---|
| 215 | |
|---|
| 216 | { |
|---|
| 217 | extern void App_SWVer(void); |
|---|
| 218 | App_SWVer(); |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | if (g_bInitialized) return; |
|---|
| 222 | |
|---|
| 223 | // °¢Á¾ debug level ¼³Á¤ÀÌ ÇÊ¿äÇϸé enable |
|---|
| 224 | //App_SetDebugLevel(1); |
|---|
| 225 | |
|---|
| 226 | DMW_SYS_TimerInit(); |
|---|
| 227 | /* init variable ¿¡¼ ÀϺΠº¯¼ö eeprom ÀúÀå --> flash sync timer ¼³Á¤. |
|---|
| 228 | ±×·¯³ª app timer °ü·Ã timer Ç÷¡±×¸¦ eeprom¿¡¼ Àоî¿Í¾ß ÇÒ ¼öµµ ÀÖÀ½. */ |
|---|
| 229 | |
|---|
| 230 | APP_POD_Init(); |
|---|
| 231 | APP_POD_Start(); |
|---|
| 232 | // ¾Æ·¡ si´Â card detect µÈ ÈÄ¿¡ µ¿ÀÛ½ÃŲ´Ù. |
|---|
| 233 | // card°¡ plug out µÇ¸é stopÀ» ÇØ¾ß ÇϹǷΠcard ÀåÂø »óÅ¿¡ µû¶ó µ¿ÀÛÇÏ´Â °ÍÀÌ ´õ ¹Ù¶÷Á÷ÇÔ. |
|---|
| 234 | //APP_ScteSiStart(); |
|---|
| 235 | |
|---|
| 236 | App_PrintLogo(); |
|---|
| 237 | |
|---|
| 238 | App_InitVariable(); |
|---|
| 239 | |
|---|
| 240 | App_Pwr_Init(); |
|---|
| 241 | |
|---|
| 242 | App_ChTuneInit(); |
|---|
| 243 | |
|---|
| 244 | App_VideoInit(); |
|---|
| 245 | |
|---|
| 246 | App_AutoScanInit(); |
|---|
| 247 | |
|---|
| 248 | App_UcmInit(); |
|---|
| 249 | |
|---|
| 250 | App_AudioInit(); |
|---|
| 251 | |
|---|
| 252 | App_InitDebug(); |
|---|
| 253 | |
|---|
| 254 | App_TimeInit(); /* cafrii 081121, do all time related init, including daylight savings. */ |
|---|
| 255 | |
|---|
| 256 | App_EpgInit(); /* Epg module Init */ |
|---|
| 257 | |
|---|
| 258 | AppF_EAInit(); |
|---|
| 259 | |
|---|
| 260 | AppRrt_Init(); /* cafrii 060609, add rrt & rating init */ |
|---|
| 261 | AppRating_InitBlock(); |
|---|
| 262 | |
|---|
| 263 | App_SMInit(); /* Signal Monitor Init */ |
|---|
| 264 | |
|---|
| 265 | //App_RfUpdateInit(); /* Not used file 2009.08.25 foxhunt */ |
|---|
| 266 | |
|---|
| 267 | App_CC_Init(); |
|---|
| 268 | |
|---|
| 269 | #if SUPPORT_SDDS |
|---|
| 270 | App_SddsInit(); |
|---|
| 271 | #endif |
|---|
| 272 | |
|---|
| 273 | #if 0 |
|---|
| 274 | App_Pwr_Ready(); |
|---|
| 275 | #else |
|---|
| 276 | // ¸¹Àº ÀÛ¾÷µéÀÌ menu task¿¡¼ ¼öÇàÇÏ´Â °¢Á¾ ÀÛ¾÷µé°ú °æÀï °ü°è¿¡ Àֱ⠶§¹®¿¡ |
|---|
| 277 | // init task¿¡¼ Á÷Á¢ È£ÃâÇÏÁö ¾Êµµ·Ï ÇÑ´Ù. |
|---|
| 278 | // menu task·Î ÀÛ¾÷À» deferÇÏ¿© ½ÇÇàÀ» serialize ÇÑ´Ù. |
|---|
| 279 | //DMG_SetUserDefined(UD_ID_POWER_ON, 0, 0); |
|---|
| 280 | #endif |
|---|
| 281 | |
|---|
| 282 | //App_ChTuneRecoverLastChannel(); |
|---|
| 283 | |
|---|
| 284 | g_bInitialized = TRUE; |
|---|
| 285 | |
|---|
| 286 | DHL_OS_Printf("*** %s is completed\n", __FUNCTION__); |
|---|
| 287 | } |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | /******************************************************************************** |
|---|
| 291 | FUNCTION: |
|---|
| 292 | - App_Main |
|---|
| 293 | |
|---|
| 294 | Purpose: |
|---|
| 295 | - application main function. |
|---|
| 296 | *********************************************************************************/ |
|---|
| 297 | void App_Main() |
|---|
| 298 | { |
|---|
| 299 | App_PreInitialize(); |
|---|
| 300 | App_InitializeTask(); |
|---|
| 301 | |
|---|
| 302 | if(0) { |
|---|
| 303 | DMG_MenuStart(MID_IDLE); |
|---|
| 304 | } |
|---|
| 305 | else { |
|---|
| 306 | DMG_SetMenuParam1(MID_STANDBY, 0); |
|---|
| 307 | DMG_MenuStart(MID_STANDBY); |
|---|
| 308 | } |
|---|
| 309 | |
|---|
| 310 | #if APP_BREAK_MAP |
|---|
| 311 | { |
|---|
| 312 | void MapMeaninglessCode(int count); |
|---|
| 313 | MapMeaninglessCode(100); |
|---|
| 314 | } |
|---|
| 315 | #endif |
|---|
| 316 | |
|---|
| 317 | // while(1) { |
|---|
| 318 | // DHL_OS_Delay(1000); |
|---|
| 319 | // } |
|---|
| 320 | |
|---|
| 321 | } |
|---|
| 322 | |
|---|
| 323 | #if 1 |
|---|
| 324 | void ram_start() |
|---|
| 325 | { |
|---|
| 326 | //printf(">> App_Main: ram_start\n"); |
|---|
| 327 | App_Main(); |
|---|
| 328 | while(1) |
|---|
| 329 | { |
|---|
| 330 | DHL_OS_Delay(100); |
|---|
| 331 | } |
|---|
| 332 | } |
|---|
| 333 | #endif |
|---|
| 334 | |
|---|
| 335 | |
|---|
| 336 | /* end of file */ |
|---|