| 1 | /** |
|---|
| 2 | @file |
|---|
| 3 | DHL_SYS_Platform.c |
|---|
| 4 | |
|---|
| 5 | @brief |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | ÀÌ ¸ðµâ¿¡ ´ëÇÑ °£´ÜÇÑ ¼³¸í.. |
|---|
| 9 | ex: AudioVideo decoding/capture/output implementation |
|---|
| 10 | |
|---|
| 11 | Copyright 2006~2010 Digital STREAM Technology, Inc. |
|---|
| 12 | All Rights Reserved |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | #include "DHL_OSAL.h" |
|---|
| 17 | #include "DHL_DBG.h" |
|---|
| 18 | #include "DHL_SYS.h" |
|---|
| 19 | #include "bsettop.h" |
|---|
| 20 | #include "bsettop_user_io.h" |
|---|
| 21 | #include "bsettop_rfm.h" |
|---|
| 22 | #include "DHL_SYS_Impl.h" |
|---|
| 23 | |
|---|
| 24 | /* |
|---|
| 25 | ¸ðµç Çì´õ ÆÄÀÏÀ» Æ÷ÇÔÇÏÁö´Â ¾ÊÀ¸¸ç, compile timeÀ» ÁÙÀ̱â À§ÇØ |
|---|
| 26 | °¢ ¸ðµâÀº ÇÊ¿äÇÑ ¸¸ÅÀÇ Çì´õ¸¦ ¼±¾ðÇϵµ·Ï ÇÔ. |
|---|
| 27 | */ |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | /* |
|---|
| 32 | DHL µð¹ö±× ¸ðµâ À̸§ Á¤ÀÇ ·ê Âü°í: |
|---|
| 33 | |
|---|
| 34 | DHL ¸ðµâµéÀº ¸ðµÎ * ·Î ½ÃÀÛ. |
|---|
| 35 | API´Â ´ë¹®ÀÚ, Platform ¹× ±âŸ´Â ¼Ò¹®ÀÚ »ç¿ë. |
|---|
| 36 | |
|---|
| 37 | µðÆúÆ® ·¹º§Àº 0À¸·Î ¼³Á¤ÇÑ´Ù. (0: ¿¡·¯ ¸Þ½ÃÁö¸¸ Ãâ·Â) |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | */ |
|---|
| 41 | |
|---|
| 42 | //DHL_MODULE("*SYS", 0); |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | #if COMMENT |
|---|
| 46 | ____Config____(){} |
|---|
| 47 | #endif |
|---|
| 48 | |
|---|
| 49 | /* |
|---|
| 50 | ÀÌ ¸ðµâ ³»ºÎ¿¡¼ »ç¿ëµÇ´Â °¢Á¾ configuration Á¤ÀÇ. |
|---|
| 51 | */ |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | /* #define SUPPORT_FAST_SWITCHING_OPTIMIZATION 1 */ |
|---|
| 55 | /* #define FUNC_MONITOR_TIMER_ID TIMER_ID_FUNC_MONITOR */ |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | #if COMMENT |
|---|
| 59 | ____Types____(){} |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 62 | /* |
|---|
| 63 | ÀÌ ¸ðµâ ³»ºÎ¿¡¼ »ç¿ëµÇ´Â structure ¹× enumerations. |
|---|
| 64 | */ |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | #if COMMENT |
|---|
| 68 | ____Variables____(){} |
|---|
| 69 | #endif |
|---|
| 70 | |
|---|
| 71 | /* |
|---|
| 72 | global·Î Àû¿ëµÇ´Â variable Á¤ÀÇ. |
|---|
| 73 | °¢ function º°·Î Ư¼öÇÑ ¿ëµµÀÇ variableÀº °¢ functionX block ¿¡¼ Á¤ÀÇ °¡´É. |
|---|
| 74 | */ |
|---|
| 75 | |
|---|
| 76 | buser_input_t g_sys_user_io; |
|---|
| 77 | brfm_t g_sys_rfm; |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | /* |
|---|
| 81 | °¢ ÇÁ·ÎÁ§Æ®ÀÇ Rev º° H/W bit Á¤ÀÇ |
|---|
| 82 | |
|---|
| 83 | DHL_BOARD_REV ¿¡ Á¤ÀÇµÈ Rev ±¸Á¶¸¦ ÀÏÄ¡ ½ÃÄѾߵÊ. |
|---|
| 84 | |
|---|
| 85 | BKNOTE: newcon2¿¡¼ micom°ü·ÃµÈ ³»¿ë È®ÀÎ ÇÒ °Í. (wakeup°°Àº Á¤º¸µé ÇÊ¿äÇÔ) |
|---|
| 86 | */ |
|---|
| 87 | |
|---|
| 88 | static const UINT16 NEWCON3_REV_table[][2] = { |
|---|
| 89 | {0x00, eREV_010}, // R0.1 |
|---|
| 90 | {0x01, eREV_020}, // R0.2 |
|---|
| 91 | {0x02, eREV_021}, // R0.21 |
|---|
| 92 | {0x03, eREV_030}, // R0.3 |
|---|
| 93 | }; |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | #if COMMENT |
|---|
| 97 | ____GPIO____(){} |
|---|
| 98 | #endif |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | #if COMMENT |
|---|
| 105 | ____API____(){} |
|---|
| 106 | #endif |
|---|
| 107 | /** |
|---|
| 108 | |
|---|
| 109 | */ |
|---|
| 110 | |
|---|
| 111 | enum DHL_HOST_ENDIAN DHL_SYS_GetHostEndianness(void) |
|---|
| 112 | { |
|---|
| 113 | static BOOL s_HostEndian; |
|---|
| 114 | |
|---|
| 115 | if (s_HostEndian == eENDIAN_BIG || s_HostEndian == eENDIAN_LITTLE) |
|---|
| 116 | return s_HostEndian; |
|---|
| 117 | |
|---|
| 118 | //if (g_HostEndian == eENDIAN_UNKNOWN) |
|---|
| 119 | { |
|---|
| 120 | UINT16 dummy = 0x1234; |
|---|
| 121 | if (*(UINT8 *)&dummy == 0x12) { |
|---|
| 122 | // big endian |
|---|
| 123 | s_HostEndian = eENDIAN_BIG; |
|---|
| 124 | } |
|---|
| 125 | else { |
|---|
| 126 | // little endian |
|---|
| 127 | s_HostEndian = eENDIAN_LITTLE; |
|---|
| 128 | } |
|---|
| 129 | return s_HostEndian; |
|---|
| 130 | } |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | DHL_RESULT DHL_SYS_GetBoardTypeVersion(DHL_BOARD_TYPE *pType, |
|---|
| 134 | DHL_BOARD_REV *pVer) |
|---|
| 135 | { |
|---|
| 136 | *pType = eDHL_BOARD_NEWCON3; |
|---|
| 137 | *pVer = (DHL_BOARD_REV)NEWCON3_REV_table[2][1]; |
|---|
| 138 | |
|---|
| 139 | return DHL_OK; |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | DHL_RESULT DHL_SYS_Control(DHL_SYSCTL_TYPE type, UINT32 param) |
|---|
| 144 | { |
|---|
| 145 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 146 | switch (type) |
|---|
| 147 | { |
|---|
| 148 | case eSYSCTL_Reset: |
|---|
| 149 | DHL_SYS_Reset((DHL_RESET_MODE)param); |
|---|
| 150 | |
|---|
| 151 | break; |
|---|
| 152 | default: |
|---|
| 153 | DHL_OS_Printf("|%s| unsupported control type(type:%d).\n", |
|---|
| 154 | __FUNCTION__, type); |
|---|
| 155 | |
|---|
| 156 | dhlResult = DHL_FAIL_INVALID_PARAM; |
|---|
| 157 | |
|---|
| 158 | break; |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | return dhlResult; |
|---|
| 162 | } |
|---|
| 163 | |
|---|
| 164 | DHL_RESULT DHL_SYS_Query(DHL_SYSQRY_TYPE type, void *pdata) |
|---|
| 165 | { |
|---|
| 166 | return DHL_FAIL_NOT_IMPLEMENTED; |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | |
|---|
| 170 | #if COMMENT |
|---|
| 171 | ____Debug____(){} |
|---|
| 172 | #endif |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | DHL_RESULT DHL_SYS_Reset(DHL_RESET_MODE mode) |
|---|
| 177 | { |
|---|
| 178 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 179 | if (mode == eDHL_RESET_Standby) |
|---|
| 180 | { |
|---|
| 181 | dhl_sys_standby(); |
|---|
| 182 | } |
|---|
| 183 | else if (mode == eDHL_RESET_Reboot) |
|---|
| 184 | { |
|---|
| 185 | dhl_sys_reset(0); |
|---|
| 186 | } |
|---|
| 187 | else |
|---|
| 188 | { |
|---|
| 189 | return DHL_OK; |
|---|
| 190 | } |
|---|
| 191 | |
|---|
| 192 | return dhlResult; |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | #if COMMENT |
|---|
| 198 | ____Symbol____(){} |
|---|
| 199 | #endif |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | #if DHL_REGISTER_DEUBG_SYMBOLS |
|---|
| 203 | |
|---|
| 204 | static DHL_SymbolTable _symbols[] = |
|---|
| 205 | { |
|---|
| 206 | /* however, if you want typing short-cut, it is good usage. |
|---|
| 207 | DHL_FNC_SYM_ENTRY2("epg_start", App_EpgUpdateStart), |
|---|
| 208 | DHL_FNC_SYM_ENTRY2("epg_stop", App_EpgUpdateCancel), |
|---|
| 209 | DHL_FNC_SYM_ENTRY2("epg_list", Dmc_EpgPrintAllTables), |
|---|
| 210 | DHL_FNC_SYM_ENTRY2("epg_delete", App_EpgDeleteAll), |
|---|
| 211 | |
|---|
| 212 | DHL_VAR_SYM_ENTRY(g_XX_TestMode), |
|---|
| 213 | */ |
|---|
| 214 | |
|---|
| 215 | }; |
|---|
| 216 | |
|---|
| 217 | #endif /* DHL_REGISTER_DEUBG_SYMBOLS */ |
|---|
| 218 | |
|---|
| 219 | #if COMMENT |
|---|
| 220 | ____Watchdog____(){} |
|---|
| 221 | #endif |
|---|
| 222 | |
|---|
| 223 | BOOL g_dhl_bEnableWatchdog; |
|---|
| 224 | |
|---|
| 225 | BOOL DHL_SYS_IsWatchdogEnabled(void) |
|---|
| 226 | { |
|---|
| 227 | return g_dhl_bEnableWatchdog; |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | void DHL_SYS_EnableWatchdog(void) |
|---|
| 231 | { |
|---|
| 232 | #if 0 |
|---|
| 233 | dhl_sys_enable_watchdog(TRUE, 0x7FFFFFF); // about 5 seconds |
|---|
| 234 | g_dhl_bEnableWatchdog = TRUE; |
|---|
| 235 | #endif |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | void DHL_SYS_DisableWatchdog(void) |
|---|
| 239 | { |
|---|
| 240 | #if 0//CONFIG_WATCHDOG |
|---|
| 241 | dhl_sys_enable_watchdog(FALSE, 0); |
|---|
| 242 | g_dhl_bEnableWatchdog = FALSE; |
|---|
| 243 | #endif |
|---|
| 244 | } |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | |
|---|
| 248 | #if COMMENT |
|---|
| 249 | ____Init____(){} |
|---|
| 250 | #endif |
|---|
| 251 | |
|---|
| 252 | |
|---|
| 253 | DHL_RESULT DHL_SYS_Init(void) |
|---|
| 254 | { |
|---|
| 255 | |
|---|
| 256 | #if DHL_REGISTER_DEUBG_SYMBOLS |
|---|
| 257 | DHL_DBG_RegisterSymbols(_symbols, DHL_NUMSYMBOLS(_symbols)); |
|---|
| 258 | #endif |
|---|
| 259 | |
|---|
| 260 | bsettop_init(0); |
|---|
| 261 | |
|---|
| 262 | // dhl_sys_init(); |
|---|
| 263 | |
|---|
| 264 | g_sys_user_io = buser_input_open(B_ID(USERIO_ID)); |
|---|
| 265 | g_sys_rfm = brfm_open(0); |
|---|
| 266 | buser_AOV_input_LED(g_sys_rfm, eLED_Status_G); |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | #if CONFIG_WATCHDOG |
|---|
| 270 | // DHL_SYS_EnableWatchdog(); //BKNOTE: bsettop_init()¿¡¼ 󸮵ȴÙ. |
|---|
| 271 | #endif |
|---|
| 272 | return DHL_OK; |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | DHL_RESULT DHL_SYS_Uninit(void) |
|---|
| 276 | { |
|---|
| 277 | return DHL_FAIL_NOT_IMPLEMENTED; |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | /* end of file */ |
|---|
| 282 | |
|---|