static int mcsdl_download(const UINT8 *pBianry, const UINT16 unLength, INT8 IdxNum ) { int nRet; //--------------------------------- // Check Binary Size //--------------------------------- if( unLength >= MELFAS_FIRMWARE_MAX_SIZE ){ nRet = MCSDL_RET_PROGRAM_SIZE_IS_WRONG; goto MCSDL_DOWNLOAD_FINISH; } #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" - Starting download...\n"); #endif //--------------------------------- // Make it ready //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Ready\n"); #endif mcsdl_set_ready(); // mcsdl_delay(MCSDL_DELAY_1MS); //--------------------------------- // Erase Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Erase\n"); #endif nRet = mcsdl_erase_flash(IdxNum); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; // mcsdl_delay(MCSDL_DELAY_1MS); //--------------------------------- // Program Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Program "); #endif // if(IdxNum > 0) // mcsdl_set_ready(); nRet = mcsdl_program_flash( (UINT8*)pBianry, (UINT16)unLength, IdxNum ); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; // mcsdl_delay(MCSDL_DELAY_1MS); //--------------------------------- // Verify flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Verify "); #endif nRet = mcsdl_verify_flash((UINT8*)pBianry, (UINT16)unLength, IdxNum); if (nRet != MCSDL_RET_SUCCESS) goto MCSDL_DOWNLOAD_FINISH; // mcsdl_delay(MCSDL_DELAY_1MS); nRet = MCSDL_RET_SUCCESS; MCSDL_DOWNLOAD_FINISH : #if MELFAS_ENABLE_DBG_PRINT mcsdl_print_result( nRet ); // Show result #endif #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Rebooting\n"); printk(" - Fin.\n\n"); #endif mcsdl_reboot_mcs(); return nRet; }
static int mcsdl_download(const UINT8 *pBianry, const UINT16 unLength, INT8 IdxNum ) { int nRet; //--------------------------------- // Check Binary Size //--------------------------------- // wcjeong - modified //if( unLength >= MELFAS_FIRMWARE_MAX_SIZE ){ if( unLength >= MELFAS_FIRMWARE_MAX_SIZE ){ dbg("ISP - mcsdl firmware size error: %u(0x%X) [limit: %u(0x%X)] \n", unLength, unLength, MELFAS_FIRMWARE_MAX_SIZE, MELFAS_FIRMWARE_MAX_SIZE ); nRet = MCSDL_RET_PROGRAM_SIZE_IS_WRONG; goto MCSDL_DOWNLOAD_FINISH; } #if MELFAS_ENABLE_DBG_PROGRESS_PRINT dbg(" - Starting ISP download...\n"); #endif //--------------------------------- // Make it ready //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT dbg(" > Ready\n"); #endif mcsdl_set_ready(); //--------------------------------- // Erase Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT dbg(" > Erase: %d\n", IdxNum); #endif nRet = mcsdl_erase_flash(IdxNum); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; //--------------------------------- // Program Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Program "); #endif // if(IdxNum > 0) // mcsdl_set_ready(); nRet = mcsdl_program_flash( (UINT8*)pBianry, (UINT16)unLength, IdxNum ); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; //--------------------------------- // Verify flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Verify "); #endif nRet = mcsdl_verify_flash((UINT8*)pBianry, (UINT16)unLength, IdxNum); if (nRet != MCSDL_RET_SUCCESS) goto MCSDL_DOWNLOAD_FINISH; nRet = MCSDL_RET_SUCCESS; MCSDL_DOWNLOAD_FINISH : #if MELFAS_ENABLE_DBG_PRINT mcsdl_print_result( nRet ); // Show result #endif #if MELFAS_ENABLE_DBG_PROGRESS_PRINT dbg(" > Rebooting\n"); dbg(" - Fin.\n\n"); #endif mcsdl_reboot_mcs(); return nRet; }
static int mcsdl_download(const UINT8 *pBianry, const UINT16 unLength, INT8 IdxNum ) { int nRet; //--------------------------------- // Check Binary Size //--------------------------------- if( unLength >= MELFAS_FIRMWARE_MAX_SIZE ){ nRet = MCSDL_RET_PROGRAM_SIZE_IS_WRONG; goto MCSDL_DOWNLOAD_FINISH; } #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" - Starting download...\n"); #endif //--------------------------------- // Make it ready //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Ready\n"); #endif mcsdl_set_ready(); // mcsdl_delay(MCSDL_DELAY_1MS); //--------------------------------- // Erase Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Erase\n"); #endif nRet = mcsdl_erase_flash(IdxNum); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; // mcsdl_delay(MCSDL_DELAY_1MS); //--------------------------------- // Program Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Program "); #endif nRet = mcsdl_program_flash( (UINT8*)pBianry, (UINT16)unLength, IdxNum ); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; //--------------------------------- // Verify flash //--------------------------------- /*if (IdxNum == 0)*/ { #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Verify=== \n"); #endif nRet = mcsdl_verify_flash( (UINT8*)pBianry, (UINT16)unLength, IdxNum ); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; } nRet = MCSDL_RET_SUCCESS; MCSDL_DOWNLOAD_FINISH : #if MELFAS_ENABLE_DBG_PRINT mcsdl_print_result( nRet ); // Show result #endif #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Rebooting\n"); printk(" - Fin.\n\n"); printk(" - IdxNum =[%d] \n",IdxNum); #endif if(IdxNum == 0) mcsdl_reboot_mcs(); else { MCSDL_RESETB_SET_LOW(); MCSDL_RESETB_SET_OUTPUT(1); mcsdl_delay(MCSDL_DELAY_25MS); // Delay for Stable VDD MCSDL_RESETB_SET_INPUT(); MCSDL_VDD_SET_HIGH(); msleep(25); } return nRet; }
static int mcsdl_download(const UINT8 *pBianry, const UINT16 unLength, INT8 IdxNum ) { int nRet; //--------------------------------- // Check Binary Size //--------------------------------- if( unLength > MELFAS_FIRMWARE_MAX_SIZE ){ nRet = MCSDL_RET_PROGRAM_SIZE_IS_WRONG; goto MCSDL_DOWNLOAD_FINISH; } #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" - Starting download...\n"); #endif //--------------------------------- // Make it ready //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Ready start \n"); #endif mcsdl_set_ready(); // printk("[JHLog]set ready finished \n"); //--------------------------------- // Erase Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Erase start : IdxNum = %d\n", IdxNum); #endif nRet = mcsdl_erase_flash(IdxNum); printk(" > Erase end %d\n", nRet); //return 0; if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; printk(" > Erase succes\n"); //--------------------------------- // Program Flash //--------------------------------- #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Program "); #endif // if(IdxNum > 0) // mcsdl_set_ready(); nRet = mcsdl_program_flash( (UINT8*)pBianry, (UINT16)unLength, IdxNum ); if( nRet != MCSDL_RET_SUCCESS ) goto MCSDL_DOWNLOAD_FINISH; //--------------------------------- // Verify flash //--------------------------------- // #if 0 // Desc : skip verify to reduce down load time. #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Verify "); #endif nRet = mcsdl_verify_flash((UINT8*)pBianry, (UINT16)unLength, IdxNum); if (nRet != MCSDL_RET_SUCCESS) goto MCSDL_DOWNLOAD_FINISH; #endif // nRet = MCSDL_RET_SUCCESS; MCSDL_DOWNLOAD_FINISH : #if MELFAS_ENABLE_DBG_PRINT mcsdl_print_result( nRet ); // Show result #endif #if MELFAS_ENABLE_DBG_PROGRESS_PRINT printk(" > Rebooting\n"); printk(" - Fin.\n\n"); #endif mcsdl_reboot_mcs(); return nRet; }