| 1 | /****************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright (c) 2009 |
|---|
| 4 | Infineon Technologies AG |
|---|
| 5 | Am Campeon 1-12; 81726 Munich, Germany |
|---|
| 6 | |
|---|
| 7 | For licensing information, see the file 'LICENSE' in the root folder of |
|---|
| 8 | this software module. |
|---|
| 9 | |
|---|
| 10 | ******************************************************************************/ |
|---|
| 11 | |
|---|
| 12 | #define DSL_INTERN |
|---|
| 13 | |
|---|
| 14 | #include "drv_dsl_cpe_api.h" |
|---|
| 15 | #include "drv_dsl_cpe_autoboot.h" |
|---|
| 16 | |
|---|
| 17 | #undef DSL_DBG_BLOCK |
|---|
| 18 | #define DSL_DBG_BLOCK DSL_DBG_AUTOBOOT_THREAD |
|---|
| 19 | |
|---|
| 20 | /** \addtogroup DRV_DSL_CPE_COMMON |
|---|
| 21 | @{ */ |
|---|
| 22 | |
|---|
| 23 | static DSL_int_t DSL_DRV_AutobootThreadMain( |
|---|
| 24 | DSL_DRV_ThreadParams_t *param); |
|---|
| 25 | |
|---|
| 26 | static DSL_Error_t DSL_DRV_AutobootHandleStart( |
|---|
| 27 | DSL_Context_t *pContext); |
|---|
| 28 | |
|---|
| 29 | static DSL_Error_t DSL_DRV_AutobootHandleRestart( |
|---|
| 30 | DSL_Context_t *pContext); |
|---|
| 31 | |
|---|
| 32 | static DSL_Error_t DSL_DRV_AutobootHandleShowtime( |
|---|
| 33 | DSL_Context_t *pContext); |
|---|
| 34 | |
|---|
| 35 | static DSL_Error_t DSL_DRV_AutobootHandleException( |
|---|
| 36 | DSL_Context_t *pContext); |
|---|
| 37 | |
|---|
| 38 | static DSL_Error_t DSL_DRV_AutobootHandleFwRequest( |
|---|
| 39 | DSL_Context_t *pContext); |
|---|
| 40 | |
|---|
| 41 | static DSL_Error_t DSL_DRV_AutobootHandleFwWait( |
|---|
| 42 | DSL_Context_t *pContext); |
|---|
| 43 | |
|---|
| 44 | static DSL_Error_t DSL_DRV_AutobootHandleFwReady( |
|---|
| 45 | DSL_Context_t *pContext); |
|---|
| 46 | |
|---|
| 47 | static DSL_Error_t DSL_DRV_AutobootHandleL3( |
|---|
| 48 | DSL_Context_t *pContext, |
|---|
| 49 | DSL_boolean_t bL3Forced); |
|---|
| 50 | |
|---|
| 51 | static DSL_Error_t DSL_DRV_AutobootHandleTraining( |
|---|
| 52 | DSL_Context_t *pContext); |
|---|
| 53 | |
|---|
| 54 | static DSL_Error_t DSL_DRV_AutobootThreadInit( |
|---|
| 55 | DSL_Context_t *pContext) |
|---|
| 56 | { |
|---|
| 57 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 58 | DSL_boolean_t bFirst = DSL_FALSE, bInitComplete = DSL_FALSE; |
|---|
| 59 | DSL_AutobootCtrlSet_t nAutobootStartupMode = DSL_AUTOBOOT_CTRL_STOP; |
|---|
| 60 | |
|---|
| 61 | DSL_CHECK_CTX_POINTER(pContext); |
|---|
| 62 | DSL_CHECK_ERR_CODE(); |
|---|
| 63 | |
|---|
| 64 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 65 | (pContext, "DSL[%02d]: Set init state in the autoboot thread..."DSL_DRV_CRLF, |
|---|
| 66 | DSL_DEV_NUM(pContext))); |
|---|
| 67 | |
|---|
| 68 | DSL_CTX_READ_SCALAR(pContext, nErrCode, pDevCtx->bFirstPowerOn, bFirst); |
|---|
| 69 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nAutobootStartupMode, |
|---|
| 70 | nAutobootStartupMode); |
|---|
| 71 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bInitComplete, bInitComplete); |
|---|
| 72 | |
|---|
| 73 | if (bFirst == DSL_TRUE || nAutobootStartupMode == DSL_AUTOBOOT_CTRL_STOP) |
|---|
| 74 | { |
|---|
| 75 | /* In case of 1st activation move to the |
|---|
| 76 | DSL_AUTOBOOTSTATE_FIRMWARE_READY state*/ |
|---|
| 77 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 78 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_READY, |
|---|
| 79 | DSL_AUTOBOOT_FW_READY_POLL_TIME); |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | if (nErrCode == DSL_SUCCESS) |
|---|
| 83 | { |
|---|
| 84 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bAutobootStopPending, DSL_FALSE); |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | if (pContext->disconnectTime == 0) |
|---|
| 88 | pContext->disconnectTime = DSL_DRV_TimeMSecGet(); |
|---|
| 89 | |
|---|
| 90 | DSL_DEBUG( DSL_DBG_MSG, |
|---|
| 91 | (pContext, "DSL[%02d]: DSL_DRV_AutobootThreadInit: Disconnected at %d sec"DSL_DRV_CRLF, |
|---|
| 92 | DSL_DEV_NUM(pContext), DSL_DRV_TimeSecGet(pContext->disconnectTime)/1000)); |
|---|
| 93 | |
|---|
| 94 | DSL_DRV_WAKEUP_EVENT(pContext->autobootEvent); |
|---|
| 95 | |
|---|
| 96 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 97 | (pContext, "DSL[%02d]: Set init state in the autoboot is completed..."DSL_DRV_CRLF, |
|---|
| 98 | DSL_DEV_NUM(pContext))); |
|---|
| 99 | |
|---|
| 100 | return nErrCode; |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | /* |
|---|
| 104 | For a detailed description of the function, its arguments and return value |
|---|
| 105 | please refer to the description in the header file 'drv_dsl_cpe_autoboot.h' |
|---|
| 106 | */ |
|---|
| 107 | DSL_Error_t DSL_DRV_AutobootThreadStart( |
|---|
| 108 | DSL_Context_t *pContext) |
|---|
| 109 | { |
|---|
| 110 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 111 | |
|---|
| 112 | DSL_CHECK_POINTER(pContext, pContext->pDevCtx); |
|---|
| 113 | DSL_CHECK_ERR_CODE(); |
|---|
| 114 | |
|---|
| 115 | if (pContext->bAutobootThreadStarted == DSL_FALSE) |
|---|
| 116 | { |
|---|
| 117 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 118 | (pContext, "DSL[%02d]: Autoboot thread will be started..."DSL_DRV_CRLF, |
|---|
| 119 | DSL_DEV_NUM(pContext))); |
|---|
| 120 | |
|---|
| 121 | /* Set Autoboot Status*/ |
|---|
| 122 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, DSL_AUTOBOOT_STATUS_STARTING, |
|---|
| 123 | DSL_FW_REQUEST_NA); |
|---|
| 124 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 125 | { |
|---|
| 126 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 127 | (pContext, "DSL[%02d]: ERROR - Autoboot status set failed!"DSL_DRV_CRLF, |
|---|
| 128 | DSL_DEV_NUM(pContext))); |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | pContext->bAutobootThreadShutdown = DSL_FALSE; |
|---|
| 132 | pContext->nAutobootPollTime = DSL_AUTOBOOT_IDLE_POLL_TIME; |
|---|
| 133 | |
|---|
| 134 | DSL_DRV_INIT_EVENT("autbtev", pContext->autobootEvent); |
|---|
| 135 | |
|---|
| 136 | if ((nErrCode == DSL_SUCCESS) |
|---|
| 137 | && (nErrCode = DSL_DRV_AutobootThreadInit(pContext)) == DSL_SUCCESS) |
|---|
| 138 | { |
|---|
| 139 | #ifdef INCLUDE_DSL_DELT |
|---|
| 140 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bLoopDiagnosticsCompleted, DSL_FALSE); |
|---|
| 141 | #endif /* INCLUDE_DSL_DELT*/ |
|---|
| 142 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 143 | (pContext, "DSL[%02d]: Starting autoboot thread..."DSL_DRV_CRLF, |
|---|
| 144 | DSL_DEV_NUM(pContext))); |
|---|
| 145 | |
|---|
| 146 | nErrCode = (DSL_Error_t)DSL_DRV_THREAD( |
|---|
| 147 | &pContext->AutobootControl, "autbtex", DSL_DRV_AutobootThreadMain, (DSL_uint32_t)pContext); |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 151 | (pContext, "DSL[%02d]: Autoboot thread start finished with %d code..."DSL_DRV_CRLF, |
|---|
| 152 | DSL_DEV_NUM(pContext), nErrCode)); |
|---|
| 153 | |
|---|
| 154 | return nErrCode; |
|---|
| 155 | } |
|---|
| 156 | else |
|---|
| 157 | { |
|---|
| 158 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 159 | (pContext, "DSL[%02d]: Autoboot thread is already running..."DSL_DRV_CRLF, |
|---|
| 160 | DSL_DEV_NUM(pContext))); |
|---|
| 161 | |
|---|
| 162 | return DSL_ERR_AUTOBOOT_BUSY; /* Device or resource busy */ |
|---|
| 163 | } |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | /* |
|---|
| 167 | For a detailed description of the function, its arguments and return value |
|---|
| 168 | please refer to the description in the header file 'drv_dsl_cpe_autoboot.h' |
|---|
| 169 | */ |
|---|
| 170 | static DSL_int_t DSL_DRV_AutobootThreadMain( |
|---|
| 171 | DSL_DRV_ThreadParams_t *param) |
|---|
| 172 | { |
|---|
| 173 | DSL_Context_t *pContext = (DSL_Context_t *)param->nArg1; |
|---|
| 174 | DSL_int_t nOsRet = 0; |
|---|
| 175 | DSL_Error_t nRet; |
|---|
| 176 | DSL_boolean_t bAutobootThreadShutdown = DSL_FALSE; |
|---|
| 177 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 178 | #if defined(INCLUDE_DSL_CPE_API_VINAX) || (defined(INCLUDE_DSL_CPE_API_DANUBE) && defined(INCLUDE_DSL_G997_LINE_INVENTORY)) |
|---|
| 179 | DSL_int_t nEventType = 0; |
|---|
| 180 | DSL_uint32_t nTimeoutID = 0; |
|---|
| 181 | #endif /* defined(INCLUDE_DSL_CPE_API_VINAX) || (defined(INCLUDE_DSL_CPE_API_DANUBE) && defined(INCLUDE_DSL_G997_LINE_INVENTORY))*/ |
|---|
| 182 | |
|---|
| 183 | if (pContext == DSL_NULL) |
|---|
| 184 | { |
|---|
| 185 | return -1; |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | pContext->bAutobootThreadStarted = DSL_TRUE; |
|---|
| 189 | |
|---|
| 190 | DSL_CTX_READ_SCALAR( |
|---|
| 191 | pContext, nErrCode, bAutobootThreadShutdown, bAutobootThreadShutdown); |
|---|
| 192 | |
|---|
| 193 | /* Set Autoboot Status*/ |
|---|
| 194 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, DSL_AUTOBOOT_STATUS_RUNNING, |
|---|
| 195 | DSL_FW_REQUEST_NA); |
|---|
| 196 | |
|---|
| 197 | while( bAutobootThreadShutdown == DSL_FALSE && nErrCode == DSL_SUCCESS) |
|---|
| 198 | { |
|---|
| 199 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 200 | (pContext, "DSL[%02d]: Autoboot is running..."DSL_DRV_CRLF, |
|---|
| 201 | DSL_DEV_NUM(pContext))); |
|---|
| 202 | |
|---|
| 203 | DSL_DRV_WAIT_EVENT_TIMEOUT(pContext->autobootEvent, pContext->nAutobootPollTime); |
|---|
| 204 | |
|---|
| 205 | /* Check autoboot state*/ |
|---|
| 206 | if ((nRet = DSL_DRV_AutobootStateCheck(pContext)) != DSL_SUCCESS) |
|---|
| 207 | { |
|---|
| 208 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 209 | (pContext, "DSL[%02d]: ERROR - autoboot state machine status check failed"DSL_DRV_CRLF, |
|---|
| 210 | DSL_DEV_NUM(pContext))); |
|---|
| 211 | |
|---|
| 212 | nOsRet = DSL_DRV_ErrorToOS(nRet); |
|---|
| 213 | break; |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | #if defined(INCLUDE_DSL_CPE_API_VINAX) || (defined(INCLUDE_DSL_CPE_API_DANUBE) && defined(INCLUDE_DSL_G997_LINE_INVENTORY)) |
|---|
| 217 | while( DSL_DRV_Timeout_GetNextActiveEvent( |
|---|
| 218 | pContext, &nEventType, &nTimeoutID ) >= DSL_SUCCESS) |
|---|
| 219 | { |
|---|
| 220 | /* Clear Active event */ |
|---|
| 221 | nErrCode = DSL_DRV_Timeout_RemoveEvent(pContext, nTimeoutID); |
|---|
| 222 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 223 | { |
|---|
| 224 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 225 | (pContext, "DSL[%02d]: ERROR - timeout event remove failed!"DSL_DRV_CRLF, |
|---|
| 226 | DSL_DEV_NUM(pContext))); |
|---|
| 227 | } |
|---|
| 228 | |
|---|
| 229 | /* Handle Timeout event*/ |
|---|
| 230 | nErrCode = DSL_DRV_OnTimeoutEvent(pContext, nEventType, nTimeoutID); |
|---|
| 231 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 232 | { |
|---|
| 233 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 234 | (pContext, "DSL[%02d]: ERROR - timeout event handle failed!"DSL_DRV_CRLF, |
|---|
| 235 | DSL_DEV_NUM(pContext))); |
|---|
| 236 | } |
|---|
| 237 | } |
|---|
| 238 | #endif /* defined(INCLUDE_DSL_CPE_API_VINAX) || (defined(INCLUDE_DSL_CPE_API_DANUBE) && defined(INCLUDE_DSL_G997_LINE_INVENTORY))*/ |
|---|
| 239 | |
|---|
| 240 | DSL_CTX_READ_SCALAR( |
|---|
| 241 | pContext, nErrCode, bAutobootThreadShutdown, bAutobootThreadShutdown); |
|---|
| 242 | } |
|---|
| 243 | |
|---|
| 244 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 245 | (pContext, "DSL[%02d]: autoboot ending (%lu)"DSL_DRV_CRLF, |
|---|
| 246 | DSL_DEV_NUM(pContext), DSL_DRV_TimeMSecGet())); |
|---|
| 247 | |
|---|
| 248 | pContext->bAutobootThreadStarted = DSL_FALSE; |
|---|
| 249 | |
|---|
| 250 | /* Set Autoboot Status*/ |
|---|
| 251 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, DSL_AUTOBOOT_STATUS_STOPPED, |
|---|
| 252 | DSL_FW_REQUEST_NA); |
|---|
| 253 | |
|---|
| 254 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 255 | (pContext, "DSL[%02d]: autoboot complete (%lu)"DSL_DRV_CRLF, |
|---|
| 256 | DSL_DEV_NUM(pContext), DSL_DRV_TimeMSecGet())); |
|---|
| 257 | |
|---|
| 258 | DSL_DRV_THREAD_DELETE(pContext->AutobootControl, 0); |
|---|
| 259 | |
|---|
| 260 | return nOsRet; |
|---|
| 261 | } |
|---|
| 262 | |
|---|
| 263 | /* |
|---|
| 264 | For a detailed description of the function, its arguments and return value |
|---|
| 265 | please refer to the description in the header file 'drv_dsl_cpe_autoboot.h' |
|---|
| 266 | */ |
|---|
| 267 | DSL_Error_t DSL_DRV_AutobootThreadStop( |
|---|
| 268 | DSL_Context_t *pContext) |
|---|
| 269 | { |
|---|
| 270 | if( pContext->bAutobootThreadStarted == DSL_FALSE ) |
|---|
| 271 | return DSL_ERR_AUTOBOOT_NOT_STARTED; |
|---|
| 272 | |
|---|
| 273 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 274 | (pContext, "DSL[%02d]: Stopping autoboot thread... (%lu)"DSL_DRV_CRLF, |
|---|
| 275 | DSL_DEV_NUM(pContext), DSL_DRV_TimeMSecGet())); |
|---|
| 276 | |
|---|
| 277 | pContext->bAutobootThreadShutdown = DSL_TRUE; |
|---|
| 278 | |
|---|
| 279 | DSL_DRV_WAKEUP_EVENT(pContext->autobootEvent); |
|---|
| 280 | |
|---|
| 281 | DSL_DRV_WAIT_COMPLETION(&pContext->AutobootControl); |
|---|
| 282 | |
|---|
| 283 | pContext->bAutobootThreadStarted = DSL_FALSE; |
|---|
| 284 | |
|---|
| 285 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 286 | (pContext, "DSL[%02d]: Autoboot thread has stopped... (%lu)"DSL_DRV_CRLF, |
|---|
| 287 | DSL_DEV_NUM(pContext), DSL_DRV_TimeMSecGet())); |
|---|
| 288 | |
|---|
| 289 | return DSL_SUCCESS; |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | /* |
|---|
| 293 | For a detailed description of the function, its arguments and return value |
|---|
| 294 | please refer to the description in the header file 'drv_dsl_cpe_autoboot.h' |
|---|
| 295 | */ |
|---|
| 296 | DSL_Error_t DSL_DRV_AutobootTimeoutSet( |
|---|
| 297 | DSL_Context_t *pContext, |
|---|
| 298 | DSL_uint32_t nTimeout) |
|---|
| 299 | { |
|---|
| 300 | DSL_DRV_MUTEX_LOCK(pContext->dataMutex); |
|---|
| 301 | |
|---|
| 302 | pContext->autobootStartTime = DSL_DRV_TimeMSecGet(); |
|---|
| 303 | pContext->nAutobootTimeoutLimit = (DSL_int_t)nTimeout; |
|---|
| 304 | |
|---|
| 305 | DSL_DRV_MUTEX_UNLOCK(pContext->dataMutex); |
|---|
| 306 | |
|---|
| 307 | return DSL_SUCCESS; |
|---|
| 308 | } |
|---|
| 309 | |
|---|
| 310 | /* |
|---|
| 311 | For a detailed description of the function, its arguments and return value |
|---|
| 312 | please refer to the description in the header file 'drv_dsl_cpe_autoboot.h' |
|---|
| 313 | */ |
|---|
| 314 | DSL_Error_t DSL_DRV_AutobootStateSet( |
|---|
| 315 | DSL_Context_t *pContext, |
|---|
| 316 | DSL_Autoboot_State_t nState, |
|---|
| 317 | DSL_uint32_t nPollTimeSec) |
|---|
| 318 | { |
|---|
| 319 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 320 | DSL_TestModeControlSet_t nTestMode; |
|---|
| 321 | |
|---|
| 322 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nTestModeControl, nTestMode); |
|---|
| 323 | |
|---|
| 324 | if (nTestMode == DSL_TESTMODE_LOCK) |
|---|
| 325 | { |
|---|
| 326 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 327 | (pContext, "DSL[%02d]: DSL_DRV_AutobootStateSet: state will not be changed " |
|---|
| 328 | "because of test lock"DSL_DRV_CRLF, DSL_DEV_NUM(pContext))); |
|---|
| 329 | } |
|---|
| 330 | else |
|---|
| 331 | { |
|---|
| 332 | DSL_DEBUG(DSL_DBG_MSG, (pContext, |
|---|
| 333 | "DSL[%02d]: Autoboot State: %s" DSL_DRV_CRLF, DSL_DEV_NUM(pContext), |
|---|
| 334 | DSL_DBG_PRN_AUTOBOOT_STATE[nState])); |
|---|
| 335 | |
|---|
| 336 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, nAutobootState, nState); |
|---|
| 337 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, nAutobootPollTime, nPollTimeSec); |
|---|
| 338 | } |
|---|
| 339 | |
|---|
| 340 | return nErrCode; |
|---|
| 341 | } |
|---|
| 342 | |
|---|
| 343 | /* |
|---|
| 344 | For a detailed description of the function, its arguments and return value |
|---|
| 345 | please refer to the description in the header file 'drv_dsl_cpe_autoboot.h' |
|---|
| 346 | */ |
|---|
| 347 | DSL_Error_t DSL_DRV_AutobootStateCheck( |
|---|
| 348 | DSL_Context_t *pContext) |
|---|
| 349 | { |
|---|
| 350 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 351 | DSL_Autoboot_State_t nAutoBootSt = DSL_AUTOBOOTSTATE_UNKNOWN, |
|---|
| 352 | nPrev = DSL_AUTOBOOTSTATE_UNKNOWN; |
|---|
| 353 | DSL_DEV_Handle_t dev; |
|---|
| 354 | DSL_boolean_t bPowerManagementL3Forced, bAutobootContinue = DSL_FALSE, |
|---|
| 355 | bAutobootRestart = DSL_FALSE, bAutobootReboot = DSL_FALSE; |
|---|
| 356 | #if defined (INCLUDE_DSL_CPE_API_DANUBE) |
|---|
| 357 | DSL_LineStateValue_t nCurrentState = DSL_LINESTATE_UNKNOWN; |
|---|
| 358 | DSL_TestModeControlSet_t nTestMode = DSL_TESTMODE_DISABLE; |
|---|
| 359 | #endif /* defined (INCLUDE_DSL_CPE_API_DANUBE)*/ |
|---|
| 360 | |
|---|
| 361 | DSL_CHECK_POINTER(pContext, pContext->pDevCtx); |
|---|
| 362 | DSL_CHECK_ERR_CODE(); |
|---|
| 363 | |
|---|
| 364 | dev = DSL_DRV_LowDeviceGet(pContext->pDevCtx); |
|---|
| 365 | if (dev == DSL_NULL) |
|---|
| 366 | { |
|---|
| 367 | return DSL_ERR_INTERNAL; |
|---|
| 368 | } |
|---|
| 369 | |
|---|
| 370 | #if defined (INCLUDE_DSL_CPE_API_DANUBE) |
|---|
| 371 | /* Check if MEI reboot event occured*/ |
|---|
| 372 | if (pContext->bMeiReboot) |
|---|
| 373 | { |
|---|
| 374 | /* Reset MEI reboot flag*/ |
|---|
| 375 | pContext->bMeiReboot = DSL_FALSE; |
|---|
| 376 | |
|---|
| 377 | /* Get Line state*/ |
|---|
| 378 | DSL_CTX_READ(pContext, nErrCode, nLineState, nCurrentState); |
|---|
| 379 | |
|---|
| 380 | if ((nCurrentState != DSL_LINESTATE_IDLE) && (nCurrentState != DSL_LINESTATE_SILENT)) |
|---|
| 381 | { |
|---|
| 382 | DSL_CTX_READ(pContext, nErrCode, nTestModeControl, nTestMode); |
|---|
| 383 | |
|---|
| 384 | if (nTestMode == DSL_TESTMODE_SHOWTIME_LOCK || |
|---|
| 385 | nTestMode == DSL_TESTMODE_TRAINING_LOCK) |
|---|
| 386 | { |
|---|
| 387 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 388 | (pContext, "DSL[%02d]: Autoboot Locked... "DSL_DRV_CRLF, |
|---|
| 389 | DSL_DEV_NUM(pContext))); |
|---|
| 390 | } |
|---|
| 391 | else |
|---|
| 392 | { |
|---|
| 393 | /* Set reboot flag*/ |
|---|
| 394 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bAutobootReboot, DSL_TRUE); |
|---|
| 395 | } |
|---|
| 396 | } |
|---|
| 397 | } |
|---|
| 398 | #endif /* defined (INCLUDE_DSL_CPE_API_DANUBE)*/ |
|---|
| 399 | |
|---|
| 400 | /* Get Restart flag*/ |
|---|
| 401 | DSL_CTX_READ(pContext, nErrCode, bAutobootRestart, bAutobootRestart); |
|---|
| 402 | |
|---|
| 403 | /* Check for external restart trigger*/ |
|---|
| 404 | if (bAutobootRestart) |
|---|
| 405 | { |
|---|
| 406 | /* Set Autoboot state*/ |
|---|
| 407 | nErrCode = DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_RESTART, |
|---|
| 408 | DSL_AUTOBOOT_RESTART_POLL_TIME); |
|---|
| 409 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 410 | { |
|---|
| 411 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 412 | (pContext,"DSL[%02d]: ERROR - Autoboot state set failed!" DSL_DRV_CRLF, |
|---|
| 413 | DSL_DEV_NUM(pContext))); |
|---|
| 414 | return nErrCode; |
|---|
| 415 | } |
|---|
| 416 | } |
|---|
| 417 | |
|---|
| 418 | /* Get Reboot flag*/ |
|---|
| 419 | DSL_CTX_READ(pContext, nErrCode, bAutobootReboot, bAutobootReboot); |
|---|
| 420 | |
|---|
| 421 | /* Check for external restart trigger*/ |
|---|
| 422 | if (bAutobootReboot) |
|---|
| 423 | { |
|---|
| 424 | /* Set Autoboot state*/ |
|---|
| 425 | nErrCode = DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_EXCEPTION, |
|---|
| 426 | DSL_AUTOBOOT_EXCEPTION_POLL_TIME); |
|---|
| 427 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 428 | { |
|---|
| 429 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 430 | (pContext,"DSL[%02d]: ERROR - Autoboot state set failed!" DSL_DRV_CRLF, |
|---|
| 431 | DSL_DEV_NUM(pContext))); |
|---|
| 432 | return nErrCode; |
|---|
| 433 | } |
|---|
| 434 | |
|---|
| 435 | /* Reset Reboot flag*/ |
|---|
| 436 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bAutobootReboot, DSL_FALSE); |
|---|
| 437 | } |
|---|
| 438 | |
|---|
| 439 | /* Get Autoboot state*/ |
|---|
| 440 | DSL_CTX_READ(pContext, nErrCode, nAutobootState, nPrev); |
|---|
| 441 | |
|---|
| 442 | switch (nPrev) |
|---|
| 443 | { |
|---|
| 444 | case DSL_AUTOBOOTSTATE_FIRMWARE_REQUEST: |
|---|
| 445 | nErrCode = DSL_DRV_AutobootHandleFwRequest(pContext); |
|---|
| 446 | break; |
|---|
| 447 | |
|---|
| 448 | case DSL_AUTOBOOTSTATE_RESTART_WAIT: |
|---|
| 449 | /* Wait for the external trigger to continue Autoboot processing*/ |
|---|
| 450 | DSL_CTX_READ_SCALAR( |
|---|
| 451 | pContext, nErrCode, bAutobootContinue, bAutobootContinue); |
|---|
| 452 | |
|---|
| 453 | if (bAutobootContinue) |
|---|
| 454 | { |
|---|
| 455 | /* Reset external trigger*/ |
|---|
| 456 | DSL_CTX_WRITE_SCALAR( |
|---|
| 457 | pContext, nErrCode, bAutobootContinue, DSL_FALSE); |
|---|
| 458 | |
|---|
| 459 | /* Switch to RESTART...*/ |
|---|
| 460 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 461 | pContext, |
|---|
| 462 | DSL_AUTOBOOTSTATE_RESTART, |
|---|
| 463 | DSL_AUTOBOOT_RESTART_POLL_TIME); |
|---|
| 464 | |
|---|
| 465 | /* Set Autoboot Status*/ |
|---|
| 466 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, |
|---|
| 467 | DSL_AUTOBOOT_STATUS_RUNNING, DSL_FW_REQUEST_NA); |
|---|
| 468 | } |
|---|
| 469 | break; |
|---|
| 470 | |
|---|
| 471 | case DSL_AUTOBOOTSTATE_FIRMWARE_WAIT: |
|---|
| 472 | nErrCode = DSL_DRV_AutobootHandleFwWait(pContext); |
|---|
| 473 | break; |
|---|
| 474 | |
|---|
| 475 | case DSL_AUTOBOOTSTATE_FIRMWARE_READY: |
|---|
| 476 | /* Handle Fw Ready state*/ |
|---|
| 477 | nErrCode = DSL_DRV_AutobootHandleFwReady(pContext); |
|---|
| 478 | break; |
|---|
| 479 | |
|---|
| 480 | case DSL_AUTOBOOTSTATE_CONFIG_WRITE_WAIT: |
|---|
| 481 | /* Wait for the external trigger to continue Autoboot processing*/ |
|---|
| 482 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bAutobootContinue, |
|---|
| 483 | bAutobootContinue); |
|---|
| 484 | |
|---|
| 485 | if (bAutobootContinue) |
|---|
| 486 | { |
|---|
| 487 | /* Reset external trigger*/ |
|---|
| 488 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bAutobootContinue, |
|---|
| 489 | DSL_FALSE); |
|---|
| 490 | |
|---|
| 491 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bPowerManagementL3Forced, |
|---|
| 492 | bPowerManagementL3Forced); |
|---|
| 493 | |
|---|
| 494 | if (bPowerManagementL3Forced != DSL_FALSE) |
|---|
| 495 | { |
|---|
| 496 | DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_L3, |
|---|
| 497 | DSL_AUTOBOOT_L3_POLL_TIME); |
|---|
| 498 | } |
|---|
| 499 | else |
|---|
| 500 | { |
|---|
| 501 | DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_INIT, |
|---|
| 502 | DSL_AUTOBOOT_INIT_POLL_TIME); |
|---|
| 503 | } |
|---|
| 504 | |
|---|
| 505 | /* Set Autoboot Status*/ |
|---|
| 506 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, |
|---|
| 507 | DSL_AUTOBOOT_STATUS_RUNNING, DSL_FW_REQUEST_NA); |
|---|
| 508 | } |
|---|
| 509 | break; |
|---|
| 510 | |
|---|
| 511 | case DSL_AUTOBOOTSTATE_LINK_ACTIVATE_WAIT: |
|---|
| 512 | /* Wait for the external trigger to continue Autoboot processing*/ |
|---|
| 513 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bAutobootContinue, |
|---|
| 514 | bAutobootContinue); |
|---|
| 515 | |
|---|
| 516 | if (bAutobootContinue) |
|---|
| 517 | { |
|---|
| 518 | /* Reset external trigger*/ |
|---|
| 519 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bAutobootContinue, |
|---|
| 520 | DSL_FALSE); |
|---|
| 521 | |
|---|
| 522 | /* Activate Link*/ |
|---|
| 523 | nErrCode = DSL_DRV_DEV_LinkActivate(pContext); |
|---|
| 524 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 525 | { |
|---|
| 526 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 527 | (pContext, "DSL[%02d]: ERROR - Link Activation failed!"DSL_DRV_CRLF, |
|---|
| 528 | DSL_DEV_NUM(pContext))); |
|---|
| 529 | |
|---|
| 530 | break; |
|---|
| 531 | } |
|---|
| 532 | |
|---|
| 533 | DSL_DRV_AutobootTimeoutSet( |
|---|
| 534 | pContext, |
|---|
| 535 | #ifdef INCLUDE_DSL_CPE_API_VINAX |
|---|
| 536 | 120 |
|---|
| 537 | #else |
|---|
| 538 | 60 |
|---|
| 539 | #endif |
|---|
| 540 | ); |
|---|
| 541 | |
|---|
| 542 | /* Change Autoboot State*/ |
|---|
| 543 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 544 | pContext, |
|---|
| 545 | DSL_AUTOBOOTSTATE_TRAIN, |
|---|
| 546 | DSL_AUTOBOOT_TRAINING_POLL_TIME); |
|---|
| 547 | |
|---|
| 548 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 549 | { |
|---|
| 550 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 551 | (pContext, "DSL[%02d]: ERROR - Autoboot state set failed!"DSL_DRV_CRLF, |
|---|
| 552 | DSL_DEV_NUM(pContext))); |
|---|
| 553 | |
|---|
| 554 | break; |
|---|
| 555 | } |
|---|
| 556 | |
|---|
| 557 | /* Set Autoboot Status*/ |
|---|
| 558 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, |
|---|
| 559 | DSL_AUTOBOOT_STATUS_RUNNING, |
|---|
| 560 | DSL_FW_REQUEST_NA); |
|---|
| 561 | } |
|---|
| 562 | break; |
|---|
| 563 | |
|---|
| 564 | case DSL_AUTOBOOTSTATE_L3: |
|---|
| 565 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bPowerManagementL3Forced, |
|---|
| 566 | bPowerManagementL3Forced); |
|---|
| 567 | nErrCode = DSL_DRV_AutobootHandleL3(pContext, |
|---|
| 568 | bPowerManagementL3Forced); |
|---|
| 569 | break; |
|---|
| 570 | |
|---|
| 571 | case DSL_AUTOBOOTSTATE_INIT: |
|---|
| 572 | nErrCode = DSL_DRV_AutobootHandleStart(pContext); |
|---|
| 573 | break; |
|---|
| 574 | |
|---|
| 575 | case DSL_AUTOBOOTSTATE_DIAGNOSTIC: |
|---|
| 576 | case DSL_AUTOBOOTSTATE_TRAIN: |
|---|
| 577 | nErrCode = DSL_DRV_AutobootHandleTraining(pContext); |
|---|
| 578 | break; |
|---|
| 579 | |
|---|
| 580 | case DSL_AUTOBOOTSTATE_SHOWTIME: |
|---|
| 581 | nErrCode = DSL_DRV_AutobootHandleShowtime(pContext); |
|---|
| 582 | break; |
|---|
| 583 | |
|---|
| 584 | case DSL_AUTOBOOTSTATE_EXCEPTION: |
|---|
| 585 | nErrCode = DSL_DRV_AutobootHandleException(pContext); |
|---|
| 586 | break; |
|---|
| 587 | |
|---|
| 588 | case DSL_AUTOBOOTSTATE_RESTART: |
|---|
| 589 | nErrCode = DSL_DRV_AutobootHandleRestart(pContext); |
|---|
| 590 | break; |
|---|
| 591 | |
|---|
| 592 | default: |
|---|
| 593 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 594 | (pContext, "DSL[%02d]: autoboot unknown state: %d???"DSL_DRV_CRLF, |
|---|
| 595 | DSL_DEV_NUM(pContext), pContext->nAutobootState)); |
|---|
| 596 | |
|---|
| 597 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 598 | pContext, |
|---|
| 599 | pContext->nAutobootState, |
|---|
| 600 | DSL_AUTOBOOT_IDLE_POLL_TIME); |
|---|
| 601 | break; |
|---|
| 602 | } |
|---|
| 603 | |
|---|
| 604 | if (nErrCode != DSL_SUCCESS) |
|---|
| 605 | { |
|---|
| 606 | nErrCode = DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_RESTART, |
|---|
| 607 | DSL_AUTOBOOT_RESTART_POLL_TIME); |
|---|
| 608 | } |
|---|
| 609 | |
|---|
| 610 | |
|---|
| 611 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nAutobootState, nAutoBootSt); |
|---|
| 612 | |
|---|
| 613 | if (nPrev != nAutoBootSt) |
|---|
| 614 | { |
|---|
| 615 | DSL_DEBUG(DSL_DBG_MSG, (pContext, "DSL[%02d]: autoboot state was switched: %d " |
|---|
| 616 | "to %d (%ld), retCode=%d"DSL_DRV_CRLF, DSL_DEV_NUM(pContext), (int)nPrev, |
|---|
| 617 | (int)pContext->nAutobootState, DSL_DRV_TimeMSecGet(), nErrCode)); |
|---|
| 618 | } |
|---|
| 619 | |
|---|
| 620 | return nErrCode; |
|---|
| 621 | } |
|---|
| 622 | |
|---|
| 623 | #ifdef HAS_TO_BE_CLARIFIED |
|---|
| 624 | static DSL_Error_t DSL_DRV_FirmwareStartupInit( |
|---|
| 625 | DSL_Context_t *pContext) |
|---|
| 626 | { |
|---|
| 627 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 628 | |
|---|
| 629 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 630 | (pContext, "DSL[%02d]: IN - DSL_DRV_FirmwareStartupInit"DSL_DRV_CRLF, |
|---|
| 631 | DSL_DEV_NUM(pContext))); |
|---|
| 632 | |
|---|
| 633 | #if defined(_INCLUDE_ADSL_LATENCY) |
|---|
| 634 | nErrCode = DSL_DRV_DualLatency_FirmwareInit(pContext); |
|---|
| 635 | if (nErrCode != DSL_SUCCESS) |
|---|
| 636 | { |
|---|
| 637 | return nErrCode; |
|---|
| 638 | } |
|---|
| 639 | #endif |
|---|
| 640 | |
|---|
| 641 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 642 | (pContext, "DSL[%02d]: OUT - DSL_DRV_FirmwareStartupInit"DSL_DRV_CRLF, |
|---|
| 643 | DSL_DEV_NUM(pContext))); |
|---|
| 644 | |
|---|
| 645 | return nErrCode; |
|---|
| 646 | } |
|---|
| 647 | #endif /* HAS_TO_BE_CLARIFIED*/ |
|---|
| 648 | |
|---|
| 649 | /* |
|---|
| 650 | * Write down the initial configuration to the firmware and activate link |
|---|
| 651 | */ |
|---|
| 652 | static DSL_Error_t DSL_DRV_AutobootHandleStart( |
|---|
| 653 | DSL_Context_t *pContext) |
|---|
| 654 | { |
|---|
| 655 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 656 | #ifdef INCLUDE_DSL_DELT |
|---|
| 657 | DSL_G997_LDSF_t nLoopMode = DSL_G997_INHIBIT_LDSF; |
|---|
| 658 | #endif /* INCLUDE_DSL_DELT*/ |
|---|
| 659 | DSL_G997_StartupMode_t nStartupMode = DSL_G997_NORMAL_STARTUP; |
|---|
| 660 | DSL_uint8_t nAutoCount = 0; |
|---|
| 661 | DSL_boolean_t bFirst = DSL_FALSE; |
|---|
| 662 | DSL_boolean_t bWaitBeforeLinkActivation = DSL_FALSE; |
|---|
| 663 | DSL_Autoboot_State_t nState = DSL_AUTOBOOTSTATE_UNKNOWN; |
|---|
| 664 | |
|---|
| 665 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 666 | (pContext, "DSL[%02d]: IN - DSL_AutobootHandleStart"DSL_DRV_CRLF, |
|---|
| 667 | DSL_DEV_NUM(pContext))); |
|---|
| 668 | |
|---|
| 669 | #if defined(INCLUDE_DSL_CPE_API_VINAX) || (defined(INCLUDE_DSL_CPE_API_DANUBE) && defined(INCLUDE_DSL_G997_LINE_INVENTORY)) |
|---|
| 670 | DSL_DRV_Timeout_RemoveAllEvents(pContext); |
|---|
| 671 | #endif /* defined(INCLUDE_DSL_CPE_API_VINAX) || (defined(INCLUDE_DSL_CPE_API_DANUBE) && defined(INCLUDE_DSL_G997_LINE_INVENTORY))*/ |
|---|
| 672 | |
|---|
| 673 | pContext->bGotShortInitResponse = DSL_FALSE; |
|---|
| 674 | pContext->bGotShowtime = DSL_FALSE; |
|---|
| 675 | pContext->bGotFullInit = DSL_FALSE; |
|---|
| 676 | |
|---|
| 677 | #ifdef HAS_TO_BE_CLARIFIED |
|---|
| 678 | if ((nErrCode = DSL_DRV_FirmwareStartupInit(pContext)) != DSL_SUCCESS) |
|---|
| 679 | { |
|---|
| 680 | return nErrCode; |
|---|
| 681 | } |
|---|
| 682 | #endif /* HAS_TO_BE_CLARIFIED */ |
|---|
| 683 | |
|---|
| 684 | #ifdef INCLUDE_DSL_DELT |
|---|
| 685 | DSL_CTX_READ_SCALAR(pContext, nErrCode, lineActivateConfig.nLDSF, nLoopMode); |
|---|
| 686 | #endif /* INCLUDE_DSL_DELT*/ |
|---|
| 687 | DSL_CTX_READ_SCALAR(pContext, nErrCode, lineActivateConfig.nStartupMode, |
|---|
| 688 | nStartupMode); |
|---|
| 689 | DSL_CTX_READ_SCALAR(pContext, nErrCode, pDevCtx->bFirstPowerOn, bFirst); |
|---|
| 690 | |
|---|
| 691 | #ifdef INCLUDE_DSL_DELT |
|---|
| 692 | if (nLoopMode == DSL_G997_AUTO_LDSF) |
|---|
| 693 | { |
|---|
| 694 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nLoopAutoCount, nAutoCount); |
|---|
| 695 | } |
|---|
| 696 | else |
|---|
| 697 | { |
|---|
| 698 | if (nLoopMode == DSL_G997_FORCE_LDSF) |
|---|
| 699 | { |
|---|
| 700 | nAutoCount = 1; |
|---|
| 701 | } |
|---|
| 702 | } |
|---|
| 703 | #endif /* INCLUDE_DSL_DELT*/ |
|---|
| 704 | |
|---|
| 705 | if ((nErrCode = DSL_DRV_DEV_AutobootHandleStart(pContext, |
|---|
| 706 | (nAutoCount > 0) ? DSL_TRUE : DSL_FALSE, |
|---|
| 707 | (nStartupMode == DSL_G997_FORCE_SHORT_STARTUP) ? DSL_TRUE : DSL_FALSE )) |
|---|
| 708 | != DSL_SUCCESS) |
|---|
| 709 | { |
|---|
| 710 | DSL_DEBUG(DSL_DBG_ERR, (pContext, "DSL[%02d]: Could not handle modem " |
|---|
| 711 | "start!"DSL_DRV_CRLF, DSL_DEV_NUM(pContext))); |
|---|
| 712 | |
|---|
| 713 | #if defined(INCLUDE_DSL_G997_STATUS) || defined(INCLUDE_DSL_G997_ALARM) || defined(INCLUDE_DSL_CPE_API_VINAX) |
|---|
| 714 | /* Set LINIT value to 'LINIT_UNKNOWN' in case of an error */ |
|---|
| 715 | DSL_DRV_HandleLinitValue(pContext, LINIT_UNKNOWN, LINIT_SUB_NONE); |
|---|
| 716 | #endif /* defined(INCLUDE_DSL_G997_STATUS) || defined(INCLUDE_DSL_G997_ALARM) || defined(INCLUDE_DSL_CPE_API_VINAX)*/ |
|---|
| 717 | |
|---|
| 718 | return nErrCode; |
|---|
| 719 | } |
|---|
| 720 | |
|---|
| 721 | #ifdef INCLUDE_DSL_PM |
|---|
| 722 | if (!bFirst) |
|---|
| 723 | { |
|---|
| 724 | /* Restore PM module counters*/ |
|---|
| 725 | nErrCode = DSL_DRV_PM_CountersRestore(pContext); |
|---|
| 726 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 727 | { |
|---|
| 728 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 729 | (pContext, "DSL[%02d]: ERROR - PM counters restore failed!"DSL_DRV_CRLF, |
|---|
| 730 | DSL_DEV_NUM(pContext))); |
|---|
| 731 | |
|---|
| 732 | return nErrCode; |
|---|
| 733 | } |
|---|
| 734 | } |
|---|
| 735 | #endif /* INCLUDE_DSL_PM*/ |
|---|
| 736 | |
|---|
| 737 | /* Get actual autoboot state*/ |
|---|
| 738 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nAutobootState, nState); |
|---|
| 739 | if( nState == DSL_AUTOBOOTSTATE_INIT ) |
|---|
| 740 | { |
|---|
| 741 | /* Get Link Activation option*/ |
|---|
| 742 | DSL_CTX_READ_SCALAR(pContext, nErrCode, |
|---|
| 743 | nAutobootConfig.nStateMachineOptions.bWaitBeforeLinkActivation, |
|---|
| 744 | bWaitBeforeLinkActivation); |
|---|
| 745 | |
|---|
| 746 | if (bWaitBeforeLinkActivation) |
|---|
| 747 | { |
|---|
| 748 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 749 | pContext, |
|---|
| 750 | DSL_AUTOBOOTSTATE_LINK_ACTIVATE_WAIT, |
|---|
| 751 | DSL_AUTOBOOT_LINK_ACTIVATE_WAIT_POLL_TIME); |
|---|
| 752 | |
|---|
| 753 | /* Set Autoboot Status*/ |
|---|
| 754 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, |
|---|
| 755 | DSL_AUTOBOOT_STATUS_LINK_ACTIVATE_WAIT, |
|---|
| 756 | DSL_FW_REQUEST_NA); |
|---|
| 757 | |
|---|
| 758 | /* IDLE line state reached*/ |
|---|
| 759 | DSL_DRV_LineStateSet(pContext, DSL_LINESTATE_IDLE); |
|---|
| 760 | } |
|---|
| 761 | else |
|---|
| 762 | { |
|---|
| 763 | /* IDLE line state reached*/ |
|---|
| 764 | DSL_DRV_LineStateSet(pContext, DSL_LINESTATE_IDLE); |
|---|
| 765 | |
|---|
| 766 | /* Activate Link*/ |
|---|
| 767 | nErrCode = DSL_DRV_DEV_LinkActivate(pContext); |
|---|
| 768 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 769 | { |
|---|
| 770 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 771 | (pContext, "DSL[%02d]: ERROR - Link Activation failed!"DSL_DRV_CRLF, |
|---|
| 772 | DSL_DEV_NUM(pContext))); |
|---|
| 773 | |
|---|
| 774 | return nErrCode; |
|---|
| 775 | } |
|---|
| 776 | |
|---|
| 777 | DSL_DRV_AutobootTimeoutSet(pContext, 120); |
|---|
| 778 | |
|---|
| 779 | /* Change Autoboot State*/ |
|---|
| 780 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 781 | pContext, |
|---|
| 782 | DSL_AUTOBOOTSTATE_TRAIN, |
|---|
| 783 | DSL_AUTOBOOT_TRAINING_POLL_TIME); |
|---|
| 784 | |
|---|
| 785 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 786 | { |
|---|
| 787 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 788 | (pContext, "DSL[%02d]: ERROR - Autoboot state set failed!"DSL_DRV_CRLF, |
|---|
| 789 | DSL_DEV_NUM(pContext))); |
|---|
| 790 | |
|---|
| 791 | return nErrCode; |
|---|
| 792 | } |
|---|
| 793 | } |
|---|
| 794 | } |
|---|
| 795 | |
|---|
| 796 | if (bFirst == DSL_TRUE && nErrCode == DSL_SUCCESS) |
|---|
| 797 | { |
|---|
| 798 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, pDevCtx->bFirstPowerOn, DSL_FALSE); |
|---|
| 799 | } |
|---|
| 800 | |
|---|
| 801 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 802 | (pContext, "DSL[%02d]: OUT - DSL_AutobootHandleStart"DSL_DRV_CRLF, |
|---|
| 803 | DSL_DEV_NUM(pContext))); |
|---|
| 804 | |
|---|
| 805 | return nErrCode; |
|---|
| 806 | } |
|---|
| 807 | |
|---|
| 808 | static DSL_Error_t DSL_DRV_AutobootHandleRestart( |
|---|
| 809 | DSL_Context_t *pContext) |
|---|
| 810 | { |
|---|
| 811 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 812 | DSL_boolean_t bAutobootFwLoadPending = DSL_FALSE; |
|---|
| 813 | DSL_FirmwareRequestType_t nFwReqType = DSL_FW_REQUEST_NA; |
|---|
| 814 | DSL_boolean_t bAutobootRestart = DSL_FALSE; |
|---|
| 815 | #ifdef INCLUDE_DSL_CPE_API_VINAX |
|---|
| 816 | DSL_FirmwareRequestType_t nFwType = DSL_FW_REQUEST_NA; |
|---|
| 817 | DSL_uint32_t nEapsTimeoutId = 0; |
|---|
| 818 | #endif /* INCLUDE_DSL_CPE_API_VINAX*/ |
|---|
| 819 | |
|---|
| 820 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 821 | (pContext, "DSL[%02d]: IN - DSL_AutobootHandleRestart"DSL_DRV_CRLF, |
|---|
| 822 | DSL_DEV_NUM(pContext))); |
|---|
| 823 | |
|---|
| 824 | #ifdef INCLUDE_DSL_CPE_API_VINAX |
|---|
| 825 | /* Get EAPS timeout ID from the DSL CPE Context*/ |
|---|
| 826 | DSL_CTX_READ(pContext, nErrCode, nEapsTimeoutId, nEapsTimeoutId); |
|---|
| 827 | if (nEapsTimeoutId != 0) |
|---|
| 828 | { |
|---|
| 829 | /* Remove EAPS timeout event*/ |
|---|
| 830 | nErrCode = DSL_DRV_Timeout_RemoveEvent(pContext, nEapsTimeoutId); |
|---|
| 831 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 832 | { |
|---|
| 833 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 834 | (pContext, "DSL[%02d]: ERROR - EAPS timeout event remove failed!"DSL_DRV_CRLF, |
|---|
| 835 | DSL_DEV_NUM(pContext))); |
|---|
| 836 | } |
|---|
| 837 | } |
|---|
| 838 | |
|---|
| 839 | /* Save Clause30 counters*/ |
|---|
| 840 | nErrCode = DSL_DRV_DEV_Clause30CountersSave(pContext); |
|---|
| 841 | if (nErrCode < DSL_SUCCESS) |
|---|
| 842 | { |
|---|
| 843 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 844 | (pContext, "DSL[%02d]: ERROR - Clause30 counters save failed!"DSL_DRV_CRLF, |
|---|
| 845 | DSL_DEV_NUM(pContext))); |
|---|
| 846 | } |
|---|
| 847 | |
|---|
| 848 | /* Update nLastShowtime value*/ |
|---|
| 849 | DSL_CTX_WRITE(pContext, nErrCode, pDevCtx->data.nLastShowtime, pContext->pDevCtx->data.nCurrShowtime); |
|---|
| 850 | /* Reset bPermanentShowtime information*/ |
|---|
| 851 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, pDevCtx->data.bPermanentShowtime, DSL_FALSE); |
|---|
| 852 | #endif /* INCLUDE_DSL_CPE_API_VINAX*/ |
|---|
| 853 | |
|---|
| 854 | DSL_DRV_LineStateSet(pContext, DSL_LINESTATE_NOT_INITIALIZED); |
|---|
| 855 | |
|---|
| 856 | /* Reset the showtime indication flag*/ |
|---|
| 857 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bShowtimeReached, DSL_FALSE); |
|---|
| 858 | |
|---|
| 859 | nErrCode = DSL_DRV_AutobootThreadInit(pContext); |
|---|
| 860 | if (nErrCode != DSL_SUCCESS) |
|---|
| 861 | { |
|---|
| 862 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 863 | (pContext, "DSL[%02d]: ERROR - Autoboot thread init failed!"DSL_DRV_CRLF, |
|---|
| 864 | DSL_DEV_NUM(pContext))); |
|---|
| 865 | |
|---|
| 866 | return nErrCode; |
|---|
| 867 | } |
|---|
| 868 | |
|---|
| 869 | #ifdef INCLUDE_DSL_PM |
|---|
| 870 | /* Suspend PM module*/ |
|---|
| 871 | nErrCode = DSL_DRV_PM_Suspend(pContext); |
|---|
| 872 | |
|---|
| 873 | if (nErrCode != DSL_SUCCESS) |
|---|
| 874 | { |
|---|
| 875 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 876 | (pContext, "DSL[%02d]: ERROR - PM module suspend failed!"DSL_DRV_CRLF, |
|---|
| 877 | DSL_DEV_NUM(pContext))); |
|---|
| 878 | |
|---|
| 879 | return nErrCode; |
|---|
| 880 | } |
|---|
| 881 | #endif /* #ifdef INCLUDE_DSL_PM*/ |
|---|
| 882 | |
|---|
| 883 | /* Update DSL CPE API Context Data*/ |
|---|
| 884 | nErrCode = DSL_DRV_CtxDataUpdate(pContext); |
|---|
| 885 | |
|---|
| 886 | DSL_CTX_READ(pContext, nErrCode, bAutobootRestart, bAutobootRestart); |
|---|
| 887 | if (bAutobootRestart) |
|---|
| 888 | { |
|---|
| 889 | #ifdef INCLUDE_DSL_CPE_API_VINAX |
|---|
| 890 | /* Reset nPrevMode value*/ |
|---|
| 891 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, pDevCtx->data.nPrevMode, FWMODE_NA); |
|---|
| 892 | |
|---|
| 893 | /* Reset CAM state*/ |
|---|
| 894 | nErrCode = DSL_DRV_VNX_CamFsmStateSet(pContext, DSL_CAM_INIT); |
|---|
| 895 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 896 | { |
|---|
| 897 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 898 | (pContext, "DSL[%02d]: ERROR - CAM FSM state set failed!"DSL_DRV_CRLF, |
|---|
| 899 | DSL_DEV_NUM(pContext))); |
|---|
| 900 | |
|---|
| 901 | return nErrCode; |
|---|
| 902 | } |
|---|
| 903 | #endif /* #ifdef INCLUDE_DSL_CPE_API_VINAX*/ |
|---|
| 904 | /* Reset external trigger*/ |
|---|
| 905 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bAutobootRestart, DSL_FALSE); |
|---|
| 906 | } |
|---|
| 907 | |
|---|
| 908 | #ifdef INCLUDE_DSL_CPE_API_VINAX |
|---|
| 909 | DSL_CTX_READ_SCALAR(pContext, nErrCode, pDevCtx->data.deviceCfg.nFwType, nFwType); |
|---|
| 910 | nFwReqType = nFwType; |
|---|
| 911 | #else |
|---|
| 912 | nFwReqType = DSL_FW_REQUEST_ADSL; |
|---|
| 913 | #endif /* #ifdef INCLUDE_DSL_CPE_API_VINAX*/ |
|---|
| 914 | |
|---|
| 915 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bAutobootFwLoadPending, bAutobootFwLoadPending); |
|---|
| 916 | /* Check for pending FW download*/ |
|---|
| 917 | if( bAutobootFwLoadPending ) |
|---|
| 918 | { |
|---|
| 919 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 920 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_WAIT, DSL_AUTOBOOT_FW_WAIT_POLL_TIME); |
|---|
| 921 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 922 | { |
|---|
| 923 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 924 | (pContext, "DSL[%02d]: ERROR - Autoboot State set failed!"DSL_DRV_CRLF, |
|---|
| 925 | DSL_DEV_NUM(pContext))); |
|---|
| 926 | } |
|---|
| 927 | |
|---|
| 928 | /* Set Autoboot Status */ |
|---|
| 929 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, DSL_AUTOBOOT_STATUS_FW_WAIT, |
|---|
| 930 | nFwReqType); |
|---|
| 931 | |
|---|
| 932 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 933 | { |
|---|
| 934 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 935 | (pContext, "DSL[%02d]: ERROR - Autoboot Status set failed!"DSL_DRV_CRLF, |
|---|
| 936 | DSL_DEV_NUM(pContext))); |
|---|
| 937 | } |
|---|
| 938 | |
|---|
| 939 | /* Activate Autoboot timeout for the Firmware Wait dtate*/ |
|---|
| 940 | DSL_DRV_AutobootTimeoutSet(pContext, 10); |
|---|
| 941 | } |
|---|
| 942 | else |
|---|
| 943 | { |
|---|
| 944 | #if defined (INCLUDE_DSL_CPE_API_DANUBE) && !defined (INCLUDE_DSL_FIRMWARE_MEMORY_FREE) |
|---|
| 945 | /* Reboot device*/ |
|---|
| 946 | nErrCode = DSL_DRV_DEV_Reboot(pContext); |
|---|
| 947 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 948 | { |
|---|
| 949 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 950 | (pContext, "DSL[%02d]: ERROR - Device reboot failed, trying to request FW!"DSL_DRV_CRLF, |
|---|
| 951 | DSL_DEV_NUM(pContext))); |
|---|
| 952 | |
|---|
| 953 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 954 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_REQUEST, DSL_AUTOBOOT_FW_REQUEST_POLL_TIME); |
|---|
| 955 | } |
|---|
| 956 | else |
|---|
| 957 | { |
|---|
| 958 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bFwReLoaded, DSL_TRUE); |
|---|
| 959 | |
|---|
| 960 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 961 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_READY, DSL_AUTOBOOT_FW_READY_POLL_TIME); |
|---|
| 962 | } |
|---|
| 963 | #else |
|---|
| 964 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 965 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_REQUEST, DSL_AUTOBOOT_FW_REQUEST_POLL_TIME); |
|---|
| 966 | #endif /* defined (INCLUDE_DSL_CPE_API_DANUBE) && !defined (INCLUDE_DSL_FIRMWARE_MEMORY_FREE)*/ |
|---|
| 967 | } |
|---|
| 968 | |
|---|
| 969 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 970 | (pContext, "DSL[%02d]: OUT - DSL_AutobootHandleRestart, retCode=%d"DSL_DRV_CRLF, |
|---|
| 971 | nErrCode, DSL_DEV_NUM(pContext))); |
|---|
| 972 | |
|---|
| 973 | return nErrCode; |
|---|
| 974 | } |
|---|
| 975 | |
|---|
| 976 | static DSL_Error_t DSL_DRV_AutobootHandleTraining( |
|---|
| 977 | DSL_Context_t *pContext) |
|---|
| 978 | { |
|---|
| 979 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 980 | DSL_Autoboot_State_t nAutobootState = DSL_AUTOBOOTSTATE_UNKNOWN; |
|---|
| 981 | DSL_TestModeControlSet_t nTestMode; |
|---|
| 982 | |
|---|
| 983 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 984 | (pContext, "DSL[%02d]: IN - DSL_AutobootHandleTraining"DSL_DRV_CRLF, |
|---|
| 985 | DSL_DEV_NUM(pContext))); |
|---|
| 986 | |
|---|
| 987 | nErrCode = DSL_DRV_DEV_AutobootHandleTraining(pContext); |
|---|
| 988 | |
|---|
| 989 | if (nErrCode == DSL_SUCCESS) |
|---|
| 990 | { |
|---|
| 991 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nAutobootState, nAutobootState); |
|---|
| 992 | |
|---|
| 993 | if ((nAutobootState == DSL_AUTOBOOTSTATE_TRAIN) || |
|---|
| 994 | (nAutobootState == DSL_AUTOBOOTSTATE_DIAGNOSTIC)) |
|---|
| 995 | { |
|---|
| 996 | DSL_uint32_t currentTime; |
|---|
| 997 | |
|---|
| 998 | currentTime = DSL_DRV_TimeMSecGet(); |
|---|
| 999 | |
|---|
| 1000 | pContext->autobootStartTime = pContext->autobootStartTime > currentTime ? |
|---|
| 1001 | currentTime : pContext->autobootStartTime; |
|---|
| 1002 | |
|---|
| 1003 | if ((pContext->autobootStartTime + (DSL_uint32_t)(pContext->nAutobootTimeoutLimit*1000)) |
|---|
| 1004 | < currentTime ) |
|---|
| 1005 | { |
|---|
| 1006 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nTestModeControl, nTestMode); |
|---|
| 1007 | if (nTestMode == DSL_TESTMODE_TRAINING_LOCK || |
|---|
| 1008 | nTestMode == DSL_TESTMODE_QUIET) |
|---|
| 1009 | { |
|---|
| 1010 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1011 | (pContext, "DSL[%02d]: time out on training but training lock is set, " |
|---|
| 1012 | "autoboot will not be restarted"DSL_DRV_CRLF, DSL_DEV_NUM(pContext))); |
|---|
| 1013 | } |
|---|
| 1014 | else |
|---|
| 1015 | { |
|---|
| 1016 | #if defined(INCLUDE_DSL_G997_STATUS) || defined(INCLUDE_DSL_G997_ALARM) || defined(INCLUDE_DSL_CPE_API_VINAX) |
|---|
| 1017 | /* Generate LINIT event on timeout*/ |
|---|
| 1018 | DSL_DRV_HandleLinitValue(pContext, LINIT_NO_PEER_XTU, LINIT_SUB_NONE); |
|---|
| 1019 | #endif /* #if defined(INCLUDE_DSL_G997_STATUS) || defined(INCLUDE_DSL_G997_ALARM) || defined(INCLUDE_DSL_CPE_API_VINAX)*/ |
|---|
| 1020 | |
|---|
| 1021 | #ifdef INCLUDE_DSL_CPE_API_VINAX |
|---|
| 1022 | /* Reset nPrevMode value*/ |
|---|
| 1023 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, pDevCtx->data.nPrevMode, FWMODE_NA); |
|---|
| 1024 | |
|---|
| 1025 | /* Reset CAM state in case of timeout while training*/ |
|---|
| 1026 | nErrCode = DSL_DRV_VNX_CamFsmStateSet(pContext, DSL_CAM_INIT); |
|---|
| 1027 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1028 | { |
|---|
| 1029 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1030 | (pContext, "DSL[%02d]: ERROR - CAM FSM state set failed!"DSL_DRV_CRLF, |
|---|
| 1031 | DSL_DEV_NUM(pContext))); |
|---|
| 1032 | |
|---|
| 1033 | return nErrCode; |
|---|
| 1034 | } |
|---|
| 1035 | #endif /* #ifdef INCLUDE_DSL_CPE_API_VINAX*/ |
|---|
| 1036 | |
|---|
| 1037 | DSL_DEBUG(DSL_DBG_ERR, (pContext, |
|---|
| 1038 | "DSL[%02d]: Reboot on training timeout (%d)!!!"DSL_DRV_CRLF, |
|---|
| 1039 | DSL_DEV_NUM(pContext), pContext->nAutobootTimeoutLimit)); |
|---|
| 1040 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1041 | pContext, DSL_AUTOBOOTSTATE_RESTART, |
|---|
| 1042 | DSL_AUTOBOOT_RESTART_POLL_TIME); |
|---|
| 1043 | } |
|---|
| 1044 | } |
|---|
| 1045 | } |
|---|
| 1046 | } |
|---|
| 1047 | |
|---|
| 1048 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1049 | (pContext, "DSL[%02d]: OUT - DSL_AutobootHandleTraining nReturn(%d)"DSL_DRV_CRLF, |
|---|
| 1050 | DSL_DEV_NUM(pContext), nErrCode)); |
|---|
| 1051 | |
|---|
| 1052 | return nErrCode; |
|---|
| 1053 | } |
|---|
| 1054 | |
|---|
| 1055 | static DSL_Error_t DSL_DRV_AutobootHandleShowtime( |
|---|
| 1056 | DSL_Context_t *pContext) |
|---|
| 1057 | { |
|---|
| 1058 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 1059 | DSL_LineStateValue_t nOldLineState = DSL_LINESTATE_UNKNOWN, |
|---|
| 1060 | nLineState = DSL_LINESTATE_UNKNOWN; |
|---|
| 1061 | DSL_TestModeControlSet_t nTestMode = DSL_TESTMODE_DISABLE; |
|---|
| 1062 | DSL_int16_t nMinSnrm = 0, nSnrm = 0; |
|---|
| 1063 | DSL_G997_PowerManagement_t nPms = DSL_G997_PMS_NA; |
|---|
| 1064 | |
|---|
| 1065 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1066 | (pContext, "DSL[%02d]: IN - DSL_AutobootHandleShowtime"DSL_DRV_CRLF, |
|---|
| 1067 | DSL_DEV_NUM(pContext))); |
|---|
| 1068 | |
|---|
| 1069 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nLineState, nOldLineState); |
|---|
| 1070 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nTestModeControl, nTestMode); |
|---|
| 1071 | |
|---|
| 1072 | nErrCode = DSL_DRV_LineStateUpdate(pContext); |
|---|
| 1073 | if (nErrCode == DSL_SUCCESS) |
|---|
| 1074 | { |
|---|
| 1075 | DSL_CTX_READ_SCALAR(pContext, nErrCode, nLineState, nLineState); |
|---|
| 1076 | switch (nLineState) |
|---|
| 1077 | { |
|---|
| 1078 | case DSL_LINESTATE_SHOWTIME_NO_SYNC: |
|---|
| 1079 | case DSL_LINESTATE_SHOWTIME_TC_SYNC: |
|---|
| 1080 | nErrCode = DSL_DRV_ShowtimeStatusUpdate(pContext, DSL_FALSE); |
|---|
| 1081 | if (nErrCode == DSL_SUCCESS) |
|---|
| 1082 | { |
|---|
| 1083 | DSL_CTX_READ(pContext, nErrCode, |
|---|
| 1084 | powerMgmtStatus.nPowerManagementStatus, nPms); |
|---|
| 1085 | if (nPms == DSL_G997_PMS_L3) |
|---|
| 1086 | { |
|---|
| 1087 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1088 | (pContext, "DSL[%02d]: Transition to L3 detected, restarting..." |
|---|
| 1089 | DSL_DRV_CRLF, DSL_DEV_NUM(pContext))); |
|---|
| 1090 | |
|---|
| 1091 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1092 | pContext, |
|---|
| 1093 | DSL_AUTOBOOTSTATE_RESTART, |
|---|
| 1094 | DSL_AUTOBOOT_RESTART_POLL_TIME); |
|---|
| 1095 | break; |
|---|
| 1096 | } |
|---|
| 1097 | } |
|---|
| 1098 | |
|---|
| 1099 | if (nErrCode == DSL_SUCCESS) |
|---|
| 1100 | { |
|---|
| 1101 | DSL_CTX_READ(pContext, nErrCode, nMinSnrmDs, nMinSnrm); |
|---|
| 1102 | DSL_CTX_READ(pContext, nErrCode, nSnrmDs, nSnrm); |
|---|
| 1103 | |
|---|
| 1104 | if (nSnrm < nMinSnrm) |
|---|
| 1105 | { |
|---|
| 1106 | if (nTestMode == DSL_TESTMODE_SHOWTIME_LOCK |
|---|
| 1107 | || nTestMode == DSL_TESTMODE_TRAINING_LOCK) |
|---|
| 1108 | { |
|---|
| 1109 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1110 | (pContext, "DSL[%02d]: SNR Margin DS (%d/10dB) < " |
|---|
| 1111 | "MINSNRM (%d/10dB), but showtime or training" |
|---|
| 1112 | " lock"DSL_DRV_CRLF, DSL_DEV_NUM(pContext), |
|---|
| 1113 | nSnrm, nMinSnrm)); |
|---|
| 1114 | } |
|---|
| 1115 | else |
|---|
| 1116 | { |
|---|
| 1117 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1118 | (pContext, "DSL[%02d]: SNR Margin DS (%d/10dB) < " |
|---|
| 1119 | "MINSNRM (%d/10dB), set reboot flag!"DSL_DRV_CRLF, |
|---|
| 1120 | DSL_DEV_NUM(pContext), nSnrm, nMinSnrm)); |
|---|
| 1121 | |
|---|
| 1122 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1123 | pContext, |
|---|
| 1124 | DSL_AUTOBOOTSTATE_EXCEPTION, |
|---|
| 1125 | DSL_AUTOBOOT_EXCEPTION_POLL_TIME); |
|---|
| 1126 | } |
|---|
| 1127 | } |
|---|
| 1128 | } |
|---|
| 1129 | break; |
|---|
| 1130 | default: |
|---|
| 1131 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1132 | pContext, |
|---|
| 1133 | DSL_AUTOBOOTSTATE_EXCEPTION, |
|---|
| 1134 | DSL_AUTOBOOT_EXCEPTION_POLL_TIME); |
|---|
| 1135 | break; |
|---|
| 1136 | } |
|---|
| 1137 | } |
|---|
| 1138 | |
|---|
| 1139 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1140 | (pContext, "DSL[%02d]: OUT - DSL_AutobootHandleShowtime nReturn(%d)"DSL_DRV_CRLF, |
|---|
| 1141 | DSL_DEV_NUM(pContext), nErrCode)); |
|---|
| 1142 | |
|---|
| 1143 | return nErrCode; |
|---|
| 1144 | } |
|---|
| 1145 | |
|---|
| 1146 | static DSL_Error_t DSL_DRV_AutobootHandleException( |
|---|
| 1147 | DSL_Context_t *pContext) |
|---|
| 1148 | { |
|---|
| 1149 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 1150 | DSL_boolean_t bWaitBeforeRestart = DSL_FALSE; |
|---|
| 1151 | |
|---|
| 1152 | nErrCode = DSL_DRV_LineStateSet(pContext, DSL_LINESTATE_EXCEPTION); |
|---|
| 1153 | if (nErrCode != DSL_SUCCESS) |
|---|
| 1154 | { |
|---|
| 1155 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 1156 | (pContext, "DSL[%02d]: ERROR - Line state set failed!"DSL_DRV_CRLF, |
|---|
| 1157 | DSL_DEV_NUM(pContext))); |
|---|
| 1158 | } |
|---|
| 1159 | |
|---|
| 1160 | /* Call device specific stuff*/ |
|---|
| 1161 | nErrCode = DSL_DRV_DEV_AutobootHandleException(pContext); |
|---|
| 1162 | if (nErrCode != DSL_SUCCESS) |
|---|
| 1163 | { |
|---|
| 1164 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 1165 | (pContext, "DSL[%02d]: ERROR - Exception state handle failed!"DSL_DRV_CRLF, |
|---|
| 1166 | DSL_DEV_NUM(pContext))); |
|---|
| 1167 | } |
|---|
| 1168 | |
|---|
| 1169 | /* Get Restart option*/ |
|---|
| 1170 | DSL_CTX_READ_SCALAR(pContext, nErrCode, |
|---|
| 1171 | nAutobootConfig.nStateMachineOptions.bWaitBeforeRestart, |
|---|
| 1172 | bWaitBeforeRestart); |
|---|
| 1173 | |
|---|
| 1174 | /* Switch to the next state according to the restart option*/ |
|---|
| 1175 | if (bWaitBeforeRestart) |
|---|
| 1176 | { |
|---|
| 1177 | #ifdef INCLUDE_DSL_PM |
|---|
| 1178 | nErrCode = DSL_DRV_PM_FwPollingStop(pContext); |
|---|
| 1179 | if (nErrCode != DSL_SUCCESS) |
|---|
| 1180 | { |
|---|
| 1181 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 1182 | (pContext, "DSL[%02d]: ERROR - PM firmware polling stop failed!"DSL_DRV_CRLF, |
|---|
| 1183 | DSL_DEV_NUM(pContext))); |
|---|
| 1184 | } |
|---|
| 1185 | #endif /* INCLUDE_DSL_PM*/ |
|---|
| 1186 | DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_RESTART_WAIT, |
|---|
| 1187 | DSL_AUTOBOOT_RESTART_WAIT_POLL_TIME); |
|---|
| 1188 | /* Set Autoboot Status*/ |
|---|
| 1189 | DSL_DRV_AutobootStatusSet( |
|---|
| 1190 | pContext, DSL_AUTOBOOT_STATUS_RESTART_WAIT, DSL_FW_REQUEST_NA); |
|---|
| 1191 | } |
|---|
| 1192 | else |
|---|
| 1193 | { |
|---|
| 1194 | /* Switch to RESTART...*/ |
|---|
| 1195 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1196 | pContext, |
|---|
| 1197 | DSL_AUTOBOOTSTATE_RESTART, |
|---|
| 1198 | DSL_AUTOBOOT_RESTART_POLL_TIME); |
|---|
| 1199 | } |
|---|
| 1200 | |
|---|
| 1201 | return nErrCode; |
|---|
| 1202 | } |
|---|
| 1203 | |
|---|
| 1204 | static DSL_Error_t DSL_DRV_AutobootHandleFwRequest( |
|---|
| 1205 | DSL_Context_t *pContext) |
|---|
| 1206 | { |
|---|
| 1207 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 1208 | #ifndef INCLUDE_FW_REQUEST_SUPPORT |
|---|
| 1209 | DSL_int32_t nOff = 0, nLoff = 0; |
|---|
| 1210 | #else |
|---|
| 1211 | DSL_FirmwareRequestData_t fwReqData = { DSL_FW_REQUEST_NA }; |
|---|
| 1212 | #endif /* #ifndef INCLUDE_FW_REQUEST_SUPPORT*/ |
|---|
| 1213 | DSL_FirmwareRequestType_t nFwType = DSL_FW_REQUEST_NA; |
|---|
| 1214 | |
|---|
| 1215 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1216 | (pContext, "DSL[%02d]: IN - DSL_DRV_AutobootHandleFwRequest"DSL_DRV_CRLF, |
|---|
| 1217 | DSL_DEV_NUM(pContext))); |
|---|
| 1218 | |
|---|
| 1219 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bFwReLoaded, DSL_FALSE); |
|---|
| 1220 | |
|---|
| 1221 | #if defined(INCLUDE_DSL_CPE_API_VINAX) |
|---|
| 1222 | /* Call device specific stuff*/ |
|---|
| 1223 | nErrCode = DSL_DRV_DEV_AutobootHandleFwRequest(pContext); |
|---|
| 1224 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1225 | { |
|---|
| 1226 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1227 | (pContext, "DSL[%02d]: ERROR - Device Specific Firmware request handling failed!"DSL_DRV_CRLF, |
|---|
| 1228 | DSL_DEV_NUM(pContext))); |
|---|
| 1229 | |
|---|
| 1230 | return nErrCode; |
|---|
| 1231 | } |
|---|
| 1232 | |
|---|
| 1233 | DSL_CTX_READ_SCALAR(pContext, nErrCode, pDevCtx->data.deviceCfg.nFwType, nFwType); |
|---|
| 1234 | #else |
|---|
| 1235 | nFwType = DSL_FW_REQUEST_ADSL; |
|---|
| 1236 | #endif |
|---|
| 1237 | |
|---|
| 1238 | while(1) |
|---|
| 1239 | { |
|---|
| 1240 | #ifndef INCLUDE_FW_REQUEST_SUPPORT |
|---|
| 1241 | /* Check if the FW download available from the Context*/ |
|---|
| 1242 | if( (pContext->pFirmware != DSL_NULL && pContext->nFirmwareSize) || |
|---|
| 1243 | (pContext->pFirmware2 != DSL_NULL && pContext->nFirmwareSize2) ) |
|---|
| 1244 | { |
|---|
| 1245 | /* Try to download stored FW binary from the Context*/ |
|---|
| 1246 | nErrCode = DSL_DRV_FwDownload(pContext, |
|---|
| 1247 | (DSL_char_t*)pContext->pFirmware, pContext->nFirmwareSize, |
|---|
| 1248 | (DSL_char_t*)pContext->pFirmware2, pContext->nFirmwareSize2, |
|---|
| 1249 | &nLoff, &nOff, DSL_TRUE); |
|---|
| 1250 | |
|---|
| 1251 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1252 | { |
|---|
| 1253 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1254 | (pContext, "DSL[%02d]: ERROR - Firmware download failed!"DSL_DRV_CRLF, |
|---|
| 1255 | DSL_DEV_NUM(pContext))); |
|---|
| 1256 | } |
|---|
| 1257 | else |
|---|
| 1258 | { |
|---|
| 1259 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1260 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_READY, DSL_AUTOBOOT_FW_READY_POLL_TIME); |
|---|
| 1261 | } |
|---|
| 1262 | } |
|---|
| 1263 | else |
|---|
| 1264 | { |
|---|
| 1265 | /* ... Switch to the DSL_AUTOBOOTSTATE_FIRMWARE_WAIT state*/ |
|---|
| 1266 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1267 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_WAIT, DSL_AUTOBOOT_FW_WAIT_POLL_TIME); |
|---|
| 1268 | |
|---|
| 1269 | /* Set Autoboot Status*/ |
|---|
| 1270 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, DSL_AUTOBOOT_STATUS_FW_WAIT, |
|---|
| 1271 | nFwType); |
|---|
| 1272 | |
|---|
| 1273 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1274 | { |
|---|
| 1275 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1276 | (pContext, "DSL[%02d]: ERROR - Autoboot Status set failed!"DSL_DRV_CRLF, |
|---|
| 1277 | DSL_DEV_NUM(pContext))); |
|---|
| 1278 | } |
|---|
| 1279 | |
|---|
| 1280 | /* Activate Autoboot timeout for the Firmware Wait dtate*/ |
|---|
| 1281 | DSL_DRV_AutobootTimeoutSet(pContext, 10); |
|---|
| 1282 | |
|---|
| 1283 | DSL_DEBUG( DSL_DBG_MSG, |
|---|
| 1284 | (pContext, "DSL[%02d]: No stored FW, entering FW wait state..."DSL_DRV_CRLF, |
|---|
| 1285 | DSL_DEV_NUM(pContext))); |
|---|
| 1286 | } |
|---|
| 1287 | #else /* INCLUDE_FW_REQUEST_SUPPORT */ |
|---|
| 1288 | #ifdef INCLUDE_DSL_CPE_API_VINAX |
|---|
| 1289 | fwReqData.nFirmwareRequestType = nFwType; |
|---|
| 1290 | #else |
|---|
| 1291 | fwReqData.nFirmwareRequestType = DSL_FW_REQUEST_ADSL; |
|---|
| 1292 | #endif /* INCLUDE_DSL_CPE_API_VINAX*/ |
|---|
| 1293 | |
|---|
| 1294 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bFwRequestHandled, DSL_FALSE); |
|---|
| 1295 | |
|---|
| 1296 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1297 | pContext, |
|---|
| 1298 | DSL_AUTOBOOTSTATE_FIRMWARE_WAIT, |
|---|
| 1299 | DSL_AUTOBOOT_FW_WAIT_POLL_TIME); |
|---|
| 1300 | |
|---|
| 1301 | /* Set Autoboot Status*/ |
|---|
| 1302 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, DSL_AUTOBOOT_STATUS_FW_WAIT, nFwType); |
|---|
| 1303 | |
|---|
| 1304 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1305 | { |
|---|
| 1306 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1307 | (pContext, "DSL[%02d]: ERROR - Autoboot Status set failed!"DSL_DRV_CRLF, |
|---|
| 1308 | DSL_DEV_NUM(pContext))); |
|---|
| 1309 | |
|---|
| 1310 | break; |
|---|
| 1311 | } |
|---|
| 1312 | |
|---|
| 1313 | nErrCode = DSL_DRV_EventGenerate( pContext, 0, DSL_ACCESSDIR_NA, |
|---|
| 1314 | DSL_XTUDIR_NA, DSL_EVENT_S_FIRMWARE_REQUEST, |
|---|
| 1315 | (DSL_EventData_Union_t*)&fwReqData, sizeof(DSL_FirmwareRequestData_t)); |
|---|
| 1316 | |
|---|
| 1317 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1318 | { |
|---|
| 1319 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1320 | (pContext, "DSL[%02d]: ERROR - Event(%d) generate failed!"DSL_DRV_CRLF, |
|---|
| 1321 | DSL_DEV_NUM(pContext), DSL_EVENT_S_FIRMWARE_REQUEST)); |
|---|
| 1322 | |
|---|
| 1323 | break; |
|---|
| 1324 | } |
|---|
| 1325 | |
|---|
| 1326 | /* Activate Autoboot timeout for the Firmware Wait dtate*/ |
|---|
| 1327 | DSL_DRV_AutobootTimeoutSet(pContext, 10); |
|---|
| 1328 | #endif |
|---|
| 1329 | break; |
|---|
| 1330 | } /* while(1)*/ |
|---|
| 1331 | |
|---|
| 1332 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1333 | (pContext, "DSL[%02d]: OUT - DSL_DRV_AutobootHandleFwRequest, retCode=%d"DSL_DRV_CRLF, |
|---|
| 1334 | DSL_DEV_NUM(pContext), nErrCode)); |
|---|
| 1335 | |
|---|
| 1336 | return nErrCode; |
|---|
| 1337 | } |
|---|
| 1338 | |
|---|
| 1339 | static DSL_Error_t DSL_DRV_AutobootHandleFwWait( |
|---|
| 1340 | DSL_Context_t *pContext) |
|---|
| 1341 | { |
|---|
| 1342 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 1343 | DSL_boolean_t bFwRequestHandled = DSL_FALSE; |
|---|
| 1344 | DSL_uint32_t currentTime; |
|---|
| 1345 | |
|---|
| 1346 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bFwRequestHandled, bFwRequestHandled); |
|---|
| 1347 | |
|---|
| 1348 | if (bFwRequestHandled) |
|---|
| 1349 | { |
|---|
| 1350 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1351 | (pContext, "DSL[%02d]: FW request handled..."DSL_DRV_CRLF, |
|---|
| 1352 | DSL_DEV_NUM(pContext))); |
|---|
| 1353 | |
|---|
| 1354 | /* Move to the next state*/ |
|---|
| 1355 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1356 | pContext, |
|---|
| 1357 | DSL_AUTOBOOTSTATE_FIRMWARE_READY, |
|---|
| 1358 | DSL_AUTOBOOT_FW_READY_POLL_TIME); |
|---|
| 1359 | |
|---|
| 1360 | /* Set Autoboot Status*/ |
|---|
| 1361 | nErrCode = DSL_DRV_AutobootStatusSet(pContext, DSL_AUTOBOOT_STATUS_RUNNING, |
|---|
| 1362 | DSL_FW_REQUEST_NA); |
|---|
| 1363 | |
|---|
| 1364 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1365 | { |
|---|
| 1366 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1367 | (pContext, "DSL[%02d]: ERROR - Autoboot Status set failed!"DSL_DRV_CRLF, |
|---|
| 1368 | DSL_DEV_NUM(pContext))); |
|---|
| 1369 | } |
|---|
| 1370 | |
|---|
| 1371 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bFwReLoaded, DSL_TRUE); |
|---|
| 1372 | } |
|---|
| 1373 | else |
|---|
| 1374 | { |
|---|
| 1375 | DSL_DEBUG( DSL_DBG_MSG, |
|---|
| 1376 | (pContext, "DSL[%02d]: Autoboot waiting for the FW..."DSL_DRV_CRLF, |
|---|
| 1377 | DSL_DEV_NUM(pContext))); |
|---|
| 1378 | |
|---|
| 1379 | currentTime = DSL_DRV_TimeMSecGet(); |
|---|
| 1380 | |
|---|
| 1381 | pContext->autobootStartTime = pContext->autobootStartTime > currentTime ? |
|---|
| 1382 | currentTime : pContext->autobootStartTime; |
|---|
| 1383 | |
|---|
| 1384 | /* Check for the Firmware Wait state timeout*/ |
|---|
| 1385 | if ((pContext->autobootStartTime + (DSL_uint32_t)(pContext->nAutobootTimeoutLimit*1000)) |
|---|
| 1386 | < currentTime ) |
|---|
| 1387 | { |
|---|
| 1388 | /* Tru to request FW again */ |
|---|
| 1389 | nErrCode = DSL_DRV_AutobootStateSet( |
|---|
| 1390 | pContext, DSL_AUTOBOOTSTATE_FIRMWARE_REQUEST, |
|---|
| 1391 | DSL_AUTOBOOT_FW_REQUEST_POLL_TIME); |
|---|
| 1392 | } |
|---|
| 1393 | } |
|---|
| 1394 | |
|---|
| 1395 | return nErrCode; |
|---|
| 1396 | } |
|---|
| 1397 | |
|---|
| 1398 | static DSL_Error_t DSL_DRV_AutobootHandleFwReady( |
|---|
| 1399 | DSL_Context_t *pContext) |
|---|
| 1400 | { |
|---|
| 1401 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 1402 | DSL_boolean_t bPowerManagementL3Forced, bWaitBeforeConfigWrite = DSL_FALSE; |
|---|
| 1403 | |
|---|
| 1404 | /* Reset bFwRequestHandled flag*/ |
|---|
| 1405 | DSL_CTX_WRITE_SCALAR(pContext, nErrCode, bFwRequestHandled, DSL_FALSE); |
|---|
| 1406 | |
|---|
| 1407 | /* Reset modem*/ |
|---|
| 1408 | nErrCode = DSL_DRV_LinkReset(pContext); |
|---|
| 1409 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1410 | { |
|---|
| 1411 | DSL_DEBUG(DSL_DBG_ERR, |
|---|
| 1412 | (pContext, "DSL[%02d]: ERROR - Modem reset failed!"DSL_DRV_CRLF, |
|---|
| 1413 | DSL_DEV_NUM(pContext))); |
|---|
| 1414 | |
|---|
| 1415 | return nErrCode; |
|---|
| 1416 | } |
|---|
| 1417 | |
|---|
| 1418 | DSL_CTX_READ_SCALAR(pContext, nErrCode, bPowerManagementL3Forced, |
|---|
| 1419 | bPowerManagementL3Forced); |
|---|
| 1420 | |
|---|
| 1421 | /* Get Link Activation option*/ |
|---|
| 1422 | DSL_CTX_READ_SCALAR(pContext, nErrCode, |
|---|
| 1423 | nAutobootConfig.nStateMachineOptions.bWaitBeforeConfigWrite, |
|---|
| 1424 | bWaitBeforeConfigWrite); |
|---|
| 1425 | |
|---|
| 1426 | /* Switch to the next state according to the link activation option*/ |
|---|
| 1427 | if (bWaitBeforeConfigWrite) |
|---|
| 1428 | { |
|---|
| 1429 | DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_CONFIG_WRITE_WAIT, |
|---|
| 1430 | DSL_AUTOBOOT_CONFIG_WRITE_WAIT_POLL_TIME); |
|---|
| 1431 | |
|---|
| 1432 | /* Set Autoboot Status*/ |
|---|
| 1433 | DSL_DRV_AutobootStatusSet(pContext, |
|---|
| 1434 | DSL_AUTOBOOT_STATUS_CONFIG_WRITE_WAIT, DSL_FW_REQUEST_NA); |
|---|
| 1435 | |
|---|
| 1436 | /* IDLE line state reached*/ |
|---|
| 1437 | DSL_DRV_LineStateSet(pContext, DSL_LINESTATE_IDLE); |
|---|
| 1438 | } |
|---|
| 1439 | else |
|---|
| 1440 | { |
|---|
| 1441 | if (bPowerManagementL3Forced != DSL_FALSE) |
|---|
| 1442 | { |
|---|
| 1443 | DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_L3, |
|---|
| 1444 | DSL_AUTOBOOT_L3_POLL_TIME); |
|---|
| 1445 | } |
|---|
| 1446 | else |
|---|
| 1447 | { |
|---|
| 1448 | DSL_DRV_AutobootStateSet(pContext, DSL_AUTOBOOTSTATE_INIT, |
|---|
| 1449 | DSL_AUTOBOOT_INIT_POLL_TIME); |
|---|
| 1450 | } |
|---|
| 1451 | } |
|---|
| 1452 | |
|---|
| 1453 | #if defined(INCLUDE_DSL_PM) |
|---|
| 1454 | /* Resume PM module*/ |
|---|
| 1455 | nErrCode = DSL_DRV_PM_Resume(pContext); |
|---|
| 1456 | if( nErrCode != DSL_SUCCESS ) |
|---|
| 1457 | { |
|---|
| 1458 | DSL_DEBUG( DSL_DBG_ERR, |
|---|
| 1459 | (pContext, "DSL[%02d]: ERROR - PM resume failed!"DSL_DRV_CRLF, |
|---|
| 1460 | DSL_DEV_NUM(pContext))); |
|---|
| 1461 | |
|---|
| 1462 | return nErrCode; |
|---|
| 1463 | } |
|---|
| 1464 | #endif /* #if defined(INCLUDE_DSL_PM)*/ |
|---|
| 1465 | |
|---|
| 1466 | return(nErrCode); |
|---|
| 1467 | } |
|---|
| 1468 | |
|---|
| 1469 | static DSL_Error_t DSL_DRV_AutobootHandleL3( |
|---|
| 1470 | DSL_Context_t *pContext, |
|---|
| 1471 | DSL_boolean_t bL3Forced) |
|---|
| 1472 | { |
|---|
| 1473 | DSL_Error_t nErrCode = DSL_SUCCESS; |
|---|
| 1474 | |
|---|
| 1475 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1476 | (pContext, "DSL[%02d]: IN - DSL_DRV_AutobootHandleL3"DSL_DRV_CRLF, |
|---|
| 1477 | DSL_DEV_NUM(pContext))); |
|---|
| 1478 | |
|---|
| 1479 | /* Call device specific implementation*/ |
|---|
| 1480 | nErrCode = DSL_DRV_DEV_AutobootHandleL3(pContext, bL3Forced); |
|---|
| 1481 | |
|---|
| 1482 | DSL_DEBUG(DSL_DBG_MSG, |
|---|
| 1483 | (pContext, "DSL[%02d]: OUT - DSL_DRV_AutobootHandleFwRequest, retCode=%d"DSL_DRV_CRLF, |
|---|
| 1484 | DSL_DEV_NUM(pContext), nErrCode)); |
|---|
| 1485 | |
|---|
| 1486 | return(nErrCode); |
|---|
| 1487 | } |
|---|
| 1488 | /** @} DRV_DSL_CPE_COMMON */ |
|---|